Improve CKEditor plugin listeners logic

This commit is contained in:
Aljaž Grilc 2024-04-22 07:57:30 +02:00
parent b8dba4bba9
commit 5ed444f577

View File

@ -692,10 +692,10 @@ class BesCKService extends BesService {
}
})
this.ckEditorInstance.commands.get('undo').on('execute', () => {
this.handlePluginChanges()
this.proofCKEditor()
})
this.ckEditorInstance.commands.get('redo').on('execute', () => {
this.handlePluginChanges()
this.proofCKEditor()
})
this.ckEditorInstance.commands.get('bold').on('execute', () => {
setTimeout(() => {
@ -710,16 +710,16 @@ class BesCKService extends BesService {
}, 500)
})
this.ckEditorInstance.commands.get('indent').on('execute', () => {
this.handlePluginChanges()
this.proofCKEditor()
})
this.ckEditorInstance.commands.get('outdent').on('execute', () => {
this.handlePluginChanges()
this.proofCKEditor()
})
this.ckEditorInstance.commands.get('numberedList').on('execute', () => {
this.handlePluginChanges()
this.proofCKEditor()
})
this.ckEditorInstance.commands.get('bulletedList').on('execute', () => {
this.handlePluginChanges()
this.proofCKEditor()
})
}
@ -777,7 +777,7 @@ class BesCKService extends BesService {
this.children = []
}
handlePluginChanges() {
proofCKEditor() {
this.clearAllMistakes(this.scrollPanel)
this.clearChildren()
setTimeout(() => {
@ -858,7 +858,7 @@ class BesCKService extends BesService {
// It maintains reasonable performance as it only checks the block element that has been modified,
// rather than re-evaluating the entire document or a larger set of elements.
this.abortController = new AbortController()
this.proof(el)
this.proofCKEditor()
}
}