fix: note init bug

This commit is contained in:
xiangyu 2022-06-10 14:30:35 +08:00
parent fc015938a0
commit f0a1b98c4f
2 changed files with 7 additions and 4 deletions

View File

@ -124,6 +124,7 @@ class AddonEvents extends AddonBase {
if (state) {
const noteTab = state.tabs.find((t) => t.type === "betternotes");
Zotero.debug(noteTab);
this._Addon.views.showProgressWindow("1", noteTab.select);
if (noteTab) {
let t = 0;
while (t < 5) {
@ -132,7 +133,7 @@ class AddonEvents extends AddonBase {
await this._Addon.knowledge.openWorkspaceWindow(
"tab",
false,
noteTab.selected
false
);
break;
} catch (e) {
@ -775,7 +776,7 @@ class AddonEvents extends AddonBase {
message.content.params.item
);
}
(_window as Window).focus();
this._Addon.knowledge.openWorkspaceWindow();
} else {
ZoteroPane.openNoteWindow(message.content.params.item.id);
}

View File

@ -170,7 +170,7 @@ class Knowledge extends AddonBase {
noteEditor.viewMode = "library";
noteEditor.parent = null;
noteEditor.item = note;
if (this.workspaceTabId) {
if (!noteEditor || !noteEditor.getCurrentInstance()) {
noteEditor.initEditor();
}
@ -186,7 +186,9 @@ class Knowledge extends AddonBase {
params: type,
})
);
this._Addon.views.updateOutline();
if (type === "main") {
this._Addon.views.updateOutline();
}
}
getLinesInNote(note: ZoteroItem): string[] {