diff options
Diffstat (limited to 'ext/fg/js/source.js')
-rw-r--r-- | ext/fg/js/source.js | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/ext/fg/js/source.js b/ext/fg/js/source.js index a5421934..e724488d 100644 --- a/ext/fg/js/source.js +++ b/ext/fg/js/source.js @@ -25,13 +25,20 @@ const IGNORE_TEXT_PATTERN = /\u200c/; */ class TextSourceRange { - constructor(range, content='') { + constructor(range, content, imposterContainer) { this.range = range; this.content = content; + this.imposterContainer = imposterContainer; } clone() { - return new TextSourceRange(this.range.cloneRange(), this.content); + return new TextSourceRange(this.range.cloneRange(), this.content, this.imposterContainer); + } + + cleanup() { + if (this.imposterContainer !== null && this.imposterContainer.parentNode !== null) { + this.imposterContainer.parentNode.removeChild(this.imposterContainer); + } } text() { @@ -242,6 +249,10 @@ class TextSourceElement { return new TextSourceElement(this.element, this.content); } + cleanup() { + // NOP + } + text() { return this.content; } |