Improve event handling and refactor clear children in CKEditor
This commit is contained in:
parent
1e46ef97ea
commit
05b1b04012
38
service.js
38
service.js
@ -695,12 +695,14 @@ class BesCKService extends BesService {
|
||||
})
|
||||
this.ckEditorInstance.commands.get('undo').on('execute', () => {
|
||||
this.clearAllMistakes(this.scrollPanel)
|
||||
this.clearChildren()
|
||||
setTimeout(() => {
|
||||
this.proof(hostElement)
|
||||
}, 500)
|
||||
})
|
||||
this.ckEditorInstance.commands.get('redo').on('execute', () => {
|
||||
this.clearAllMistakes(this.scrollPanel)
|
||||
this.clearChildren()
|
||||
setTimeout(() => {
|
||||
this.proof(hostElement)
|
||||
}, 500)
|
||||
@ -717,6 +719,34 @@ class BesCKService extends BesService {
|
||||
window.dispatchEvent(new Event('resize'))
|
||||
}, 500)
|
||||
})
|
||||
this.ckEditorInstance.commands.get('indent').on('execute', () => {
|
||||
this.clearAllMistakes(this.scrollPanel)
|
||||
this.clearChildren()
|
||||
setTimeout(() => {
|
||||
this.proof(hostElement)
|
||||
}, 500)
|
||||
})
|
||||
this.ckEditorInstance.commands.get('outdent').on('execute', () => {
|
||||
this.clearAllMistakes(this.scrollPanel)
|
||||
this.clearChildren()
|
||||
setTimeout(() => {
|
||||
this.proof(hostElement)
|
||||
}, 500)
|
||||
})
|
||||
this.ckEditorInstance.commands.get('numberedList').on('execute', () => {
|
||||
this.clearAllMistakes(this.scrollPanel)
|
||||
this.clearChildren()
|
||||
setTimeout(() => {
|
||||
this.proof(hostElement)
|
||||
}, 500)
|
||||
})
|
||||
this.ckEditorInstance.commands.get('bulletedList').on('execute', () => {
|
||||
this.clearAllMistakes(this.scrollPanel)
|
||||
this.clearChildren()
|
||||
setTimeout(() => {
|
||||
this.proof(hostElement)
|
||||
}, 500)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@ -767,11 +797,13 @@ class BesCKService extends BesService {
|
||||
}
|
||||
|
||||
clearAllMistakes(el) {
|
||||
if (el.children.length) {
|
||||
for (let i = 0; i < el.children.length; i++) {
|
||||
el.children[i].remove()
|
||||
while (el.firstChild) {
|
||||
el.removeChild(el.firstChild)
|
||||
}
|
||||
}
|
||||
|
||||
clearChildren() {
|
||||
this.children = []
|
||||
}
|
||||
|
||||
handleCKInput(hostElement, ckEditorInstance) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user