diff --git a/qt/aqt/data/web/js/reviewer.ts b/qt/aqt/data/web/js/reviewer.ts index fe9935e87..d56d09fe7 100644 --- a/qt/aqt/data/web/js/reviewer.ts +++ b/qt/aqt/data/web/js/reviewer.ts @@ -61,14 +61,17 @@ async function _updateQA( onShownHook = [onshown]; const qa = document.getElementById("qa")!; - const renderError = (kind: string) => (error: Error): void => { - const errorMessage = String(error).substring(0, 2000); - const errorStack = String(error.stack).substring(0, 2000); - qa.innerHTML = `Invalid ${kind} on card: ${errorMessage}\n${errorStack}`.replace( - /\n/g, - "
" - ); - }; + const renderError = + (kind: string) => + (error: Error): void => { + const errorMessage = String(error).substring(0, 2000); + const errorStack = String(error.stack).substring(0, 2000); + qa.innerHTML = + `Invalid ${kind} on card: ${errorMessage}\n${errorStack}`.replace( + /\n/g, + "
" + ); + }; // hide current card qa.style.opacity = "0"; diff --git a/ts/components/ButtonDropdown.svelte b/ts/components/ButtonDropdown.svelte index 530defa1a..622ac521d 100644 --- a/ts/components/ButtonDropdown.svelte +++ b/ts/components/ButtonDropdown.svelte @@ -18,6 +18,17 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html setContext(dropdownKey, null); + + + + + + - - - - - - diff --git a/ts/components/ButtonGroup.svelte b/ts/components/ButtonGroup.svelte index 5f8de7614..9ce4b3f25 100644 --- a/ts/components/ButtonGroup.svelte +++ b/ts/components/ButtonGroup.svelte @@ -24,12 +24,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html return { detach, position }; } - const { - registerComponent, - items, - dynamicItems, - getDynamicInterface, - } = makeInterface(makeRegistration); + const { registerComponent, items, dynamicItems, getDynamicInterface } = + makeInterface(makeRegistration); $: for (const [index, item] of $items.entries()) { if ($items.length === 1) { @@ -49,9 +45,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html let buttonGroupRef: HTMLDivElement; $: if (api && buttonGroupRef) { - const { addComponent, updateRegistration } = getDynamicInterface( - buttonGroupRef - ); + const { addComponent, updateRegistration } = + getDynamicInterface(buttonGroupRef); const insertButton = (button: SvelteComponent, position: Identifier = 0) => addComponent(button, (added, parent) => insert(added, parent, position)); @@ -78,20 +73,13 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html } - -
+ role="group" +> {#each $dynamicItems as item} @@ -99,3 +87,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html {/each}
+ + diff --git a/ts/components/ButtonGroupItem.svelte b/ts/components/ButtonGroupItem.svelte index 937ef66db..6d4ea0f97 100644 --- a/ts/components/ButtonGroupItem.svelte +++ b/ts/components/ButtonGroupItem.svelte @@ -44,9 +44,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html detach.subscribe((value: boolean) => (detached = value)); position.subscribe((value: ButtonPosition) => (position_ = value)); } else if (hasContext(buttonGroupKey)) { - const registerComponent = getContext>( - buttonGroupKey - ); + const registerComponent = + getContext>(buttonGroupKey); const { detach, position } = registerComponent(); detach.subscribe((value: boolean) => (detached = value)); position.subscribe((value: ButtonPosition) => (position_ = value)); diff --git a/ts/components/ButtonToolbar.svelte b/ts/components/ButtonToolbar.svelte index 66b2f1571..8b43a1480 100644 --- a/ts/components/ButtonToolbar.svelte +++ b/ts/components/ButtonToolbar.svelte @@ -24,9 +24,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html return { detach }; } - const { registerComponent, dynamicItems, getDynamicInterface } = makeInterface( - makeRegistration - ); + const { registerComponent, dynamicItems, getDynamicInterface } = + makeInterface(makeRegistration); setContext(buttonToolbarKey, registerComponent); @@ -34,9 +33,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html let buttonToolbarRef: HTMLDivElement; $: if (buttonToolbarRef && api) { - const { addComponent, updateRegistration } = getDynamicInterface( - buttonToolbarRef - ); + const { addComponent, updateRegistration } = + getDynamicInterface(buttonToolbarRef); const insertGroup = (group: SvelteComponent, position: Identifier = 0) => addComponent(group, (added, parent) => insert(added, parent, position)); @@ -68,7 +66,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html {id} class={`btn-toolbar ${className}`} class:flex-nowrap={nowrap} - role="toolbar"> + role="toolbar" +> {#each $dynamicItems as item} diff --git a/ts/components/ButtonToolbarItem.svelte b/ts/components/ButtonToolbarItem.svelte index 575f5a1ad..5d77dd16a 100644 --- a/ts/components/ButtonToolbarItem.svelte +++ b/ts/components/ButtonToolbarItem.svelte @@ -20,9 +20,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html const { detach } = registration; detach.subscribe((value: boolean) => (detached = value)); } else if (hasContext(buttonToolbarKey)) { - const registerComponent = getContext>( - buttonToolbarKey - ); + const registerComponent = + getContext>(buttonToolbarKey); const { detach } = registerComponent(); detach.subscribe((value: boolean) => (detached = value)); } else { @@ -30,15 +29,15 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html } - -
+ + diff --git a/ts/components/ColorPicker.svelte b/ts/components/ColorPicker.svelte index b2e8288fd..d29c88fe0 100644 --- a/ts/components/ColorPicker.svelte +++ b/ts/components/ColorPicker.svelte @@ -25,6 +25,20 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html onMount(() => dispatch("mount", { button: buttonRef, input: inputRef })); + + - - diff --git a/ts/components/DropdownItem.svelte b/ts/components/DropdownItem.svelte index 84f3911d9..03b31518c 100644 --- a/ts/components/DropdownItem.svelte +++ b/ts/components/DropdownItem.svelte @@ -20,6 +20,19 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html onMount(() => dispatch("mount", { button: buttonRef })); + + - - diff --git a/ts/components/DropdownMenu.svelte b/ts/components/DropdownMenu.svelte index b3cc9e1b4..8db932f4f 100644 --- a/ts/components/DropdownMenu.svelte +++ b/ts/components/DropdownMenu.svelte @@ -11,13 +11,13 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html setContext(dropdownKey, null); + + - - diff --git a/ts/components/IconButton.svelte b/ts/components/IconButton.svelte index ff594339f..a63c89ecc 100644 --- a/ts/components/IconButton.svelte +++ b/ts/components/IconButton.svelte @@ -29,6 +29,24 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html onMount(() => dispatch("mount", { button: buttonRef })); + + - - diff --git a/ts/components/LabelButton.svelte b/ts/components/LabelButton.svelte index 71082fcb6..74c1c78ee 100644 --- a/ts/components/LabelButton.svelte +++ b/ts/components/LabelButton.svelte @@ -34,6 +34,24 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html onMount(() => dispatch("mount", { button: buttonRef })); + + - - diff --git a/ts/components/SelectButton.svelte b/ts/components/SelectButton.svelte index 4309e4985..35f33f058 100644 --- a/ts/components/SelectButton.svelte +++ b/ts/components/SelectButton.svelte @@ -25,17 +25,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html onMount(() => dispatch("mount", { button: buttonRef })); - - + + diff --git a/ts/components/StickyBar.svelte b/ts/components/StickyBar.svelte index d5aa9f1e5..c6adc0b20 100644 --- a/ts/components/StickyBar.svelte +++ b/ts/components/StickyBar.svelte @@ -8,6 +8,10 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html export { className as class }; + + - - diff --git a/ts/components/WithLabel.svelte b/ts/components/WithLabel.svelte index 29544290a..ac1218942 100644 --- a/ts/components/WithLabel.svelte +++ b/ts/components/WithLabel.svelte @@ -12,16 +12,16 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html export let button: ToolbarItem; - - + + diff --git a/ts/components/WithState.svelte b/ts/components/WithState.svelte index 3ff94d7a8..97d22ee4c 100644 --- a/ts/components/WithState.svelte +++ b/ts/components/WithState.svelte @@ -13,17 +13,15 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html const stateStore = writable(stateMap); function updateAllStateWithCallback(callback: (key: string) => boolean): void { - stateStore.update( - (map: StateMap): StateMap => { - const newMap = new Map() as StateMap; + stateStore.update((map: StateMap): StateMap => { + const newMap = new Map() as StateMap; - for (const key of map.keys()) { - newMap.set(key, callback(key)); - } - - return newMap; + for (const key of map.keys()) { + newMap.set(key, callback(key)); } - ); + + return newMap; + }); } export function updateAllState(event: Event): void { @@ -37,12 +35,10 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html } function updateStateByKey(key: string, event: Event): void { - stateStore.update( - (map: StateMap): StateMap => { - map.set(key, updaterMap.get(key)!(event)); - return map; - } - ); + stateStore.update((map: StateMap): StateMap => { + map.set(key, updaterMap.get(key)!(event)); + return map; + }); } diff --git a/ts/components/WithTheming.svelte b/ts/components/WithTheming.svelte index 8b088b224..6cb3b5603 100644 --- a/ts/components/WithTheming.svelte +++ b/ts/components/WithTheming.svelte @@ -9,12 +9,12 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html export let style: string; +
+ +
+ - -
- -
diff --git a/ts/congrats/CongratsPage.svelte b/ts/congrats/CongratsPage.svelte index 2aabc5d84..f2a5fc9d5 100644 --- a/ts/congrats/CongratsPage.svelte +++ b/ts/congrats/CongratsPage.svelte @@ -23,22 +23,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html }); - -

{congrats}

@@ -74,3 +58,19 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html {/if}
+ + diff --git a/ts/deckoptions/AdvancedOptions.svelte b/ts/deckoptions/AdvancedOptions.svelte index 625b8efe2..d445cf014 100644 --- a/ts/deckoptions/AdvancedOptions.svelte +++ b/ts/deckoptions/AdvancedOptions.svelte @@ -21,7 +21,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html min={1} max={365 * 100} defaultValue={defaults.maximumReviewInterval} - bind:value={$config.maximumReviewInterval} /> + bind:value={$config.maximumReviewInterval} +/> ($config.initialEase = evt.detail.value)} /> + on:changed={(evt) => ($config.initialEase = evt.detail.value)} +/> ($config.easyMultiplier = evt.detail.value)} /> + on:changed={(evt) => ($config.easyMultiplier = evt.detail.value)} +/> ($config.intervalMultiplier = evt.detail.value)} /> + on:changed={(evt) => ($config.intervalMultiplier = evt.detail.value)} +/> ($config.hardMultiplier = evt.detail.value)} /> + on:changed={(evt) => ($config.hardMultiplier = evt.detail.value)} +/> ($config.lapseMultiplier = evt.detail.value)} /> + on:changed={(evt) => ($config.lapseMultiplier = evt.detail.value)} +/> diff --git a/ts/deckoptions/BuryOptions.svelte b/ts/deckoptions/BuryOptions.svelte index 11cacca33..7786f3119 100644 --- a/ts/deckoptions/BuryOptions.svelte +++ b/ts/deckoptions/BuryOptions.svelte @@ -18,10 +18,12 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html label={tr.deckConfigBuryNewSiblings()} tooltip={tr.deckConfigBuryTooltip()} defaultValue={defaults.buryNew} - bind:value={$config.buryNew} /> + bind:value={$config.buryNew} +/> + bind:value={$config.buryReviews} +/> diff --git a/ts/deckoptions/CheckBox.svelte b/ts/deckoptions/CheckBox.svelte index ad5b4cdf1..20dec648c 100644 --- a/ts/deckoptions/CheckBox.svelte +++ b/ts/deckoptions/CheckBox.svelte @@ -12,12 +12,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html export let id: string | undefined = undefined; - -
@@ -26,3 +20,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html {/if}
+ + diff --git a/ts/deckoptions/ConfigEditor.svelte b/ts/deckoptions/ConfigEditor.svelte index 9d24dbc57..8f3c143a2 100644 --- a/ts/deckoptions/ConfigEditor.svelte +++ b/ts/deckoptions/ConfigEditor.svelte @@ -16,6 +16,19 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html export let state: DeckOptionsState; +
+ + + + + {#if state.v3Scheduler} + + {/if} + + + +
+ - -
- - - - - {#if state.v3Scheduler} - - {/if} - - - -
diff --git a/ts/deckoptions/ConfigEntry.svelte b/ts/deckoptions/ConfigEntry.svelte index fe4a251ba..c2d1abf88 100644 --- a/ts/deckoptions/ConfigEntry.svelte +++ b/ts/deckoptions/ConfigEntry.svelte @@ -21,6 +21,32 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html $: renderedTooltip = marked(tooltip); +
+ {#if label} +
+ + {label} + {#if renderedTooltip} + + {/if} + +
+ {/if} + +
+ + +
+ +
+ {#each warnings as warning} + {#if warning} +
{warning}
+ {/if} + {/each} +
+
+ - -
- {#if label} -
- - {label} - {#if renderedTooltip} - - {/if} - -
- {/if} - -
- - -
- -
- {#each warnings as warning} - {#if warning} -
{warning}
- {/if} - {/each} -
-
diff --git a/ts/deckoptions/ConfigSelector.svelte b/ts/deckoptions/ConfigSelector.svelte index fdd7681a0..44cb5920f 100644 --- a/ts/deckoptions/ConfigSelector.svelte +++ b/ts/deckoptions/ConfigSelector.svelte @@ -64,13 +64,15 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html title="Add Config" prompt="Name" onOk={onAddConfig} - bind:modalKey={addModalKey} /> + bind:modalKey={addModalKey} +/> + bind:modalKey={renameModalKey} +/> @@ -82,7 +84,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html {#each $configList as entry} + selected={entry.current} + > {configLabel(entry)} {/each} diff --git a/ts/deckoptions/DailyLimits.svelte b/ts/deckoptions/DailyLimits.svelte index bed449940..fa197f4d7 100644 --- a/ts/deckoptions/DailyLimits.svelte +++ b/ts/deckoptions/DailyLimits.svelte @@ -41,7 +41,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html min={0} warnings={[newCardsGreaterThanParent]} defaultValue={defaults.newPerDay} - bind:value={$config.newPerDay} /> + bind:value={$config.newPerDay} +/> + bind:value={$config.reviewsPerDay} +/> diff --git a/ts/deckoptions/DisplayOrder.svelte b/ts/deckoptions/DisplayOrder.svelte index 940721597..d06e9a5ff 100644 --- a/ts/deckoptions/DisplayOrder.svelte +++ b/ts/deckoptions/DisplayOrder.svelte @@ -37,32 +37,37 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html tooltip={tr.deckConfigNewGatherPriorityTooltip()} choices={newGatherPriorityChoices} defaultValue={defaults.newCardGatherPriority} - bind:value={$config.newCardGatherPriority} /> + bind:value={$config.newCardGatherPriority} +/> + bind:value={$config.newCardSortOrder} +/> + bind:value={$config.newMix} +/> + bind:value={$config.interdayLearningMix} +/> + bind:value={$config.reviewOrder} +/> diff --git a/ts/deckoptions/GeneralOptions.svelte b/ts/deckoptions/GeneralOptions.svelte index b1a0c1638..e1b2729e7 100644 --- a/ts/deckoptions/GeneralOptions.svelte +++ b/ts/deckoptions/GeneralOptions.svelte @@ -21,24 +21,28 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html min={30} max={600} defaultValue={defaults.capAnswerTimeToSecs} - bind:value={$config.capAnswerTimeToSecs} /> + bind:value={$config.capAnswerTimeToSecs} +/> + bind:value={$config.showTimer} +/>

{tr.deckConfigAudioTitle()}

+ bind:value={$config.disableAutoplay} +/> + bind:value={$config.skipQuestionWhenReplayingAnswer} +/> diff --git a/ts/deckoptions/HelpPopup.svelte b/ts/deckoptions/HelpPopup.svelte index 15ccc9c15..ddb1265d8 100644 --- a/ts/deckoptions/HelpPopup.svelte +++ b/ts/deckoptions/HelpPopup.svelte @@ -20,13 +20,13 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html }); + + {@html infoCircle} + + - - - {@html infoCircle} - diff --git a/ts/deckoptions/LapseOptions.svelte b/ts/deckoptions/LapseOptions.svelte index cda0ced36..2fee6b80f 100644 --- a/ts/deckoptions/LapseOptions.svelte +++ b/ts/deckoptions/LapseOptions.svelte @@ -35,7 +35,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html tooltip={tr.deckConfigRelearningStepsTooltip()} defaultValue={defaults.relearnSteps} value={$config.relearnSteps} - on:changed={(evt) => ($config.relearnSteps = evt.detail.value)} /> + on:changed={(evt) => ($config.relearnSteps = evt.detail.value)} + /> + bind:value={$config.minimumLapseInterval} + /> + bind:value={$config.leechThreshold} + /> + bind:value={$config.leechAction} + /> diff --git a/ts/deckoptions/NewOptions.svelte b/ts/deckoptions/NewOptions.svelte index ea43288e5..a2e680bd7 100644 --- a/ts/deckoptions/NewOptions.svelte +++ b/ts/deckoptions/NewOptions.svelte @@ -42,25 +42,29 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html tooltip={tr.deckConfigLearningStepsTooltip()} defaultValue={defaults.learnSteps} value={$config.learnSteps} - on:changed={(evt) => ($config.learnSteps = evt.detail.value)} /> + on:changed={(evt) => ($config.learnSteps = evt.detail.value)} +/> + bind:value={$config.graduatingIntervalGood} +/> + bind:value={$config.graduatingIntervalEasy} +/> + bind:value={$config.newCardInsertOrder} +/> diff --git a/ts/deckoptions/RevertButton.svelte b/ts/deckoptions/RevertButton.svelte index 9f7afaa50..29176ff95 100644 --- a/ts/deckoptions/RevertButton.svelte +++ b/ts/deckoptions/RevertButton.svelte @@ -48,6 +48,17 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html } +{#if modified} +
+ {@html revertIcon} +
+{/if} + - -{#if modified} -
- {@html revertIcon} -
-{/if} diff --git a/ts/deckoptions/SaveButton.svelte b/ts/deckoptions/SaveButton.svelte index 5a5002f38..f1c29c327 100644 --- a/ts/deckoptions/SaveButton.svelte +++ b/ts/deckoptions/SaveButton.svelte @@ -56,8 +56,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html - dispatch('add')}>Add Config - dispatch('rename')}> + dispatch("add")}>Add Config + dispatch("rename")}> Rename Config Remove Config diff --git a/ts/deckoptions/SpinBox.svelte b/ts/deckoptions/SpinBox.svelte index efa787ce4..6c9e89017 100644 --- a/ts/deckoptions/SpinBox.svelte +++ b/ts/deckoptions/SpinBox.svelte @@ -29,5 +29,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html {max} bind:value class="form-control" - on:blur={checkMinMax} /> + on:blur={checkMinMax} + /> diff --git a/ts/deckoptions/SpinBoxFloat.svelte b/ts/deckoptions/SpinBoxFloat.svelte index 34f4912a6..812cac01a 100644 --- a/ts/deckoptions/SpinBoxFloat.svelte +++ b/ts/deckoptions/SpinBoxFloat.svelte @@ -38,5 +38,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html step="0.01" value={stringValue} on:blur={update} - class="form-control" /> + class="form-control" + /> diff --git a/ts/deckoptions/StepsInput.svelte b/ts/deckoptions/StepsInput.svelte index a8ef674ee..55c528192 100644 --- a/ts/deckoptions/StepsInput.svelte +++ b/ts/deckoptions/StepsInput.svelte @@ -36,6 +36,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html {defaultValue} {warnings} wholeLine={value.length > 2} - on:revert={revert}> + on:revert={revert} +> diff --git a/ts/deckoptions/TextInputModal.svelte b/ts/deckoptions/TextInputModal.svelte index 8d132941b..4571c28f3 100644 --- a/ts/deckoptions/TextInputModal.svelte +++ b/ts/deckoptions/TextInputModal.svelte @@ -47,6 +47,53 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html const nightMode = getContext(nightModeKey); + + - - diff --git a/ts/deckoptions/lib.test.ts b/ts/deckoptions/lib.test.ts index 7daa3d0e7..05f85b880 100644 --- a/ts/deckoptions/lib.test.ts +++ b/ts/deckoptions/lib.test.ts @@ -33,8 +33,7 @@ const exampleData = { leechAction: "LEECH_ACTION_TAG_ONLY", leechThreshold: 8, capAnswerTimeToSecs: 60, - other: - "eyJuZXciOnsic2VwYXJhdGUiOnRydWV9LCJyZXYiOnsiZnV6eiI6MC4wNSwibWluU3BhY2UiOjF9fQ==", + other: "eyJuZXciOnsic2VwYXJhdGUiOnRydWV9LCJyZXYiOnsiZnV6eiI6MC4wNSwibWluU3BhY2UiOjF9fQ==", }, }, useCount: 1, diff --git a/ts/deckoptions/lib.ts b/ts/deckoptions/lib.ts index f31af59f3..8a9e456af 100644 --- a/ts/deckoptions/lib.ts +++ b/ts/deckoptions/lib.ts @@ -71,7 +71,8 @@ export class DeckOptionsState { constructor(targetDeckId: number, data: pb.BackendProto.DeckConfigsForUpdate) { this.targetDeckId = targetDeckId; - this.currentDeck = data.currentDeck as pb.BackendProto.DeckConfigsForUpdate.CurrentDeck; + this.currentDeck = + data.currentDeck as pb.BackendProto.DeckConfigsForUpdate.CurrentDeck; this.defaults = data.defaults!.config! as ConfigInner; this.configs = data.allConfig.map((config) => { const configInner = config.config as pb.BackendProto.DeckConfig; diff --git a/ts/editor/ClozeButton.svelte b/ts/editor/ClozeButton.svelte index ecd8a1984..003eb0191 100644 --- a/ts/editor/ClozeButton.svelte +++ b/ts/editor/ClozeButton.svelte @@ -41,11 +41,12 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html } - + + on:mount={createShortcut} + > {@html bracketsIcon} diff --git a/ts/editor/ColorButtons.svelte b/ts/editor/ColorButtons.svelte index d0cf27d6f..beea69bb3 100644 --- a/ts/editor/ColorButtons.svelte +++ b/ts/editor/ColorButtons.svelte @@ -36,23 +36,28 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html - + + on:mount={createShortcut} + > {@html squareFillIcon} - + + on:mount={createShortcut} + /> diff --git a/ts/editor/FormatBlockButtons.svelte b/ts/editor/FormatBlockButtons.svelte index 3585b8469..358b02ad5 100644 --- a/ts/editor/FormatBlockButtons.svelte +++ b/ts/editor/FormatBlockButtons.svelte @@ -48,16 +48,18 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html document.queryCommandState('insertUnorderedList')} + update={() => document.queryCommandState("insertUnorderedList")} let:state={active} - let:updateState> + let:updateState + > { - document.execCommand('insertUnorderedList'); + document.execCommand("insertUnorderedList"); updateState(event); - }}> + }} + > {@html ulIcon} @@ -66,16 +68,18 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html document.queryCommandState('insertOrderedList')} + update={() => document.queryCommandState("insertOrderedList")} let:state={active} - let:updateState> + let:updateState + > { - document.execCommand('insertOrderedList'); + document.execCommand("insertOrderedList"); updateState(event); - }}> + }} + > {@html olIcon} @@ -93,16 +97,18 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html document.queryCommandState('justifyLeft')} + update={() => document.queryCommandState("justifyLeft")} let:state={active} - let:updateState> + let:updateState + > { - document.execCommand('justifyLeft'); + document.execCommand("justifyLeft"); updateState(event); - }}> + }} + > {@html justifyLeftIcon} @@ -111,16 +117,19 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html document.queryCommandState('justifyCenter')} + update={() => + document.queryCommandState("justifyCenter")} let:state={active} - let:updateState> + let:updateState + > { - document.execCommand('justifyCenter'); + document.execCommand("justifyCenter"); updateState(event); - }}> + }} + > {@html justifyCenterIcon} @@ -129,16 +138,19 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html document.queryCommandState('justifyRight')} + update={() => + document.queryCommandState("justifyRight")} let:state={active} - let:updateState> + let:updateState + > { - document.execCommand('justifyRight'); + document.execCommand("justifyRight"); updateState(event); - }}> + }} + > {@html justifyRightIcon} @@ -147,16 +159,18 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html document.queryCommandState('justifyFull')} + update={() => document.queryCommandState("justifyFull")} let:state={active} - let:updateState> + let:updateState + > { - document.execCommand('justifyFull'); + document.execCommand("justifyFull"); updateState(event); - }}> + }} + > {@html justifyFullIcon} @@ -169,7 +183,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html + tooltip={tr.editingOutdent()} + > {@html outdentIcon} @@ -177,7 +192,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html + tooltip={tr.editingIndent()} + > {@html indentIcon} diff --git a/ts/editor/FormatInlineButtons.svelte b/ts/editor/FormatInlineButtons.svelte index cc773e378..156317a20 100644 --- a/ts/editor/FormatInlineButtons.svelte +++ b/ts/editor/FormatInlineButtons.svelte @@ -26,20 +26,22 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html - + document.queryCommandState('bold')} + update={() => document.queryCommandState("bold")} let:state={active} - let:updateState> + let:updateState + > { - document.execCommand('bold'); + document.execCommand("bold"); updateState(event); }} - on:mount={createShortcut}> + on:mount={createShortcut} + > {@html boldIcon} @@ -47,20 +49,22 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html - + document.queryCommandState('italic')} + update={() => document.queryCommandState("italic")} let:state={active} - let:updateState> + let:updateState + > { - document.execCommand('italic'); + document.execCommand("italic"); updateState(event); }} - on:mount={createShortcut}> + on:mount={createShortcut} + > {@html italicIcon} @@ -68,20 +72,25 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html - + document.queryCommandState('underline')} + update={() => document.queryCommandState("underline")} let:state={active} - let:updateState> + let:updateState + > { - document.execCommand('underline'); + document.execCommand("underline"); updateState(event); }} - on:mount={createShortcut}> + on:mount={createShortcut} + > {@html underlineIcon} @@ -89,20 +98,25 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html - + document.queryCommandState('superscript')} + update={() => document.queryCommandState("superscript")} let:state={active} - let:updateState> + let:updateState + > { - document.execCommand('superscript'); + document.execCommand("superscript"); updateState(event); }} - on:mount={createShortcut}> + on:mount={createShortcut} + > {@html superscriptIcon} @@ -110,20 +124,22 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html - + document.queryCommandState('subscript')} + update={() => document.queryCommandState("subscript")} let:state={active} - let:updateState> + let:updateState + > { - document.execCommand('subscript'); + document.execCommand("subscript"); updateState(event); }} - on:mount={createShortcut}> + on:mount={createShortcut} + > {@html subscriptIcon} @@ -131,13 +147,17 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html - + { - document.execCommand('removeFormat'); + document.execCommand("removeFormat"); }} - on:mount={createShortcut}> + on:mount={createShortcut} + > {@html eraserIcon} diff --git a/ts/editor/NoteTypeButtons.svelte b/ts/editor/NoteTypeButtons.svelte index edd1c89af..4017464bd 100644 --- a/ts/editor/NoteTypeButtons.svelte +++ b/ts/editor/NoteTypeButtons.svelte @@ -19,18 +19,20 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html bridgeCommand('fields')}> + on:click={() => bridgeCommand("fields")} + > {tr.editingFields()}... - + bridgeCommand('cards')} - on:mount={createShortcut}> + on:click={() => bridgeCommand("cards")} + on:mount={createShortcut} + > {tr.editingCards()}... diff --git a/ts/editor/PreviewButton.svelte b/ts/editor/PreviewButton.svelte index 13b16e7a6..6f1f0a198 100644 --- a/ts/editor/PreviewButton.svelte +++ b/ts/editor/PreviewButton.svelte @@ -10,12 +10,13 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import LabelButton from "components/LabelButton.svelte"; - + bridgeCommand('preview')} - on:mount={createShortcut}> + on:click={() => bridgeCommand("preview")} + on:mount={createShortcut} + > {tr.actionsPreview()} diff --git a/ts/editor/TemplateButtons.svelte b/ts/editor/TemplateButtons.svelte index bec728d26..264399e72 100644 --- a/ts/editor/TemplateButtons.svelte +++ b/ts/editor/TemplateButtons.svelte @@ -36,22 +36,27 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html - + + on:mount={createShortcut} + > {@html paperclipIcon} - + + on:mount={createShortcut} + > {@html micIcon} @@ -69,72 +74,84 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html + let:shortcutLabel + > wrap('\\(', '\\)')} - on:mount={createShortcut}> + on:click={() => wrap("\\(", "\\)")} + on:mount={createShortcut} + > {tr.editingMathjaxInline()} {shortcutLabel} + let:shortcutLabel + > wrap('\\[', '\\]')} - on:mount={createShortcut}> + on:click={() => wrap("\\[", "\\]")} + on:mount={createShortcut} + > {tr.editingMathjaxBlock()} {shortcutLabel} + let:shortcutLabel + > wrap('\\(\\ce{', '}\\)')} - on:mount={createShortcut}> + on:click={() => wrap("\\(\\ce{", "}\\)")} + on:mount={createShortcut} + > {tr.editingMathjaxChemistry()} {shortcutLabel} + let:shortcutLabel + > wrap('[latex]', '[/latex]')} - on:mount={createShortcut}> + on:click={() => wrap("[latex]", "[/latex]")} + on:mount={createShortcut} + > {tr.editingLatex()} {shortcutLabel} + let:shortcutLabel + > wrap('[$]', '[/$]')} - on:mount={createShortcut}> + on:click={() => wrap("[$]", "[/$]")} + on:mount={createShortcut} + > {tr.editingLatexEquation()} {shortcutLabel} + let:shortcutLabel + > wrap('[$$]', '[/$$]')} - on:mount={createShortcut}> + on:click={() => wrap("[$$]", "[/$$]")} + on:mount={createShortcut} + > {tr.editingLatexMathEnv()} {shortcutLabel} @@ -144,11 +161,12 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html - + + on:mount={createShortcut} + > {@html xmlIcon} diff --git a/ts/editor/helpers.ts b/ts/editor/helpers.ts index 6d752e752..871feb1c7 100644 --- a/ts/editor/helpers.ts +++ b/ts/editor/helpers.ts @@ -78,25 +78,25 @@ export function caretToEnd(currentField: EditingArea): void { selection.addRange(range); } -const getAnchorParent = ( - predicate: (element: Element) => element is T -) => (currentField: DocumentOrShadowRoot): T | null => { - const anchor = currentField.getSelection()?.anchorNode; +const getAnchorParent = + (predicate: (element: Element) => element is T) => + (currentField: DocumentOrShadowRoot): T | null => { + const anchor = currentField.getSelection()?.anchorNode; - if (!anchor) { - return null; - } + if (!anchor) { + return null; + } - let anchorParent: T | null = null; - let element = nodeIsElement(anchor) ? anchor : anchor.parentElement; + let anchorParent: T | null = null; + let element = nodeIsElement(anchor) ? anchor : anchor.parentElement; - while (element) { - anchorParent = anchorParent || (predicate(element) ? element : null); - element = element.parentElement; - } + while (element) { + anchorParent = anchorParent || (predicate(element) ? element : null); + element = element.parentElement; + } - return anchorParent; -}; + return anchorParent; + }; const isListItem = (element: Element): element is HTMLLIElement => window.getComputedStyle(element).display === "list-item"; diff --git a/ts/graphs/AxisTicks.svelte b/ts/graphs/AxisTicks.svelte index 1c3a90970..01737cf50 100644 --- a/ts/graphs/AxisTicks.svelte +++ b/ts/graphs/AxisTicks.svelte @@ -8,12 +8,12 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html export let bounds: GraphBounds; + + + + - - - - diff --git a/ts/graphs/CardCounts.svelte b/ts/graphs/CardCounts.svelte index 614bde6b3..198938796 100644 --- a/ts/graphs/CardCounts.svelte +++ b/ts/graphs/CardCounts.svelte @@ -28,8 +28,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html bounds.width = 225; bounds.marginBottom = 0; - let graphData = (null as unknown) as GraphData; - let tableData = (null as unknown) as TableDatum[]; + let graphData = null as unknown as GraphData; + let tableData = null as unknown as TableDatum[]; $: { graphData = gatherData(sourceData, $cardCountsSeparateInactive); @@ -40,6 +40,52 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html const total = tr2.statisticsCountsTotalCards(); + + + + + +
+ + + +
+ + {#each tableData as d, _idx} + + + + + + + {/each} + + + + + +
+ ■  + {#if browserLinksSupported} + dispatch('search', { query: d.query })}>{d.label} + {:else} + {d.label} + {/if} + {d.count}{d.percent}
{total}{graphData.totalCards} +
+
+
+
+ - - - - - - -
- - - -
- - {#each tableData as d, _idx} - - - - - - - {/each} - - - - - -
- ■  - {#if browserLinksSupported} - dispatch('search', { query: d.query })}>{d.label} - {:else} - {d.label} - {/if} - {d.count}{d.percent}
{total}{graphData.totalCards} -
-
-
-
diff --git a/ts/graphs/CumulativeOverlay.svelte b/ts/graphs/CumulativeOverlay.svelte index 39d40409f..88222f514 100644 --- a/ts/graphs/CumulativeOverlay.svelte +++ b/ts/graphs/CumulativeOverlay.svelte @@ -1,3 +1,5 @@ + +