fix: template editor open bug

This commit is contained in:
xiangyu 2022-06-27 20:49:22 +08:00
parent f461abe0fb
commit 0d5f213506
2 changed files with 13 additions and 5 deletions

View File

@ -1283,11 +1283,7 @@ class AddonEvents extends AddonBase {
/*
message.content = {}
*/
window.open(
"chrome://Knowledge4Zotero/content/template.xul",
"_blank",
"chrome,extrachrome,centerscreen,width=800,height=400,resizable=yes"
);
this._Addon.template.openEditor();
} else if (message.type === "export") {
/*
message.content = {

View File

@ -67,6 +67,18 @@ class AddonTemplate extends AddonBase {
];
}
openEditor() {
if (this._window && !this._window.closed) {
this._window.focus();
} else {
window.open(
"chrome://Knowledge4Zotero/content/template.xul",
"_blank",
"chrome,extrachrome,centerscreen,width=800,height=400,resizable=yes"
);
}
}
initTemplates(_window: Window) {
this._window = _window;
this.updateTemplateView();