fix: #70
This commit is contained in:
parent
6d4e9628a5
commit
10e57afadb
@ -88,7 +88,6 @@ Search `@example` in `src/examples.ts`. The examples are called in `src/hooks.ts
|
||||
- registerExtraColumn
|
||||
- registerExtraColumnWithCustomCell
|
||||
- registerCustomItemBoxRow
|
||||
- registerCustomCellRenderer
|
||||
- registerLibraryTabPanel
|
||||
- registerReaderTabPanel
|
||||
|
||||
|
22
package.json
22
package.json
@ -41,23 +41,23 @@
|
||||
},
|
||||
"homepage": "https://github.com/windingwind/zotero-addon-template#readme",
|
||||
"dependencies": {
|
||||
"zotero-plugin-toolkit": "^2.2.8"
|
||||
"zotero-plugin-toolkit": "^2.3.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.4.2",
|
||||
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
||||
"@typescript-eslint/parser": "^6.0.0",
|
||||
"@types/node": "^20.6.0",
|
||||
"@typescript-eslint/eslint-plugin": "^6.6.0",
|
||||
"@typescript-eslint/parser": "^6.6.0",
|
||||
"chokidar-cli": "^3.0.0",
|
||||
"compressing": "^1.9.0",
|
||||
"concurrently": "^8.2.0",
|
||||
"compressing": "^1.10.0",
|
||||
"concurrently": "^8.2.1",
|
||||
"cross-env": "^7.0.3",
|
||||
"esbuild": "^0.19.2",
|
||||
"eslint": "^8.44.0",
|
||||
"eslint": "^8.49.0",
|
||||
"eslint-config-prettier": "^9.0.0",
|
||||
"prettier": "^3.0.0",
|
||||
"release-it": "^16.1.0",
|
||||
"prettier": "^3.0.3",
|
||||
"release-it": "^16.1.5",
|
||||
"replace-in-file": "^7.0.1",
|
||||
"typescript": "^5.1.6",
|
||||
"zotero-types": "^1.0.16"
|
||||
"typescript": "^5.2.2",
|
||||
"zotero-types": "^1.2.3"
|
||||
}
|
||||
}
|
||||
|
@ -60,8 +60,6 @@ async function onMainWindowLoad(win: Window): Promise<void> {
|
||||
|
||||
await UIExampleFactory.registerExtraColumnWithCustomCell();
|
||||
|
||||
await UIExampleFactory.registerCustomCellRenderer();
|
||||
|
||||
await UIExampleFactory.registerCustomItemBoxRow();
|
||||
|
||||
UIExampleFactory.registerLibraryTabPanel();
|
||||
|
@ -277,11 +277,13 @@ export class UIExampleFactory {
|
||||
return String(item.id);
|
||||
},
|
||||
{
|
||||
renderCellHook(index, data, column) {
|
||||
renderCell(index, data, column) {
|
||||
ztoolkit.log("Custom column cell is rendered!");
|
||||
const span = document.createElementNS(
|
||||
"http://www.w3.org/1999/xhtml",
|
||||
"span",
|
||||
);
|
||||
span.className = `cell ${column.className}`;
|
||||
span.style.background = "#0dd068";
|
||||
span.innerText = "⭐" + data;
|
||||
return span;
|
||||
@ -290,21 +292,6 @@ export class UIExampleFactory {
|
||||
);
|
||||
}
|
||||
|
||||
@example
|
||||
static async registerCustomCellRenderer() {
|
||||
await ztoolkit.ItemTree.addRenderCellHook(
|
||||
"title",
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
(index: number, data: string, column: any, original: Function) => {
|
||||
const span = original(index, data, column) as HTMLSpanElement;
|
||||
span.style.background = "rgb(30, 30, 30)";
|
||||
span.style.color = "rgb(156, 220, 240)";
|
||||
return span;
|
||||
},
|
||||
);
|
||||
await ztoolkit.ItemTree.refresh();
|
||||
}
|
||||
|
||||
@example
|
||||
static async registerCustomItemBoxRow() {
|
||||
await ztoolkit.ItemBox.register(
|
||||
|
Loading…
x
Reference in New Issue
Block a user