mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-11-09 19:01:45 +08:00
fix(in-app-help): headings not always updated properly
This commit is contained in:
parent
ff0514a7dc
commit
3796818a78
@ -155,6 +155,10 @@ export type CommandMappings = {
|
|||||||
callback?: GetTextEditorCallback;
|
callback?: GetTextEditorCallback;
|
||||||
};
|
};
|
||||||
executeWithCodeEditor: CommandData & ExecuteCommandData<null>;
|
executeWithCodeEditor: CommandData & ExecuteCommandData<null>;
|
||||||
|
/**
|
||||||
|
* Called upon when attempting to retrieve the content element of a {@link NoteContext}.
|
||||||
|
* Generally should not be invoked manually, as it is used by {@link NoteContext.getContentElement}.
|
||||||
|
*/
|
||||||
executeWithContentElement: CommandData & ExecuteCommandData<JQuery<HTMLElement>>;
|
executeWithContentElement: CommandData & ExecuteCommandData<JQuery<HTMLElement>>;
|
||||||
executeWithTypeWidget: CommandData & ExecuteCommandData<null>;
|
executeWithTypeWidget: CommandData & ExecuteCommandData<null>;
|
||||||
addTextToActiveEditor: CommandData & {
|
addTextToActiveEditor: CommandData & {
|
||||||
|
|||||||
@ -319,6 +319,15 @@ class NoteContext extends Component implements EventListener<"entitiesReloaded">
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a promise which will retrieve the JQuery element of the content of this note context.
|
||||||
|
*
|
||||||
|
* Do note that retrieving the content element needs to be handled by the type widget, which is the one which
|
||||||
|
* provides the content element by listening to the `executeWithContentElement` event. Not all note types support
|
||||||
|
* this.
|
||||||
|
*
|
||||||
|
* If no content could be determined `null` is returned instead.
|
||||||
|
*/
|
||||||
async getContentElement() {
|
async getContentElement() {
|
||||||
return this.timeout<JQuery<HTMLElement>>(
|
return this.timeout<JQuery<HTMLElement>>(
|
||||||
new Promise((resolve) =>
|
new Promise((resolve) =>
|
||||||
|
|||||||
@ -36,6 +36,11 @@ export default class DocTypeWidget extends TypeWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async doRefresh(note: FNote) {
|
async doRefresh(note: FNote) {
|
||||||
|
this.initialized = this.#loadContent(note);
|
||||||
|
}
|
||||||
|
|
||||||
|
#loadContent(note: FNote) {
|
||||||
|
return new Promise<void>((resolve) => {
|
||||||
const docName = note.getLabelValue("docName");
|
const docName = note.getLabelValue("docName");
|
||||||
|
|
||||||
if (docName) {
|
if (docName) {
|
||||||
@ -47,14 +52,17 @@ export default class DocTypeWidget extends TypeWidget {
|
|||||||
if (status === "error") {
|
if (status === "error") {
|
||||||
const fallbackUrl = `${window.glob.appPath}/doc_notes/en/${docName}.html`;
|
const fallbackUrl = `${window.glob.appPath}/doc_notes/en/${docName}.html`;
|
||||||
this.$content.load(fallbackUrl, () => this.#processContent(fallbackUrl));
|
this.$content.load(fallbackUrl, () => this.#processContent(fallbackUrl));
|
||||||
|
resolve();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.#processContent(url);
|
this.#processContent(url);
|
||||||
|
resolve();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.$content.empty();
|
this.$content.empty();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#processContent(url: string) {
|
#processContent(url: string) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user