diff --git a/ftl/core/editing.ftl b/ftl/core/editing.ftl
index c6ef0fa73..41084e61f 100644
--- a/ftl/core/editing.ftl
+++ b/ftl/core/editing.ftl
@@ -19,7 +19,6 @@ editing-fields = Fields
editing-float-left = Float left
editing-float-right = Float right
editing-float-none = No float
-editing-html-editor = HTML Editor
editing-indent = Increase indent
editing-italic-text = Italic text
editing-jump-to-tags-with-ctrlandshiftandt = Jump to tags with Ctrl+Shift+T
@@ -44,10 +43,13 @@ editing-subscript = Subscript
editing-superscript = Superscript
editing-tags = Tags
editing-to-make-a-cloze-deletion-on = To make a cloze deletion on an existing note, you need to change it to a cloze type first, via 'Notes>Change Note Type'
+editing-toggle-html-editor = Toggle HTML Editor
editing-toggle-sticky = Toggle sticky
+editing-toggle-visual-editor = Toggle Visual Editor
editing-underline-text = Underline text
editing-unordered-list = Unordered list
editing-warning-cloze-deletions-will-not-work = Warning, cloze deletions will not work until you switch the type at the top to Cloze.
## You don't need to translate these strings, as they will be replaced with different ones soon.
+editing-html-editor = HTML Editor
diff --git a/qt/aqt/addcards.py b/qt/aqt/addcards.py
index b8cf5b206..39a352fed 100644
--- a/qt/aqt/addcards.py
+++ b/qt/aqt/addcards.py
@@ -77,7 +77,6 @@ class AddCards(QMainWindow):
self,
editor_mode=aqt.editor.EditorMode.ADD_CARDS,
)
- self.editor.web.eval("noteEditorPromise.then(() => activateStickyShortcuts());")
def setup_choosers(self) -> None:
defaults = self.col.defaults_for_adding(
diff --git a/qt/aqt/browser/card_info.py b/qt/aqt/browser/card_info.py
index 01424f8ec..54f44c0bd 100644
--- a/qt/aqt/browser/card_info.py
+++ b/qt/aqt/browser/card_info.py
@@ -63,15 +63,11 @@ class CardInfoDialog(QDialog):
layout.addWidget(buttons)
qconnect(buttons.rejected, self.reject)
self.setLayout(layout)
-
- self.web.eval(
- "const cardInfo = anki.cardInfo(document.getElementById('main'));"
- )
self.update_card(card_id)
def update_card(self, card_id: CardId | None) -> None:
self.web.eval(
- f"cardInfo.then((c) => c.$set({{ cardId: {json.dumps(card_id)} }}));"
+ f"anki.cardInfoPromise.then((c) => c.$set({{ cardId: {json.dumps(card_id)} }}));"
)
def reject(self) -> None:
diff --git a/qt/aqt/changenotetype.py b/qt/aqt/changenotetype.py
index 51bfcfade..bf22e382f 100644
--- a/qt/aqt/changenotetype.py
+++ b/qt/aqt/changenotetype.py
@@ -59,8 +59,7 @@ class ChangeNotetypeDialog(QDialog):
self.setLayout(layout)
self.web.eval(
- f"""anki.changeNotetypePage(
- document.getElementById('main'), {notetype_id}, {notetype_id});"""
+ f"""anki.setupChangeNotetypePage({notetype_id}, {notetype_id});"""
)
self.setWindowTitle(tr.browsing_change_notetype())
diff --git a/qt/aqt/deckoptions.py b/qt/aqt/deckoptions.py
index ad3b83607..ff8258839 100644
--- a/qt/aqt/deckoptions.py
+++ b/qt/aqt/deckoptions.py
@@ -51,8 +51,7 @@ class DeckOptionsDialog(QDialog):
self.setLayout(layout)
self.web.eval(
- f"""const $deckOptions = anki.deckOptions(
- document.getElementById('main'), {self._deck["id"]});"""
+ f"""const $deckOptions = anki.setupDeckOptions({self._deck["id"]});"""
)
self.setWindowTitle(
without_unicode_isolation(tr.actions_options_for(val=self._deck["name"]))
diff --git a/ts/BUILD.bazel b/ts/BUILD.bazel
index f4dc180d0..e2679ea7f 100644
--- a/ts/BUILD.bazel
+++ b/ts/BUILD.bazel
@@ -15,6 +15,7 @@ exports_files([
"jest.config.js",
"package.json",
"protobuf-no-long.js",
+ "page.html",
])
# a copy needs to be placed in bazel-bin for libs with
diff --git a/ts/card-info/BUILD.bazel b/ts/card-info/BUILD.bazel
index 447dfe6bc..5f8829d95 100644
--- a/ts/card-info/BUILD.bazel
+++ b/ts/card-info/BUILD.bazel
@@ -2,12 +2,15 @@ load("//ts:prettier.bzl", "prettier_test")
load("//ts:eslint.bzl", "eslint_test")
load("//ts/svelte:svelte.bzl", "compile_svelte", "svelte_check")
load("//ts:esbuild.bzl", "esbuild")
+load("//ts:generate_page.bzl", "generate_page")
load("//ts:compile_sass.bzl", "compile_sass")
load("//ts:typescript.bzl", "typescript")
+generate_page(page = "card-info")
+
compile_sass(
- srcs = ["card-info-base.scss"],
group = "base_css",
+ srcs = ["card-info-base.scss"],
visibility = ["//visibility:public"],
deps = [
"//sass:base_lib",
@@ -17,8 +20,8 @@ compile_sass(
)
_ts_deps = [
- "//ts/components",
"//ts/lib",
+ "//ts/components",
"@npm//@fluent",
]
@@ -50,8 +53,6 @@ esbuild(
],
)
-exports_files(["card-info.html"])
-
# Tests
################
diff --git a/ts/card-info/card-info.html b/ts/card-info/card-info.html
deleted file mode 100644
index 3b47d574f..000000000
--- a/ts/card-info/card-info.html
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ts/card-info/index.ts b/ts/card-info/index.ts
index 2473c285f..eedd3bccc 100644
--- a/ts/card-info/index.ts
+++ b/ts/card-info/index.ts
@@ -5,11 +5,23 @@ import { setupI18n, ModuleName } from "../lib/i18n";
import { checkNightMode } from "../lib/nightmode";
import CardInfo from "./CardInfo.svelte";
+import "./card-info-base.css";
-export async function cardInfo(target: HTMLDivElement): Promise {
+const i18n = setupI18n({
+ modules: [ModuleName.CARD_STATS, ModuleName.SCHEDULING, ModuleName.STATISTICS],
+});
+
+export async function setupCardInfo(): Promise {
checkNightMode();
- await setupI18n({
- modules: [ModuleName.CARD_STATS, ModuleName.SCHEDULING, ModuleName.STATISTICS],
- });
- return new CardInfo({ target });
+ await i18n;
+
+ return new CardInfo({ target: document.body, props: { includeRevlog: true } });
+}
+
+export const cardInfoPromise = setupCardInfo();
+
+if (window.location.hash.startsWith("#test")) {
+ // use #testXXXX where XXXX is card ID to test
+ const cardId = parseInt(window.location.hash.substr("#test".length), 10);
+ cardInfoPromise.then((cardInfo: CardInfo): void => cardInfo.$set({ cardId }));
}
diff --git a/ts/change-notetype/BUILD.bazel b/ts/change-notetype/BUILD.bazel
index e04a7b4e3..9653221cc 100644
--- a/ts/change-notetype/BUILD.bazel
+++ b/ts/change-notetype/BUILD.bazel
@@ -2,10 +2,13 @@ load("//ts:prettier.bzl", "prettier_test")
load("//ts:eslint.bzl", "eslint_test")
load("//ts/svelte:svelte.bzl", "compile_svelte", "svelte_check")
load("//ts:esbuild.bzl", "esbuild")
+load("//ts:generate_page.bzl", "generate_page")
load("//ts:compile_sass.bzl", "compile_sass")
load("//ts:typescript.bzl", "typescript")
load("//ts:jest.bzl", "jest_test")
+generate_page(page = "change-notetype")
+
compile_sass(
srcs = ["change-notetype-base.scss"],
group = "base_css",
@@ -54,8 +57,6 @@ esbuild(
],
)
-exports_files(["change-notetype.html"])
-
# Tests
################
diff --git a/ts/change-notetype/change-notetype.html b/ts/change-notetype/change-notetype.html
deleted file mode 100644
index 90e18ca94..000000000
--- a/ts/change-notetype/change-notetype.html
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ts/change-notetype/index.ts b/ts/change-notetype/index.ts
index eaa5aa639..e82c97492 100644
--- a/ts/change-notetype/index.ts
+++ b/ts/change-notetype/index.ts
@@ -8,10 +8,11 @@
import { ChangeNotetypeState, getChangeNotetypeInfo, getNotetypeNames } from "./lib";
import { setupI18n, ModuleName } from "../lib/i18n";
import { checkNightMode } from "../lib/nightmode";
-import ChangeNotetypePage from "./ChangeNotetypePage.svelte";
-export async function changeNotetypePage(
- target: HTMLDivElement,
+import ChangeNotetypePage from "./ChangeNotetypePage.svelte";
+import "./change-notetype-base.css";
+
+export async function setupChangeNotetypePage(
oldNotetypeId: number,
newNotetypeId: number,
): Promise {
@@ -31,7 +32,13 @@ export async function changeNotetypePage(
const state = new ChangeNotetypeState(names, info);
return new ChangeNotetypePage({
- target,
- props: { state },
- } as any);
+ target: document.body,
+ props: { state } as any,
+ });
+}
+
+// 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);
}
diff --git a/ts/compile_sass.bzl b/ts/compile_sass.bzl
index 713251786..00fb453e2 100644
--- a/ts/compile_sass.bzl
+++ b/ts/compile_sass.bzl
@@ -5,8 +5,6 @@ def compile_sass(group, srcs, deps = [], visibility = ["//visibility:private"]):
for scss_file in srcs:
base = scss_file.replace(".scss", "")
name = base + "_sass"
- css_file = base + ".css"
- css_files.append(css_file)
sass_binary(
name = name,
@@ -22,6 +20,9 @@ def compile_sass(group, srcs, deps = [], visibility = ["//visibility:private"]):
],
)
+ css_file = base + ".css"
+ css_files.append(css_file)
+
native.filegroup(
name = group,
srcs = css_files,
diff --git a/ts/components/WithDropdown.svelte b/ts/components/WithDropdown.svelte
index c797fc88b..2b69c9796 100644
--- a/ts/components/WithDropdown.svelte
+++ b/ts/components/WithDropdown.svelte
@@ -85,12 +85,14 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
api = {
show: dropdown.show.bind(dropdown),
- toggle: dropdown.toggle.bind(dropdown),
+ // TODO this is quite confusing, but commenting this fixes Bootstrap
+ // in the deck-options when not including Bootstrap via
+ toggle: () => {}, // toggle: dropdown.toggle.bind(dropdown),
hide: dropdown.hide.bind(dropdown),
update: dropdown.update.bind(dropdown),
dispose: dropdown.dispose.bind(dropdown),
isVisible,
- };
+ } as any;
return api;
}
diff --git a/ts/congrats/BUILD.bazel b/ts/congrats/BUILD.bazel
index 8c462d734..216ec0c0b 100644
--- a/ts/congrats/BUILD.bazel
+++ b/ts/congrats/BUILD.bazel
@@ -2,12 +2,15 @@ load("//ts:prettier.bzl", "prettier_test")
load("//ts:eslint.bzl", "eslint_test")
load("//ts/svelte:svelte.bzl", "compile_svelte", "svelte_check")
load("//ts:esbuild.bzl", "esbuild")
+load("//ts:generate_page.bzl", "generate_page")
load("//ts:compile_sass.bzl", "compile_sass")
load("//ts:typescript.bzl", "typescript")
+generate_page(page = "congrats")
+
compile_sass(
srcs = ["congrats-base.scss"],
- group = "congrats_css",
+ group = "base_css",
visibility = ["//visibility:public"],
deps = [
"//sass:base_lib",
@@ -20,7 +23,7 @@ compile_svelte(
)
typescript(
- name = "congrats_ts",
+ name = "index",
deps = [
":svelte",
"//ts/components",
@@ -35,19 +38,18 @@ esbuild(
name = "congrats",
args = {
"globalName": "anki",
+ "loader": {".svg": "text"},
},
entry_point = "index.ts",
output_css = "congrats.css",
visibility = ["//visibility:public"],
deps = [
- ":congrats_css",
- ":congrats_ts",
+ ":base_css",
+ ":index",
":svelte",
],
)
-exports_files(["congrats.html"])
-
# Tests
################
diff --git a/ts/congrats/congrats.html b/ts/congrats/congrats.html
deleted file mode 100644
index 023c3f369..000000000
--- a/ts/congrats/congrats.html
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ts/congrats/index.ts b/ts/congrats/index.ts
index 4c4c4c79d..7141665e6 100644
--- a/ts/congrats/index.ts
+++ b/ts/congrats/index.ts
@@ -6,18 +6,27 @@ import { setupI18n, ModuleName } from "../lib/i18n";
import { checkNightMode } from "../lib/nightmode";
import CongratsPage from "./CongratsPage.svelte";
+import "./congrats-base.css";
-export async function congrats(target: HTMLDivElement): Promise {
+const i18n = setupI18n({ modules: [ModuleName.SCHEDULING] });
+
+export async function setupCongrats(): Promise {
checkNightMode();
- await setupI18n({ modules: [ModuleName.SCHEDULING] });
+ await i18n;
+
const info = await getCongratsInfo();
const page = new CongratsPage({
- target,
+ target: document.body,
props: { info },
});
+
setInterval(() => {
getCongratsInfo().then((info) => {
page.$set({ info });
});
}, 60000);
+
+ return page;
}
+
+setupCongrats();
diff --git a/ts/deck-options/BUILD.bazel b/ts/deck-options/BUILD.bazel
index 4c1eb9d8d..0476c2452 100644
--- a/ts/deck-options/BUILD.bazel
+++ b/ts/deck-options/BUILD.bazel
@@ -2,10 +2,13 @@ load("//ts:prettier.bzl", "prettier_test")
load("//ts:eslint.bzl", "eslint_test")
load("//ts/svelte:svelte.bzl", "compile_svelte", "svelte_check")
load("//ts:esbuild.bzl", "esbuild")
+load("//ts:generate_page.bzl", "generate_page")
load("//ts:compile_sass.bzl", "compile_sass")
load("//ts:jest.bzl", "jest_test")
load("//ts:typescript.bzl", "typescript")
+generate_page(page = "deck-options")
+
compile_sass(
srcs = ["deck-options-base.scss"],
group = "base_css",
@@ -26,6 +29,7 @@ _ts_deps = [
"@npm//@popperjs",
"@npm//@types/jest",
"@npm//bootstrap-icons",
+ "@npm//bootstrap",
"@npm//lodash-es",
"@npm//svelte",
"@npm//marked",
@@ -60,8 +64,6 @@ esbuild(
],
)
-exports_files(["deck-options.html"])
-
# Tests
################
@@ -79,11 +81,11 @@ svelte_check(
"//sass:night_mode_lib",
"//sass:breakpoints_lib",
"//sass/bootstrap",
+ "//ts/components",
+ "//ts/sveltelib:sveltelib_pkg",
"@npm//@types/bootstrap",
"@npm//@types/lodash-es",
"@npm//@types/marked",
- "//ts/components",
- "//ts/sveltelib:sveltelib_pkg",
],
)
diff --git a/ts/deck-options/SaveButton.svelte b/ts/deck-options/SaveButton.svelte
index 6b1a4270b..fca32e7b8 100644
--- a/ts/deck-options/SaveButton.svelte
+++ b/ts/deck-options/SaveButton.svelte
@@ -62,7 +62,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
-
+
save(false)}
diff --git a/ts/deck-options/deck-options.html b/ts/deck-options/deck-options.html
deleted file mode 100644
index 0b7c3915e..000000000
--- a/ts/deck-options/deck-options.html
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ts/deck-options/index.ts b/ts/deck-options/index.ts
index 190efe824..1d9955dad 100644
--- a/ts/deck-options/index.ts
+++ b/ts/deck-options/index.ts
@@ -10,41 +10,35 @@ import "../sveltelib/export-runtime";
import { getDeckOptionsInfo, DeckOptionsState } from "./lib";
import { setupI18n, ModuleName } from "../lib/i18n";
import { checkNightMode } from "../lib/nightmode";
-import DeckOptionsPage from "./DeckOptionsPage.svelte";
import { touchDeviceKey, modalsKey } from "../components/context-keys";
-export async function deckOptions(
- target: HTMLDivElement,
- deckId: number,
-): Promise {
- const [info] = await Promise.all([
- getDeckOptionsInfo(deckId),
- setupI18n({
- modules: [
- ModuleName.SCHEDULING,
- ModuleName.ACTIONS,
- ModuleName.DECK_CONFIG,
- ModuleName.KEYBOARD,
- ],
- }),
- ]);
+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(deckId: number): Promise {
+ const [info] = await Promise.all([getDeckOptionsInfo(deckId), i18n]);
checkNightMode();
const context = new Map();
-
- const modals = new Map();
- context.set(modalsKey, modals);
-
- const touchDevice = "ontouchstart" in document.documentElement;
- context.set(touchDeviceKey, touchDevice);
+ context.set(modalsKey, new Map());
+ context.set(touchDeviceKey, "ontouchstart" in document.documentElement);
const state = new DeckOptionsState(deckId, info);
return new DeckOptionsPage({
- target,
+ target: document.body,
props: { state },
context,
- } as any);
+ });
}
import TitledContainer from "./TitledContainer.svelte";
@@ -60,3 +54,7 @@ export const components = {
EnumSelectorRow,
SwitchRow,
};
+
+if (window.location.hash.startsWith("#test")) {
+ setupDeckOptions(1);
+}
diff --git a/ts/editable/content-editable.ts b/ts/editable/content-editable.ts
index 3f2582bb7..658f2e7c9 100644
--- a/ts/editable/content-editable.ts
+++ b/ts/editable/content-editable.ts
@@ -5,6 +5,8 @@ import { on, preventDefault } from "../lib/events";
import { registerShortcut } from "../lib/shortcuts";
import { placeCaretAfterContent } from "../domlib/place-caret";
import { saveSelection, restoreSelection } from "../domlib/location";
+import { isApplePlatform } from "../lib/platform";
+import { bridgeCommand } from "../lib/bridgecommand";
import type { SelectionLocation } from "../domlib/location";
const locationEvents: (() => void)[] = [];
@@ -76,6 +78,10 @@ export function saveLocation(editable: HTMLElement): { destroy(): void } {
};
}
+if (isApplePlatform()) {
+ registerShortcut(() => bridgeCommand("paste"), "Control+Shift+V");
+}
+
export function preventBuiltinContentEditableShortcuts(editable: HTMLElement): void {
for (const keyCombination of ["Control+B", "Control+U", "Control+I", "Control+R"]) {
registerShortcut(preventDefault, keyCombination, editable);
diff --git a/ts/editor/AddTagBadge.svelte b/ts/editor/AddTagBadge.svelte
index fe54aaa15..69158dac0 100644
--- a/ts/editor/AddTagBadge.svelte
+++ b/ts/editor/AddTagBadge.svelte
@@ -7,7 +7,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import Badge from "../components/Badge.svelte";
import { withSpan } from "../components/helpers";
- import { appendInParentheses } from "./helpers";
import { tagIcon, addTagIcon } from "./icons";
const tooltip = "Add tag";
@@ -17,7 +16,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
diff --git a/ts/editor/ColorButtons.svelte b/ts/editor/ColorButtons.svelte
index db751b2d1..600ad54b7 100644
--- a/ts/editor/ColorButtons.svelte
+++ b/ts/editor/ColorButtons.svelte
@@ -14,7 +14,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import { bridgeCommand } from "../lib/bridgecommand";
import { withButton } from "../components/helpers";
import { textColorIcon, highlightColorIcon, arrowIcon } from "./icons";
- import { appendInParentheses, execCommand } from "./helpers";
+ import { execCommand } from "./helpers";
import { getNoteEditor } from "./OldEditorAdapter.svelte";
export let api = {};
@@ -41,10 +41,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
diff --git a/ts/editor/CommandIconButton.svelte b/ts/editor/CommandIconButton.svelte
index 0a9f6c2c2..4404b7c8d 100644
--- a/ts/editor/CommandIconButton.svelte
+++ b/ts/editor/CommandIconButton.svelte
@@ -8,7 +8,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import WithState from "../components/WithState.svelte";
import { withButton } from "../components/helpers";
- import { appendInParentheses, execCommand, queryCommandState } from "./helpers";
+ import { execCommand, queryCommandState } from "./helpers";
import { getNoteEditor } from "./OldEditorAdapter.svelte";
export let key: string;
@@ -49,7 +49,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
{:else if withoutState}
execCommand(key)}
on:mount={withButton(createShortcut)}
@@ -66,7 +66,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
let:updateState
>
{
diff --git a/ts/editor/Components.svelte b/ts/editor/Components.svelte
deleted file mode 100644
index 79687947d..000000000
--- a/ts/editor/Components.svelte
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
diff --git a/ts/editor/FormatBlockButtons.svelte b/ts/editor/FormatBlockButtons.svelte
index 3d0fd1ef0..3400f14c4 100644
--- a/ts/editor/FormatBlockButtons.svelte
+++ b/ts/editor/FormatBlockButtons.svelte
@@ -13,7 +13,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import * as tr from "../lib/ftl";
import { getListItem } from "../lib/dom";
- import { appendInParentheses, execCommand } from "./helpers";
+ import { execCommand } from "./helpers";
import {
ulIcon,
olIcon,
@@ -129,10 +129,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
{@html outdentIcon}
@@ -149,10 +146,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
{@html indentIcon}
diff --git a/ts/editor/NoteCreator.svelte b/ts/editor/NoteCreator.svelte
index fad9e991e..b252d6ee3 100644
--- a/ts/editor/NoteCreator.svelte
+++ b/ts/editor/NoteCreator.svelte
@@ -3,8 +3,12 @@ Copyright: Ankitects Pty Ltd and contributors
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
-->
-
+
+
+
+
+
diff --git a/ts/editor/OldEditorAdapter.svelte b/ts/editor/OldEditorAdapter.svelte
index b18e6d8f1..5cacd0e67 100644
--- a/ts/editor/OldEditorAdapter.svelte
+++ b/ts/editor/OldEditorAdapter.svelte
@@ -52,12 +52,10 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import RichTextBadge from "./RichTextBadge.svelte";
import PlainTextBadge from "./PlainTextBadge.svelte";
- import StickyBadge from "./StickyBadge.svelte";
- import { onMount, onDestroy } from "svelte";
+ import { onMount } from "svelte";
import type { Writable } from "svelte/store";
import { bridgeCommand } from "../lib/bridgecommand";
- import { registerShortcut } from "../lib/shortcuts";
import { isApplePlatform } from "../lib/platform";
import { ChangeTimer } from "./change-timer";
import { alertIcon } from "./icons";
@@ -146,11 +144,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
$tags = ts;
}
- let stickies: boolean[] | null = null;
- export function setSticky(sts: boolean[]): void {
- stickies = sts;
- }
-
let noteId: number | null = null;
export function setNoteId(ntid: number): void {
noteId = ntid;
@@ -203,15 +196,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
}
}
- function toggleStickyAll(): void {
- bridgeCommand("toggleStickyAll", (values: boolean[]) => (stickies = values));
- }
-
- let deregisterSticky: () => void;
- export function activateStickyShortcuts() {
- deregisterSticky = registerShortcut(toggleStickyAll, "Shift+F9");
- }
-
export function focusIfField(x: number, y: number): boolean {
const elements = document.elementsFromPoint(x, y);
const first = elements[0];
@@ -249,6 +233,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
);
import { wrapInternal } from "../lib/wrap";
+ import * as oldEditorAdapter from "./old-editor-adapter";
onMount(() => {
function wrap(before: string, after: string): void {
@@ -270,21 +255,18 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
focusField,
setColorButtons,
setTags,
- setSticky,
setBackgrounds,
setClozeHint,
saveNow: saveFieldNow,
- activateStickyShortcuts,
focusIfField,
setNoteId,
wrap,
+ ...oldEditorAdapter,
});
document.addEventListener("visibilitychange", saveOnPageHide);
return () => document.removeEventListener("visibilitychange", saveOnPageHide);
});
-
- onDestroy(() => deregisterSticky);
@@ -332,9 +314,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
{/if}
- {#if stickies}
-
- {/if}
+
+
diff --git a/ts/editor/PlainTextBadge.svelte b/ts/editor/PlainTextBadge.svelte
index c0783bf43..6495c759e 100644
--- a/ts/editor/PlainTextBadge.svelte
+++ b/ts/editor/PlainTextBadge.svelte
@@ -4,7 +4,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
-->
-
+
{@html icon}{@html icon}
diff --git a/ts/editor/RichTextBadge.svelte b/ts/editor/RichTextBadge.svelte
index 1ceceec65..0dda59372 100644
--- a/ts/editor/RichTextBadge.svelte
+++ b/ts/editor/RichTextBadge.svelte
@@ -4,6 +4,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
-->
-
- {@html icon}
+
+ {@html icon}