From 199b926f239ddf64c95f23415851a11ba4bf7c2a Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Fri, 27 Mar 2020 22:11:24 -0400 Subject: Add overridable getDocumentTitle --- ext/mixed/js/display.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'ext/mixed') diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js index 646d60e7..64c604e8 100644 --- a/ext/mixed/js/display.js +++ b/ext/mixed/js/display.js @@ -908,12 +908,17 @@ class Display { async getDefinitionsAddable(definitions, modes) { try { - return await apiDefinitionsAddable(definitions, modes, this._getNoteContext(), this.getOptionsContext()); + const context = await this._getNoteContext(); + return await apiDefinitionsAddable(definitions, modes, context, this.getOptionsContext()); } catch (e) { return []; } } + async getDocumentTitle() { + return document.title; + } + static indexOf(nodeList, node) { for (let i = 0, ii = nodeList.length; i < ii; ++i) { if (nodeList[i] === node) { @@ -934,10 +939,11 @@ class Display { return (typeof key === 'string' ? (key.length === 1 ? key.toUpperCase() : key) : ''); } - _getNoteContext() { + async _getNoteContext() { + const documentTitle = await this.getDocumentTitle(); return { document: { - title: document.title + title: documentTitle } }; } -- cgit v1.2.3