mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-03-30 13:45:19 +00:00
Now, Self-hosted LiveSync has finally begun to be split into the Self-hosted LiveSync plugin for Obsidian, and a properly abstracted version of it. This may not offer much benefit to Obsidian plugin users, or might even cause a slight inconvenience, but I believe it will certainly help improve testability and make the ecosystem better. However, I do not see the point in putting something with little benefit into beta, so I am handling this on the alpha branch. I would actually preferred to create an R&D branch, but I was not keen on the ampersand, and I feel it will eventually become a proper beta anyway. ### Refactored - Separated `ObsidianLiveSyncPlugin` into `ObsidianLiveSyncPlugin` and `LiveSyncBaseCore`. - Now `LiveSyncCore` indicates the type specified version of `LiveSyncBaseCore`. - Referencing `plugin.xxx` has been rewritten to referencing the corresponding service or `core.xxx`. ### Internal API changes - Storage Access APIs are now yielding Promises. This is to allow more limited storage platforms to be supported. ### R&D - Browser-version of Self-hosted LiveSync is now in development. This is not intended for public use now, but I will eventually make it available for testing. - We can see the code in `src/apps/webapp` for the browser version.
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import { mount, unmount } from "svelte";
|
|
import { App, Modal } from "../../deps.ts";
|
|
import ObsidianLiveSyncPlugin from "../../main.ts";
|
|
import PluginPane from "./PluginPane.svelte";
|
|
export class PluginDialogModal extends Modal {
|
|
plugin: ObsidianLiveSyncPlugin;
|
|
component: ReturnType<typeof mount> | undefined;
|
|
isOpened() {
|
|
return this.component != undefined;
|
|
}
|
|
|
|
constructor(app: App, plugin: ObsidianLiveSyncPlugin) {
|
|
super(app);
|
|
this.plugin = plugin;
|
|
}
|
|
|
|
override onOpen() {
|
|
const { contentEl } = this;
|
|
this.contentEl.style.overflow = "auto";
|
|
this.contentEl.style.display = "flex";
|
|
this.contentEl.style.flexDirection = "column";
|
|
this.titleEl.setText("Customization Sync (Beta3)");
|
|
if (!this.component) {
|
|
this.component = mount(PluginPane, {
|
|
target: contentEl,
|
|
props: { plugin: this.plugin, core: this.plugin.core },
|
|
});
|
|
}
|
|
}
|
|
|
|
override onClose() {
|
|
if (this.component) {
|
|
void unmount(this.component);
|
|
this.component = undefined;
|
|
}
|
|
}
|
|
}
|