mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-04-01 22:55:16 +00:00
- Refactored, linted, fixed potential problems, enabled 'use strict' Fixed: - Added "Enable plugin synchronization" option (Plugins and settings had been run always) Implemented: - Sync preset implemented. - "Check integrity on saving" implemented. - "Sanity check" implemented It's mainly for debugging.
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import { App, Modal } from "obsidian";
|
|
import { escapeStringToHTML } from "./utils";
|
|
import ObsidianLiveSyncPlugin from "./main";
|
|
|
|
export class LogDisplayModal extends Modal {
|
|
plugin: ObsidianLiveSyncPlugin;
|
|
logEl: HTMLDivElement;
|
|
constructor(app: App, plugin: ObsidianLiveSyncPlugin) {
|
|
super(app);
|
|
this.plugin = plugin;
|
|
}
|
|
updateLog() {
|
|
let msg = "";
|
|
for (const v of this.plugin.logMessage) {
|
|
msg += escapeStringToHTML(v) + "<br>";
|
|
}
|
|
this.logEl.innerHTML = msg;
|
|
}
|
|
onOpen() {
|
|
const { contentEl } = this;
|
|
|
|
contentEl.empty();
|
|
contentEl.createEl("h2", { text: "Sync Status" });
|
|
const div = contentEl.createDiv("");
|
|
div.addClass("op-scrollable");
|
|
div.addClass("op-pre");
|
|
this.logEl = div;
|
|
this.updateLog = this.updateLog.bind(this);
|
|
this.plugin.addLogHook = this.updateLog;
|
|
this.updateLog();
|
|
}
|
|
onClose() {
|
|
const { contentEl } = this;
|
|
contentEl.empty();
|
|
this.plugin.addLogHook = null;
|
|
}
|
|
}
|