From b0afef570864fa80d1298a350f3249ab68dc69c2 Mon Sep 17 00:00:00 2001 From: Phillip Bronzel Date: Mon, 5 Dec 2022 20:51:49 +0100 Subject: [PATCH] fix: 1.1.0 compatibility --- manifest.json | 5 +++-- package.json | 2 +- src/manager/commands/explorerManager.ts | 13 ++++++++++--- src/manager/commands/menuManager.ts | 3 ++- src/manager/commands/statusBarManager.ts | 18 +++++++++++------- src/manager/commands/titleBarManager.ts | 3 ++- src/ui/components/AdvancedToolbarSettings.tsx | 5 ++++- src/util.tsx | 3 ++- versions.json | 2 ++ 9 files changed, 37 insertions(+), 17 deletions(-) diff --git a/manifest.json b/manifest.json index 662ecb7..6179ab4 100644 --- a/manifest.json +++ b/manifest.json @@ -1,10 +1,11 @@ { "id": "cmdr", "name": "Commander", - "version": "0.4.1", - "minAppVersion": "0.16.0", + "version": "0.4.2", + "minAppVersion": "1.1.0", "description": "Customize your workspace by adding commands everywhere, create Macros and supercharge your mobile toolbar.", "author": "jsmorabito & phibr0", "authorUrl": "https://github.com/phibr0", + "donation": "https://ko-fi.com/phibr0", "isDesktopOnly": false } diff --git a/package.json b/package.json index b92bde8..30b8c69 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cmdr", - "version": "0.4.1", + "version": "0.4.2", "description": "Customize your workspace by adding commands /everywhere/.", "main": "main.js", "scripts": { diff --git a/src/manager/commands/explorerManager.ts b/src/manager/commands/explorerManager.ts index b285791..f71ad92 100644 --- a/src/manager/commands/explorerManager.ts +++ b/src/manager/commands/explorerManager.ts @@ -99,14 +99,21 @@ export default class ExplorerManager extends CommandManagerBase { const setNormal = (): void => { btn.empty(); - setIcon(btn, pair.icon, 12); + btn.style.setProperty("--icon-size", `12px`); + setIcon(btn, pair.icon); btn.onclick = (): void => app.commands.executeCommandById(pair.id); }; const setRemovable = (): void => { btn.empty(); - setIcon(btn, "trash", 12); + btn.style.setProperty("--icon-size", `12px`); + setIcon(btn, "trash"); btn.onclick = async (): Promise => { - if (!this.plugin.settings.confirmDeletion || (await new ConfirmDeleteModal(this.plugin).didChooseRemove())) { + if ( + !this.plugin.settings.confirmDeletion || + (await new ConfirmDeleteModal( + this.plugin + ).didChooseRemove()) + ) { this.removeCommand(pair); } }; diff --git a/src/manager/commands/menuManager.ts b/src/manager/commands/menuManager.ts index a10cece..f28df61 100644 --- a/src/manager/commands/menuManager.ts +++ b/src/manager/commands/menuManager.ts @@ -85,7 +85,8 @@ abstract class Base extends CommandManagerBase { } }); - setIcon(optionEl, "more-vertical", 16); + optionEl.style.setProperty("--icon-size", `16px`); + setIcon(optionEl, "more-vertical"); item.dom.append(optionEl); item diff --git a/src/manager/commands/statusBarManager.ts b/src/manager/commands/statusBarManager.ts index 4352df1..749a90d 100644 --- a/src/manager/commands/statusBarManager.ts +++ b/src/manager/commands/statusBarManager.ts @@ -40,12 +40,13 @@ export default class StatusBarManager extends CommandManagerBase { } new Menu() - .addItem(item => { - item - .setTitle(t("Add command")) + .addItem((item) => { + item.setTitle(t("Add command")) .setIcon("command") .onClick(async () => { - const pair = await chooseNewCommand(this.plugin); + const pair = await chooseNewCommand( + this.plugin + ); this.addCommand(pair); }); }) @@ -53,7 +54,8 @@ export default class StatusBarManager extends CommandManagerBase { }); this.plugin.register(() => this.addBtn.remove()); - setIcon(this.addBtn, "plus", 12); + this.addBtn.style.setProperty("--icon-size", `12px`); + setIcon(this.addBtn, "plus"); this.addBtn.onclick = async (): Promise => { const pair = await chooseNewCommand(this.plugin); this.addCommand(pair); @@ -93,12 +95,14 @@ export default class StatusBarManager extends CommandManagerBase { const setNormal = (): void => { btn.empty(); - setIcon(btn, pair.icon, 12); + btn.style.setProperty("--icon-size", `12px`); + setIcon(btn, pair.icon); btn.onclick = (): void => app.commands.executeCommandById(pair.id); }; const setRemovable = (): void => { btn.empty(); - setIcon(btn, "trash", 12); + btn.style.setProperty("--icon-size", `12px`); + setIcon(btn, "trash"); btn.onclick = async (): Promise => { if (!this.plugin.settings.confirmDeletion || (await new ConfirmDeleteModal(this.plugin).didChooseRemove())) { this.removeCommand(pair); diff --git a/src/manager/commands/titleBarManager.ts b/src/manager/commands/titleBarManager.ts index 69510ab..f70c16a 100644 --- a/src/manager/commands/titleBarManager.ts +++ b/src/manager/commands/titleBarManager.ts @@ -36,7 +36,8 @@ export default class TitleBarManager extends CommandManagerBase { this.plugin.saveSettings(); this.plugin.register(() => this.addBtn.remove()); - setIcon(this.addBtn, "plus", 12); + this.addBtn.style.setProperty("--icon-size", `12px`); + setIcon(this.addBtn, "plus"); this.addBtn.onclick = async (): Promise => { const pair = await chooseNewCommand(this.plugin); this.addCommand(pair); diff --git a/src/ui/components/AdvancedToolbarSettings.tsx b/src/ui/components/AdvancedToolbarSettings.tsx index 98c2a0c..54c8613 100644 --- a/src/ui/components/AdvancedToolbarSettings.tsx +++ b/src/ui/components/AdvancedToolbarSettings.tsx @@ -74,8 +74,11 @@ function render(containerEl: HTMLElement, plugin: CommanderPlugin) { if (command.icon) { setIcon(iconDiv, command.icon, 20); } else { + iconDiv.style.setProperty("--icon-size", "20px"); const currentIcon = plugin.settings.advancedToolbar.mappedIcons.find(m => m.commandID === command.id)?.iconID; - currentIcon ? setIcon(iconDiv, currentIcon, 20) : bt.setButtonText("No Icon"); + currentIcon + ? setIcon(iconDiv, currentIcon) + : bt.setButtonText("No Icon"); } bt.onClick(async () => { const icon = await new ChooseIconModal(plugin).awaitSelection(); diff --git a/src/util.tsx b/src/util.tsx index da8e51f..0188761 100644 --- a/src/util.tsx +++ b/src/util.tsx @@ -48,7 +48,8 @@ export function ObsidianIcon({ icon, size, ...props }: ObsidianIconProps): h.JSX useLayoutEffect(() => { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - setIcon(iconEl.current!, icon, size); + iconEl.current!.style.setProperty("--icon-size", `${size}px`); + setIcon(iconEl.current!, icon); }, [icon, size]); return
; diff --git a/versions.json b/versions.json index 6de9902..b20df6a 100644 --- a/versions.json +++ b/versions.json @@ -1,4 +1,6 @@ { + "0.4.2": "1.1.0", + "0.4.1": "0.16.0", "0.1.1": "0.16.0", "0.1.0": "0.15.0" }