mirror of
https://github.com/wanglin2/mind-map.git
synced 2026-03-10 10:47:47 +08:00
feat: 在富文本节点中支持enableAutoEmptyTextWhenKeydown属性
This commit is contained in:
parent
4a56d8e46c
commit
622153b0a2
@ -185,6 +185,7 @@ export default class TextEdit {
|
||||
node,
|
||||
isInserting = false,
|
||||
isFromKeyDown = false,
|
||||
isFromScale = false
|
||||
}) {
|
||||
// 使用了自定义节点内容那么不响应编辑事件
|
||||
if (node.isUseCustomNodeContent()) {
|
||||
@ -216,6 +217,7 @@ export default class TextEdit {
|
||||
rect,
|
||||
isInserting,
|
||||
isFromKeyDown,
|
||||
isFromScale
|
||||
}
|
||||
if (this.mindMap.richText) {
|
||||
this.mindMap.richText.showEditText(params)
|
||||
|
||||
@ -188,7 +188,8 @@ class RichText {
|
||||
textAutoWrapWidth,
|
||||
selectTextOnEnterEditText,
|
||||
transformRichTextOnEnterEdit,
|
||||
openRealtimeRenderOnNodeTextEdit
|
||||
openRealtimeRenderOnNodeTextEdit,
|
||||
enableAutoEmptyTextWhenKeydown
|
||||
} = this.mindMap.opt
|
||||
textAutoWrapWidth = node.hasCustomWidth()
|
||||
? node.customTextWidth
|
||||
@ -288,6 +289,10 @@ class RichText {
|
||||
// 已经是富文本
|
||||
this.textEditNode.innerHTML = this.cacheEditingText || nodeText
|
||||
}
|
||||
if (enableAutoEmptyTextWhenKeydown && isFromKeyDown) {
|
||||
this.textEditNode.innerHTML = ''
|
||||
this.lostStyle = true
|
||||
}
|
||||
this.initQuillEditor()
|
||||
document.querySelector('.ql-editor').style.minHeight = originHeight + 'px'
|
||||
this.showTextEdit = true
|
||||
|
||||
Loading…
Reference in New Issue
Block a user