Skip to content

Commit

Permalink
fix(fic tree): 限制了对根节点的复制和剪切操作
Browse files Browse the repository at this point in the history
  • Loading branch information
GwokHiujin authored and Hyggge committed Jun 7, 2023
1 parent 0b8d751 commit 355fd1c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
2 changes: 1 addition & 1 deletion demo/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
demo 是演示 ficus 功能的事例文件夹,一共有三个子文件夹:
![]()![]()![]()![]()![]()![]()![]()![]()![]()![]()![]()![]()![]()![]()![]()![]()demo 是演示 ficus 功能的事例文件夹,一共有三个子文件夹:

`demo/2022` 文件夹记录着 2022 年的笔记,共有如下文件:

Expand Down
25 changes: 18 additions & 7 deletions src/renderer/components/mindEditor/FicTree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ export default defineComponent({
})
ficTree.on('node_mousedown', (node, e) => {
if (node.nodeData.data.type === 'root') {
// Cannot operate
// Cannot Drag
ficTree.emit('mouseup', e)
}
})
Expand All @@ -371,7 +371,6 @@ export default defineComponent({
bus.on('sendToFicTree', (obj) => {
const rawData = JSON.parse(JSON.stringify(obj))
bfs(rawData)
// console.log(rawData)
ficTree.setData(rawData)
mode = store.getters.getMode // 2: Tree; 5: Forest
setStyle()
Expand Down Expand Up @@ -420,18 +419,30 @@ export default defineComponent({
dropdownType.value = ''
}
function hasRoot () {
return activeNodes.value.findIndex(node => {
return node.nodeData.data.type === 'root'
}) !== -1
}
function copy () {
copyData = ficTree.renderer.copyNode()
if (!hasRoot()) {
copyData = ficTree.renderer.copyNode()
}
hide()
}
function cut () {
ficTree.execCommand('CUT_NODE', _copyData => {
copyData = _copyData
})
if (!hasRoot()) {
ficTree.execCommand('CUT_NODE', _copyData => {
copyData = _copyData
})
}
hide()
}
function paste () {
ficTree.execCommand('PASTE_NODE', copyData)
if (copyData !== null) {
ficTree.execCommand('PASTE_NODE', copyData)
}
hide()
}
Expand Down
2 changes: 0 additions & 2 deletions src/renderer/components/sideBar/SideBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,13 @@ import PropBar from '@/renderer/components/sideBar/PropBar'
import ForestBar from '@/renderer/components/sideBar/ForestBar'
import GraphBar from '@/renderer/components/sideBar/GraphBar'
import PreBar from '@/renderer/components/sideBar/PreBar'
import SpinLoading from '@/renderer/assets/SpinLoading.vue'
export default {
name: 'SideBar',
directives: {
contextmenu: directive
},
components: {
SpinLoading,
PreBar,
GraphBar,
ForestBar,
Expand Down
2 changes: 1 addition & 1 deletion vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = defineConfig({
'universal'
]
}
],
]
}
},
externals: ['chokidar']
Expand Down

0 comments on commit 355fd1c

Please sign in to comment.