style: lint and prettier
This commit is contained in:
		
							parent
							
								
									67f2dcb7fc
								
							
						
					
					
						commit
						5852ecfc9f
					
				
							
								
								
									
										48
									
								
								.vscode/launch.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										48
									
								
								.vscode/launch.json
									
									
									
									
										vendored
									
									
								
							@ -1,28 +1,22 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    // 使用 IntelliSense 了解相关属性。 
 | 
					  // 使用 IntelliSense 了解相关属性。
 | 
				
			||||||
    // 悬停以查看现有属性的描述。
 | 
					  // 悬停以查看现有属性的描述。
 | 
				
			||||||
    // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
 | 
					  // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
 | 
				
			||||||
    "version": "0.2.0",
 | 
					  "version": "0.2.0",
 | 
				
			||||||
    "configurations": [
 | 
					  "configurations": [
 | 
				
			||||||
        {
 | 
					    {
 | 
				
			||||||
            "type": "node",
 | 
					      "type": "node",
 | 
				
			||||||
            "request": "launch",
 | 
					      "request": "launch",
 | 
				
			||||||
            "name": "Restart",
 | 
					      "name": "Restart",
 | 
				
			||||||
            "runtimeExecutable": "npm",
 | 
					      "runtimeExecutable": "npm",
 | 
				
			||||||
            "runtimeArgs": [
 | 
					      "runtimeArgs": ["run", "restart"]
 | 
				
			||||||
                "run",
 | 
					    },
 | 
				
			||||||
                "restart"
 | 
					    {
 | 
				
			||||||
            ],
 | 
					      "type": "node",
 | 
				
			||||||
        },
 | 
					      "request": "launch",
 | 
				
			||||||
        {
 | 
					      "name": "Restart in Prod Mode",
 | 
				
			||||||
            "type": "node",
 | 
					      "runtimeExecutable": "npm",
 | 
				
			||||||
            "request": "launch",
 | 
					      "runtimeArgs": ["run", "restart-prod"]
 | 
				
			||||||
            "name": "Restart in Prod Mode",
 | 
					    }
 | 
				
			||||||
            "runtimeExecutable": "npm",
 | 
					  ]
 | 
				
			||||||
            "runtimeArgs": [
 | 
					}
 | 
				
			||||||
                "run",
 | 
					 | 
				
			||||||
                "restart-prod"
 | 
					 | 
				
			||||||
            ],
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    ]
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										86
									
								
								.vscode/toolkit.code-snippets
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										86
									
								
								.vscode/toolkit.code-snippets
									
									
									
									
										vendored
									
									
								
							@ -1,45 +1,45 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    "appendElement - full": {
 | 
					  "appendElement - full": {
 | 
				
			||||||
        "scope": "javascript,typescript",
 | 
					    "scope": "javascript,typescript",
 | 
				
			||||||
        "prefix": "appendElement",
 | 
					    "prefix": "appendElement",
 | 
				
			||||||
        "body": [
 | 
					    "body": [
 | 
				
			||||||
            "appendElement({",
 | 
					      "appendElement({",
 | 
				
			||||||
            "\ttag: '${1:div}',",
 | 
					      "\ttag: '${1:div}',",
 | 
				
			||||||
            "\tid: '${2:id}',",
 | 
					      "\tid: '${2:id}',",
 | 
				
			||||||
            "\tnamespace: '${3:html}',",
 | 
					      "\tnamespace: '${3:html}',",
 | 
				
			||||||
            "\tclassList: ['${4:class}'],",
 | 
					      "\tclassList: ['${4:class}'],",
 | 
				
			||||||
            "\tstyles: {${5:style}: '$6'},",
 | 
					      "\tstyles: {${5:style}: '$6'},",
 | 
				
			||||||
            "\tproperties: {},",
 | 
					      "\tproperties: {},",
 | 
				
			||||||
            "\tattributes: {},",
 | 
					      "\tattributes: {},",
 | 
				
			||||||
            "\t[{ '${7:onload}', (e: Event) => $8, ${9:false} }],",
 | 
					      "\t[{ '${7:onload}', (e: Event) => $8, ${9:false} }],",
 | 
				
			||||||
            "\tcheckExistanceParent: ${10:HTMLElement},",
 | 
					      "\tcheckExistanceParent: ${10:HTMLElement},",
 | 
				
			||||||
            "\tignoreIfExists: ${11:true},",
 | 
					      "\tignoreIfExists: ${11:true},",
 | 
				
			||||||
            "\tskipIfExists: ${12:true},",
 | 
					      "\tskipIfExists: ${12:true},",
 | 
				
			||||||
            "\tremoveIfExists: ${13:true},",
 | 
					      "\tremoveIfExists: ${13:true},",
 | 
				
			||||||
            "\tcustomCheck: (doc: Document, options: ElementOptions) => ${14:true},",
 | 
					      "\tcustomCheck: (doc: Document, options: ElementOptions) => ${14:true},",
 | 
				
			||||||
            "\tchildren: [$15]",
 | 
					      "\tchildren: [$15]",
 | 
				
			||||||
            "}, ${16:container});"
 | 
					      "}, ${16:container});"
 | 
				
			||||||
        ]
 | 
					    ]
 | 
				
			||||||
    },
 | 
					  },
 | 
				
			||||||
    "appendElement - minimum": {
 | 
					  "appendElement - minimum": {
 | 
				
			||||||
        "scope": "javascript,typescript",
 | 
					    "scope": "javascript,typescript",
 | 
				
			||||||
        "prefix": "appendElement",
 | 
					    "prefix": "appendElement",
 | 
				
			||||||
        "body": "appendElement({ tag: '$1' }, $2);"
 | 
					    "body": "appendElement({ tag: '$1' }, $2);"
 | 
				
			||||||
    },
 | 
					  },
 | 
				
			||||||
    "register Notifier": {
 | 
					  "register Notifier": {
 | 
				
			||||||
        "scope": "javascript,typescript",
 | 
					    "scope": "javascript,typescript",
 | 
				
			||||||
        "prefix": "registerObserver",
 | 
					    "prefix": "registerObserver",
 | 
				
			||||||
        "body": [
 | 
					    "body": [
 | 
				
			||||||
            "registerObserver({",
 | 
					      "registerObserver({",
 | 
				
			||||||
            "\t notify: (",
 | 
					      "\t notify: (",
 | 
				
			||||||
            "\t\tevent: _ZoteroTypes.Notifier.Event,",
 | 
					      "\t\tevent: _ZoteroTypes.Notifier.Event,",
 | 
				
			||||||
            "\t\ttype: _ZoteroTypes.Notifier.Type,",
 | 
					      "\t\ttype: _ZoteroTypes.Notifier.Type,",
 | 
				
			||||||
            "\t\tids: string[],",
 | 
					      "\t\tids: string[],",
 | 
				
			||||||
            "\t\textraData: _ZoteroTypes.anyObj",
 | 
					      "\t\textraData: _ZoteroTypes.anyObj",
 | 
				
			||||||
            "\t) => {",
 | 
					      "\t) => {",
 | 
				
			||||||
            "\t\t$0",
 | 
					      "\t\t$0",
 | 
				
			||||||
            "\t}",
 | 
					      "\t}",
 | 
				
			||||||
            "});"
 | 
					      "});"
 | 
				
			||||||
        ]
 | 
					    ]
 | 
				
			||||||
    }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,3 @@
 | 
				
			|||||||
.makeItRed {
 | 
					.makeItRed {
 | 
				
			||||||
    background-color: tomato;
 | 
					  background-color: tomato;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -6,4 +6,4 @@
 | 
				
			|||||||
    "6": "/path/to/zotero6.exe",
 | 
					    "6": "/path/to/zotero6.exe",
 | 
				
			||||||
    "7": "/path/to/zotero7.exe"
 | 
					    "7": "/path/to/zotero7.exe"
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -21,7 +21,7 @@ class Addon {
 | 
				
			|||||||
  // Lifecycle hooks
 | 
					  // Lifecycle hooks
 | 
				
			||||||
  public hooks: typeof hooks;
 | 
					  public hooks: typeof hooks;
 | 
				
			||||||
  // APIs
 | 
					  // APIs
 | 
				
			||||||
  public api: {};
 | 
					  public api: object;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  constructor() {
 | 
					  constructor() {
 | 
				
			||||||
    this.data = {
 | 
					    this.data = {
 | 
				
			||||||
 | 
				
			|||||||
@ -8,10 +8,7 @@ export function initLocale() {
 | 
				
			|||||||
  };
 | 
					  };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export function getString(
 | 
					export function getString(localString: string, noReload = false): string {
 | 
				
			||||||
  localString: string,
 | 
					 | 
				
			||||||
  noReload: boolean = false
 | 
					 | 
				
			||||||
): string {
 | 
					 | 
				
			||||||
  try {
 | 
					  try {
 | 
				
			||||||
    return addon.data.locale?.stringBundle.GetStringFromName(localString);
 | 
					    return addon.data.locale?.stringBundle.GetStringFromName(localString);
 | 
				
			||||||
  } catch (e) {
 | 
					  } catch (e) {
 | 
				
			||||||
 | 
				
			|||||||
@ -46,7 +46,8 @@ async function updatePrefsUI() {
 | 
				
			|||||||
  // with addon.data.prefs.window.document
 | 
					  // with addon.data.prefs.window.document
 | 
				
			||||||
  // Or bind some events to the elements
 | 
					  // Or bind some events to the elements
 | 
				
			||||||
  const renderLock = ztoolkit.getGlobal("Zotero").Promise.defer();
 | 
					  const renderLock = ztoolkit.getGlobal("Zotero").Promise.defer();
 | 
				
			||||||
  const tableHelper = new ztoolkit.VirtualizedTable(addon.data.prefs?.window!)
 | 
					  if (addon.data.prefs?.window == undefined) return;
 | 
				
			||||||
 | 
					  const tableHelper = new ztoolkit.VirtualizedTable(addon.data.prefs?.window)
 | 
				
			||||||
    .setContainerId(`${config.addonRef}-table-container`)
 | 
					    .setContainerId(`${config.addonRef}-table-container`)
 | 
				
			||||||
    .setProp({
 | 
					    .setProp({
 | 
				
			||||||
      id: `${config.addonRef}-prefs-table`,
 | 
					      id: `${config.addonRef}-prefs-table`,
 | 
				
			||||||
@ -122,7 +123,7 @@ function bindPrefEvents() {
 | 
				
			|||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  addon.data
 | 
					  addon.data
 | 
				
			||||||
    .prefs!!.window.document.querySelector(
 | 
					    .prefs!.window.document.querySelector(
 | 
				
			||||||
      `#zotero-prefpane-${config.addonRef}-input`
 | 
					      `#zotero-prefpane-${config.addonRef}-input`
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
    ?.addEventListener("change", (e) => {
 | 
					    ?.addEventListener("change", (e) => {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user