mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00

* Add _bytes methods for all methods in the backend Expose get_note in qt/aqt/mediasrv.py * Satisfy formatter * Rename _bytes function to _raw and have them bytes as input * Fix backend generation * Use lib/proto/deckOptions in deck-options * Add exposed_backend to qt/aqt/mediasrv.py * Move some more backend methods to exposed_backend_list * Use protobufjs for congrats and i18n * Use protobufjs for completeTag * Use protobufjs services in change-notetype * Reorder post handlers in alphabetical manner * Satisfy tests * Remove unused collection methods * Rename access_backend to raw_backend_request * Use _vendor.stringcase instead of creating a new function * Remove SKIP_UNROLL_OUTPUT * Directly call _run_command in non _raw methods * Remove TranslateString, ChangeNotetype and CompleteTag from SKIP_UNROLL_INPUT * Remove UpdateDeckConfigs from SKIP_UNROLL_INPUT * Remove ChangeNotetype from SKIP_UNROLL_INPUT * Remove SKIP_UNROLL_INPUT * Fix typing issue with translate_string - Adds typing support for Protobuf maps in genbackend.py * Do not emit convenience method for protobuf TranslateString
64 lines
1.7 KiB
TypeScript
64 lines
1.7 KiB
TypeScript
// Copyright: Ankitects Pty Ltd and contributors
|
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
/* eslint
|
|
@typescript-eslint/no-explicit-any: "off",
|
|
*/
|
|
|
|
import "../sveltelib/export-runtime";
|
|
|
|
import { DeckOptionsState } from "./lib";
|
|
import { setupI18n, ModuleName } from "../lib/i18n";
|
|
import { deckConfig } from "../lib/proto";
|
|
import { checkNightMode } from "../lib/nightmode";
|
|
import { touchDeviceKey, modalsKey } from "../components/context-keys";
|
|
|
|
import DeckOptionsPage from "./DeckOptionsPage.svelte";
|
|
import "./deck-options-base.css";
|
|
|
|
const i18n = setupI18n({
|
|
modules: [
|
|
ModuleName.SCHEDULING,
|
|
ModuleName.ACTIONS,
|
|
ModuleName.DECK_CONFIG,
|
|
ModuleName.KEYBOARD,
|
|
],
|
|
});
|
|
|
|
export async function setupDeckOptions(did: number): Promise<DeckOptionsPage> {
|
|
const [info] = await Promise.all([
|
|
deckConfig.getDeckConfigsForUpdate({ did }),
|
|
i18n,
|
|
]);
|
|
|
|
checkNightMode();
|
|
|
|
const context = new Map();
|
|
context.set(modalsKey, new Map());
|
|
context.set(touchDeviceKey, "ontouchstart" in document.documentElement);
|
|
|
|
const state = new DeckOptionsState(did, info);
|
|
return new DeckOptionsPage({
|
|
target: document.body,
|
|
props: { state },
|
|
context,
|
|
});
|
|
}
|
|
|
|
import TitledContainer from "./TitledContainer.svelte";
|
|
import SpinBoxRow from "./SpinBoxRow.svelte";
|
|
import SpinBoxFloatRow from "./SpinBoxFloatRow.svelte";
|
|
import EnumSelectorRow from "./EnumSelectorRow.svelte";
|
|
import SwitchRow from "./SwitchRow.svelte";
|
|
|
|
export const components = {
|
|
TitledContainer,
|
|
SpinBoxRow,
|
|
SpinBoxFloatRow,
|
|
EnumSelectorRow,
|
|
SwitchRow,
|
|
};
|
|
|
|
if (window.location.hash.startsWith("#test")) {
|
|
setupDeckOptions(1);
|
|
}
|