mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-03-29 05:05:17 +00:00
### New Features - Automatic display-language changing according to the Obsidian language setting. - Now we can limit files to be synchronised even in the hidden files. - "Use Request API to avoid `inevitable` CORS problem" has been implemented. - `Show status icon instead of file warnings banner` has been implemented. ### Improved - All regular expressions can be inverted by prefixing `!!` now. ### Fixed - No longer unexpected files will be gathered during hidden file sync. - No longer broken `\n` and new-line characters during the bucket synchronisation. - We can purge the remote bucket again if we using MinIO instead of AWS S3 or Cloudflare R2. - Purging the remote bucket is now more reliable. - Some wrong messages have been fixed. ### Behaviour changed - Entering into the deeper directories to gather the hidden files is now limited by `/` or `\/` prefixed ignore filters. ### Etcetera - Some code has been tidied up. - Trying less warning-suppressing and be more safer-coding. - Dependent libraries have been updated to the latest version. - Some build processes have been separated to `pre` and `post` processes.
106 lines
3.0 KiB
Svelte
106 lines
3.0 KiB
Svelte
<script lang="ts">
|
|
import type { CustomRegExpSource } from "../../../lib/src/common/types";
|
|
import { isInvertedRegExp, isValidRegExp } from "../../../lib/src/common/utils";
|
|
|
|
export let patterns = [] as CustomRegExpSource[];
|
|
export let originals = [] as CustomRegExpSource[];
|
|
|
|
export let apply: (args: CustomRegExpSource[]) => Promise<void> = (_: CustomRegExpSource[]) => Promise.resolve();
|
|
function revert() {
|
|
patterns = [...originals];
|
|
}
|
|
const CHECK_OK = "✔";
|
|
const CHECK_NG = "⚠";
|
|
const MARK_MODIFIED = "✏ ";
|
|
function checkRegExp(pattern: CustomRegExpSource) {
|
|
return isValidRegExp(pattern) ? CHECK_OK : CHECK_NG;
|
|
}
|
|
$: statusName = patterns.map((e) => checkRegExp(e));
|
|
$: modified = patterns.map((e, i) => (e != (originals?.[i] ?? "") ? MARK_MODIFIED : ""));
|
|
$: isInvertedExp = patterns.map((e) => isInvertedRegExp(e));
|
|
function remove(idx: number) {
|
|
patterns[idx] = "" as CustomRegExpSource;
|
|
}
|
|
function add() {
|
|
patterns = [...patterns, "" as CustomRegExpSource];
|
|
}
|
|
</script>
|
|
|
|
<ul>
|
|
{#each patterns as pattern, idx}
|
|
<!-- svelte-ignore a11y-label-has-associated-control -->
|
|
<li>
|
|
<label>{modified[idx]}{statusName[idx]}</label>
|
|
<span class="chip">{isInvertedExp[idx] ? "INVERTED" : ""}</span>
|
|
<input type="text" bind:value={pattern} class={modified[idx]} />
|
|
<button class="iconbutton" on:click={() => remove(idx)}>🗑</button>
|
|
</li>
|
|
{/each}
|
|
<li>
|
|
<label>
|
|
<button on:click={() => add()}>Add</button>
|
|
</label>
|
|
</li>
|
|
<li class="buttons">
|
|
<button
|
|
on:click={() => apply(patterns)}
|
|
disabled={statusName.some((e) => e === CHECK_NG) || modified.every((e) => e === "")}
|
|
>Apply
|
|
</button>
|
|
<button
|
|
on:click={() => revert()}
|
|
disabled={statusName.some((e) => e === CHECK_NG) || modified.every((e) => e === "")}
|
|
>Revert
|
|
</button>
|
|
</li>
|
|
</ul>
|
|
|
|
<style>
|
|
label {
|
|
min-width: 4em;
|
|
width: 4em;
|
|
display: inline-flex;
|
|
flex-direction: row;
|
|
justify-content: flex-end;
|
|
}
|
|
|
|
ul {
|
|
flex-grow: 1;
|
|
display: inline-flex;
|
|
flex-direction: column;
|
|
list-style-type: none;
|
|
margin-block-start: 0;
|
|
margin-block-end: 0;
|
|
margin-inline-start: 0;
|
|
margin-inline-end: 0;
|
|
padding-inline-start: 0;
|
|
}
|
|
|
|
li {
|
|
padding: var(--size-2-1) var(--size-4-1);
|
|
display: inline-flex;
|
|
flex-grow: 1;
|
|
align-items: center;
|
|
justify-content: flex-end;
|
|
gap: var(--size-4-2);
|
|
}
|
|
|
|
li input {
|
|
min-width: 10em;
|
|
}
|
|
|
|
button.iconbutton {
|
|
max-width: 4em;
|
|
}
|
|
.chip {
|
|
background-color: var(--tag-background);
|
|
color: var(--tag-color);
|
|
padding: var(--size-2-1) var(--size-4-1);
|
|
border-radius: 0.5em;
|
|
font-size: 0.8em;
|
|
}
|
|
.chip:empty {
|
|
display: none;
|
|
}
|
|
</style>
|