From 75d30594511a6593044565829ad55369fecaf4cd Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 25 Sep 2022 09:37:33 -0400 Subject: TextSource* API updates (#2236) * Move TextSourceRange static functions to DocumentUtil getWritingMode is also simplified * Update Google Docs range to be empty to match other range sources * Rename imposterContainer to imposterElement * Add static creation functions * Add static creation function * Remove unused collapse function * Don't select imposter elements * Refactor setEndOffset * Adjust argument order for setEndOffset * Update TextSourceRange constructor * Remove unused isConnected * Cache rects * Fix test * Remove unused getRect * Revert "Fix test" * Remove cachedRect * Use the source element rect to handle scroll differences * Writing mode update * Remove _cachedRects update This shouldn't be necessary as the imposter is usually detached almost immediately after scanning, giving no time for the window to be resized or scrolled. --- ext/js/app/frontend.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext/js/app') diff --git a/ext/js/app/frontend.js b/ext/js/app/frontend.js index 3a262c65..229ec940 100644 --- a/ext/js/app/frontend.js +++ b/ext/js/app/frontend.js @@ -757,7 +757,7 @@ class Frontend { async _scanSelectedText(allowEmptyRange) { const range = this._getFirstSelectionRange(allowEmptyRange); if (range === null) { return false; } - const source = new TextSourceRange(range, range.toString(), null, null); + const source = TextSourceRange.create(range); await this._textScanner.search(source, {focus: true, restoreSelection: true}); return true; } -- cgit v1.2.3