Demo:切换是否开启富文本的设置增加二次提示

This commit is contained in:
街角小林 2024-12-20 15:47:57 +08:00
parent 3f2b5be4aa
commit 71f92c985f
6 changed files with 42 additions and 13 deletions

View File

@ -77,7 +77,12 @@ export default {
tagPositionRight: 'Text right', tagPositionRight: 'Text right',
tagPositionBottom: 'Text bottom', tagPositionBottom: 'Text bottom',
alwaysShowExpandBtn: 'Always show expand btn', alwaysShowExpandBtn: 'Always show expand btn',
enableAutoEnterTextEditWhenKeydown: 'Auto enter text edit when keydown' enableAutoEnterTextEditWhenKeydown: 'Auto enter text edit when keydown',
confirm: 'Confirm',
cancel: 'Cancel',
changeRichTextTip: 'This operation will clear all historical modification records and modify the mind map data. Do you want to continue?',
changeRichTextTip2: 'Do you want to switch to rich text mode?',
changeRichTextTip3: 'Do you want to switch to non rich text mode?'
}, },
color: { color: {
moreColor: 'More color' moreColor: 'More color'

View File

@ -75,7 +75,12 @@ export default {
tagPositionRight: '文本右侧', tagPositionRight: '文本右侧',
tagPositionBottom: '文本下面', tagPositionBottom: '文本下面',
alwaysShowExpandBtn: '是否一直显示展开收起按钮', alwaysShowExpandBtn: '是否一直显示展开收起按钮',
enableAutoEnterTextEditWhenKeydown: '键盘输入时自动进入文本编辑' enableAutoEnterTextEditWhenKeydown: '键盘输入时自动进入文本编辑',
confirm: '确定',
cancel: '取消',
changeRichTextTip: '该操作会清空所有历史修改记录,并且修改思维导图数据,是否继续?',
changeRichTextTip2: '是否切换为富文本模式?',
changeRichTextTip3: '是否切换为非富文本模式?'
}, },
color: { color: {
moreColor: '更多颜色' moreColor: '更多颜色'

View File

@ -76,7 +76,12 @@ export default {
watermarkAngle: '旋轉角度', watermarkAngle: '旋轉角度',
watermarkTextOpacity: '文字透明度', watermarkTextOpacity: '文字透明度',
watermarkTextFontSize: '字型大小', watermarkTextFontSize: '字型大小',
belowNode: '顯示在節點下方' belowNode: '顯示在節點下方',
confirm: '確定',
cancel: '取消',
changeRichTextTip: '該操作會清空所有曆史修改記錄,並且修改思維導圖數據,是否繼續?',
changeRichTextTip2: '是否切換爲富文本模式?',
changeRichTextTip3: '是否切換爲非富文本模式?'
}, },
color: { color: {
moreColor: '更多顏色' moreColor: '更多顏色'

View File

@ -212,7 +212,7 @@ export default {
if (!targetNode) return if (!targetNode) return
this.notHandleDataChange = true this.notHandleDataChange = true
if (richText) { if (richText) {
targetNode.setText(textToNodeRichTextWithWrap(text), true, true) targetNode.setText(textToNodeRichTextWithWrap(text), true)
} else { } else {
targetNode.setText(text) targetNode.setText(text)
} }

View File

@ -149,7 +149,6 @@ export default {
const richText = node.data.data.richText const richText = node.data.data.richText
const text = richText ? e.target.innerHTML : e.target.innerText const text = richText ? e.target.innerHTML : e.target.innerText
node.data.data.text = richText ? textToNodeRichTextWithWrap(text) : text node.data.data.text = richText ? textToNodeRichTextWithWrap(text) : text
if (richText) node.data.data.resetRichText = true
node.data.textCache = e.target.innerHTML node.data.textCache = e.target.innerHTML
this.save() this.save()
}, },
@ -170,9 +169,6 @@ export default {
}, },
children: [] children: []
} }
if (richText) {
data.data.resetRichText = true
}
if (e.keyCode === 13 && !e.shiftKey) { if (e.keyCode === 13 && !e.shiftKey) {
e.preventDefault() e.preventDefault()
if (node.data.root) { if (node.data.root) {

View File

@ -214,7 +214,9 @@
<div class="rowItem"> <div class="rowItem">
<el-checkbox <el-checkbox
v-model="config.enableAutoEnterTextEditWhenKeydown" v-model="config.enableAutoEnterTextEditWhenKeydown"
@change="updateOtherConfig('enableAutoEnterTextEditWhenKeydown', $event)" @change="
updateOtherConfig('enableAutoEnterTextEditWhenKeydown', $event)
"
>{{ $t('setting.enableAutoEnterTextEditWhenKeydown') }}</el-checkbox >{{ $t('setting.enableAutoEnterTextEditWhenKeydown') }}</el-checkbox
> >
</div> </div>
@ -496,10 +498,26 @@ export default {
// //
enableNodeRichTextChange(e) { enableNodeRichTextChange(e) {
this.mindMap.renderer.textEdit.hideEditTextBox() this.$confirm(
this.setLocalConfig({ this.$t('setting.changeRichTextTip'),
openNodeRichText: e e
}) ? this.$t('setting.changeRichTextTip2')
: this.$t('setting.changeRichTextTip3'),
{
confirmButtonText: this.$t('setting.confirm'),
cancelButtonText: this.$t('setting.cancel'),
type: 'warning'
}
)
.then(() => {
this.mindMap.renderer.textEdit.hideEditTextBox()
this.setLocalConfig({
openNodeRichText: e
})
})
.catch(() => {
this.enableNodeRichText = !this.enableNodeRichText
})
}, },
// //