diff --git a/ftl/core/editing.ftl b/ftl/core/editing.ftl index 585ec5f0f..a49fe3db9 100644 --- a/ftl/core/editing.ftl +++ b/ftl/core/editing.ftl @@ -9,6 +9,7 @@ editing-cards = Cards editing-center = Center editing-change-color = Change color editing-cloze-deletion = Cloze deletion +editing-cloze-deletion-repeat = Repeat cloze deletion editing-couldnt-record-audio-have-you-installed = Couldn't record audio. Have you installed 'lame'? editing-customize-card-templates = Customize Card Templates editing-customize-fields = Customize Fields diff --git a/qt/aqt/editor.py b/qt/aqt/editor.py index 68c1cc299..ad6094009 100644 --- a/qt/aqt/editor.py +++ b/qt/aqt/editor.py @@ -1387,7 +1387,7 @@ def set_cloze_button(editor: Editor) -> None: action = "show" if editor.note.note_type()["type"] == MODEL_CLOZE else "hide" editor.web.eval( 'require("anki/ui").loaded.then(() =>' - f'require("anki/NoteEditor").instances[0].toolbar.templateButtons.{action}("cloze")' + f'require("anki/NoteEditor").instances[0].toolbar.toolbar.{action}("cloze")' "); " ) diff --git a/ts/BUILD.bazel b/ts/BUILD.bazel index e2679ea7f..9fb25671a 100644 --- a/ts/BUILD.bazel +++ b/ts/BUILD.bazel @@ -35,3 +35,11 @@ alias( name = "node", actual = "@nodejs//:node", ) + +filegroup( + name = "ts", + srcs = [ + "//ts/icons", + ], + visibility = ["//ts:__subpackages__"], +) diff --git a/ts/editor/BUILD.bazel b/ts/editor/BUILD.bazel index 389b7b61b..ca17ca28c 100644 --- a/ts/editor/BUILD.bazel +++ b/ts/editor/BUILD.bazel @@ -47,6 +47,7 @@ _esbuild_deps = [ "//sass:button_mixins_lib", "@npm//@mdi", "@npm//bootstrap-icons", + "//ts/icons", "@npm//protobufjs", ] diff --git a/ts/editor/editor-toolbar/BlockButtons.svelte b/ts/editor/editor-toolbar/BlockButtons.svelte index 1f0e93845..6bf7ba478 100644 --- a/ts/editor/editor-toolbar/BlockButtons.svelte +++ b/ts/editor/editor-toolbar/BlockButtons.svelte @@ -12,7 +12,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html } from "../../components/ButtonGroupItem.svelte"; import DynamicallySlottable from "../../components/DynamicallySlottable.svelte"; import IconButton from "../../components/IconButton.svelte"; - import Item from "../../components/Item.svelte"; import Shortcut from "../../components/Shortcut.svelte"; import WithDropdown from "../../components/WithDropdown.svelte"; import { getListItem } from "../../lib/dom"; @@ -92,73 +91,69 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html - - - {@html justifyLeftIcon} + + {@html justifyLeftIcon} - {@html justifyCenterIcon} + {@html justifyCenterIcon} - {@html justifyRightIcon} + {@html justifyRightIcon} - {@html justifyFullIcon} - - + {@html justifyFullIcon} + - - - - {@html outdentIcon} - + + + {@html outdentIcon} + - + - - {@html indentIcon} - + + {@html indentIcon} + - - - + + diff --git a/ts/editor/editor-toolbar/ClozeButton.svelte b/ts/editor/editor-toolbar/ClozeButtons.svelte similarity index 58% rename from ts/editor/editor-toolbar/ClozeButton.svelte rename to ts/editor/editor-toolbar/ClozeButtons.svelte index 2041b60d2..28bf8fa3a 100644 --- a/ts/editor/editor-toolbar/ClozeButton.svelte +++ b/ts/editor/editor-toolbar/ClozeButtons.svelte @@ -5,6 +5,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html - - {@html ellipseIcon} - + + + {@html incrementClozeIcon} + - onCloze(event.detail.originalEvent)} -/> + + + + {@html clozeIcon} + + + + diff --git a/ts/editor/editor-toolbar/EditorToolbar.svelte b/ts/editor/editor-toolbar/EditorToolbar.svelte index 455b3f7d9..cd00895bc 100644 --- a/ts/editor/editor-toolbar/EditorToolbar.svelte +++ b/ts/editor/editor-toolbar/EditorToolbar.svelte @@ -56,6 +56,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import Item from "../../components/Item.svelte"; import StickyContainer from "../../components/StickyContainer.svelte"; import BlockButtons from "./BlockButtons.svelte"; + import ClozeButtons from "./ClozeButtons.svelte"; import InlineButtons from "./InlineButtons.svelte"; import NotetypeButtons from "./NotetypeButtons.svelte"; import TemplateButtons from "./TemplateButtons.svelte"; @@ -105,6 +106,10 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html + + + + diff --git a/ts/editor/editor-toolbar/TemplateButtons.svelte b/ts/editor/editor-toolbar/TemplateButtons.svelte index a6e311ea3..528b9368c 100644 --- a/ts/editor/editor-toolbar/TemplateButtons.svelte +++ b/ts/editor/editor-toolbar/TemplateButtons.svelte @@ -20,7 +20,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import { context } from "../NoteEditor.svelte"; import { setFormat } from "../old-editor-adapter"; import { editingInputIsRichText } from "../rich-text-input"; - import ClozeButton from "./ClozeButton.svelte"; import { micIcon, paperclipIcon } from "./icons"; import LatexButton from "./LatexButton.svelte"; @@ -116,10 +115,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html /> - - - - diff --git a/ts/editor/editor-toolbar/icons.ts b/ts/editor/editor-toolbar/icons.ts index 70647187b..0bc292d07 100644 --- a/ts/editor/editor-toolbar/icons.ts +++ b/ts/editor/editor-toolbar/icons.ts @@ -24,7 +24,8 @@ export { default as underlineIcon } from "bootstrap-icons/icons/type-underline.s export const arrowIcon = ''; -export { default as ellipseIcon } from "@mdi/svg/svg/contain.svg"; +export { default as incrementClozeIcon } from "../../icons/contain-plus.svg"; +export { default as clozeIcon } from "@mdi/svg/svg/contain.svg"; export { default as functionIcon } from "@mdi/svg/svg/function-variant.svg"; export { default as paperclipIcon } from "@mdi/svg/svg/paperclip.svg"; export { default as micIcon } from "bootstrap-icons/icons/mic.svg"; diff --git a/ts/icons/BUILD.bazel b/ts/icons/BUILD.bazel new file mode 100644 index 000000000..d5a816504 --- /dev/null +++ b/ts/icons/BUILD.bazel @@ -0,0 +1,9 @@ +load("@build_bazel_rules_nodejs//:index.bzl", "js_library") + +js_library( + name = "icons", + srcs = glob([ + "*.svg", + ]), + visibility = ["//visibility:public"], +) diff --git a/ts/icons/contain-plus.svg b/ts/icons/contain-plus.svg new file mode 100644 index 000000000..c815e09c7 --- /dev/null +++ b/ts/icons/contain-plus.svg @@ -0,0 +1 @@ + diff --git a/ts/tsconfig.json b/ts/tsconfig.json index 42a371ec7..0e9fbf09d 100644 --- a/ts/tsconfig.json +++ b/ts/tsconfig.json @@ -12,7 +12,8 @@ { "path": "reviewer" }, { "path": "lib" }, { "path": "domlib" }, - { "path": "sveltelib" } + { "path": "sveltelib" }, + { "path": "icons" } ], "compilerOptions": { "declaration": true,