update: use toolkit 0.1.1
This commit is contained in:
		
							parent
							
								
									a4873cdb99
								
							
						
					
					
						commit
						acf0e98cf2
					
				@ -31,7 +31,7 @@
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  "homepage": "https://github.com/windingwind/zotero-addon-template#readme",
 | 
					  "homepage": "https://github.com/windingwind/zotero-addon-template#readme",
 | 
				
			||||||
  "dependencies": {
 | 
					  "dependencies": {
 | 
				
			||||||
    "zotero-plugin-toolkit": "^0.1.0"
 | 
					    "zotero-plugin-toolkit": "^0.1.1"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "@types/node": "^18.11.17",
 | 
					    "@types/node": "^18.11.17",
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										31
									
								
								src/views.ts
									
									
									
									
									
								
							
							
						
						
									
										31
									
								
								src/views.ts
									
									
									
									
									
								
							@ -152,18 +152,21 @@ class AddonViews extends AddonModule {
 | 
				
			|||||||
            subElementOptions: [
 | 
					            subElementOptions: [
 | 
				
			||||||
              {
 | 
					              {
 | 
				
			||||||
                tag: "h2",
 | 
					                tag: "h2",
 | 
				
			||||||
 | 
					                namespace: "html",
 | 
				
			||||||
                directAttributes: {
 | 
					                directAttributes: {
 | 
				
			||||||
                  innerText: "Hello World!",
 | 
					                  innerText: "Hello World!",
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
              },
 | 
					              },
 | 
				
			||||||
              {
 | 
					              {
 | 
				
			||||||
                tag: "div",
 | 
					                tag: "div",
 | 
				
			||||||
 | 
					                namespace: "html",
 | 
				
			||||||
                directAttributes: {
 | 
					                directAttributes: {
 | 
				
			||||||
                  innerText: "This is a library tab.",
 | 
					                  innerText: "This is a library tab.",
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
              },
 | 
					              },
 | 
				
			||||||
              {
 | 
					              {
 | 
				
			||||||
                tag: "button",
 | 
					                tag: "button",
 | 
				
			||||||
 | 
					                namespace: "html",
 | 
				
			||||||
                directAttributes: {
 | 
					                directAttributes: {
 | 
				
			||||||
                  innerText: "Unregister",
 | 
					                  innerText: "Unregister",
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
@ -217,34 +220,40 @@ class AddonViews extends AddonModule {
 | 
				
			|||||||
            id: `${config.addonRef}-${reader._instanceID}-extra-reader-tab-div`,
 | 
					            id: `${config.addonRef}-${reader._instanceID}-extra-reader-tab-div`,
 | 
				
			||||||
            namespace: "xul",
 | 
					            namespace: "xul",
 | 
				
			||||||
            // This is important! Don't create content for multiple times
 | 
					            // This is important! Don't create content for multiple times
 | 
				
			||||||
            ignoreIfExists: true,
 | 
					            // ignoreIfExists: true,
 | 
				
			||||||
 | 
					            removeIfExists: true,
 | 
				
			||||||
            subElementOptions: [
 | 
					            subElementOptions: [
 | 
				
			||||||
              {
 | 
					              {
 | 
				
			||||||
                tag: "h2",
 | 
					                tag: "h2",
 | 
				
			||||||
 | 
					                namespace: "html",
 | 
				
			||||||
                directAttributes: {
 | 
					                directAttributes: {
 | 
				
			||||||
                  innerText: "Hello World!",
 | 
					                  innerText: "Hello World!",
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
              },
 | 
					              },
 | 
				
			||||||
              {
 | 
					              {
 | 
				
			||||||
                tag: "div",
 | 
					                tag: "div",
 | 
				
			||||||
 | 
					                namespace: "html",
 | 
				
			||||||
                directAttributes: {
 | 
					                directAttributes: {
 | 
				
			||||||
                  innerText: "This is a reader tab.",
 | 
					                  innerText: "This is a reader tab.",
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
              },
 | 
					              },
 | 
				
			||||||
              {
 | 
					              {
 | 
				
			||||||
                tag: "div",
 | 
					                tag: "div",
 | 
				
			||||||
 | 
					                namespace: "html",
 | 
				
			||||||
                directAttributes: {
 | 
					                directAttributes: {
 | 
				
			||||||
                  innerText: `Reader: ${reader._title.slice(0, 20)}`,
 | 
					                  innerText: `Reader: ${reader._title.slice(0, 20)}`,
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
              },
 | 
					              },
 | 
				
			||||||
              {
 | 
					              {
 | 
				
			||||||
                tag: "div",
 | 
					                tag: "div",
 | 
				
			||||||
 | 
					                namespace: "html",
 | 
				
			||||||
                directAttributes: {
 | 
					                directAttributes: {
 | 
				
			||||||
                  innerText: `itemID: ${reader.itemID}.`,
 | 
					                  innerText: `itemID: ${reader.itemID}.`,
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
              },
 | 
					              },
 | 
				
			||||||
              {
 | 
					              {
 | 
				
			||||||
                tag: "button",
 | 
					                tag: "button",
 | 
				
			||||||
 | 
					                namespace: "html",
 | 
				
			||||||
                directAttributes: {
 | 
					                directAttributes: {
 | 
				
			||||||
                  innerText: "Unregister",
 | 
					                  innerText: "Unregister",
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
@ -266,6 +275,7 @@ class AddonViews extends AddonModule {
 | 
				
			|||||||
      },
 | 
					      },
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        tabId: readerTabId,
 | 
					        tabId: readerTabId,
 | 
				
			||||||
 | 
					        targetIndex: 1,
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@ -275,17 +285,18 @@ class AddonViews extends AddonModule {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  public unInitViews() {
 | 
					  public unInitViews() {
 | 
				
			||||||
    this._Addon.toolkit.Tool.log("Uninitializing UI");
 | 
					    this._Addon.toolkit.Tool.log("Uninitializing UI");
 | 
				
			||||||
    this._Addon.toolkit.UI.removeAddonElements();
 | 
					    this._Addon.toolkit.unregisterAll();
 | 
				
			||||||
    // Remove extra columns
 | 
					    // this._Addon.toolkit.UI.removeAddonElements();
 | 
				
			||||||
    this._Addon.toolkit.ItemTree.unregister("test1");
 | 
					    // // Remove extra columns
 | 
				
			||||||
    this._Addon.toolkit.ItemTree.unregister("test2");
 | 
					    // this._Addon.toolkit.ItemTree.unregister("test1");
 | 
				
			||||||
 | 
					    // this._Addon.toolkit.ItemTree.unregister("test2");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Remove title cell patch
 | 
					    // // Remove title cell patch
 | 
				
			||||||
    this._Addon.toolkit.ItemTree.removeRenderCellHook("title");
 | 
					    // this._Addon.toolkit.ItemTree.removeRenderCellHook("title");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this._Addon.toolkit.UI.unregisterReaderTabPanel(
 | 
					    // this._Addon.toolkit.UI.unregisterReaderTabPanel(
 | 
				
			||||||
      `${config.addonRef}-extra-reader-tab`
 | 
					    //   `${config.addonRef}-extra-reader-tab`
 | 
				
			||||||
    );
 | 
					    // );
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  public showProgressWindow(
 | 
					  public showProgressWindow(
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user