mirror of
https://github.com/devonthesofa/obsidian-note-status.git
synced 2026-07-22 12:30:24 +00:00
feat: add settings to change the file explorer icon position
This commit is contained in:
parent
b412698403
commit
248dbd7700
2 changed files with 34 additions and 0 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import { PluginSettings } from "@/types/pluginSettings";
|
||||
import React from "react";
|
||||
import { Select } from "../atoms/Select";
|
||||
import { SettingItem } from "./SettingItem";
|
||||
|
||||
export type Props = {
|
||||
|
|
@ -51,6 +52,23 @@ export const UISettings: React.FC<Props> = ({ settings, onChange }) => {
|
|||
/>
|
||||
</SettingItem>
|
||||
|
||||
<SettingItem
|
||||
name="Status icon in file explorer position"
|
||||
description="Change the position of the icon"
|
||||
>
|
||||
<Select
|
||||
options={[
|
||||
{ display: "Filename left", value: "file-name-left" },
|
||||
{ display: "Filename right", value: "file-name-right" },
|
||||
{ display: "Absolute right", value: "absolute-right" },
|
||||
]}
|
||||
defaultValue={settings.fileExplorerIconPosition}
|
||||
onChange={(value) =>
|
||||
onChange("fileExplorerIconPosition", value)
|
||||
}
|
||||
/>
|
||||
</SettingItem>
|
||||
|
||||
<SettingItem
|
||||
name="Hide unknown status in file explorer"
|
||||
description="Hide status icons for files with unknown status in the file explorer"
|
||||
|
|
|
|||
|
|
@ -42,6 +42,18 @@ export class FileExplorerIntegration implements IElementProcessor {
|
|||
},
|
||||
this.EVENT_SUBSCRIPTION_ID,
|
||||
);
|
||||
|
||||
eventBus.subscribe(
|
||||
"plugin-settings-changed",
|
||||
({ key }) => {
|
||||
if (key === "fileExplorerIconPosition") {
|
||||
console.log("renreder");
|
||||
this.destroy();
|
||||
this.integrate().catch((r) => console.error(r));
|
||||
}
|
||||
},
|
||||
"fileExplorerIntegrationSubscription2",
|
||||
);
|
||||
}
|
||||
|
||||
private getFileNoteStatusService(
|
||||
|
|
@ -137,6 +149,10 @@ export class FileExplorerIntegration implements IElementProcessor {
|
|||
"frontmatter-manually-changed",
|
||||
this.EVENT_SUBSCRIPTION_ID,
|
||||
);
|
||||
eventBus.unsubscribe(
|
||||
"frontmatter-manually-changed",
|
||||
"fileExplorerIntegrationSubscription2",
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue