mirror of
https://github.com/ankitects/anki.git
synced 2025-11-08 21:57:12 -05:00
* Add componentHook functionality
* Register package NoteEditor
* Rename OldEditorAdapter to NoteEditor
* Expose instances in component-hook as well
* Rename NoteTypeButtons to NotetypeButtons
* Move PreviewButton initialization to BrowserEditor.svelte
* Remove focusInRichText
- Same thing can be done by inspecting activeInput
* Satisfy formatter
* Fix remaining rebase issues
* Add .bazel to .prettierignore
* Rename currentField and activeInput to focused{Field,Input}
* Move identifier to lib and registration to sveltelib
* Fix Dynamic component insertion
* Simplify editingInputIsRichText
* Give extra warning in svelte/svelte.ts
- This was caused by doing a rename of a files, that only differed in
case: NoteTypeButtons.svelte to NotetypeButtons.svelte
- It was quite tough to figure out, and this console.log might make it
easier if it ever happens again
* Change signature of contextProperty
* Add ts/typings for add-on definition files
* Add Anki types in typings/common/index.d.ts
* Export without .svelte suffix
It conflicts with how Svelte types its packages
* Fix left over .svelte import from editor.py
* Rename NoteTypeButtons to unrelated to ensure case-only rename
* Rename back to NotetypeButtons.svelte
* Remove unused component-hook.ts, Fix typing in lifecycle-hooks
* Merge runtime-require and register-package into one file
+ Give some preliminary types to require
* Rename uiDidLoad to loaded
* Fix eslint / svelte-check
* Rename context imports to noteEditorContext
* Fix import name mismatch
- I wonder why these issues are not caught by svelte-check?
* Rename two missed usages of uiDidLoad
* Fix ButtonDropdown from having wrong border-radius
* Uniformly rename libraries to packages
- I don't have a strong opinion on whether to name them libraries or
packages, I just think we should have a uniform name.
- JS/TS only uses the terms "module" and "namespace", however `package`
is a reserved keyword for future use, whereas `library` is not.
* Refactor registration.ts into dynamic-slotting
- This is part of an effort to refactor the dynamic slotting (extending
buttons) functionality out of components like ButtonGroup.
* Remove dynamically-slottable logic from ButtonToolbar
* Use DynamicallySlottable in editor-toolbar
* Fix no border radius on indentation button dropdown
* Fix AddonButtons
* Remove Item/ButtonGroupItem in deck-options, where it's not necessary
* Remove unnecessary uses of Item and ButtonGroupItem
* Fix remaining tests
* Fix relative imports
* Revert change return value of remapBinToSrcDir to ./bazel/out...
* Remove typings directory
* Adjust comments for dynamic-slottings
107 lines
3.9 KiB
Svelte
107 lines
3.9 KiB
Svelte
<!--
|
|
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 TitledContainer from "./TitledContainer.svelte";
|
|
import EnumSelectorRow from "./EnumSelectorRow.svelte";
|
|
import DynamicallySlottable from "../components/DynamicallySlottable.svelte";
|
|
import Item from "../components/Item.svelte";
|
|
|
|
import type { DeckOptionsState } from "./lib";
|
|
import { reviewMixChoices } from "./strings";
|
|
|
|
export let state: DeckOptionsState;
|
|
export let api: Record<string, never>;
|
|
|
|
let config = state.currentConfig;
|
|
let defaults = state.defaults;
|
|
|
|
let currentDeck = "\n\n" + tr.deckConfigDisplayOrderWillUseCurrentDeck();
|
|
|
|
const newGatherPriorityChoices = [
|
|
tr.deckConfigNewGatherPriorityDeck(),
|
|
tr.deckConfigNewGatherPriorityPositionLowestFirst(),
|
|
tr.deckConfigNewGatherPriorityPositionHighestFirst(),
|
|
];
|
|
const newSortOrderChoices = [
|
|
tr.deckConfigSortOrderCardTemplateThenLowestPosition(),
|
|
tr.deckConfigSortOrderCardTemplateThenHighestPosition(),
|
|
tr.deckConfigSortOrderCardTemplateThenRandom(),
|
|
tr.deckConfigSortOrderLowestPosition(),
|
|
tr.deckConfigSortOrderHighestPosition(),
|
|
tr.deckConfigSortOrderRandom(),
|
|
tr.deckConfigSortOrderTemplateThenGather(),
|
|
tr.deckConfigSortOrderGather(),
|
|
];
|
|
const reviewOrderChoices = [
|
|
tr.deckConfigSortOrderDueDateThenRandom(),
|
|
tr.deckConfigSortOrderDueDateThenDeck(),
|
|
tr.deckConfigSortOrderDeckThenDueDate(),
|
|
tr.deckConfigSortOrderAscendingIntervals(),
|
|
tr.deckConfigSortOrderDescendingIntervals(),
|
|
tr.deckConfigSortOrderAscendingEase(),
|
|
tr.deckConfigSortOrderDescendingEase(),
|
|
];
|
|
</script>
|
|
|
|
<TitledContainer title={tr.deckConfigOrderingTitle()}>
|
|
<DynamicallySlottable slotHost={Item} {api}>
|
|
<Item>
|
|
<EnumSelectorRow
|
|
bind:value={$config.newCardGatherPriority}
|
|
defaultValue={defaults.newCardGatherPriority}
|
|
choices={newGatherPriorityChoices}
|
|
markdownTooltip={tr.deckConfigNewGatherPriorityTooltip() + currentDeck}
|
|
>
|
|
{tr.deckConfigNewGatherPriority()}
|
|
</EnumSelectorRow>
|
|
</Item>
|
|
|
|
<Item>
|
|
<EnumSelectorRow
|
|
bind:value={$config.newCardSortOrder}
|
|
defaultValue={defaults.newCardSortOrder}
|
|
choices={newSortOrderChoices}
|
|
markdownTooltip={tr.deckConfigNewCardSortOrderTooltip() + currentDeck}
|
|
>
|
|
{tr.deckConfigNewCardSortOrder()}
|
|
</EnumSelectorRow>
|
|
</Item>
|
|
|
|
<Item>
|
|
<EnumSelectorRow
|
|
bind:value={$config.newMix}
|
|
defaultValue={defaults.newMix}
|
|
choices={reviewMixChoices()}
|
|
markdownTooltip={tr.deckConfigNewReviewPriorityTooltip() + currentDeck}
|
|
>
|
|
{tr.deckConfigNewReviewPriority()}
|
|
</EnumSelectorRow>
|
|
</Item>
|
|
|
|
<Item>
|
|
<EnumSelectorRow
|
|
bind:value={$config.interdayLearningMix}
|
|
defaultValue={defaults.interdayLearningMix}
|
|
choices={reviewMixChoices()}
|
|
markdownTooltip={tr.deckConfigInterdayStepPriorityTooltip() +
|
|
currentDeck}
|
|
>
|
|
{tr.deckConfigInterdayStepPriority()}
|
|
</EnumSelectorRow>
|
|
</Item>
|
|
|
|
<Item>
|
|
<EnumSelectorRow
|
|
bind:value={$config.reviewOrder}
|
|
defaultValue={defaults.reviewOrder}
|
|
choices={reviewOrderChoices}
|
|
markdownTooltip={tr.deckConfigReviewSortOrderTooltip() + currentDeck}
|
|
>
|
|
{tr.deckConfigReviewSortOrder()}
|
|
</EnumSelectorRow>
|
|
</Item>
|
|
</DynamicallySlottable>
|
|
</TitledContainer>
|