Add TODO comment and commented code for rich HTML text replacement
This commit is contained in:
parent
3f39889b0b
commit
26539b8c10
@ -432,7 +432,10 @@ class BesEditor {
|
||||
return false
|
||||
}
|
||||
|
||||
// TODO: In rich HTML texts, match.offset has different value than in plain text.
|
||||
// This function should be able to handle both cases or find a way that works for both.
|
||||
static replaceText(el, rect, match, replacement, editor) {
|
||||
// const tags = this.getTagsAndText(el)
|
||||
const text = el.textContent
|
||||
const newText =
|
||||
text.substring(0, match.offset) +
|
||||
@ -446,6 +449,20 @@ class BesEditor {
|
||||
editor.proof(el)
|
||||
}
|
||||
|
||||
// static getTagsAndText(node) {
|
||||
// if (node.nodeType === Node.TEXT_NODE) {
|
||||
// return node.textContent
|
||||
// } else if (node.nodeType === Node.ELEMENT_NODE) {
|
||||
// let tag = node.tagName.toLowerCase()
|
||||
// let content = Array.from(node.childNodes)
|
||||
// .map(BesEditor.getTagsAndText)
|
||||
// .join('')
|
||||
// return `<${tag}>${content}</${tag}>`
|
||||
// } else {
|
||||
// return ''
|
||||
// }
|
||||
// }
|
||||
|
||||
// This function clears a single mistake
|
||||
static clearSingleMistake(editor, el, rect) {
|
||||
const childToDelete = editor.children.filter(
|
||||
|
Loading…
x
Reference in New Issue
Block a user