mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
Add "Show duplicates" to LabelContainer
This commit is contained in:
parent
afff4fc437
commit
fffeedc59c
3 changed files with 18 additions and 5 deletions
|
@ -127,7 +127,7 @@ class Editor:
|
|||
|
||||
# then load page
|
||||
self.web.stdHtml(
|
||||
"", # % tr.editing_show_duplicates(),
|
||||
"",
|
||||
css=["css/editor.css"],
|
||||
js=["js/editor.js"],
|
||||
context=self,
|
||||
|
|
|
@ -28,6 +28,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import * as tr from "../lib/ftl";
|
||||
import EditingArea from "./EditingArea.svelte";
|
||||
import LabelContainer from "./LabelContainer.svelte";
|
||||
import LabelDescription from "./LabelDescription.svelte";
|
||||
|
@ -44,6 +45,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
export let content: Writable<string>;
|
||||
export let field: FieldData;
|
||||
export let autofocus = false;
|
||||
export let dupes = false;
|
||||
|
||||
export let api: (Partial<EditorFieldAPI> & Destroyable) | undefined = undefined;
|
||||
|
||||
|
@ -75,7 +77,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
on:focusout
|
||||
on:click={() => editingArea.focus?.()}
|
||||
>
|
||||
<LabelContainer>
|
||||
<LabelContainer --label-color={dupes ? "var(--flag1-bg)" : "transparent"}>
|
||||
<span>
|
||||
<LabelName>
|
||||
{field.name}
|
||||
|
@ -84,6 +86,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
<LabelDescription description={field.description} />
|
||||
{/if}
|
||||
</span>
|
||||
{#if dupes}
|
||||
<span class="dupes" on:click={() => globalThis.pycmd("dupes")}
|
||||
>{tr.editingShowDuplicates()}
|
||||
</span>
|
||||
{/if}
|
||||
<FieldState><slot name="field-state" /></FieldState>
|
||||
</LabelContainer>
|
||||
<EditingArea
|
||||
|
@ -113,4 +120,12 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
box-shadow: 0 0 0 3px var(--focus-shadow);
|
||||
}
|
||||
}
|
||||
|
||||
.dupes {
|
||||
cursor: pointer;
|
||||
color: var(--highlight-fg);
|
||||
&:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -283,6 +283,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
{field}
|
||||
content={fieldStores[index]}
|
||||
autofocus={index === focusTo}
|
||||
dupes={cols[index] === "dupe"}
|
||||
api={fields[index]}
|
||||
on:focusin={() => {
|
||||
$currentField = fields[index];
|
||||
|
@ -294,9 +295,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
`blur:${index}:${getNoteId()}:${get(fieldStores[index])}`,
|
||||
);
|
||||
}}
|
||||
--label-color={cols[index] === "dupe"
|
||||
? "var(--flag1-bg)"
|
||||
: "transparent"}
|
||||
>
|
||||
<svelte:fragment slot="field-state">
|
||||
<RichTextBadge bind:off={richTextsHidden[index]} />
|
||||
|
|
Loading…
Reference in a new issue