mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-06-04 05:22:58 +00:00
satisfies
Address following rules - - @typescript-eslint/unbound-method - obsidianmd/prefer-active-doc - obsidianmd/prefer-window-timer Improve typing
This commit is contained in:
@@ -411,10 +411,7 @@ export class HiddenFileSync extends LiveSyncCommands {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateLastProcessedAsActualDatabase(
|
async updateLastProcessedAsActualDatabase(file: FilePath, doc?: MetaEntry | LoadedEntry | null | false) {
|
||||||
file: FilePath,
|
|
||||||
doc?: MetaEntry | LoadedEntry | null | false
|
|
||||||
) {
|
|
||||||
const dbPath = addPrefix(file, ICHeader);
|
const dbPath = addPrefix(file, ICHeader);
|
||||||
if (!doc) doc = await this.localDatabase.getDBEntryMeta(dbPath);
|
if (!doc) doc = await this.localDatabase.getDBEntryMeta(dbPath);
|
||||||
if (!doc) return;
|
if (!doc) return;
|
||||||
|
|||||||
+1
-1
Submodule src/lib updated: 64d5b17925...af21598b78
@@ -80,11 +80,19 @@ export class ModuleObsidianEvents extends AbstractObsidianModule {
|
|||||||
this.watchWindowVisibility = this.watchWindowVisibility.bind(this);
|
this.watchWindowVisibility = this.watchWindowVisibility.bind(this);
|
||||||
this.watchWorkspaceOpen = this.watchWorkspaceOpen.bind(this);
|
this.watchWorkspaceOpen = this.watchWorkspaceOpen.bind(this);
|
||||||
this.watchOnline = this.watchOnline.bind(this);
|
this.watchOnline = this.watchOnline.bind(this);
|
||||||
|
// Already bound
|
||||||
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||||
this.plugin.registerEvent(this.app.workspace.on("file-open", this.watchWorkspaceOpen));
|
this.plugin.registerEvent(this.app.workspace.on("file-open", this.watchWorkspaceOpen));
|
||||||
this.plugin.registerDomEvent(document, "visibilitychange", this.watchWindowVisibility);
|
// Already bound
|
||||||
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||||
|
this.plugin.registerDomEvent(activeDocument, "visibilitychange", this.watchWindowVisibility);
|
||||||
this.plugin.registerDomEvent(window, "focus", () => this.setHasFocus(true));
|
this.plugin.registerDomEvent(window, "focus", () => this.setHasFocus(true));
|
||||||
this.plugin.registerDomEvent(window, "blur", () => this.setHasFocus(false));
|
this.plugin.registerDomEvent(window, "blur", () => this.setHasFocus(false));
|
||||||
|
// Already bound
|
||||||
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||||
this.plugin.registerDomEvent(window, "online", this.watchOnline);
|
this.plugin.registerDomEvent(window, "online", this.watchOnline);
|
||||||
|
// Already bound
|
||||||
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||||
this.plugin.registerDomEvent(window, "offline", this.watchOnline);
|
this.plugin.registerDomEvent(window, "offline", this.watchOnline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onDestroy, onMount } from "svelte";
|
import { onDestroy, onMount } from "svelte";
|
||||||
import { logMessages } from "../../../lib/src/mock_and_interop/stores";
|
import { logMessages } from "../../../lib/src/mock_and_interop/stores";
|
||||||
import { reactive, type ReactiveInstance } from "octagonal-wheels/dataobject/reactive";
|
import { reactive, type ReactiveInstance } from "octagonal-wheels/dataobject/reactive";
|
||||||
import { Logger } from "../../../lib/src/common/logger";
|
import { Logger } from "../../../lib/src/common/logger";
|
||||||
import { $msg as msg, currentLang as lang } from "../../../lib/src/common/i18n.ts";
|
import { $msg as msg, currentLang as lang } from "../../../lib/src/common/i18n.ts";
|
||||||
|
import { compatGlobal } from "@lib/common/coreEnvFunctions.ts";
|
||||||
|
|
||||||
let unsubscribe: () => void;
|
let unsubscribe: () => void;
|
||||||
let messages = $state([] as string[]);
|
let messages = $state([] as string[]);
|
||||||
let wrapRight = $state(false);
|
let wrapRight = $state(false);
|
||||||
let autoScroll = $state(true);
|
let autoScroll = $state(true);
|
||||||
@@ -16,90 +17,90 @@
|
|||||||
};
|
};
|
||||||
let { close }: Props = $props();
|
let { close }: Props = $props();
|
||||||
// export let close: () => void;
|
// export let close: () => void;
|
||||||
function updateLog(logs: ReactiveInstance<string[]>) {
|
function updateLog(logs: ReactiveInstance<string[]>) {
|
||||||
const e = logs.value;
|
const e = logs.value;
|
||||||
if (!suspended) {
|
if (!suspended) {
|
||||||
messages = [...e];
|
messages = [...e];
|
||||||
setTimeout(() => {
|
compatGlobal.setTimeout(() => {
|
||||||
if (scroll) scroll.scrollTop = scroll.scrollHeight;
|
if (scroll) scroll.scrollTop = scroll.scrollHeight;
|
||||||
}, 10);
|
}, 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
const _logMessages = reactive(() => logMessages.value);
|
const _logMessages = reactive(() => logMessages.value);
|
||||||
_logMessages.onChanged(updateLog);
|
_logMessages.onChanged(updateLog);
|
||||||
Logger(msg("logPane.logWindowOpened", {}, lang));
|
Logger(msg("logPane.logWindowOpened", {}, lang));
|
||||||
unsubscribe = () => _logMessages.offChanged(updateLog);
|
unsubscribe = () => _logMessages.offChanged(updateLog);
|
||||||
});
|
});
|
||||||
onDestroy(() => {
|
onDestroy(() => {
|
||||||
if (unsubscribe) unsubscribe();
|
if (unsubscribe) unsubscribe();
|
||||||
});
|
});
|
||||||
let scroll: HTMLDivElement;
|
let scroll: HTMLDivElement;
|
||||||
function closeDialogue() {
|
function closeDialogue() {
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="logpane">
|
<div class="logpane">
|
||||||
<!-- <h1>{msg("logPane.title", {}, lang)}</h1> -->
|
<!-- <h1>{msg("logPane.title", {}, lang)}</h1> -->
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" bind:checked={wrapRight} />
|
<input type="checkbox" bind:checked={wrapRight} />
|
||||||
<span>{msg("logPane.wrap", {}, lang)}</span>
|
<span>{msg("logPane.wrap", {}, lang)}</span>
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" bind:checked={autoScroll} />
|
<input type="checkbox" bind:checked={autoScroll} />
|
||||||
<span>{msg("logPane.autoScroll", {}, lang)}</span>
|
<span>{msg("logPane.autoScroll", {}, lang)}</span>
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" bind:checked={suspended} />
|
<input type="checkbox" bind:checked={suspended} />
|
||||||
<span>{msg("logPane.pause", {}, lang)}</span>
|
<span>{msg("logPane.pause", {}, lang)}</span>
|
||||||
</label>
|
</label>
|
||||||
<span class="spacer"></span>
|
<span class="spacer"></span>
|
||||||
<button onclick={() => closeDialogue()}>Close</button>
|
<button onclick={() => closeDialogue()}>Close</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="log" bind:this={scroll}>
|
<div class="log" bind:this={scroll}>
|
||||||
{#each messages as line}
|
{#each messages as line}
|
||||||
<pre class:wrap-right={wrapRight}>{line}</pre>
|
<pre class:wrap-right={wrapRight}>{line}</pre>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
* {
|
* {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
.logpane {
|
.logpane {
|
||||||
display: flex;
|
display: flex;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
.log {
|
.log {
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
user-select: text;
|
user-select: text;
|
||||||
-webkit-user-select: text;
|
-webkit-user-select: text;
|
||||||
padding-bottom: 2em;
|
padding-bottom: 2em;
|
||||||
}
|
}
|
||||||
.log > pre {
|
.log > pre {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
.log > pre.wrap-right {
|
.log > pre.wrap-right {
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
white-space: normal;
|
white-space: normal;
|
||||||
}
|
}
|
||||||
.row {
|
.row {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
.row > label {
|
.row > label {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
min-width: 5em;
|
min-width: 5em;
|
||||||
margin-right: 1em;
|
margin-right: 1em;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ import { paneAdvanced } from "./PaneAdvanced.ts";
|
|||||||
import { panePowerUsers } from "./PanePowerUsers.ts";
|
import { panePowerUsers } from "./PanePowerUsers.ts";
|
||||||
import { panePatches } from "./PanePatches.ts";
|
import { panePatches } from "./PanePatches.ts";
|
||||||
import { paneMaintenance } from "./PaneMaintenance.ts";
|
import { paneMaintenance } from "./PaneMaintenance.ts";
|
||||||
|
import { compatGlobal } from "@lib/common/coreEnvFunctions.ts";
|
||||||
|
|
||||||
// For creating a document
|
// For creating a document
|
||||||
const toc = new Set<string>();
|
const toc = new Set<string>();
|
||||||
@@ -141,7 +142,7 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
|
|
||||||
async saveLocalSetting(key: keyof typeof OnDialogSettingsDefault) {
|
async saveLocalSetting(key: keyof typeof OnDialogSettingsDefault) {
|
||||||
if (key == "configPassphrase") {
|
if (key == "configPassphrase") {
|
||||||
localStorage.setItem("ls-setting-passphrase", this.editingSettings?.[key] ?? "");
|
compatGlobal.localStorage.setItem("ls-setting-passphrase", this.editingSettings?.[key] ?? "");
|
||||||
return await Promise.resolve();
|
return await Promise.resolve();
|
||||||
}
|
}
|
||||||
if (key == "deviceAndVaultName") {
|
if (key == "deviceAndVaultName") {
|
||||||
@@ -214,7 +215,7 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
|
|
||||||
reloadAllLocalSettings() {
|
reloadAllLocalSettings() {
|
||||||
const ret = { ...OnDialogSettingsDefault };
|
const ret = { ...OnDialogSettingsDefault };
|
||||||
ret.configPassphrase = localStorage.getItem("ls-setting-passphrase") || "";
|
ret.configPassphrase = compatGlobal.localStorage.getItem("ls-setting-passphrase") || "";
|
||||||
ret.preset = "";
|
ret.preset = "";
|
||||||
ret.deviceAndVaultName = this.services.setting.getDeviceAndVaultName();
|
ret.deviceAndVaultName = this.services.setting.getDeviceAndVaultName();
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ export function panePatches(this: ObsidianLiveSyncSettingTab, paneEl: HTMLElemen
|
|||||||
}
|
}
|
||||||
this.requestUpdate();
|
this.requestUpdate();
|
||||||
};
|
};
|
||||||
text.inputEl.before((dateEl = document.createElement("span")));
|
text.inputEl.before((dateEl = activeDocument.createElement("span")));
|
||||||
text.inputEl.type = "datetime-local";
|
text.inputEl.type = "datetime-local";
|
||||||
if (this.editingSettings.maxMTimeForReflectEvents > 0) {
|
if (this.editingSettings.maxMTimeForReflectEvents > 0) {
|
||||||
const date = new Date(this.editingSettings.maxMTimeForReflectEvents);
|
const date = new Date(this.editingSettings.maxMTimeForReflectEvents);
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ export function getSummaryFromPartialSettings(setting: Partial<ObsidianLiveSyncS
|
|||||||
if (config.isAdvanced && !showAdvanced) continue;
|
if (config.isAdvanced && !showAdvanced) continue;
|
||||||
const value =
|
const value =
|
||||||
key != "E2EEAlgorithm"
|
key != "E2EEAlgorithm"
|
||||||
? `${setting[key]}`
|
? `${setting[key] as string}`
|
||||||
: E2EEAlgorithmNames[`${setting[key]}` as keyof typeof E2EEAlgorithmNames];
|
: E2EEAlgorithmNames[`${setting[key]}` as keyof typeof E2EEAlgorithmNames];
|
||||||
const displayValue = config.isHidden ? "•".repeat(value.length) : escapeStringToHTML(value);
|
const displayValue = config.isHidden ? "•".repeat(value.length) : escapeStringToHTML(value);
|
||||||
outputSummary[config.name] = displayValue;
|
outputSummary[config.name] = displayValue;
|
||||||
|
|||||||
Reference in New Issue
Block a user