a8d4774cdb
* 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
41 lines
1.3 KiB
TypeScript
41 lines
1.3 KiB
TypeScript
// Copyright: Ankitects Pty Ltd and contributors
|
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
import { setupI18n, ModuleName } from "../lib/i18n";
|
|
import { notetypes, empty } from "../lib/proto";
|
|
import { checkNightMode } from "../lib/nightmode";
|
|
import { ChangeNotetypeState } from "./lib";
|
|
|
|
import ChangeNotetypePage from "./ChangeNotetypePage.svelte";
|
|
import "./change-notetype-base.css";
|
|
|
|
const notetypeNames = notetypes.getNotetypeNames(empty);
|
|
const i18n = setupI18n({
|
|
modules: [ModuleName.ACTIONS, ModuleName.CHANGE_NOTETYPE, ModuleName.KEYBOARD],
|
|
});
|
|
|
|
export async function setupChangeNotetypePage(
|
|
oldNotetypeId: number,
|
|
newNotetypeId: number,
|
|
): Promise<ChangeNotetypePage> {
|
|
const changeNotetypeInfo = notetypes.getChangeNotetypeInfo({
|
|
oldNotetypeId,
|
|
newNotetypeId,
|
|
});
|
|
const [names, info] = await Promise.all([notetypeNames, changeNotetypeInfo, i18n]);
|
|
|
|
checkNightMode();
|
|
|
|
const state = new ChangeNotetypeState(names, info);
|
|
return new ChangeNotetypePage({
|
|
target: document.body,
|
|
props: { state },
|
|
});
|
|
}
|
|
|
|
// use #testXXXX where XXXX is notetype ID to test
|
|
if (window.location.hash.startsWith("#test")) {
|
|
const ntid = parseInt(window.location.hash.substr("#test".length), 10);
|
|
setupChangeNotetypePage(ntid, ntid);
|
|
}
|