diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2021-09-27 19:07:28 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-27 19:07:28 -0400 |
commit | b0f6c41f5dc7f498f2948f846dd273bcb1bc1f0b (patch) | |
tree | 09f17dd0c6d549528d680c6f982efeb55610858d /ext/js/dom | |
parent | b784e5b11a596a456eb8879d394fde64bc63aaef (diff) |
Search query offset value (#1968)
* Add type property to TextSource* classes
* Use type property rather than instanceof
* Expose a sentence offset value
* Use offset added to URL
* Improve fallback sentence for Anki note context
Diffstat (limited to 'ext/js/dom')
-rw-r--r-- | ext/js/dom/text-source-element.js | 4 | ||||
-rw-r--r-- | ext/js/dom/text-source-range.js | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/ext/js/dom/text-source-element.js b/ext/js/dom/text-source-element.js index 499ee45d..11bf7eb0 100644 --- a/ext/js/dom/text-source-element.js +++ b/ext/js/dom/text-source-element.js @@ -24,6 +24,10 @@ class TextSourceElement { this._content = this._fullContent.substring(this._startOffset, this._endOffset); } + get type() { + return 'element'; + } + get element() { return this._element; } diff --git a/ext/js/dom/text-source-range.js b/ext/js/dom/text-source-range.js index 377016da..591429da 100644 --- a/ext/js/dom/text-source-range.js +++ b/ext/js/dom/text-source-range.js @@ -29,6 +29,10 @@ class TextSourceRange { this._imposterSourceElement = imposterSourceElement; } + get type() { + return 'range'; + } + get range() { return this._range; } |