diff --git a/dist/main.js b/dist/main.js index 0d009ed..fbf8d2d 100644 --- a/dist/main.js +++ b/dist/main.js @@ -623,6 +623,10 @@ var IconoirPlugin = class extends import_obsidian.Plugin { this.registerMarkdownPostProcessor(buildPostProcessor()); this.iconoirNames = Object.keys(iconoir); this.isListItem = false; + let isRegistered = window.customElements.get("iconoir-icon"); + if (isRegistered === void 0) { + window.customElements.define("iconoir-icon", IconoirIcon); + } console.log("iconoir-icons loaded"); } onunload() { @@ -654,7 +658,7 @@ function buildPostProcessor() { (_j = code.parentElement) == null ? void 0 : _j.addClass("special-iconoir-td-callout"); (_k = code.parentElement) == null ? void 0 : _k.setAttr("data-icon", arr[0]); } - var newEl = document.createElement("iconoir-icon"); + let newEl = document.createElement("iconoir-icon"); newEl.setAttribute("name", arr[0]); newEl.setAttribute("aria-label", arr[0] + " icon"); newEl.setAttribute("aria-label-position", "top"); @@ -683,20 +687,17 @@ var IconoirSuggester = class extends import_obsidian.EditorSuggest { } onTrigger(cursor, editor, _2) { var _a; - let foo = "bar"; - if (foo === "bar") { - const sub = editor.getLine(cursor.line).substring(0, cursor.ch); - const match = (_a = sub.match(/&&\S+$/)) == null ? void 0 : _a.first(); - if (match) { - return { - end: cursor, - start: { - ch: sub.lastIndexOf(match), - line: cursor.line - }, - query: match - }; - } + const sub = editor.getLine(cursor.line).substring(0, cursor.ch); + const match = (_a = sub.match(/&&\S+$/)) == null ? void 0 : _a.first(); + if (match) { + return { + end: cursor, + start: { + ch: sub.lastIndexOf(match), + line: cursor.line + }, + query: match + }; } return null; } @@ -759,10 +760,6 @@ var IconoirIcon = class extends s4 { `; } }; -var isRegistered = window.customElements.get("iconoir-icon"); -if (isRegistered === void 0) { - window.customElements.define("iconoir-icon", IconoirIcon); -} /** * @license * Copyright 2017 Google LLC diff --git a/manifest.json b/manifest.json index 1eeedf6..761a718 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "iconoir-icons", "name": "Iconoir Icons", - "version": "1.0.1", + "version": "1.0.0", "minAppVersion": "0.15.0", "description": "Create & display customized SVG Iconoir icons.", "author": "@gapmiss", diff --git a/package.json b/package.json index 3ee4b1f..21aca0b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "iconoir-icons", - "version": "0.0.1", + "version": "1.0.0", "description": "Bespoken Iconoir icons for Obsidian", "main": "main.js", "scripts": { diff --git a/src/main.ts b/src/main.ts index 568f0a8..c60e848 100644 --- a/src/main.ts +++ b/src/main.ts @@ -29,6 +29,10 @@ export default class IconoirPlugin extends Plugin { this.registerMarkdownPostProcessor(buildPostProcessor()); this.iconoirNames = Object.keys(iconoir); this.isListItem = false; + let isRegistered = window.customElements.get('iconoir-icon'); + if (isRegistered === undefined) { + window.customElements.define('iconoir-icon', IconoirIcon); + } console.log('iconoir-icons loaded'); } onunload() { @@ -62,7 +66,7 @@ export function buildPostProcessor(): MarkdownPostProcessor { code.parentElement?.addClass('special-iconoir-td-callout'); code.parentElement?.setAttr("data-icon", arr[0]); } - var newEl = document.createElement("iconoir-icon"); + let newEl = document.createElement("iconoir-icon"); newEl.setAttribute('name',arr[0]); newEl.setAttribute('aria-label',arr[0]+' icon'); newEl.setAttribute('aria-label-position', 'top'); @@ -94,8 +98,8 @@ class IconoirSuggester extends EditorSuggest { } onTrigger(cursor: EditorPosition, editor: Editor, _: TFile): EditorSuggestTriggerInfo | null { - let foo='bar'; - if (foo==='bar') { + // let foo='bar'; + // if (foo==='bar') { const sub = editor.getLine(cursor.line).substring(0, cursor.ch); const match = sub.match(/&&\S+$/)?.first(); if (match) { @@ -108,7 +112,7 @@ class IconoirSuggester extends EditorSuggest { query: match, } } - } + // } return null; } @@ -180,7 +184,4 @@ class IconoirIcon extends LitElement { } } -var isRegistered = window.customElements.get('iconoir-icon'); -if (isRegistered === undefined) { - window.customElements.define('iconoir-icon', IconoirIcon); -} +