mirror of
https://github.com/devonthesofa/obsidian-note-status.git
synced 2026-07-22 05:45:04 +00:00
feat: add file explorer icon position configuration
This commit is contained in:
parent
842e10a763
commit
1cfa85db8f
4 changed files with 28 additions and 4 deletions
|
|
@ -61,6 +61,7 @@ export const PREDEFINED_TEMPLATES: StatusTemplate[] = [
|
|||
];
|
||||
|
||||
export const DEFAULT_PLUGIN_SETTINGS: PluginSettings = {
|
||||
fileExplorerIconPosition: "absolute-right",
|
||||
statusColors: {
|
||||
active: "var(--text-success)",
|
||||
onHold: "var(--text-warning)",
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import {
|
|||
IElementProcessor,
|
||||
} from "@/core/lazyElementObserver";
|
||||
import { NoteStatusService } from "@/core/noteStatusService";
|
||||
import settingsService from "@/core/settingsService";
|
||||
import { GroupedStatuses } from "@/types/noteStatus";
|
||||
import { Plugin, TFile, View } from "obsidian";
|
||||
import { createRoot } from "react-dom/client";
|
||||
|
|
@ -89,7 +90,15 @@ export class FileExplorerIntegration implements IElementProcessor {
|
|||
if (existingIcon) {
|
||||
existingIcon.remove();
|
||||
}
|
||||
const icon = createSpan({ cls: this.ICON_CLASS });
|
||||
|
||||
let positionClassName = "";
|
||||
if (
|
||||
settingsService.settings.fileExplorerIconPosition ===
|
||||
"absolute-right"
|
||||
) {
|
||||
positionClassName = "custom-icon__absolute-right";
|
||||
}
|
||||
const icon = createSpan({ cls: [this.ICON_CLASS, positionClassName] });
|
||||
const root = createRoot(icon);
|
||||
root.render(
|
||||
<FileExplorerIcon
|
||||
|
|
@ -99,7 +108,14 @@ export class FileExplorerIntegration implements IElementProcessor {
|
|||
/>,
|
||||
);
|
||||
|
||||
element.prepend(icon);
|
||||
if (
|
||||
settingsService.settings.fileExplorerIconPosition ===
|
||||
"file-name-right"
|
||||
) {
|
||||
element.append(icon);
|
||||
} else {
|
||||
element.prepend(icon);
|
||||
}
|
||||
}
|
||||
|
||||
private openModalInfo(statuses: GroupedStatuses) {
|
||||
|
|
|
|||
|
|
@ -3,11 +3,14 @@
|
|||
========================================================================== */
|
||||
|
||||
.custom-icon {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
display: inline-flex;
|
||||
}
|
||||
|
||||
.custom-icon__absolute-right {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.status-wrapper {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,10 @@ export interface StatusTemplate {
|
|||
}
|
||||
|
||||
export type PluginSettings = {
|
||||
fileExplorerIconPosition:
|
||||
| "absolute-right"
|
||||
| "file-name-left"
|
||||
| "file-name-right";
|
||||
statusColors: Record<string, string>;
|
||||
showStatusBar: boolean;
|
||||
autoHideStatusBar: boolean;
|
||||
|
|
|
|||
Loading…
Reference in a new issue