add: ItemPane custom info row example
This commit is contained in:
		
							parent
							
								
									d842292073
								
							
						
					
					
						commit
						255e057006
					
				@ -8,3 +8,4 @@ item-section-example2-sidenav-tooltip =
 | 
				
			|||||||
    .tooltiptext = This is Plugin Template section (reader)
 | 
					    .tooltiptext = This is Plugin Template section (reader)
 | 
				
			||||||
item-section-example2-button-tooltip =
 | 
					item-section-example2-button-tooltip =
 | 
				
			||||||
    .tooltiptext = Unregister this section
 | 
					    .tooltiptext = Unregister this section
 | 
				
			||||||
 | 
					item-info-row-example-label = Example Row
 | 
				
			||||||
 | 
				
			|||||||
@ -8,3 +8,4 @@ item-section-example2-sidenav-tooltip =
 | 
				
			|||||||
    .tooltiptext = 这是插件模板面板(阅读器)
 | 
					    .tooltiptext = 这是插件模板面板(阅读器)
 | 
				
			||||||
item-section-example2-button-tooltip =
 | 
					item-section-example2-button-tooltip =
 | 
				
			||||||
    .tooltiptext = 移除此面板
 | 
					    .tooltiptext = 移除此面板
 | 
				
			||||||
 | 
					item-info-row-example-label = 示例行
 | 
				
			||||||
 | 
				
			|||||||
@ -28,6 +28,8 @@ async function onStartup() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  await UIExampleFactory.registerExtraColumnWithCustomCell();
 | 
					  await UIExampleFactory.registerExtraColumnWithCustomCell();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  UIExampleFactory.registerItemPaneCustomInfoRow();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  UIExampleFactory.registerItemPaneSection();
 | 
					  UIExampleFactory.registerItemPaneSection();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  UIExampleFactory.registerReaderItemPaneSection();
 | 
					  UIExampleFactory.registerReaderItemPaneSection();
 | 
				
			||||||
 | 
				
			|||||||
@ -221,6 +221,25 @@ export class UIExampleFactory {
 | 
				
			|||||||
    });
 | 
					    });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @example
 | 
				
			||||||
 | 
					  static registerItemPaneCustomInfoRow() {
 | 
				
			||||||
 | 
					    Zotero.ItemPaneManager.registerInfoRow({
 | 
				
			||||||
 | 
					      rowID: "example",
 | 
				
			||||||
 | 
					      pluginID: addon.data.config.addonID,
 | 
				
			||||||
 | 
					      editable: true,
 | 
				
			||||||
 | 
					      label: {
 | 
				
			||||||
 | 
					        l10nID: getLocaleID("item-info-row-example-label"),
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      position: "afterCreators",
 | 
				
			||||||
 | 
					      onGetData: ({ item }) => {
 | 
				
			||||||
 | 
					        return item.getField("title");
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      onSetData: ({ item, value }) => {
 | 
				
			||||||
 | 
					        item.setField("title", value);
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @example
 | 
					  @example
 | 
				
			||||||
  static registerItemPaneSection() {
 | 
					  static registerItemPaneSection() {
 | 
				
			||||||
    Zotero.ItemPaneManager.registerSection({
 | 
					    Zotero.ItemPaneManager.registerSection({
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user