diff --git a/proto/anki/frontend.proto b/proto/anki/frontend.proto index 021322383..17090fe1e 100644 --- a/proto/anki/frontend.proto +++ b/proto/anki/frontend.proto @@ -43,6 +43,7 @@ service FrontendService { rpc RecordAudio(generic.Empty) returns (generic.String); rpc CloseAddCards(generic.Bool) returns (generic.Empty); rpc CloseEditCurrent(generic.Empty) returns (generic.Empty); + rpc OpenLink(generic.String) returns (generic.Empty); // Profile config rpc GetProfileConfigJson(generic.String) returns (generic.Json); diff --git a/qt/aqt/mediasrv.py b/qt/aqt/mediasrv.py index 1bc7cce8b..f973394a0 100644 --- a/qt/aqt/mediasrv.py +++ b/qt/aqt/mediasrv.py @@ -40,7 +40,7 @@ from aqt.operations import on_op_finished from aqt.operations.deck import update_deck_configs as update_deck_configs_op from aqt.progress import ProgressUpdate from aqt.qt import * -from aqt.utils import aqt_data_path, show_warning, tr +from aqt.utils import aqt_data_path, openLink, show_warning, tr # https://forums.ankiweb.net/t/anki-crash-when-using-a-specific-deck/22266 waitress.wasyncore._DISCONNECTED = waitress.wasyncore._DISCONNECTED.union({EPROTOTYPE}) # type: ignore @@ -830,6 +830,14 @@ def close_edit_current() -> bytes: return b"" +def open_link() -> bytes: + req = generic_pb2.String() + req.ParseFromString(request.data) + url = req.val + aqt.mw.taskman.run_on_main(lambda: openLink(url)) + return b"" + + post_handler_list = [ congrats_info, get_deck_configs_for_update, @@ -863,6 +871,7 @@ post_handler_list = [ write_clipboard, close_add_cards, close_edit_current, + open_link, ] @@ -1062,3 +1071,5 @@ def _extract_dynamic_get_request(path: str) -> DynamicRequest | None: else: return None return None + return None + return None diff --git a/ts/lib/tslib/help-page.ts b/ts/lib/tslib/help-page.ts index ff4e7e434..26363ba33 100644 --- a/ts/lib/tslib/help-page.ts +++ b/ts/lib/tslib/help-page.ts @@ -45,4 +45,7 @@ export const HelpPage = { updating: "https://docs.ankiweb.net/importing/text-files.html#duplicates-and-updating", html: "https://docs.ankiweb.net/importing/text-files.html#html", }, + Editing: { + adding: "https://docs.ankiweb.net/editing.html#adding-cards-and-notes", + }, }; diff --git a/ts/routes/editor/ActionButton.svelte b/ts/routes/editor/ActionButton.svelte new file mode 100644 index 000000000..1e7826132 --- /dev/null +++ b/ts/routes/editor/ActionButton.svelte @@ -0,0 +1,32 @@ + + + +
+ +
+ {@render children()} +
+
+
+ + diff --git a/ts/routes/editor/ActionButtons.svelte b/ts/routes/editor/ActionButtons.svelte index 9dfa8cbe9..dc7196862 100644 --- a/ts/routes/editor/ActionButtons.svelte +++ b/ts/routes/editor/ActionButtons.svelte @@ -4,6 +4,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -->
+ {#if mode === "add"} + + {/if} {#if mode === "add" || mode === "current"} {/if} diff --git a/ts/routes/editor/CloseButton.svelte b/ts/routes/editor/CloseButton.svelte index 824f1adcf..51e14f43e 100644 --- a/ts/routes/editor/CloseButton.svelte +++ b/ts/routes/editor/CloseButton.svelte @@ -5,28 +5,14 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html - -
{tr.actionsClose()}
-
- - - + + {tr.actionsClose()} + + diff --git a/ts/routes/editor/HelpButton.svelte b/ts/routes/editor/HelpButton.svelte new file mode 100644 index 000000000..32053489f --- /dev/null +++ b/ts/routes/editor/HelpButton.svelte @@ -0,0 +1,23 @@ + + + + + {tr.actionsHelp()} + +