fix: prompt example type error
update: zotero-types
This commit is contained in:
		
							parent
							
								
									bb4c31b54c
								
							
						
					
					
						commit
						414bf81fd1
					
				@ -49,6 +49,6 @@
 | 
				
			|||||||
    "release-it": "^15.6.0",
 | 
					    "release-it": "^15.6.0",
 | 
				
			||||||
    "replace-in-file": "^6.3.5",
 | 
					    "replace-in-file": "^6.3.5",
 | 
				
			||||||
    "typescript": "^4.9.4",
 | 
					    "typescript": "^4.9.4",
 | 
				
			||||||
    "zotero-types": "^1.0.6"
 | 
					    "zotero-types": "^1.0.12"
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -478,173 +478,201 @@ export class PromptExampleFactory {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  @example
 | 
					  @example
 | 
				
			||||||
  static registerAnonymousCommandExample() {
 | 
					  static registerAnonymousCommandExample() {
 | 
				
			||||||
    ztoolkit.Prompt.register([{
 | 
					    ztoolkit.Prompt.register([
 | 
				
			||||||
      id: "search",
 | 
					      {
 | 
				
			||||||
      callback: async (prompt) => {
 | 
					        id: "search",
 | 
				
			||||||
        // https://github.com/zotero/zotero/blob/7262465109c21919b56a7ab214f7c7a8e1e63909/chrome/content/zotero/integration/quickFormat.js#L589
 | 
					        callback: async (prompt) => {
 | 
				
			||||||
        function getItemDescription(item: Zotero.Item) {
 | 
					          // https://github.com/zotero/zotero/blob/7262465109c21919b56a7ab214f7c7a8e1e63909/chrome/content/zotero/integration/quickFormat.js#L589
 | 
				
			||||||
          var nodes = [];
 | 
					          function getItemDescription(item: Zotero.Item) {
 | 
				
			||||||
          var str = "";
 | 
					            var nodes = [];
 | 
				
			||||||
          var author, authorDate = "";
 | 
					            var str = "";
 | 
				
			||||||
          if (item.firstCreator) { author = authorDate = item.firstCreator; }
 | 
					            var author,
 | 
				
			||||||
          var date = item.getField("date", true, true) as string;
 | 
					              authorDate = "";
 | 
				
			||||||
          if (date && (date = date.substr(0, 4)) !== "0000") {
 | 
					            if (item.firstCreator) {
 | 
				
			||||||
            authorDate += " (" + parseInt(date) + ")";
 | 
					              author = authorDate = item.firstCreator;
 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
          authorDate = authorDate.trim();
 | 
					 | 
				
			||||||
          if (authorDate) nodes.push(authorDate);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          var publicationTitle = item.getField("publicationTitle", false, true);
 | 
					 | 
				
			||||||
          if (publicationTitle) {
 | 
					 | 
				
			||||||
            nodes.push(`<i>${publicationTitle}</i>`);
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
          var volumeIssue = item.getField("volume");
 | 
					 | 
				
			||||||
          var issue = item.getField("issue");
 | 
					 | 
				
			||||||
          if (issue) volumeIssue += "(" + issue + ")";
 | 
					 | 
				
			||||||
          if (volumeIssue) nodes.push(volumeIssue);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          var publisherPlace = [], field;
 | 
					 | 
				
			||||||
          if ((field = item.getField("publisher"))) publisherPlace.push(field);
 | 
					 | 
				
			||||||
          if ((field = item.getField("place"))) publisherPlace.push(field);
 | 
					 | 
				
			||||||
          if (publisherPlace.length) nodes.push(publisherPlace.join(": "));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          var pages = item.getField("pages");
 | 
					 | 
				
			||||||
          if (pages) nodes.push(pages);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          if (!nodes.length) {
 | 
					 | 
				
			||||||
            var url = item.getField("url");
 | 
					 | 
				
			||||||
            if (url) nodes.push(url);
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          // compile everything together
 | 
					 | 
				
			||||||
          for (var i = 0, n = nodes.length; i < n; i++) {
 | 
					 | 
				
			||||||
            var node = nodes[i];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            if (i != 0) str += ", ";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            if (typeof node === "object") {
 | 
					 | 
				
			||||||
              var label = document.createElement("label");
 | 
					 | 
				
			||||||
              label.setAttribute("value", str);
 | 
					 | 
				
			||||||
              label.setAttribute("crop", "end");
 | 
					 | 
				
			||||||
              str = "";
 | 
					 | 
				
			||||||
            } else {
 | 
					 | 
				
			||||||
              str += node;
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					            var date = item.getField("date", true, true) as string;
 | 
				
			||||||
 | 
					            if (date && (date = date.substr(0, 4)) !== "0000") {
 | 
				
			||||||
 | 
					              authorDate += " (" + parseInt(date) + ")";
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            authorDate = authorDate.trim();
 | 
				
			||||||
 | 
					            if (authorDate) nodes.push(authorDate);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            var publicationTitle = item.getField(
 | 
				
			||||||
 | 
					              "publicationTitle",
 | 
				
			||||||
 | 
					              false,
 | 
				
			||||||
 | 
					              true
 | 
				
			||||||
 | 
					            );
 | 
				
			||||||
 | 
					            if (publicationTitle) {
 | 
				
			||||||
 | 
					              nodes.push(`<i>${publicationTitle}</i>`);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            var volumeIssue = item.getField("volume");
 | 
				
			||||||
 | 
					            var issue = item.getField("issue");
 | 
				
			||||||
 | 
					            if (issue) volumeIssue += "(" + issue + ")";
 | 
				
			||||||
 | 
					            if (volumeIssue) nodes.push(volumeIssue);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            var publisherPlace = [],
 | 
				
			||||||
 | 
					              field;
 | 
				
			||||||
 | 
					            if ((field = item.getField("publisher")))
 | 
				
			||||||
 | 
					              publisherPlace.push(field);
 | 
				
			||||||
 | 
					            if ((field = item.getField("place"))) publisherPlace.push(field);
 | 
				
			||||||
 | 
					            if (publisherPlace.length) nodes.push(publisherPlace.join(": "));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            var pages = item.getField("pages");
 | 
				
			||||||
 | 
					            if (pages) nodes.push(pages);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (!nodes.length) {
 | 
				
			||||||
 | 
					              var url = item.getField("url");
 | 
				
			||||||
 | 
					              if (url) nodes.push(url);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            // compile everything together
 | 
				
			||||||
 | 
					            for (var i = 0, n = nodes.length; i < n; i++) {
 | 
				
			||||||
 | 
					              var node = nodes[i];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					              if (i != 0) str += ", ";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					              if (typeof node === "object") {
 | 
				
			||||||
 | 
					                var label = document.createElement("label");
 | 
				
			||||||
 | 
					                label.setAttribute("value", str);
 | 
				
			||||||
 | 
					                label.setAttribute("crop", "end");
 | 
				
			||||||
 | 
					                str = "";
 | 
				
			||||||
 | 
					              } else {
 | 
				
			||||||
 | 
					                str += node;
 | 
				
			||||||
 | 
					              }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            str.length && (str += ".");
 | 
				
			||||||
 | 
					            return str;
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
          str.length && (str += ".")
 | 
					          function filter(ids: number[]) {
 | 
				
			||||||
          return str
 | 
					            ids = ids.filter(async (id) => {
 | 
				
			||||||
        };
 | 
					              const item = (await Zotero.Items.getAsync(id)) as Zotero.Item;
 | 
				
			||||||
        function filter(ids: number[]) {
 | 
					              return item.isRegularItem() && !(item as any).isFeedItem;
 | 
				
			||||||
          ids = ids.filter(async (id) => {
 | 
					            });
 | 
				
			||||||
            const item = await Zotero.Items.getAsync(id)
 | 
					            return ids;
 | 
				
			||||||
            return item.isRegularItem() && !item.isFeedItem
 | 
					          }
 | 
				
			||||||
          })
 | 
					          const text = prompt.inputNode.value;
 | 
				
			||||||
          return ids
 | 
					          prompt.showTip("Searching...");
 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        const text = prompt.inputNode.value;
 | 
					 | 
				
			||||||
        prompt.showTip("Searching...")
 | 
					 | 
				
			||||||
        const s = new Zotero.Search();
 | 
					 | 
				
			||||||
        s.addCondition("quicksearch-titleCreatorYear", "contains", text);
 | 
					 | 
				
			||||||
        s.addCondition("itemType", "isNot", "attachment");
 | 
					 | 
				
			||||||
        let ids = await s.search();
 | 
					 | 
				
			||||||
        // prompt.exit will remove current container element.
 | 
					 | 
				
			||||||
        // @ts-ignore
 | 
					 | 
				
			||||||
        prompt.exit();
 | 
					 | 
				
			||||||
        const container = prompt.createCommandsContainer();
 | 
					 | 
				
			||||||
        container.classList.add("suggestions");
 | 
					 | 
				
			||||||
        ids = filter(ids)
 | 
					 | 
				
			||||||
        console.log(ids.length)
 | 
					 | 
				
			||||||
        if (ids.length == 0) {
 | 
					 | 
				
			||||||
          const s = new Zotero.Search();
 | 
					          const s = new Zotero.Search();
 | 
				
			||||||
          const operators = ['is', 'isNot', 'true', 'false', 'isInTheLast', 'isBefore', 'isAfter', 'contains', 'doesNotContain', 'beginsWith'];
 | 
					          s.addCondition("quicksearch-titleCreatorYear", "contains", text);
 | 
				
			||||||
          let hasValidCondition = false
 | 
					          s.addCondition("itemType", "isNot", "attachment");
 | 
				
			||||||
          let joinMode: string = "all"
 | 
					          let ids = await s.search();
 | 
				
			||||||
          if (/\s*\|\|\s*/.test(text)) {
 | 
					          // prompt.exit will remove current container element.
 | 
				
			||||||
            joinMode = "any"
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
          text.split(/\s*(&&|\|\|)\s*/g).forEach((conditinString: string) => {
 | 
					 | 
				
			||||||
            let conditions = conditinString.split(/\s+/g);
 | 
					 | 
				
			||||||
            if (conditions.length == 3 && operators.indexOf(conditions[1]) != -1) {
 | 
					 | 
				
			||||||
              hasValidCondition = true
 | 
					 | 
				
			||||||
              s.addCondition("joinMode", joinMode);
 | 
					 | 
				
			||||||
              s.addCondition(
 | 
					 | 
				
			||||||
                conditions[0] as string,
 | 
					 | 
				
			||||||
                conditions[1] as Zotero.Search.Operator,
 | 
					 | 
				
			||||||
                conditions[2] as string
 | 
					 | 
				
			||||||
              );
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
          })
 | 
					 | 
				
			||||||
          if (hasValidCondition) {
 | 
					 | 
				
			||||||
            ids = await s.search();
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        ids = filter(ids)
 | 
					 | 
				
			||||||
        console.log(ids.length)
 | 
					 | 
				
			||||||
        if (ids.length > 0) {
 | 
					 | 
				
			||||||
          ids.forEach((id: number) => {
 | 
					 | 
				
			||||||
            const item = Zotero.Items.get(id)
 | 
					 | 
				
			||||||
            const title = item.getField("title")
 | 
					 | 
				
			||||||
            const ele = ztoolkit.UI.createElement(document, "div", {
 | 
					 | 
				
			||||||
              namespace: "html",
 | 
					 | 
				
			||||||
              classList: ["command"],
 | 
					 | 
				
			||||||
              listeners: [
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                  type: "mousemove",
 | 
					 | 
				
			||||||
                  listener: function () {
 | 
					 | 
				
			||||||
                    // @ts-ignore
 | 
					 | 
				
			||||||
                    prompt.selectItem(this)
 | 
					 | 
				
			||||||
                  }
 | 
					 | 
				
			||||||
                },
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                  type: "click",
 | 
					 | 
				
			||||||
                  listener: () => {
 | 
					 | 
				
			||||||
                    prompt.promptNode.style.display = "none"
 | 
					 | 
				
			||||||
                    Zotero_Tabs.select('zotero-pane');
 | 
					 | 
				
			||||||
                    ZoteroPane.selectItem(item.id);
 | 
					 | 
				
			||||||
                  }
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
              ],
 | 
					 | 
				
			||||||
              styles: {
 | 
					 | 
				
			||||||
                display: "flex",
 | 
					 | 
				
			||||||
                flexDirection: "column",
 | 
					 | 
				
			||||||
                justifyContent: "start",
 | 
					 | 
				
			||||||
              },
 | 
					 | 
				
			||||||
              children: [
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                  tag: "span",
 | 
					 | 
				
			||||||
                  styles: {
 | 
					 | 
				
			||||||
                    fontWeight: "bold",
 | 
					 | 
				
			||||||
                    overflow: "hidden",
 | 
					 | 
				
			||||||
                    textOverflow: "ellipsis",
 | 
					 | 
				
			||||||
                    whiteSpace: "nowrap"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                  },
 | 
					 | 
				
			||||||
                  properties: {
 | 
					 | 
				
			||||||
                    innerText: title
 | 
					 | 
				
			||||||
                  }
 | 
					 | 
				
			||||||
                },
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                  tag: "span",
 | 
					 | 
				
			||||||
                  styles: {
 | 
					 | 
				
			||||||
                    overflow: "hidden",
 | 
					 | 
				
			||||||
                    textOverflow: "ellipsis",
 | 
					 | 
				
			||||||
                    whiteSpace: "nowrap"
 | 
					 | 
				
			||||||
                  },
 | 
					 | 
				
			||||||
                  properties: {
 | 
					 | 
				
			||||||
                    innerHTML: getItemDescription(item)
 | 
					 | 
				
			||||||
                  }
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
              ]
 | 
					 | 
				
			||||||
            })
 | 
					 | 
				
			||||||
            container.appendChild(ele)
 | 
					 | 
				
			||||||
          })
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
          // @ts-ignore
 | 
					          // @ts-ignore
 | 
				
			||||||
          prompt.exit()
 | 
					          prompt.exit();
 | 
				
			||||||
          prompt.showTip("Not Found.")
 | 
					          const container = prompt.createCommandsContainer();
 | 
				
			||||||
        }
 | 
					          container.classList.add("suggestions");
 | 
				
			||||||
      }
 | 
					          ids = filter(ids);
 | 
				
			||||||
    }])
 | 
					          console.log(ids.length);
 | 
				
			||||||
 | 
					          if (ids.length == 0) {
 | 
				
			||||||
 | 
					            const s = new Zotero.Search();
 | 
				
			||||||
 | 
					            const operators = [
 | 
				
			||||||
 | 
					              "is",
 | 
				
			||||||
 | 
					              "isNot",
 | 
				
			||||||
 | 
					              "true",
 | 
				
			||||||
 | 
					              "false",
 | 
				
			||||||
 | 
					              "isInTheLast",
 | 
				
			||||||
 | 
					              "isBefore",
 | 
				
			||||||
 | 
					              "isAfter",
 | 
				
			||||||
 | 
					              "contains",
 | 
				
			||||||
 | 
					              "doesNotContain",
 | 
				
			||||||
 | 
					              "beginsWith",
 | 
				
			||||||
 | 
					            ];
 | 
				
			||||||
 | 
					            let hasValidCondition = false;
 | 
				
			||||||
 | 
					            let joinMode: string = "all";
 | 
				
			||||||
 | 
					            if (/\s*\|\|\s*/.test(text)) {
 | 
				
			||||||
 | 
					              joinMode = "any";
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            text.split(/\s*(&&|\|\|)\s*/g).forEach((conditinString: string) => {
 | 
				
			||||||
 | 
					              let conditions = conditinString.split(/\s+/g);
 | 
				
			||||||
 | 
					              if (
 | 
				
			||||||
 | 
					                conditions.length == 3 &&
 | 
				
			||||||
 | 
					                operators.indexOf(conditions[1]) != -1
 | 
				
			||||||
 | 
					              ) {
 | 
				
			||||||
 | 
					                hasValidCondition = true;
 | 
				
			||||||
 | 
					                s.addCondition(
 | 
				
			||||||
 | 
					                  "joinMode",
 | 
				
			||||||
 | 
					                  joinMode as Zotero.Search.Operator,
 | 
				
			||||||
 | 
					                  ""
 | 
				
			||||||
 | 
					                );
 | 
				
			||||||
 | 
					                s.addCondition(
 | 
				
			||||||
 | 
					                  conditions[0] as string,
 | 
				
			||||||
 | 
					                  conditions[1] as Zotero.Search.Operator,
 | 
				
			||||||
 | 
					                  conditions[2] as string
 | 
				
			||||||
 | 
					                );
 | 
				
			||||||
 | 
					              }
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            if (hasValidCondition) {
 | 
				
			||||||
 | 
					              ids = await s.search();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					          ids = filter(ids);
 | 
				
			||||||
 | 
					          console.log(ids.length);
 | 
				
			||||||
 | 
					          if (ids.length > 0) {
 | 
				
			||||||
 | 
					            ids.forEach((id: number) => {
 | 
				
			||||||
 | 
					              const item = Zotero.Items.get(id);
 | 
				
			||||||
 | 
					              const title = item.getField("title");
 | 
				
			||||||
 | 
					              const ele = ztoolkit.UI.createElement(document, "div", {
 | 
				
			||||||
 | 
					                namespace: "html",
 | 
				
			||||||
 | 
					                classList: ["command"],
 | 
				
			||||||
 | 
					                listeners: [
 | 
				
			||||||
 | 
					                  {
 | 
				
			||||||
 | 
					                    type: "mousemove",
 | 
				
			||||||
 | 
					                    listener: function () {
 | 
				
			||||||
 | 
					                      // @ts-ignore
 | 
				
			||||||
 | 
					                      prompt.selectItem(this);
 | 
				
			||||||
 | 
					                    },
 | 
				
			||||||
 | 
					                  },
 | 
				
			||||||
 | 
					                  {
 | 
				
			||||||
 | 
					                    type: "click",
 | 
				
			||||||
 | 
					                    listener: () => {
 | 
				
			||||||
 | 
					                      prompt.promptNode.style.display = "none";
 | 
				
			||||||
 | 
					                      Zotero_Tabs.select("zotero-pane");
 | 
				
			||||||
 | 
					                      ZoteroPane.selectItem(item.id);
 | 
				
			||||||
 | 
					                    },
 | 
				
			||||||
 | 
					                  },
 | 
				
			||||||
 | 
					                ],
 | 
				
			||||||
 | 
					                styles: {
 | 
				
			||||||
 | 
					                  display: "flex",
 | 
				
			||||||
 | 
					                  flexDirection: "column",
 | 
				
			||||||
 | 
					                  justifyContent: "start",
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
 | 
					                children: [
 | 
				
			||||||
 | 
					                  {
 | 
				
			||||||
 | 
					                    tag: "span",
 | 
				
			||||||
 | 
					                    styles: {
 | 
				
			||||||
 | 
					                      fontWeight: "bold",
 | 
				
			||||||
 | 
					                      overflow: "hidden",
 | 
				
			||||||
 | 
					                      textOverflow: "ellipsis",
 | 
				
			||||||
 | 
					                      whiteSpace: "nowrap",
 | 
				
			||||||
 | 
					                    },
 | 
				
			||||||
 | 
					                    properties: {
 | 
				
			||||||
 | 
					                      innerText: title,
 | 
				
			||||||
 | 
					                    },
 | 
				
			||||||
 | 
					                  },
 | 
				
			||||||
 | 
					                  {
 | 
				
			||||||
 | 
					                    tag: "span",
 | 
				
			||||||
 | 
					                    styles: {
 | 
				
			||||||
 | 
					                      overflow: "hidden",
 | 
				
			||||||
 | 
					                      textOverflow: "ellipsis",
 | 
				
			||||||
 | 
					                      whiteSpace: "nowrap",
 | 
				
			||||||
 | 
					                    },
 | 
				
			||||||
 | 
					                    properties: {
 | 
				
			||||||
 | 
					                      innerHTML: getItemDescription(item),
 | 
				
			||||||
 | 
					                    },
 | 
				
			||||||
 | 
					                  },
 | 
				
			||||||
 | 
					                ],
 | 
				
			||||||
 | 
					              });
 | 
				
			||||||
 | 
					              container.appendChild(ele);
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					          } else {
 | 
				
			||||||
 | 
					            // @ts-ignore
 | 
				
			||||||
 | 
					            prompt.exit();
 | 
				
			||||||
 | 
					            prompt.showTip("Not Found.");
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					    ]);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @example
 | 
					  @example
 | 
				
			||||||
@ -656,16 +684,18 @@ export class PromptExampleFactory {
 | 
				
			|||||||
        // The when function is executed when Prompt UI is woken up by `Shift + P`, and this command does not display when false is returned.
 | 
					        // The when function is executed when Prompt UI is woken up by `Shift + P`, and this command does not display when false is returned.
 | 
				
			||||||
        when: () => {
 | 
					        when: () => {
 | 
				
			||||||
          const items = ZoteroPane.getSelectedItems();
 | 
					          const items = ZoteroPane.getSelectedItems();
 | 
				
			||||||
          return items.length > 0
 | 
					          return items.length > 0;
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        callback(prompt) {
 | 
					        callback(prompt) {
 | 
				
			||||||
          prompt.inputNode.placeholder = "Hello World!"
 | 
					          prompt.inputNode.placeholder = "Hello World!";
 | 
				
			||||||
          const items = ZoteroPane.getSelectedItems();
 | 
					          const items = ZoteroPane.getSelectedItems();
 | 
				
			||||||
          ztoolkit.getGlobal("alert")(
 | 
					          ztoolkit.getGlobal("alert")(
 | 
				
			||||||
            `You select ${items.length} items!\n\n${
 | 
					            `You select ${items.length} items!\n\n${items
 | 
				
			||||||
              items.map(
 | 
					              .map(
 | 
				
			||||||
                (item, index) => String(index+1) + ". " + item.getDisplayTitle()
 | 
					                (item, index) =>
 | 
				
			||||||
              ).join("\n")}`
 | 
					                  String(index + 1) + ". " + item.getDisplayTitle()
 | 
				
			||||||
 | 
					              )
 | 
				
			||||||
 | 
					              .join("\n")}`
 | 
				
			||||||
          );
 | 
					          );
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user