Skip to content

Commit

Permalink
minor refactor for release
Browse files Browse the repository at this point in the history
  • Loading branch information
gapmiss committed Jun 21, 2023
1 parent 9cdf138 commit d4e8b56
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 29 deletions.
35 changes: 16 additions & 19 deletions dist/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
17 changes: 9 additions & 8 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -94,8 +98,8 @@ class IconoirSuggester extends EditorSuggest<string> {
}

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) {
Expand All @@ -108,7 +112,7 @@ class IconoirSuggester extends EditorSuggest<string> {
query: match,
}
}
}
// }
return null;
}

Expand Down Expand Up @@ -180,7 +184,4 @@ class IconoirIcon extends LitElement {
}
}

var isRegistered = window.customElements.get('iconoir-icon');
if (isRegistered === undefined) {
window.customElements.define('iconoir-icon', IconoirIcon);
}

0 comments on commit d4e8b56

Please sign in to comment.