diff --git a/web/src/pages/Edit/components/Toolbar.vue b/web/src/pages/Edit/components/Toolbar.vue index 98c27b8a..68c028ce 100644 --- a/web/src/pages/Edit/components/Toolbar.vue +++ b/web/src/pages/Edit/components/Toolbar.vue @@ -215,7 +215,8 @@ export default { computed: { ...mapState({ isDark: state => state.localConfig.isDark, - isHandleLocalFile: state => state.isHandleLocalFile + isHandleLocalFile: state => state.isHandleLocalFile, + openNodeRichText: state => state.localConfig.openNodeRichText }) }, watch: { @@ -223,6 +224,24 @@ export default { if (!val) { 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() { @@ -246,6 +265,7 @@ export default { methods: { // 计算工具按钮如何显示 computeToolbarShow() { + if (!this.$refs.toolbarRef) return const windowWidth = window.innerWidth - 40 const all = [...this.list] let index = 1