mirror of
https://github.com/jsmorabito/obsidian-commander.git
synced 2026-07-22 06:40:31 +00:00
Compatibility with Obsidian 0.15.4's new suggestion dom structure
This commit is contained in:
parent
f317ead945
commit
cac8b52ffb
5 changed files with 20 additions and 14 deletions
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "cmdr",
|
||||
"name": "Commander",
|
||||
"version": "0.0.9",
|
||||
"version": "0.0.10",
|
||||
"minAppVersion": "0.12.0",
|
||||
"description": "Customize your workspace by adding commands /everywhere/.",
|
||||
"author": "jsmorabito & phibr0",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "cmdr",
|
||||
"version": "0.0.9",
|
||||
"version": "0.0.10",
|
||||
"description": "Customize your workspace by adding commands /everywhere/.",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
|
|
|||
15
src/main.ts
15
src/main.ts
|
|
@ -10,11 +10,10 @@ import {
|
|||
TitleBarManager,
|
||||
} from "./manager/commands";
|
||||
import { CommanderSettings, Macro } from './types';
|
||||
import MacroModal from './ui/macroModal';
|
||||
import CommanderSettingTab from './ui/settingTab';
|
||||
import SettingTabModal from './ui/settingTabModal';
|
||||
|
||||
import 'beautiful-react-diagrams/styles.css';
|
||||
//import 'beautiful-react-diagrams/styles.css';
|
||||
import "./styles.scss";
|
||||
import { updateHiderStylesheet } from './util';
|
||||
|
||||
|
|
@ -51,11 +50,11 @@ export default class CommanderPlugin extends Plugin {
|
|||
callback: () => new SettingTabModal(this).open(),
|
||||
});
|
||||
|
||||
this.addCommand({
|
||||
name: t("Open Macro Builder"),
|
||||
id: "open-macro-builder",
|
||||
callback: () => new MacroModal(this).open(),
|
||||
});
|
||||
// this.addCommand({
|
||||
// name: t("Open Macro Builder"),
|
||||
// id: "open-macro-builder",
|
||||
// callback: () => new MacroModal(this).open(),
|
||||
// });
|
||||
|
||||
this.registerEvent(
|
||||
app.workspace.on('editor-menu', this.manager.editorMenu.applyEditorMenuCommands(this)),
|
||||
|
|
@ -73,7 +72,7 @@ export default class CommanderPlugin extends Plugin {
|
|||
}
|
||||
|
||||
// Macros become quite large objects, because we are saving the whole flowchart state (including position, etc.)
|
||||
// This is why they are encoded into a single line base64 string to save space
|
||||
// This is why they are encoded into a single line base64 string to save space (wip)
|
||||
private async loadSettings(): Promise<void> {
|
||||
const data = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());
|
||||
data.macros = data.macros.map((str: string) => JSON.parse(window.atob(str)));
|
||||
|
|
|
|||
|
|
@ -38,11 +38,14 @@ export default class AddCommandModal extends FuzzySuggestModal<Command> {
|
|||
}
|
||||
|
||||
public renderSuggestion(item: FuzzyMatch<Command>, el: HTMLElement): void {
|
||||
super.renderSuggestion(item, el);
|
||||
el.addClass("mod-complex");
|
||||
const content = el.createDiv({ cls: "suggestion-content" });
|
||||
content.createDiv({ cls: "suggestion-title" }).setText(item.item.name);
|
||||
|
||||
//Append the icon if available
|
||||
if (item.item.icon) {
|
||||
setIcon(el.createSpan({ cls: "suggestion-flair" }), item.item.icon);
|
||||
const aux = el.createDiv({ cls: "suggestion-aux" });
|
||||
setIcon(aux.createSpan({ cls: "suggestion-flair" }), item.item.icon);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,8 +37,12 @@ export default class ChooseIconModal extends FuzzySuggestModal<string> {
|
|||
}
|
||||
|
||||
public renderSuggestion(item: FuzzyMatch<string>, el: HTMLElement): void {
|
||||
super.renderSuggestion(item, el);
|
||||
setIcon(el.createSpan({ cls: "suggestion-flair" }), item.item);
|
||||
el.addClass("mod-complex");
|
||||
const content = el.createDiv({ cls: "suggestion-content" });
|
||||
content.createDiv({ cls: "suggestion-title" }).setText(item.item.replace(/-/g, " ").replace(/(^\w{1})|(\s+\w{1})/g, letter => letter.toUpperCase()));
|
||||
|
||||
const aux = el.createDiv({ cls: "suggestion-aux" });
|
||||
setIcon(aux.createSpan({ cls: "suggestion-flair" }), item.item);
|
||||
}
|
||||
|
||||
public getItems(): string[] {
|
||||
|
|
|
|||
Loading…
Reference in a new issue