diff --git a/src/content-script-tools/custom-events/workflowy.js b/src/content-script-tools/custom-events/workflowy.js index 218dee7..ab540cd 100644 --- a/src/content-script-tools/custom-events/workflowy.js +++ b/src/content-script-tools/custom-events/workflowy.js @@ -7,5 +7,9 @@ export default { this.setValue = (value) => { this.elem.innerHTML = string.htmlEscape(value); }; + + this.extractTextFromUnknownElem = (elem, options) => { + return elem.innerText; + }; } }; diff --git a/src/handlers/content-editable.js b/src/handlers/content-editable.js index 9d3b95a..e0a68a5 100644 --- a/src/handlers/content-editable.js +++ b/src/handlers/content-editable.js @@ -22,11 +22,15 @@ class ContentEditableHandler extends BaseHandler { const noBreak = options.noLinebreak || i === this.elem.childNodes.length - 1; return noBreak ? '' : '\n'; default: - return child.outerHTML; + return this.extractTextFromUnknownElem(child, options); } }).join(''); } + extractTextFromUnknownElem(elem, _options) { + return elem.outerHTML; + } + setValue(value) { const htmlValue = value.split('\n').map((v) => { if (v.trim().length === 0) {