mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Reimplement "Show Duplicates" button in editor (#1550)
* Add "Show duplicates" to LabelContainer
* Avoid bubbling down the duplicate logic into EditorField
* Move duplicate link into its own slot
to center it between name/description and field-state.
* Revert "Move duplicate link into its own slot"
This reverts commit 3a4511042d
.
* Justify dupes within FieldState
to achieve the same result as before while avoiding additional logic within EditorField.
Co-Authored-By: Henrik Giesel <hengiesel@gmail.com>
This commit is contained in:
parent
4966f3cc44
commit
cc5ba4ed84
4 changed files with 33 additions and 2 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,
|
||||
|
|
25
ts/editor/DuplicateLink.svelte
Normal file
25
ts/editor/DuplicateLink.svelte
Normal file
|
@ -0,0 +1,25 @@
|
|||
<!--
|
||||
Copyright: Ankitects Pty Ltd and contributors
|
||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
-->
|
||||
<script lang="ts">
|
||||
import * as tr from "../lib/ftl";
|
||||
import { bridgeCommand } from "../lib/bridgecommand";
|
||||
</script>
|
||||
|
||||
<a
|
||||
class="duplicate-link"
|
||||
href="/#"
|
||||
tabindex="-1"
|
||||
on:click={() => bridgeCommand("dupes")}
|
||||
>
|
||||
{tr.editingShowDuplicates()}
|
||||
</a>
|
||||
|
||||
<style lang="scss">
|
||||
.duplicate-link {
|
||||
color: var(--highlight-color);
|
||||
text-align: center;
|
||||
flex-grow: 1;
|
||||
}
|
||||
</style>
|
|
@ -2,13 +2,15 @@
|
|||
Copyright: Ankitects Pty Ltd and contributors
|
||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
-->
|
||||
<span class="field-state justify-content-between">
|
||||
<span class="field-state justify-content-end">
|
||||
<slot />
|
||||
</span>
|
||||
|
||||
<style lang="scss">
|
||||
.field-state {
|
||||
display: flex;
|
||||
justify-content: flex;
|
||||
flex-grow: 1;
|
||||
|
||||
& > :global(*) {
|
||||
margin-left: 2px;
|
||||
|
|
|
@ -50,6 +50,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
import Notification from "./Notification.svelte";
|
||||
import Absolute from "../components/Absolute.svelte";
|
||||
import Badge from "../components/Badge.svelte";
|
||||
import DuplicateLink from "./DuplicateLink.svelte";
|
||||
|
||||
import DecoratedElements from "./DecoratedElements.svelte";
|
||||
import RichTextInput from "./RichTextInput.svelte";
|
||||
|
@ -299,6 +300,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
: "transparent"}
|
||||
>
|
||||
<svelte:fragment slot="field-state">
|
||||
{#if cols[index] === "dupe"}
|
||||
<DuplicateLink />
|
||||
{/if}
|
||||
<RichTextBadge bind:off={richTextsHidden[index]} />
|
||||
<PlainTextBadge bind:off={plainTextsHidden[index]} />
|
||||
{#if stickies}
|
||||
|
|
Loading…
Reference in a new issue