diff --git a/src/ui/components/customJSModal.ts b/src/ui/components/customJSModal.ts
deleted file mode 100644
index 87f83ad..0000000
--- a/src/ui/components/customJSModal.ts
+++ /dev/null
@@ -1,89 +0,0 @@
-import { Modal, TextAreaComponent } from "obsidian";
-import CommanderPlugin from "src/main";
-import { defaultKeymap, history, historyKeymap, indentWithTab } from "@codemirror/commands";
-import { javascript } from "@codemirror/lang-javascript";
-import {
- bracketMatching,
- defaultHighlightStyle,
- foldGutter,
- foldKeymap,
- indentOnInput,
- syntaxHighlighting,
-} from "@codemirror/language";
-import { EditorState, Extension } from "@codemirror/state";
-import {
- drawSelection,
- dropCursor,
- EditorView,
- highlightSpecialChars,
- keymap,
- lineNumbers,
- rectangularSelection,
-} from "@codemirror/view";
-import { autocompletion, closeBrackets, closeBracketsKeymap, completionKeymap } from "@codemirror/autocomplete";
-import { highlightSelectionMatches, searchKeymap } from "@codemirror/search";
-
-export const basicSetup: Extension[] = [
- lineNumbers(),
- // highlightActiveLineGutter(),
- highlightSpecialChars(),
- history(),
- javascript(),
- foldGutter(),
- drawSelection(),
- dropCursor(),
- EditorState.allowMultipleSelections.of(true),
- indentOnInput(),
- syntaxHighlighting(defaultHighlightStyle, { fallback: true }),
- EditorView.lineWrapping,
- bracketMatching(),
- closeBrackets(),
- autocompletion(),
- rectangularSelection(),
- highlightSelectionMatches(),
- keymap.of([
- ...closeBracketsKeymap,
- ...defaultKeymap,
- ...searchKeymap,
- ...historyKeymap,
- indentWithTab,
- ...foldKeymap,
- ...completionKeymap,
- ]),
-].filter(ext => ext);
-
-function editorFromTextArea(textarea: HTMLTextAreaElement, extensions: Extension) {
- let view = new EditorView({
- state: EditorState.create({ doc: textarea.value, extensions }),
- });
- textarea.parentNode!.insertBefore(view.dom, textarea);
- textarea.style.display = "none";
- if (textarea.form)
- textarea.form.addEventListener("submit", () => {
- textarea.value = view.state.doc.toString();
- });
- return view;
-}
-
-export default class CustomJSModal extends Modal {
- private plugin: CommanderPlugin;
- editor: EditorView;
-
- public constructor(
- plugin: CommanderPlugin,
- ) {
- super(app);
- this.plugin = plugin;
- }
-
- public onOpen(): void {
- this.titleEl.setText("Macro Builder");
- const customCSSEl = new TextAreaComponent(this.contentEl);
- this.editor = editorFromTextArea(customCSSEl.inputEl, basicSetup);
- }
-
- public onClose(): void {
- this.containerEl.empty();
- this.editor?.destroy();
- }
-}
diff --git a/src/ui/components/settingTabComponent.tsx b/src/ui/components/settingTabComponent.tsx
index e137882..a27fd06 100644
--- a/src/ui/components/settingTabComponent.tsx
+++ b/src/ui/components/settingTabComponent.tsx
@@ -131,7 +131,22 @@ export default function settingTabComponent({
+ >
+
+
+
+ Reordering/Sorting
+
+
+ As of Obsidian 1.1.0 you can reorder the Buttons
+ in the left ribbon by dragging. This will
+ replace the old sorting feature.
+
+
+
),
},
// {
diff --git a/src/util.tsx b/src/util.tsx
index 0188761..e784e48 100644
--- a/src/util.tsx
+++ b/src/util.tsx
@@ -43,12 +43,15 @@ interface ObsidianIconProps extends ComponentProps<"div"> {
icon: string;
size?: number;
}
-export function ObsidianIcon({ icon, size, ...props }: ObsidianIconProps): h.JSX.Element {
+export function ObsidianIcon({
+ icon,
+ size,
+ ...props
+}: ObsidianIconProps): h.JSX.Element {
const iconEl = useRef
(null);
useLayoutEffect(() => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- iconEl.current!.style.setProperty("--icon-size", `${size}px`);
setIcon(iconEl.current!, icon);
}, [icon, size]);
@@ -57,7 +60,12 @@ export function ObsidianIcon({ icon, size, ...props }: ObsidianIconProps): h.JSX
export function isModeActive(mode: string): boolean {
const { isMobile, appId } = app;
- return mode === "any" || mode === appId || (mode === "mobile" && isMobile) || (mode === "desktop" && !isMobile);
+ return (
+ mode === "any" ||
+ mode === appId ||
+ (mode === "mobile" && isMobile) ||
+ (mode === "desktop" && !isMobile)
+ );
}
export function updateHiderStylesheet(settings: CommanderSettings): void {
@@ -65,14 +73,17 @@ export function updateHiderStylesheet(settings: CommanderSettings): void {
for (const id of settings.hide.statusbar) {
style += `div.status-bar-item.plugin-${id} {display: none !important; content-visibility: hidden;}`;
}
- for (const name of settings.hide.leftRibbon) {
- style += `div.side-dock-ribbon-action[aria-label="${name}"] {display: none !important; content-visibility: hidden;}`;
- }
document.head.querySelector("style#cmdr")?.remove();
if (style) {
- document.head.appendChild(createEl("style", { attr: { "id": "cmdr" }, text: style, type: "text/css" }));
+ document.head.appendChild(
+ createEl("style", {
+ attr: { id: "cmdr" },
+ text: style,
+ type: "text/css",
+ })
+ );
}
}