Skip to content

Commit 0beca36

Browse files
committed
feat: update contentEditable property to plaintext-only
1 parent b378fff commit 0beca36

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/mouse.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ export default function (mind: MindElixirInstance) {
5858
*/
5959
mind.map.addEventListener('mousemove', e => {
6060
// click trigger mousemove in windows chrome
61-
if ((e.target as HTMLElement).contentEditable !== 'true') {
61+
if ((e.target as HTMLElement).contentEditable === 'inherit') {
6262
dragMoveHelper.onMove(e, mind)
6363
}
6464
})
6565
mind.map.addEventListener('mousedown', e => {
6666
const mouseMoveButton = mind.mouseSelectionButton === 0 ? 2 : 0
6767
if (e.button !== mouseMoveButton) return
68-
if ((e.target as HTMLElement).contentEditable !== 'true') {
68+
if ((e.target as HTMLElement).contentEditable === 'inherit') {
6969
dragMoveHelper.moved = false
7070
dragMoveHelper.mousedown = true
7171
}

src/utils/dom.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ export const editTopic = function (this: MindElixirInstance, el: Topic) {
143143
el.appendChild(div)
144144
div.id = 'input-box'
145145
div.textContent = origin
146-
div.contentEditable = 'true'
146+
div.contentEditable = 'plaintext-only'
147147
div.spellcheck = false
148148
const style = getComputedStyle(el)
149149
div.style.cssText = `min-width:${el.offsetWidth - 8}px;

src/utils/svg.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export const editSvgText = function (mei: MindElixirInstance, textEl: SVGTextEle
6363
const origin = textEl.innerHTML
6464
div.id = 'input-box'
6565
div.textContent = origin
66-
div.contentEditable = 'true'
66+
div.contentEditable = 'plaintext-only'
6767
div.spellcheck = false
6868
const bbox = textEl.getBBox()
6969
console.log(bbox)

0 commit comments

Comments
 (0)