summaryrefslogtreecommitdiff
path: root/ext/mixed/js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-03-27 22:11:24 -0400
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-04-06 18:20:04 -0400
commit199b926f239ddf64c95f23415851a11ba4bf7c2a (patch)
tree8cc836152ec440f9dc2aa70ce14a97de10adab02 /ext/mixed/js
parent1d7c86ded0a3ca559342dc394696cdc2504d28c4 (diff)
Add overridable getDocumentTitle
Diffstat (limited to 'ext/mixed/js')
-rw-r--r--ext/mixed/js/display.js12
1 files changed, 9 insertions, 3 deletions
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
}
};
}