add: prompt example
This commit is contained in:
		
							parent
							
								
									91d295dfe6
								
							
						
					
					
						commit
						aa51abaeb7
					
				@ -36,7 +36,7 @@
 | 
			
		||||
  },
 | 
			
		||||
  "homepage": "https://github.com/windingwind/zotero-addon-template#readme",
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "zotero-plugin-toolkit": "^1.0.6"
 | 
			
		||||
    "zotero-plugin-toolkit": "^1.1.1"
 | 
			
		||||
  },
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "@types/node": "^18.11.17",
 | 
			
		||||
@ -48,6 +48,6 @@
 | 
			
		||||
    "release-it": "^15.6.0",
 | 
			
		||||
    "replace-in-file": "^6.3.5",
 | 
			
		||||
    "typescript": "^4.9.4",
 | 
			
		||||
    "zotero-types": "^1.0.3"
 | 
			
		||||
    "zotero-types": "^1.0.6"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -2,6 +2,7 @@ import {
 | 
			
		||||
  BasicExampleFactory,
 | 
			
		||||
  HelperExampleFactory,
 | 
			
		||||
  KeyExampleFactory,
 | 
			
		||||
  PromptExampleFactory,
 | 
			
		||||
  UIExampleFactory,
 | 
			
		||||
} from "./modules/examples";
 | 
			
		||||
import { config } from "../package.json";
 | 
			
		||||
@ -61,6 +62,8 @@ async function onStartup() {
 | 
			
		||||
 | 
			
		||||
  await UIExampleFactory.registerReaderTabPanel();
 | 
			
		||||
 | 
			
		||||
  PromptExampleFactory.registerAlertPromptExample();
 | 
			
		||||
 | 
			
		||||
  await Zotero.Promise.delay(1000);
 | 
			
		||||
 | 
			
		||||
  popupWin.changeLine({
 | 
			
		||||
 | 
			
		||||
@ -424,6 +424,21 @@ export class UIExampleFactory {
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export class PromptExampleFactory {
 | 
			
		||||
  @example
 | 
			
		||||
  static registerAlertPromptExample() {
 | 
			
		||||
    ztoolkit.Prompt.register([
 | 
			
		||||
      {
 | 
			
		||||
        name: "Template Test",
 | 
			
		||||
        label: "Plugin Template",
 | 
			
		||||
        callback(prompt) {
 | 
			
		||||
          ztoolkit.getGlobal("alert")("Command triggered!");
 | 
			
		||||
        },
 | 
			
		||||
      },
 | 
			
		||||
    ]);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export class HelperExampleFactory {
 | 
			
		||||
  @example
 | 
			
		||||
  static async dialogExample() {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user