mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2025-12-20 13:11:29 +00:00
Refactored and fixed:
- 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.
This commit is contained in:
37
src/LogDisplayModal.ts
Normal file
37
src/LogDisplayModal.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user