Demo:工具栏中的公式按钮根据是否开启节点富文本配置进行显示和隐藏

This commit is contained in:
街角小林 2025-01-21 16:14:45 +08:00
parent 34f6fdd8e2
commit 9b2c9ad1d2

View File

@ -215,7 +215,8 @@ export default {
computed: { computed: {
...mapState({ ...mapState({
isDark: state => state.localConfig.isDark, isDark: state => state.localConfig.isDark,
isHandleLocalFile: state => state.isHandleLocalFile isHandleLocalFile: state => state.isHandleLocalFile,
openNodeRichText: state => state.localConfig.openNodeRichText
}) })
}, },
watch: { watch: {
@ -223,6 +224,24 @@ export default {
if (!val) { if (!val) {
Notification.closeAll() Notification.closeAll()
} }
},
openNodeRichText: {
immediate: true,
handler(val) {
const index = this.list.findIndex(item => {
return item === 'formula'
})
if (val) {
if (index === -1) {
this.list.splice(13, 0, 'formula')
}
} else {
if (index !== -1) {
this.list.splice(index, 1)
}
}
this.computeToolbarShow()
}
} }
}, },
created() { created() {
@ -246,6 +265,7 @@ export default {
methods: { methods: {
// //
computeToolbarShow() { computeToolbarShow() {
if (!this.$refs.toolbarRef) return
const windowWidth = window.innerWidth - 40 const windowWidth = window.innerWidth - 40
const all = [...this.list] const all = [...this.list]
let index = 1 let index = 1