- Reordering/Sorting
+ {" "}
+ Reordering and Sorting
As of Obsidian 1.1.0 you can reorder the Buttons
diff --git a/src/ui/confirmDeleteModal.ts b/src/ui/confirmDeleteModal.ts
index 79cd3ff..edd738f 100644
--- a/src/ui/confirmDeleteModal.ts
+++ b/src/ui/confirmDeleteModal.ts
@@ -31,5 +31,3 @@ export default class ConfirmDeleteModal extends Modal {
render(null, this.contentEl);
}
}
-
-
diff --git a/src/ui/icons.ts b/src/ui/icons.ts
index cf66516..6ea6fda 100644
--- a/src/ui/icons.ts
+++ b/src/ui/icons.ts
@@ -1,5 +1,8 @@
import { addIcon } from "obsidian";
export default function registerCustomIcons(): void {
- addIcon("cmdr-all-devices", ``);
+ addIcon(
+ "cmdr-all-devices",
+ ``
+ );
}
diff --git a/src/ui/mobileModifyModal.ts b/src/ui/mobileModifyModal.ts
index acbe847..d3a3cd5 100644
--- a/src/ui/mobileModifyModal.ts
+++ b/src/ui/mobileModifyModal.ts
@@ -1,5 +1,5 @@
/* eslint-disable no-unused-vars */
-import { CommandIconPair } from 'src/types';
+import { CommandIconPair } from "src/types";
import { Modal } from "obsidian";
import { h, render, VNode } from "preact";
import MobileModifyComponent from "./components/mobileModifyComponent";
@@ -28,5 +28,3 @@ export default class MobileModifyModal extends Modal {
render(null, this.contentEl);
}
}
-
-
diff --git a/src/ui/settingTab.ts b/src/ui/settingTab.ts
index 45d8537..b5cd8a5 100644
--- a/src/ui/settingTab.ts
+++ b/src/ui/settingTab.ts
@@ -12,7 +12,13 @@ export default class CommanderSettingTab extends PluginSettingTab {
}
public display(): void {
- render(h(settingTabComponent, { plugin: this.plugin, mobileMode: Platform.isMobile }), this.containerEl);
+ render(
+ h(settingTabComponent, {
+ plugin: this.plugin,
+ mobileMode: Platform.isMobile,
+ }),
+ this.containerEl
+ );
}
public hide(): void {
diff --git a/src/ui/settingTabModal.ts b/src/ui/settingTabModal.ts
index 992afba..b1376c1 100644
--- a/src/ui/settingTabModal.ts
+++ b/src/ui/settingTabModal.ts
@@ -9,12 +9,15 @@ export default class SettingTabModal extends Modal {
public constructor(plugin: CommanderPlugin) {
super(app);
this.plugin = plugin;
- this.containerEl.addClass('cmdr-setting-modal');
+ this.containerEl.addClass("cmdr-setting-modal");
}
public onOpen(): void {
- const mobileMode = Platform.isMobile;//this.containerEl.getBoundingClientRect().width <= 1100;
- render(h(settingTabComponent, { plugin: this.plugin, mobileMode }), this.contentEl);
+ const mobileMode = Platform.isMobile; //this.containerEl.getBoundingClientRect().width <= 1100;
+ render(
+ h(settingTabComponent, { plugin: this.plugin, mobileMode }),
+ this.contentEl
+ );
}
public onClose(): void {
diff --git a/src/util.tsx b/src/util.tsx
index e784e48..9cca470 100644
--- a/src/util.tsx
+++ b/src/util.tsx
@@ -1,12 +1,16 @@
-import { AdvancedToolbarSettings, CommanderSettings, CommandIconPair } from './types';
+import {
+ AdvancedToolbarSettings,
+ CommanderSettings,
+ CommandIconPair,
+} from "./types";
import CommanderPlugin from "./main";
import AddCommandModal from "./ui/addCommandModal";
-import ChooseIconModal from './ui/chooseIconModal';
-import { Command, Platform, setIcon } from 'obsidian';
-import ChooseCustomNameModal from './ui/chooseCustomNameModal';
-import { ComponentProps, h } from 'preact';
-import { useRef, useLayoutEffect } from 'preact/hooks';
-import confetti from 'canvas-confetti';
+import ChooseIconModal from "./ui/chooseIconModal";
+import { Command, Platform, setIcon } from "obsidian";
+import ChooseCustomNameModal from "./ui/chooseCustomNameModal";
+import { ComponentProps, h } from "preact";
+import { useRef, useLayoutEffect } from "preact/hooks";
+import confetti from "canvas-confetti";
/**
* It creates a modal, waits for the user to select a command, and then creates another modal to wait
@@ -14,8 +18,9 @@ import confetti from 'canvas-confetti';
* @param {CommanderPlugin} plugin - The plugin that is calling the modal.
* @returns {CommandIconPair}
*/
-export async function chooseNewCommand(plugin: CommanderPlugin): Promise {
-
+export async function chooseNewCommand(
+ plugin: CommanderPlugin
+): Promise {
const command = await new AddCommandModal(plugin).awaitSelection();
let icon;
@@ -31,7 +36,7 @@ export async function chooseNewCommand(plugin: CommanderPlugin): Promise {
- const myCanvas = activeDocument.createElement('canvas');
+ const myCanvas = activeDocument.createElement("canvas");
activeDocument.body.appendChild(myCanvas);
myCanvas.style.position = "fixed";
myCanvas.style.width = "100vw";
@@ -102,7 +110,7 @@ export async function showConfetti({ target }: MouseEvent): Promise {
const myConfetti = confetti.create(myCanvas, {
resize: true,
- useWorker: true
+ useWorker: true,
});
const pos = (target as HTMLDivElement).getBoundingClientRect();
@@ -128,7 +136,9 @@ export function updateSpacing(spacing: number): void {
}
export function updateMacroCommands(plugin: CommanderPlugin): void {
- const oldCommands = Object.keys(app.commands.commands).filter(p => p.startsWith("cmdr:macro-"));
+ const oldCommands = Object.keys(app.commands.commands).filter((p) =>
+ p.startsWith("cmdr:macro-")
+ );
for (const command of oldCommands) {
//@ts-ignore
app.commands.removeCommand(command);
@@ -141,7 +151,7 @@ export function updateMacroCommands(plugin: CommanderPlugin): void {
name: macro.name,
callback: () => {
plugin.executeMacro(parseInt(idx));
- }
+ },
});
}
}
@@ -151,12 +161,12 @@ export function updateStyles(settings: AdvancedToolbarSettings) {
s.setProperty("--at-button-height", (settings.rowHeight ?? 48) + "px");
s.setProperty("--at-button-width", (settings.buttonWidth ?? 48) + "px");
s.setProperty("--at-row-count", settings.rowCount.toString());
- s.setProperty("--at-spacing", (settings.spacing) + "px");
- s.setProperty("--at-offset", (settings.heightOffset) + "px");
- c.toggle('AT-multirow', settings.rowCount > 1);
- c.toggle('AT-row', !settings.columnLayout);
- c.toggle('AT-column', settings.columnLayout);
- c.toggle('AT-no-toolbar', settings.rowCount === 0);
+ s.setProperty("--at-spacing", settings.spacing + "px");
+ s.setProperty("--at-offset", settings.heightOffset + "px");
+ c.toggle("AT-multirow", settings.rowCount > 1);
+ c.toggle("AT-row", !settings.columnLayout);
+ c.toggle("AT-column", settings.columnLayout);
+ c.toggle("AT-no-toolbar", settings.rowCount === 0);
}
export function removeStyles() {
@@ -166,15 +176,15 @@ export function removeStyles() {
s.removeProperty("--at-row-count");
s.removeProperty("--at-spacing");
s.removeProperty("--at-offset");
- c.remove('AT-multirow');
- c.remove('AT-row');
- c.remove('AT-column');
- c.remove('AT-no-toolbar');
- c.remove('advanced-toolbar');
+ c.remove("AT-multirow");
+ c.remove("AT-row");
+ c.remove("AT-column");
+ c.remove("AT-no-toolbar");
+ c.remove("advanced-toolbar");
}
export function injectIcons(settings: AdvancedToolbarSettings) {
- settings.mappedIcons.forEach(mapped => {
+ settings.mappedIcons.forEach((mapped) => {
const command = app.commands.commands[mapped.commandID];
if (command) {
command.icon = mapped.iconID;