mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-10-14 05:12:30 +00:00
## 0.24.14
### Fixed
- Resolving conflicts of JSON files (and sensibly merging them) is now working fine, again!
- And, failure logs are more informative.
- More robust to release the event listeners on unwatching the local database.
### Refactored
- JSON file conflict resolution dialogue has been rewritten into svelte v5.
- Upgrade eslint.
- Remove unnecessary pragma comments for eslint.
This commit is contained in:
@@ -1,11 +0,0 @@
|
|||||||
node_modules
|
|
||||||
build
|
|
||||||
.eslintrc.js.bak
|
|
||||||
src/lib/src/patches/pouchdb-utils
|
|
||||||
esbuild.config.mjs
|
|
||||||
rollup.config.js
|
|
||||||
src/lib/test
|
|
||||||
src/lib/src/cli
|
|
||||||
main.js
|
|
||||||
src/lib/apps/webpeer/dist
|
|
||||||
src/lib/apps/webpeer/svelte.config.js
|
|
||||||
@@ -1,13 +1,34 @@
|
|||||||
{
|
{
|
||||||
"root": true,
|
"root": true,
|
||||||
"parser": "@typescript-eslint/parser",
|
"parser": "@typescript-eslint/parser",
|
||||||
"plugins": ["@typescript-eslint"],
|
"plugins": [
|
||||||
"extends": ["eslint:recommended", "plugin:@typescript-eslint/eslint-recommended", "plugin:@typescript-eslint/recommended"],
|
"@typescript-eslint",
|
||||||
|
"eslint-plugin-svelte",
|
||||||
|
"eslint-plugin-import"
|
||||||
|
],
|
||||||
|
"extends": [
|
||||||
|
"eslint:recommended",
|
||||||
|
"plugin:@typescript-eslint/eslint-recommended",
|
||||||
|
"plugin:@typescript-eslint/recommended"
|
||||||
|
],
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"sourceType": "module",
|
"sourceType": "module",
|
||||||
"project": ["tsconfig.json"]
|
"project": [
|
||||||
|
"tsconfig.json"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ignorePatterns": [],
|
"ignorePatterns": [
|
||||||
|
"**/node_modules/*",
|
||||||
|
"**/jest.config.js",
|
||||||
|
"src/lib/coverage",
|
||||||
|
"src/lib/browsertest",
|
||||||
|
"**/test.ts",
|
||||||
|
"**/tests.ts",
|
||||||
|
"**/**test.ts",
|
||||||
|
"**/**.test.ts",
|
||||||
|
"esbuild.*.mjs",
|
||||||
|
"terser.*.mjs"
|
||||||
|
],
|
||||||
"rules": {
|
"rules": {
|
||||||
"no-unused-vars": "off",
|
"no-unused-vars": "off",
|
||||||
"@typescript-eslint/no-unused-vars": [
|
"@typescript-eslint/no-unused-vars": [
|
||||||
@@ -34,4 +55,4 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -4,7 +4,7 @@ import esbuild from "esbuild";
|
|||||||
import process from "process";
|
import process from "process";
|
||||||
import builtins from "builtin-modules";
|
import builtins from "builtin-modules";
|
||||||
import sveltePlugin from "esbuild-svelte";
|
import sveltePlugin from "esbuild-svelte";
|
||||||
import sveltePreprocess from "svelte-preprocess";
|
import { sveltePreprocess } from "svelte-preprocess";
|
||||||
import fs from "node:fs";
|
import fs from "node:fs";
|
||||||
// import terser from "terser";
|
// import terser from "terser";
|
||||||
import { minify } from "terser";
|
import { minify } from "terser";
|
||||||
|
|||||||
@@ -0,0 +1,100 @@
|
|||||||
|
import typescriptEslint from "@typescript-eslint/eslint-plugin";
|
||||||
|
import svelte from "eslint-plugin-svelte";
|
||||||
|
import _import from "eslint-plugin-import";
|
||||||
|
import { fixupPluginRules } from "@eslint/compat";
|
||||||
|
import tsParser from "@typescript-eslint/parser";
|
||||||
|
import path from "node:path";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
|
import js from "@eslint/js";
|
||||||
|
import { FlatCompat } from "@eslint/eslintrc";
|
||||||
|
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = path.dirname(__filename);
|
||||||
|
const compat = new FlatCompat({
|
||||||
|
baseDirectory: __dirname,
|
||||||
|
recommendedConfig: js.configs.recommended,
|
||||||
|
allConfig: js.configs.all,
|
||||||
|
});
|
||||||
|
|
||||||
|
export default [
|
||||||
|
{
|
||||||
|
ignores: [
|
||||||
|
"**/node_modules/*",
|
||||||
|
"**/jest.config.js",
|
||||||
|
"src/lib/coverage",
|
||||||
|
"src/lib/browsertest",
|
||||||
|
"**/test.ts",
|
||||||
|
"**/tests.ts",
|
||||||
|
"**/**test.ts",
|
||||||
|
"**/**.test.ts",
|
||||||
|
"**/esbuild.*.mjs",
|
||||||
|
"**/terser.*.mjs",
|
||||||
|
"**/node_modules",
|
||||||
|
"**/build",
|
||||||
|
"**/.eslintrc.js.bak",
|
||||||
|
"src/lib/src/patches/pouchdb-utils",
|
||||||
|
"**/esbuild.config.mjs",
|
||||||
|
"**/rollup.config.js",
|
||||||
|
"modules/octagonal-wheels/rollup.config.js",
|
||||||
|
"modules/octagonal-wheels/dist/**/*",
|
||||||
|
"src/lib/test",
|
||||||
|
"src/lib/src/cli",
|
||||||
|
"**/main.js",
|
||||||
|
"src/lib/apps/webpeer/dist",
|
||||||
|
"src/lib/apps/webpeer/svelte.config.js",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
...compat.extends(
|
||||||
|
"eslint:recommended",
|
||||||
|
"plugin:@typescript-eslint/eslint-recommended",
|
||||||
|
"plugin:@typescript-eslint/recommended"
|
||||||
|
),
|
||||||
|
{
|
||||||
|
plugins: {
|
||||||
|
"@typescript-eslint": typescriptEslint,
|
||||||
|
svelte,
|
||||||
|
import: fixupPluginRules(_import),
|
||||||
|
},
|
||||||
|
|
||||||
|
languageOptions: {
|
||||||
|
parser: tsParser,
|
||||||
|
ecmaVersion: 5,
|
||||||
|
sourceType: "module",
|
||||||
|
|
||||||
|
parserOptions: {
|
||||||
|
project: ["tsconfig.json"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
rules: {
|
||||||
|
"no-unused-vars": "off",
|
||||||
|
|
||||||
|
"@typescript-eslint/no-unused-vars": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
args: "none",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
"no-unused-labels": "off",
|
||||||
|
"@typescript-eslint/ban-ts-comment": "off",
|
||||||
|
"no-prototype-builtins": "off",
|
||||||
|
"@typescript-eslint/no-empty-function": "off",
|
||||||
|
"require-await": "error",
|
||||||
|
"@typescript-eslint/require-await": "warn",
|
||||||
|
"@typescript-eslint/no-misused-promises": "warn",
|
||||||
|
"@typescript-eslint/no-floating-promises": "warn",
|
||||||
|
"no-async-promise-executor": "warn",
|
||||||
|
"@typescript-eslint/no-explicit-any": "off",
|
||||||
|
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
||||||
|
|
||||||
|
"no-constant-condition": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
checkLoops: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
Generated
+3027
-2060
File diff suppressed because it is too large
Load Diff
+12
-9
@@ -22,6 +22,9 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@chialab/esbuild-plugin-worker": "^0.18.1",
|
"@chialab/esbuild-plugin-worker": "^0.18.1",
|
||||||
|
"@eslint/compat": "^1.2.6",
|
||||||
|
"@eslint/eslintrc": "^3.2.0",
|
||||||
|
"@eslint/js": "^9.20.0",
|
||||||
"@tsconfig/svelte": "^5.0.4",
|
"@tsconfig/svelte": "^5.0.4",
|
||||||
"@types/diff-match-patch": "^1.0.36",
|
"@types/diff-match-patch": "^1.0.36",
|
||||||
"@types/node": "^22.5.4",
|
"@types/node": "^22.5.4",
|
||||||
@@ -33,17 +36,17 @@
|
|||||||
"@types/pouchdb-mapreduce": "^6.1.10",
|
"@types/pouchdb-mapreduce": "^6.1.10",
|
||||||
"@types/pouchdb-replication": "^6.4.7",
|
"@types/pouchdb-replication": "^6.4.7",
|
||||||
"@types/transform-pouch": "^1.0.6",
|
"@types/transform-pouch": "^1.0.6",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.23.0",
|
"@typescript-eslint/eslint-plugin": "^8.24.1",
|
||||||
"@typescript-eslint/parser": "^8.23.0",
|
"@typescript-eslint/parser": "^8.24.1",
|
||||||
"builtin-modules": "^4.0.0",
|
"builtin-modules": "^4.0.0",
|
||||||
"esbuild": "0.24.2",
|
"esbuild": "0.24.2",
|
||||||
"esbuild-svelte": "^0.9.0",
|
"esbuild-svelte": "^0.9.0",
|
||||||
"eslint": "^8.57.0",
|
"eslint": "^9.20.1",
|
||||||
"eslint-config-airbnb-base": "^15.0.0",
|
|
||||||
"eslint-plugin-import": "^2.31.0",
|
"eslint-plugin-import": "^2.31.0",
|
||||||
|
"eslint-plugin-svelte": "^2.46.1",
|
||||||
"events": "^3.3.0",
|
"events": "^3.3.0",
|
||||||
"obsidian": "^1.7.2",
|
"obsidian": "^1.7.2",
|
||||||
"postcss": "^8.5.1",
|
"postcss": "^8.5.2",
|
||||||
"postcss-load-config": "^6.0.1",
|
"postcss-load-config": "^6.0.1",
|
||||||
"pouchdb-adapter-http": "^9.0.0",
|
"pouchdb-adapter-http": "^9.0.0",
|
||||||
"pouchdb-adapter-idb": "^9.0.0",
|
"pouchdb-adapter-idb": "^9.0.0",
|
||||||
@@ -55,10 +58,10 @@
|
|||||||
"pouchdb-merge": "^9.0.0",
|
"pouchdb-merge": "^9.0.0",
|
||||||
"pouchdb-replication": "^9.0.0",
|
"pouchdb-replication": "^9.0.0",
|
||||||
"pouchdb-utils": "^9.0.0",
|
"pouchdb-utils": "^9.0.0",
|
||||||
"prettier": "^3.4.2",
|
"prettier": "^3.5.1",
|
||||||
"svelte": "^5.19.7",
|
"svelte": "^5.20.1",
|
||||||
"svelte-preprocess": "^6.0.3",
|
"svelte-preprocess": "^6.0.3",
|
||||||
"terser": "^5.37.0",
|
"terser": "^5.39.0",
|
||||||
"transform-pouch": "^2.0.0",
|
"transform-pouch": "^2.0.0",
|
||||||
"tslib": "^2.8.1",
|
"tslib": "^2.8.1",
|
||||||
"tsx": "^4.19.2",
|
"tsx": "^4.19.2",
|
||||||
@@ -76,7 +79,7 @@
|
|||||||
"minimatch": "^10.0.1",
|
"minimatch": "^10.0.1",
|
||||||
"octagonal-wheels": "^0.1.23",
|
"octagonal-wheels": "^0.1.23",
|
||||||
"svelte-check": "^4.1.4",
|
"svelte-check": "^4.1.4",
|
||||||
"trystero": "^0.20.0",
|
"trystero": "^0.20.1",
|
||||||
"xxhash-wasm-102": "npm:xxhash-wasm@^1.0.2"
|
"xxhash-wasm-102": "npm:xxhash-wasm@^1.0.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,14 @@ import { App, Modal } from "../../deps.ts";
|
|||||||
import { type FilePath, type LoadedEntry } from "../../lib/src/common/types.ts";
|
import { type FilePath, type LoadedEntry } from "../../lib/src/common/types.ts";
|
||||||
import JsonResolvePane from "./JsonResolvePane.svelte";
|
import JsonResolvePane from "./JsonResolvePane.svelte";
|
||||||
import { waitForSignal } from "../../lib/src/common/utils.ts";
|
import { waitForSignal } from "../../lib/src/common/utils.ts";
|
||||||
|
import { mount, unmount } from "svelte";
|
||||||
|
|
||||||
export class JsonResolveModal extends Modal {
|
export class JsonResolveModal extends Modal {
|
||||||
// result: Array<[number, string]>;
|
// result: Array<[number, string]>;
|
||||||
filename: FilePath;
|
filename: FilePath;
|
||||||
callback?: (keepRev?: string, mergedStr?: string) => Promise<void>;
|
callback?: (keepRev?: string, mergedStr?: string) => Promise<void>;
|
||||||
docs: LoadedEntry[];
|
docs: LoadedEntry[];
|
||||||
component?: JsonResolvePane;
|
component?: ReturnType<typeof mount>;
|
||||||
nameA: string;
|
nameA: string;
|
||||||
nameB: string;
|
nameB: string;
|
||||||
defaultSelect: string;
|
defaultSelect: string;
|
||||||
@@ -55,7 +56,7 @@ export class JsonResolveModal extends Modal {
|
|||||||
contentEl.empty();
|
contentEl.empty();
|
||||||
|
|
||||||
if (this.component == undefined) {
|
if (this.component == undefined) {
|
||||||
this.component = new JsonResolvePane({
|
this.component = mount(JsonResolvePane, {
|
||||||
target: contentEl,
|
target: contentEl,
|
||||||
props: {
|
props: {
|
||||||
docs: this.docs,
|
docs: this.docs,
|
||||||
@@ -81,7 +82,7 @@ export class JsonResolveModal extends Modal {
|
|||||||
void this.callback(undefined);
|
void this.callback(undefined);
|
||||||
}
|
}
|
||||||
if (this.component != undefined) {
|
if (this.component != undefined) {
|
||||||
this.component.$destroy();
|
void unmount(this.component);
|
||||||
this.component = undefined;
|
this.component = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,29 +2,64 @@
|
|||||||
import { type Diff, DIFF_DELETE, DIFF_INSERT, diff_match_patch } from "../../deps.ts";
|
import { type Diff, DIFF_DELETE, DIFF_INSERT, diff_match_patch } from "../../deps.ts";
|
||||||
import type { FilePath, LoadedEntry } from "../../lib/src/common/types.ts";
|
import type { FilePath, LoadedEntry } from "../../lib/src/common/types.ts";
|
||||||
import { decodeBinary, readString } from "../../lib/src/string_and_binary/convert.ts";
|
import { decodeBinary, readString } from "../../lib/src/string_and_binary/convert.ts";
|
||||||
import { getDocData, mergeObject } from "../../lib/src/common/utils.ts";
|
import { getDocData, isObjectDifferent, mergeObject } from "../../lib/src/common/utils.ts";
|
||||||
|
|
||||||
export let docs: LoadedEntry[] = [];
|
interface Props {
|
||||||
export let callback: (keepRev?: string, mergedStr?: string) => Promise<void> = async (_, __) => {
|
docs?: LoadedEntry[];
|
||||||
Promise.resolve();
|
callback?: (keepRev?: string, mergedStr?: string) => Promise<void>;
|
||||||
};
|
filename?: FilePath;
|
||||||
export let filename: FilePath = "" as FilePath;
|
nameA?: string;
|
||||||
export let nameA: string = "A";
|
nameB?: string;
|
||||||
export let nameB: string = "B";
|
defaultSelect?: string;
|
||||||
export let defaultSelect: string = "";
|
keepOrder?: boolean;
|
||||||
export let keepOrder = false;
|
hideLocal?: boolean;
|
||||||
export let hideLocal: boolean = false;
|
}
|
||||||
let docA: LoadedEntry;
|
|
||||||
let docB: LoadedEntry;
|
let {
|
||||||
let docAContent = "";
|
docs = $bindable([]),
|
||||||
let docBContent = "";
|
callback = $bindable((async (_, __) => {
|
||||||
let objA: any = {};
|
Promise.resolve();
|
||||||
let objB: any = {};
|
}) as (keepRev?: string, mergedStr?: string) => Promise<void>),
|
||||||
let objAB: any = {};
|
filename = $bindable("" as FilePath),
|
||||||
let objBA: any = {};
|
nameA = $bindable("A"),
|
||||||
let diffs: Diff[];
|
nameB = $bindable("B"),
|
||||||
|
defaultSelect = $bindable("" as string),
|
||||||
|
keepOrder = $bindable(false),
|
||||||
|
hideLocal = $bindable(false),
|
||||||
|
}: Props = $props();
|
||||||
|
type JSONData = Record<string | number | symbol, any> | [any];
|
||||||
|
|
||||||
|
const docsArray = $derived.by(() => {
|
||||||
|
if (docs && docs.length >= 1) {
|
||||||
|
if (keepOrder || docs[0].mtime < docs[1].mtime) {
|
||||||
|
return { a: docs[0], b: docs[1] } as const;
|
||||||
|
} else {
|
||||||
|
return { a: docs[1], b: docs[0] } as const;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return { a: false, b: false } as const;
|
||||||
|
});
|
||||||
|
const docA = $derived(docsArray.a);
|
||||||
|
const docB = $derived(docsArray.b);
|
||||||
|
const docAContent = $derived(docA && docToString(docA));
|
||||||
|
const docBContent = $derived(docB && docToString(docB));
|
||||||
|
|
||||||
|
function parseJson(json: string | false) {
|
||||||
|
if (json === false) return false;
|
||||||
|
try {
|
||||||
|
return JSON.parse(json) as JSONData;
|
||||||
|
} catch (ex) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const objA = $derived(parseJson(docAContent) || {});
|
||||||
|
const objB = $derived(parseJson(docBContent) || {});
|
||||||
|
const objAB = $derived(mergeObject(objA, objB));
|
||||||
|
const objBAw = $derived(mergeObject(objB, objA));
|
||||||
|
const objBA = $derived(isObjectDifferent(objBAw, objAB) ? objBAw : false);
|
||||||
|
let diffs: Diff[] = $derived.by(() => (objA && selectedObj ? getJsonDiff(objA, selectedObj) : []));
|
||||||
type SelectModes = "" | "A" | "B" | "AB" | "BA";
|
type SelectModes = "" | "A" | "B" | "AB" | "BA";
|
||||||
let mode: SelectModes = defaultSelect as SelectModes;
|
let mode: SelectModes = $state(defaultSelect as SelectModes);
|
||||||
|
|
||||||
function docToString(doc: LoadedEntry) {
|
function docToString(doc: LoadedEntry) {
|
||||||
return doc.datatype == "plain" ? getDocData(doc.data) : readString(new Uint8Array(decodeBinary(doc.data)));
|
return doc.datatype == "plain" ? getDocData(doc.data) : readString(new Uint8Array(decodeBinary(doc.data)));
|
||||||
@@ -45,6 +80,7 @@
|
|||||||
return getDiff(JSON.stringify(a, null, 2), JSON.stringify(b, null, 2));
|
return getDiff(JSON.stringify(a, null, 2), JSON.stringify(b, null, 2));
|
||||||
}
|
}
|
||||||
function apply() {
|
function apply() {
|
||||||
|
if (!docA || !docB) return;
|
||||||
if (docA._id == docB._id) {
|
if (docA._id == docB._id) {
|
||||||
if (mode == "A") return callback(docA._rev!, undefined);
|
if (mode == "A") return callback(docA._rev!, undefined);
|
||||||
if (mode == "B") return callback(docB._rev!, undefined);
|
if (mode == "B") return callback(docB._rev!, undefined);
|
||||||
@@ -59,50 +95,23 @@
|
|||||||
function cancel() {
|
function cancel() {
|
||||||
callback(undefined, undefined);
|
callback(undefined, undefined);
|
||||||
}
|
}
|
||||||
$: {
|
const mergedObjs = $derived.by(
|
||||||
if (docs && docs.length >= 1) {
|
() =>
|
||||||
if (keepOrder || docs[0].mtime < docs[1].mtime) {
|
({
|
||||||
docA = docs[0];
|
"": false,
|
||||||
docB = docs[1];
|
A: objA,
|
||||||
} else {
|
B: objB,
|
||||||
docA = docs[1];
|
AB: objAB,
|
||||||
docB = docs[0];
|
BA: objBA,
|
||||||
}
|
}) as Record<SelectModes, JSONData | false>
|
||||||
docAContent = docToString(docA);
|
);
|
||||||
docBContent = docToString(docB);
|
|
||||||
|
|
||||||
try {
|
let selectedObj = $derived(mode in mergedObjs ? mergedObjs[mode] : {});
|
||||||
objA = false;
|
|
||||||
objB = false;
|
|
||||||
objA = JSON.parse(docAContent);
|
|
||||||
objB = JSON.parse(docBContent);
|
|
||||||
objAB = mergeObject(objA, objB);
|
|
||||||
objBA = mergeObject(objB, objA);
|
|
||||||
if (JSON.stringify(objAB) == JSON.stringify(objBA)) {
|
|
||||||
objBA = false;
|
|
||||||
}
|
|
||||||
} catch (ex) {
|
|
||||||
objBA = false;
|
|
||||||
objAB = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$: mergedObjs = {
|
|
||||||
"": false,
|
|
||||||
A: objA,
|
|
||||||
B: objB,
|
|
||||||
AB: objAB,
|
|
||||||
BA: objBA,
|
|
||||||
};
|
|
||||||
|
|
||||||
$: selectedObj = mode in mergedObjs ? mergedObjs[mode] : {};
|
let modesSrc = $state([] as ["" | "A" | "B" | "AB" | "BA", string][]);
|
||||||
$: {
|
|
||||||
diffs = getJsonDiff(objA, selectedObj);
|
|
||||||
}
|
|
||||||
|
|
||||||
let modes = [] as ["" | "A" | "B" | "AB" | "BA", string][];
|
const modes = $derived.by(() => {
|
||||||
$: {
|
let newModes = [] as typeof modesSrc;
|
||||||
let newModes = [] as typeof modes;
|
|
||||||
|
|
||||||
if (!hideLocal) {
|
if (!hideLocal) {
|
||||||
newModes.push(["", "Not now"]);
|
newModes.push(["", "Not now"]);
|
||||||
@@ -111,15 +120,15 @@
|
|||||||
newModes.push(["B", nameB || "B"]);
|
newModes.push(["B", nameB || "B"]);
|
||||||
newModes.push(["AB", `${nameA || "A"} + ${nameB || "B"}`]);
|
newModes.push(["AB", `${nameA || "A"} + ${nameB || "B"}`]);
|
||||||
newModes.push(["BA", `${nameB || "B"} + ${nameA || "A"}`]);
|
newModes.push(["BA", `${nameB || "B"} + ${nameA || "A"}`]);
|
||||||
modes = newModes;
|
return newModes;
|
||||||
}
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<h2>{filename}</h2>
|
<h2>{filename}</h2>
|
||||||
{#if !docA || !docB}
|
{#if !docA || !docB}
|
||||||
<div class="message">Just for a minute, please!</div>
|
<div class="message">Just for a minute, please!</div>
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<button on:click={apply}>Dismiss</button>
|
<button onclick={apply}>Dismiss</button>
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<div class="options">
|
<div class="options">
|
||||||
@@ -148,39 +157,39 @@
|
|||||||
<div class="infos">
|
<div class="infos">
|
||||||
<table>
|
<table>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{nameA}</th>
|
<th>{nameA}</th>
|
||||||
<td
|
<td
|
||||||
>{#if docA._id == docB._id}
|
>{#if docA._id == docB._id}
|
||||||
Rev:{revStringToRevNumber(docA._rev)}
|
Rev:{revStringToRevNumber(docA._rev)}
|
||||||
{/if}
|
{/if}
|
||||||
{new Date(docA.mtime).toLocaleString()}</td
|
{new Date(docA.mtime).toLocaleString()}</td
|
||||||
>
|
>
|
||||||
<td>
|
<td>
|
||||||
{docAContent.length} letters
|
{docAContent && docAContent.length} letters
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{nameB}</th>
|
<th>{nameB}</th>
|
||||||
<td
|
<td
|
||||||
>{#if docA._id == docB._id}
|
>{#if docA._id == docB._id}
|
||||||
Rev:{revStringToRevNumber(docB._rev)}
|
Rev:{revStringToRevNumber(docB._rev)}
|
||||||
{/if}
|
{/if}
|
||||||
{new Date(docB.mtime).toLocaleString()}</td
|
{new Date(docB.mtime).toLocaleString()}</td
|
||||||
>
|
>
|
||||||
<td>
|
<td>
|
||||||
{docBContent.length} letters
|
{docBContent && docBContent.length} letters
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
{#if hideLocal}
|
{#if hideLocal}
|
||||||
<button on:click={cancel}>Cancel</button>
|
<button onclick={cancel}>Cancel</button>
|
||||||
{/if}
|
{/if}
|
||||||
<button on:click={apply}>Apply</button>
|
<button onclick={apply}>Apply</button>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|||||||
@@ -701,7 +701,7 @@ Offline Changed files: ${processFiles.length}`;
|
|||||||
?.filter((e) => e.status == "available" && Number(e.rev.split("-")[0]) < conflictedRevNo)
|
?.filter((e) => e.status == "available" && Number(e.rev.split("-")[0]) < conflictedRevNo)
|
||||||
.first()?.rev ?? "";
|
.first()?.rev ?? "";
|
||||||
const result = await this.plugin.localDatabase.mergeObject(
|
const result = await this.plugin.localDatabase.mergeObject(
|
||||||
path,
|
doc.path,
|
||||||
commonBase,
|
commonBase,
|
||||||
doc._rev,
|
doc._rev,
|
||||||
conflictedRev
|
conflictedRev
|
||||||
|
|||||||
+1
-1
Submodule src/lib updated: 7c3d7547e2...2a0dd3c3ac
@@ -106,7 +106,6 @@ export class ModuleObsidianMenu extends AbstractObsidianModule implements IObsid
|
|||||||
}
|
}
|
||||||
$everyOnload(): Promise<boolean> {
|
$everyOnload(): Promise<boolean> {
|
||||||
this.app.workspace.onLayoutReady(this.core.$$onLiveSyncReady.bind(this.core));
|
this.app.workspace.onLayoutReady(this.core.$$onLiveSyncReady.bind(this.core));
|
||||||
// eslint-disable-next-line no-unused-labels
|
|
||||||
return Promise.resolve(true);
|
return Promise.resolve(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ export class ModuleDev extends AbstractObsidianModule implements IObsidianModule
|
|||||||
|
|
||||||
$everyOnloadAfterLoadSettings(): Promise<boolean> {
|
$everyOnloadAfterLoadSettings(): Promise<boolean> {
|
||||||
if (!this.settings.enableDebugTools) return Promise.resolve(true);
|
if (!this.settings.enableDebugTools) return Promise.resolve(true);
|
||||||
// eslint-disable-next-line no-unused-labels
|
|
||||||
this.onMissingTranslation = this.onMissingTranslation.bind(this);
|
this.onMissingTranslation = this.onMissingTranslation.bind(this);
|
||||||
__onMissingTranslation((key) => {
|
__onMissingTranslation((key) => {
|
||||||
void this.onMissingTranslation(key);
|
void this.onMissingTranslation(key);
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ export class TestPaneView extends ItemView {
|
|||||||
return "Self-hosted LiveSync Test and Results";
|
return "Self-hosted LiveSync Test and Results";
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line require-await
|
|
||||||
async onOpen() {
|
async onOpen() {
|
||||||
this.component = new TestPaneComponent({
|
this.component = new TestPaneComponent({
|
||||||
target: this.contentEl,
|
target: this.contentEl,
|
||||||
@@ -42,7 +41,6 @@ export class TestPaneView extends ItemView {
|
|||||||
await Promise.resolve();
|
await Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line require-await
|
|
||||||
async onClose() {
|
async onClose() {
|
||||||
this.component?.$destroy();
|
this.component?.$destroy();
|
||||||
await Promise.resolve();
|
await Promise.resolve();
|
||||||
|
|||||||
Reference in New Issue
Block a user