Demo:支持配置创建新节点时的行为

This commit is contained in:
wanglin2 2023-12-04 11:25:04 +08:00
parent 55d7d0a846
commit 250ff30704
4 changed files with 52 additions and 37 deletions

View File

@ -47,6 +47,10 @@ export default {
mousewheelZoomActionReverse: 'Mouse Wheel Zoom',
mousewheelZoomActionReverse1: 'Zoom out forward and zoom in back',
mousewheelZoomActionReverse2: 'Zoom in forward and zoom out back',
createNewNodeBehavior: 'Behavior of creating new node',
default: 'Active new node and editing',
notActive: 'Not active new node',
activeOnly: 'Only active new node but not editing',
rootStyle: 'Root Node',
associativeLineText: 'Associative line text',
fontFamily: 'Font family',

View File

@ -47,6 +47,10 @@ export default {
mousewheelZoomActionReverse: '鼠标滚轮缩放',
mousewheelZoomActionReverse1: '向前缩小向后放大',
mousewheelZoomActionReverse2: '向前放大向后缩小',
createNewNodeBehavior: '创建新节点的行为',
default: '激活新节点及进入编辑',
notActive: '不激活新节点',
activeOnly: '只激活新节点,不进入编辑',
rootStyle: '根节点',
associativeLineText: '关联线文字',
fontFamily: '字体',

View File

@ -753,6 +753,36 @@
</el-select>
</div>
</div>
<!-- 配置创建新节点时的行为 -->
<div class="row">
<div class="rowItem">
<span class="name">{{ $t('baseStyle.createNewNodeBehavior') }}</span>
<el-select
size="mini"
style="width: 120px"
v-model="config.createNewNodeBehavior"
placeholder=""
@change="
value => {
updateOtherConfig('createNewNodeBehavior', value)
}
"
>
<el-option
:label="$t('baseStyle.default')"
value="default"
></el-option>
<el-option
:label="$t('baseStyle.notActive')"
value="notActive"
></el-option>
<el-option
:label="$t('baseStyle.activeOnly')"
value="activeOnly"
></el-option>
</el-select>
</div>
</div>
<!-- 是否显示滚动条 -->
<div class="row">
<div class="rowItem">
@ -843,7 +873,8 @@ export default {
config: {
enableFreeDrag: false,
mousewheelAction: 'zoom',
mousewheelZoomActionReverse: false
mousewheelZoomActionReverse: false,
createNewNodeBehavior: 'default'
},
watermarkConfig: {
show: false,
@ -968,7 +999,8 @@ export default {
;[
'enableFreeDrag',
'mousewheelAction',
'mousewheelZoomActionReverse'
'mousewheelZoomActionReverse',
'createNewNodeBehavior'
].forEach(key => {
this.config[key] = this.mindMap.getConfig(key)
})
@ -979,9 +1011,7 @@ export default {
this.enableNodeRichText = this.localConfig.openNodeRichText
this.mousewheelAction = this.localConfig.mousewheelAction
this.mousewheelZoomActionReverse = this.localConfig.mousewheelZoomActionReverse
;[
'isShowScrollbar'
].forEach(key => {
;['isShowScrollbar'].forEach(key => {
this.localConfigs[key] = this.localConfig[key]
})
},

View File

@ -20,36 +20,22 @@ const store = new Vuex.Store({
isShowScrollbar: false
},
activeSidebar: '', // 当前显示的侧边栏
isDark: false,// 是否是暗黑模式
isOutlineEdit: false,// 是否是大纲编辑模式
isReadonly: false// 是否只读
isDark: false, // 是否是暗黑模式
isOutlineEdit: false, // 是否是大纲编辑模式
isReadonly: false // 是否只读
},
mutations: {
/**
* @Author: 王林
* @Date: 2021-04-10 14:50:01
* @Desc: 设置思维导图数据
*/
// 设置思维导图数据
setMindMapData(state, data) {
state.mindMapData = data
},
/**
* javascript comment
* @Author: 王林
* @Date: 2022-09-24 13:55:38
* @Desc: 设置操作本地文件标志位
*/
// 设置操作本地文件标志位
setIsHandleLocalFile(state, data) {
state.isHandleLocalFile = data
},
/**
* javascript comment
* @Author: 王林25
* @Date: 2022-11-14 18:42:47
* @Desc: 设置本地配置
*/
// 设置本地配置
setLocalConfig(state, data) {
state.localConfig = {
...state.localConfig,
@ -58,12 +44,7 @@ const store = new Vuex.Store({
storeLocalConfig(state.localConfig)
},
/**
* javascript comment
* @Author: 王林25
* @Date: 2022-11-15 19:25:26
* @Desc: 设置当前显示的侧边栏
*/
// 设置当前显示的侧边栏
setActiveSidebar(state, data) {
state.activeSidebar = data
},
@ -81,14 +62,10 @@ const store = new Vuex.Store({
// 设置是否只读
setIsReadonly(state, data) {
state.isReadonly = data
},
}
},
actions: {
/**
* @Author: 王林
* @Date: 2021-04-10 14:50:40
* @Desc: 设置初始思维导图数据
*/
// 设置初始思维导图数据
getUserMindMapData(ctx) {
try {
let { data } = {