Skip to content

Commit

Permalink
Release 1.0.0-26
Browse files Browse the repository at this point in the history
  • Loading branch information
windingwind committed Nov 28, 2023
1 parent 748b0eb commit 9ccb528
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 25 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zotero-actions-tags",
"version": "1.0.0-25",
"version": "1.0.0-26",
"description": "Action it, tag it, sorted.",
"config": {
"addonName": "Actions and Tags for Zotero",
Expand Down
7 changes: 6 additions & 1 deletion src/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ import {
initWindowShortcuts,
unInitWindowShortcuts,
} from "./modules/shortcuts";
import { buildItemMenu, initItemMenu, initReaderAnnotationMenu, initReaderMenu } from "./modules/menu";
import {
buildItemMenu,
initItemMenu,
initReaderAnnotationMenu,
initReaderMenu,
} from "./modules/menu";
import { editAction } from "./modules/edit";
import { exportToFile, importFromFile } from "./modules/backup";

Expand Down
10 changes: 5 additions & 5 deletions src/modules/edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ async function editAction(currentKey?: string) {
const content = await openEditorWindow(dialogData.data);
(
dialog.window.document.querySelector(
"#data-input"
"#data-input",
) as HTMLTextAreaElement
).value = content;
dialogData.data = content;
Expand Down Expand Up @@ -177,7 +177,7 @@ async function editAction(currentKey?: string) {
const key = ev.target as HTMLElement;
const win = dialog.window;
key.textContent = `[${getString(
"prefs-action-edit-shortcut-placeholder"
"prefs-action-edit-shortcut-placeholder",
)}]`;
dialogData.shortcut = "";
const keyDownListener = (e: KeyboardEvent) => {
Expand Down Expand Up @@ -284,7 +284,7 @@ async function editAction(currentKey?: string) {
namespace: "html",
properties: {
textContent: getString(
"prefs-action-showInMenuReaderAnnotation"
"prefs-action-showInMenuReaderAnnotation",
),
},
},
Expand Down Expand Up @@ -362,7 +362,7 @@ async function editAction(currentKey?: string) {
readerAnnotation: dialogData.showInMenuReaderAnnotation,
},
},
currentKey
currentKey,
);
edited = true;
}
Expand All @@ -385,7 +385,7 @@ async function openEditorWindow(content: string) {
const editorWin = addon.data.prefs.window?.openDialog(
"chrome://scaffold/content/monaco/monaco.html",
"monaco",
"chrome,centerscreen,dialog=no,resizable,scrollbars=yes,width=800,height=600"
"chrome,centerscreen,dialog=no,resizable,scrollbars=yes,width=800,height=600",
) as
| (Window & {
loadMonaco: (options: Record<string, any>) => Promise<{ editor: any }>;
Expand Down
18 changes: 9 additions & 9 deletions src/modules/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function initItemMenu(win: Window) {
},
],
},
win.document.querySelector("popupset")!
win.document.querySelector("popupset")!,
);
}

Expand Down Expand Up @@ -109,15 +109,15 @@ function initReaderMenu() {
classList: ["dropmarker"],
},
],
})
}),
);
append(
ztoolkit.UI.createElement(doc, "style", {
id: `${config.addonRef}-reader-button`,
properties: {
textContent: readerButtonCSS,
},
})
}),
);
});
}
Expand All @@ -135,19 +135,19 @@ function initReaderAnnotationMenu() {
triggerMenuCommand(
action.key,
reader._item.libraryID,
...params.ids
...params.ids,
);
},
});
}
}
},
);
}

function buildItemMenu(win: Window, target: "item" | "reader") {
const doc = win.document;
const popup = doc.querySelector(
`#${config.addonRef}-${target}-popup`
`#${config.addonRef}-${target}-popup`,
) as XUL.MenuPopup;
// Remove all children in popup
while (popup.firstChild) {
Expand Down Expand Up @@ -186,7 +186,7 @@ function buildItemMenu(win: Window, target: "item" | "reader") {
};
}),
},
popup
popup,
);
}
}
Expand All @@ -200,7 +200,7 @@ function getActionsByMenu(target: ActionShowInMenu) {
action &&
action.menu &&
action.enabled &&
(!action.showInMenu || action.showInMenu[target] !== false)
(!action.showInMenu || action.showInMenu[target] !== false),
)
.sort((x, y) => {
if (!x && !y) {
Expand All @@ -214,7 +214,7 @@ function getActionsByMenu(target: ActionShowInMenu) {
}
return ((x[sortBy] as string) || "").localeCompare(
(y[sortBy] || "") as string,
Zotero.locale
Zotero.locale,
);
});
}
Expand Down
14 changes: 7 additions & 7 deletions src/utils/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function initActions() {
addon.data.actions.map = new ztoolkit.LargePref(
`${config.prefsPrefix}.rules`,
`${config.prefsPrefix}.rules.`,
"parser"
"parser",
).asMapLike() as ActionMap;
if (!getPref("rulesInit")) {
for (const key of defaultActions.keys()) {
Expand Down Expand Up @@ -158,7 +158,7 @@ function initActions() {

function updateCachedActionKeys() {
addon.data.actions.cachedKeys = Array.from(
addon.data.actions.map.keys()
addon.data.actions.map.keys(),
).sort((a, b) => {
const actionA = addon.data.actions.map.get(a);
const actionB = addon.data.actions.map.get(b);
Expand All @@ -169,13 +169,13 @@ function updateCachedActionKeys() {
actionA[
addon.data.prefs.columns[addon.data.prefs.columnIndex]
.dataKey as keyof ActionData
] || ""
] || "",
);
const valueB = String(
actionB[
addon.data.prefs.columns[addon.data.prefs.columnIndex]
.dataKey as keyof ActionData
] || ""
] || "",
);

return addon.data.prefs.columnAscending
Expand Down Expand Up @@ -231,7 +231,7 @@ async function applyAction(action: ActionData, args: ActionArgs) {
}
}
message = `Toggle tag ${tags.join(",")} to item ${item?.getField(
"title"
"title",
)}`;
break;
}
Expand Down Expand Up @@ -278,7 +278,7 @@ async function applyAction(action: ActionData, args: ActionArgs) {
const actions = getActions();
// Find the action by name
const nextAction = Object.values(actions).find(
(_action) => _action.name === action.data
(_action) => _action.name === action.data,
);
if (nextAction) {
await applyAction(nextAction, args);
Expand All @@ -299,7 +299,7 @@ async function applyAction(action: ActionData, args: ActionArgs) {
function getActions(): Record<string, ActionData>;
function getActions(key: string): ActionData | undefined;
function getActions(
key?: string
key?: string,
): Record<string, ActionData> | ActionData | undefined {
if (!key) {
const map = addon.data.actions.map;
Expand Down
4 changes: 2 additions & 2 deletions update-beta.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"zoterotag@euclpts.com": {
"updates": [
{
"version": "1.0.0-25",
"update_link": "https://github.com/windingwind/zotero-actions-tags/releases/download/v1.0.0-25/zotero-actions-tags.xpi",
"version": "1.0.0-26",
"update_link": "https://github.com/windingwind/zotero-actions-tags/releases/download/v1.0.0-26/zotero-actions-tags.xpi",
"applications": {
"zotero": {
"strict_min_version": "6.999"
Expand Down

0 comments on commit 9ccb528

Please sign in to comment.