mirror of
https://github.com/wanglin2/mind-map.git
synced 2026-02-17 22:08:25 +08:00
Demo:节点右键菜单新增添加待办按钮
This commit is contained in:
@@ -113,7 +113,9 @@ export default {
|
||||
copySuccess: 'Copy success',
|
||||
copyFail: 'Copy fail',
|
||||
number: 'Number child nodes',
|
||||
expandNodeChild: 'Expand all sub nodes'
|
||||
expandNodeChild: 'Expand all sub nodes',
|
||||
addToDo: 'Add toDo',
|
||||
removeToDo: 'Remove toDo'
|
||||
},
|
||||
count: {
|
||||
words: 'Words',
|
||||
|
||||
@@ -113,7 +113,9 @@ export default {
|
||||
copySuccess: '复制成功',
|
||||
copyFail: '复制失败',
|
||||
number: '编号其子节点',
|
||||
expandNodeChild: '展开所有下级节点'
|
||||
expandNodeChild: '展开所有下级节点',
|
||||
addToDo: '添加待办',
|
||||
removeToDo: '删除待办'
|
||||
},
|
||||
count: {
|
||||
words: '字数',
|
||||
|
||||
@@ -113,7 +113,9 @@ export default {
|
||||
copySuccess: '複製成功',
|
||||
copyFail: '複製失敗',
|
||||
number: '將其子節點編號',
|
||||
expandNodeChild: '展開所有下級節點'
|
||||
expandNodeChild: '展開所有下級節點',
|
||||
addToDo: '添加待辦',
|
||||
removeToDo: '刪除待辦'
|
||||
},
|
||||
count: {
|
||||
words: '字數',
|
||||
|
||||
@@ -89,6 +89,11 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item" @click="setCheckbox" v-if="supportCheckbox">
|
||||
<span class="name">{{
|
||||
hasCheckbox ? $t('contextmenu.removeToDo') : $t('contextmenu.addToDo')
|
||||
}}</span>
|
||||
</div>
|
||||
<div class="splitLine"></div>
|
||||
<div class="item danger" @click="exec('REMOVE_NODE')">
|
||||
<span class="name">{{ $t('contextmenu.deleteNode') }}</span>
|
||||
@@ -244,7 +249,8 @@ export default {
|
||||
...mapState({
|
||||
isZenMode: state => state.localConfig.isZenMode,
|
||||
isDark: state => state.localConfig.isDark,
|
||||
supportNumbers: state => state.supportNumbers
|
||||
supportNumbers: state => state.supportNumbers,
|
||||
supportCheckbox: state => state.supportCheckbox
|
||||
}),
|
||||
expandList() {
|
||||
return [
|
||||
@@ -322,6 +328,9 @@ export default {
|
||||
},
|
||||
numberLevelList() {
|
||||
return numberLevelList[this.$i18n.locale] || numberLevelList.zh
|
||||
},
|
||||
hasCheckbox() {
|
||||
return !!this.node.getData('checkbox')
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@@ -496,6 +505,21 @@ export default {
|
||||
this.mindMap.execCommand('SET_NUMBER', [], {
|
||||
[prop]: value
|
||||
})
|
||||
this.hide()
|
||||
},
|
||||
|
||||
// 设置待办
|
||||
setCheckbox() {
|
||||
this.mindMap.execCommand(
|
||||
'SET_CHECKBOX',
|
||||
[],
|
||||
this.hasCheckbox
|
||||
? null
|
||||
: {
|
||||
done: false
|
||||
}
|
||||
)
|
||||
this.hide()
|
||||
},
|
||||
|
||||
// 复制到剪贴板
|
||||
|
||||
@@ -74,17 +74,14 @@ import OuterFrame from 'simple-mind-map/src/plugins/OuterFrame.js'
|
||||
import Themes from 'simple-mind-map-plugin-themes'
|
||||
// 协同编辑插件
|
||||
// import Cooperate from 'simple-mind-map/src/plugins/Cooperate.js'
|
||||
// 手绘风格插件,该插件为付费插件,详情请查看开发文档
|
||||
// 以下插件为付费插件,详情请查看开发文档。依次为:手绘风格插件、标记插件、编号插件、Freemind软件格式导入导出插件、Excel软件格式导入导出插件、待办插件
|
||||
// import HandDrawnLikeStyle from 'simple-mind-map-plugin-handdrawnlikestyle'
|
||||
// 标记插件,该插件为付费插件,详情请查看开发文档
|
||||
// import Notation from 'simple-mind-map-plugin-notation'
|
||||
// 编号插件,该插件为付费插件,详情请查看开发文档
|
||||
// import Numbers from 'simple-mind-map-plugin-numbers'
|
||||
// Freemind软件格式导入导出插件,该插件为付费插件,详情请查看开发文档
|
||||
// import Freemind from 'simple-mind-map-plugin-freemind'
|
||||
// Excel软件格式导入导出插件,该插件为付费插件,详情请查看开发文档
|
||||
// import Excel from 'simple-mind-map-plugin-excel'
|
||||
// npm link simple-mind-map-plugin-excel simple-mind-map-plugin-freemind simple-mind-map-plugin-numbers simple-mind-map-plugin-notation simple-mind-map-plugin-handdrawnlikestyle simple-mind-map simple-mind-map-plugin-themes
|
||||
// import Checkbox from 'simple-mind-map-plugin-checkbox'
|
||||
// npm link simple-mind-map-plugin-excel simple-mind-map-plugin-freemind simple-mind-map-plugin-numbers simple-mind-map-plugin-notation simple-mind-map-plugin-handdrawnlikestyle simple-mind-map-plugin-checkbox simple-mind-map simple-mind-map-plugin-themes
|
||||
import OutlineSidebar from './OutlineSidebar'
|
||||
import Style from './Style'
|
||||
import BaseStyle from './BaseStyle'
|
||||
@@ -577,6 +574,10 @@ export default {
|
||||
this.$store.commit('setSupportExcel', true)
|
||||
Vue.prototype.Excel = Excel
|
||||
}
|
||||
if (typeof Checkbox !== 'undefined') {
|
||||
this.mindMap.addPlugin(Checkbox)
|
||||
this.$store.commit('setSupportCheckbox', true)
|
||||
}
|
||||
this.mindMap.keyCommand.addShortcut('Control+s', () => {
|
||||
this.manualSave()
|
||||
})
|
||||
|
||||
@@ -33,6 +33,7 @@ const store = new Vuex.Store({
|
||||
supportNumbers: false, // 是否支持编号
|
||||
supportFreemind: false, // 是否支持Freemind插件
|
||||
supportExcel: false, // 是否支持Excel插件
|
||||
supportCheckbox: false, // 是否支持Checkbox插件
|
||||
isDragOutlineTreeNode: false // 当前是否正在拖拽大纲树的节点
|
||||
},
|
||||
mutations: {
|
||||
@@ -105,6 +106,11 @@ const store = new Vuex.Store({
|
||||
state.supportExcel = data
|
||||
},
|
||||
|
||||
// 设置是否支持Checkbox插件
|
||||
setSupportCheckbox(state, data) {
|
||||
state.supportCheckbox = data
|
||||
},
|
||||
|
||||
// 设置树节点拖拽
|
||||
setIsDragOutlineTreeNode(state, data) {
|
||||
state.isDragOutlineTreeNode = data
|
||||
|
||||
Reference in New Issue
Block a user