Add overridable getDocumentTitle

This commit is contained in:
toasted-nutbread 2020-03-27 22:11:24 -04:00
parent 1d7c86ded0
commit 199b926f23

View File

@ -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
}
};
}