Files
fegger 7a6cc78e17 Update browser modal to side-panel view
The browser interface has been refactored from a modal to a persistent side-panel view that can be opened and closed
like other Obsidian panes. This provides better workflow integration and allows users to keep the browser open while
working with other notes.

The documentation has been updated to clarify that the "Browse reMarkable" command now opens the side-panel browser
instead of a modal dialog.
2026-05-31 18:43:35 +02:00

194 lines
3.6 KiB
TypeScript

export class Notice {
static messages: Array<{ message: string; timeout?: number }> = [];
constructor(message: string, timeout?: number) {
Notice.messages.push({ message, timeout });
}
}
export class Plugin {
app: any;
constructor(app?: any) {
this.app = app;
}
async loadData(): Promise<any> {
return {};
}
async saveData(): Promise<void> {}
addRibbonIcon(): void {}
addCommand(): void {}
addSettingTab(): void {}
registerView(): void {}
addStatusBarItem(): { setText: (text: string) => void } {
return { setText: () => {} };
}
registerInterval(): void {}
}
export class PluginSettingTab {
app: any;
plugin: any;
containerEl = {
empty: () => {},
createEl: () => {},
};
constructor(app: any, plugin: any) {
this.app = app;
this.plugin = plugin;
}
}
export class Modal {
app: any;
contentEl = createElement();
constructor(app: any) {
this.app = app;
}
open(): void {
this.onOpen();
}
close(): void {
this.onClose();
}
onOpen(): void {}
onClose(): void {}
}
export class ItemView {
leaf: any;
contentEl = createElement();
constructor(leaf: any) {
this.leaf = leaf;
}
getViewType(): string {
return "";
}
getDisplayText(): string {
return "";
}
getIcon(): string {
return "";
}
async onOpen(): Promise<void> {}
onClose(): void {}
}
export class ButtonComponent {
static instances: ButtonComponent[] = [];
buttonEl = createElement();
private callback: (() => void | Promise<void>) | null = null;
constructor(_containerEl: any) {
ButtonComponent.instances.push(this);
}
setButtonText(text: string): this {
this.buttonEl.text = text;
return this;
}
onClick(callback: () => void | Promise<void>): this {
this.callback = callback;
return this;
}
click(): void | Promise<void> {
return this.callback?.();
}
}
export class Setting {
constructor(_containerEl: any) {}
setName(): this {
return this;
}
setDesc(): this {
return this;
}
addText(callback: (text: any) => void): this {
callback(createTextControl());
return this;
}
addToggle(callback: (toggle: any) => void): this {
callback(createControl());
return this;
}
addDropdown(callback: (dropdown: any) => void): this {
callback({
...createControl(),
addOption: () => createControl(),
});
return this;
}
}
function createElement(): any {
const element: any = {
children: [],
text: "",
empty: () => {
element.children = [];
},
createEl: (_tag: string, options: any = {}) => {
const child = createElement();
child.text = options.text || "";
child.cls = options.cls || "";
element.children.push(child);
return child;
},
createDiv: (options: any = {}) => {
const child = createElement();
child.cls = options.cls || "";
element.children.push(child);
return child;
},
createSpan: (options: any = {}) => {
const child = createElement();
child.text = options.text || "";
child.cls = options.cls || "";
element.children.push(child);
return child;
},
};
return element;
}
function createControl(): any {
const control: any = {
inputEl: {},
setValue: () => control,
onChange: () => control,
addOption: () => control,
};
return control;
}
function createTextControl(): any {
const control = createControl();
control.inputEl = {};
return control;
}
export function normalizePath(path: string): string {
return path.replace(/\\/g, "/").replace(/\/+/g, "/").replace(/^\.\//, "");
}