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