update: move menuitems from edit menu to file and tools menu

This commit is contained in:
windingwind 2024-07-08 01:22:27 +08:00
parent 8fb4c5c324
commit e191ce9acd

View File

@ -15,56 +15,6 @@ export function registerMenus(win: Window) {
},
});
// menuEdit
const menuEditAnchor = win.document.querySelector(
"#menu_EditPreferencesItem",
) as XUL.MenuItem;
ztoolkit.Menu.register(
"menuEdit",
{
tag: "menuitem",
label: getString("menuEdit.exportTemplate"),
icon: `chrome://${config.addonRef}/content/icons/favicon.png`,
commandListener: (ev) => {
addon.hooks.onShowTemplatePicker("export");
},
},
"before",
menuEditAnchor,
);
ztoolkit.Menu.register(
"menuEdit",
{
tag: "menuitem",
label: getString("menuEdit.templateEditor"),
icon: `chrome://${config.addonRef}/content/icons/favicon.png`,
commandListener: (ev) => {
addon.hooks.onShowTemplateEditor();
},
},
"before",
menuEditAnchor,
);
ztoolkit.Menu.register(
"menuEdit",
{
tag: "menuitem",
label: getString("menuEdit.importTemplate"),
icon: `chrome://${config.addonRef}/content/icons/favicon.png`,
commandListener: (ev) => {
addon.hooks.onImportTemplateFromClipboard();
},
},
"before",
menuEditAnchor,
);
ztoolkit.Menu.register(
"menuEdit",
{ tag: "menuseparator" },
"before",
menuEditAnchor,
);
// menuTools
ztoolkit.Menu.register("menuTools", { tag: "menuseparator" });
ztoolkit.Menu.register("menuTools", {
@ -75,6 +25,22 @@ export function registerMenus(win: Window) {
addon.hooks.onShowSyncManager();
},
});
ztoolkit.Menu.register("menuTools", {
tag: "menuitem",
label: getString("menuEdit.templateEditor"),
icon: `chrome://${config.addonRef}/content/icons/favicon.png`,
commandListener: (ev) => {
addon.hooks.onShowTemplateEditor();
},
});
ztoolkit.Menu.register("menuTools", {
tag: "menuitem",
label: getString("menuEdit.importTemplate"),
icon: `chrome://${config.addonRef}/content/icons/favicon.png`,
commandListener: (ev) => {
addon.hooks.onImportTemplateFromClipboard();
},
});
// menuFile
const menuFileAnchor = win.document.querySelector(
@ -87,6 +53,19 @@ export function registerMenus(win: Window) {
"after",
menuFileAnchor,
);
ztoolkit.Menu.register(
"menuEdit",
{
tag: "menuitem",
label: getString("menuEdit.exportTemplate"),
icon: `chrome://${config.addonRef}/content/icons/favicon.png`,
commandListener: (ev) => {
addon.hooks.onShowTemplatePicker("export");
},
},
"after",
menuFileAnchor,
);
// a copy of create note menu in library
ztoolkit.Menu.register(
"menuFile",