Skip to content

Commit

Permalink
Merge pull request #40 from ChenglongMa/fix-dialog-bug
Browse files Browse the repository at this point in the history
Fix dialog bug
  • Loading branch information
ChenglongMa authored May 20, 2024
2 parents e00f897 + 80185b2 commit 11b77cc
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 10 deletions.
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,35 @@ A plugin that does one thing only: **Detect** and **Manage** duplicate items in
# Changelog

## v3.0.1
## v3.0.2

<details markdown="1" open>
<summary><i>Click here to show more.</i></summary>

In this version, we have made the following changes:

1. 🐛 **FIX!**: We have fixed the progress window icon bug in Zotero 7.0.0-beta.77.
2. 🧬 **CHANGE!**: We have updated the style of duplicate detection dialog.
3. 🧬 **CHANGE!**: We have updated the icon style in preference pane.
4. 🧬 **CHANGE!**: Items with different `itemType` will not be considered as duplicates.

</details>

## v3.0.1

<details markdown="1">
<summary><i>Click here to show more.</i></summary>

In this version, we have made the following changes:

1. 🧬 **CHANGE!**: We have updated the UI of buttons in the duplicate pane.
2. 🐛 **FIX!**: We have optimized the performance of duplicate search and detection.

</details>

## v3.0.0

<details markdown="1" open>
<details markdown="1">
<summary><i>Click here to show more.</i></summary>

In this version, we have made the following changes:
Expand Down
4 changes: 2 additions & 2 deletions addon/chrome/content/icons/preficon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zoplicate",
"version": "3.0.1",
"version": "3.0.2",
"description": "Detect and manage duplicate items in Zotero.",
"config": {
"addonName": "Zoplicate",
Expand Down
19 changes: 19 additions & 0 deletions src/modules/duplicates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,25 @@ export class Duplicates {
savePreference: false,
defaultAction: Action.CANCEL,
loadCallback: () => {
const cssFiles = [
"chrome://global/skin/",
"chrome://zotero/skin/zotero.css",
"chrome://zotero/skin/overlay.css",
"chrome://zotero-platform/content/overlay.css",
"chrome://zotero-platform/content/zotero.css",
];
ztoolkit.log("this.document", this.document)
cssFiles.forEach((css) => {
this.document?.head.appendChild(
ztoolkit.UI.createElement(this.document, "link", {
properties: {
rel: "stylesheet",
href: css,
},
}),
);
});

const defaultActionOptions = this.document?.getElementById(
`act_${this.dialogData.defaultAction}`,
) as HTMLInputElement;
Expand Down
9 changes: 7 additions & 2 deletions src/modules/merger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ export async function merge(
masterItem: Zotero.Item,
otherItems: Zotero.Item[], // Already sorted
): Promise<any> {

Zotero.CollectionTreeCache.clear();

const masterJSON = masterItem.toJSON();
const masterItemType = masterItem.itemTypeID;
otherItems = otherItems.filter((item) => item.itemTypeID === masterItemType);
if (otherItems.length === 0) {

return;
}

const masterJSON = masterItem.toJSON();
const candidateJSON: {
[field in Zotero.Item.DataType]?: string | unknown;
} = otherItems.reduce((acc, obj) => ({ ...acc, ...obj.toJSON() }), {});
Expand Down
3 changes: 2 additions & 1 deletion src/utils/ztoolkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ function initZToolkit(_ztoolkit: ReturnType<typeof createZToolkit>) {
_ztoolkit.UI.basicOptions.ui.enableElementDOMLog = enableUILog;
_ztoolkit.basicOptions.debug.disableDebugBridgePassword = __env__ === "development";
_ztoolkit.basicOptions.api.pluginID = config.addonID;
_ztoolkit.ProgressWindow.setIconURI("default", `chrome://${config.addonRef}/content/icons/preficon.svg`);
// TODO: Uncomment the following line to set the icon URI for the progress window
// _ztoolkit.ProgressWindow.setIconURI("default", `chrome://${config.addonRef}/content/icons/preficon.svg`);
}

import { BasicTool, makeHelperTool, unregister } from "zotero-plugin-toolkit/dist/basic";
Expand Down
2 changes: 1 addition & 1 deletion update-beta.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"zoplicate@chenglongma.com": {
"updates": [
{
"version": "3.0.1",
"version": "3.0.2",
"update_link": "https://github.com/ChenglongMa/zoplicate/releases/latest/download/zoplicate.xpi",
"applications": {
"zotero": {
Expand Down
2 changes: 1 addition & 1 deletion update.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"zoplicate@chenglongma.com": {
"updates": [
{
"version": "3.0.1",
"version": "3.0.2",
"update_link": "https://github.com/ChenglongMa/zoplicate/releases/latest/download/zoplicate.xpi",
"applications": {
"zotero": {
Expand Down

0 comments on commit 11b77cc

Please sign in to comment.