aboutsummaryrefslogtreecommitdiff
path: root/ext/js/display/display.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-03-31 18:17:28 -0400
committerGitHub <noreply@github.com>2021-03-31 18:17:28 -0400
commitbcbd413e571d772a4438f57138169ad1a6a3b5a8 (patch)
treee8768f5e91e62759e2dce7179359aa83ff6e4d0f /ext/js/display/display.js
parentcbcfdcacaf68efb09e47932f5b14881b982aecd2 (diff)
Definition collapsing when overflowing (#1575)
* Add double-down-chevron.svg * Add options * Update dictionary importers * Update settings * Add support for collapsible definitions * Improve case when there is a very small amount of overflow * Fix incorrect enabled state of newly imported dictionaries
Diffstat (limited to 'ext/js/display/display.js')
-rw-r--r--ext/js/display/display.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/js/display/display.js b/ext/js/display/display.js
index ee2448d6..b17a6168 100644
--- a/ext/js/display/display.js
+++ b/ext/js/display/display.js
@@ -23,6 +23,7 @@
* DisplayHistory
* DisplayNotification
* DocumentUtil
+ * ElementOverflowController
* FrameEndpoint
* Frontend
* HotkeyHelpController
@@ -114,6 +115,7 @@ class Display extends EventDispatcher {
this._ankiNoteNotificationEventListeners = null;
this._queryPostProcessor = null;
this._optionToggleHotkeyHandler = new OptionToggleHotkeyHandler(this);
+ this._elementOverflowController = new ElementOverflowController();
this._hotkeyHandler.registerActions([
['close', () => { this._onHotkeyClose(); }],
@@ -305,6 +307,7 @@ class Display extends EventDispatcher {
this._hotkeyHelpController.setOptions(options);
this._displayGenerator.updateHotkeys();
this._hotkeyHelpController.setupNode(document.documentElement);
+ this._elementOverflowController.setOptions(options);
this._queryParser.setOptions({
selectedParser: options.parsing.selectedParser,
@@ -535,6 +538,7 @@ class Display extends EventDispatcher {
this._hideAnkiNoteErrors(false);
this._definitions = [];
this._definitionNodes = [];
+ this._elementOverflowController.clearElements();
// Prepare
const urlSearchParams = new URLSearchParams(location.search);
@@ -966,6 +970,8 @@ class Display extends EventDispatcher {
if (focusEntry === i) {
this._focusEntry(i, false);
}
+
+ this._elementOverflowController.addElements(entry);
}
if (typeof scrollX === 'number' || typeof scrollY === 'number') {