Remove editorReady()

bridgeCommand() looks cleaner here
This commit is contained in:
Abdo 2025-05-25 21:14:10 +03:00
parent 48fb272700
commit 3073ef02b5
4 changed files with 4 additions and 16 deletions

View file

@ -30,7 +30,6 @@ service FrontendService {
rpc deckOptionsReady(generic.Empty) returns (generic.Empty);
// Editor
rpc editorReady(generic.Empty) returns (generic.Empty);
rpc editorUpdateNote(notes.UpdateNotesRequest) returns (generic.Empty);
}

View file

@ -496,6 +496,8 @@ require("anki/ui").loaded.then(() => require("anki/NoteEditor").instances[0].too
gui_hooks.editor_mask_editor_did_load_image(
self, NoteId(int(path_or_nid))
)
elif cmd == "editorReady":
self._set_ready()
elif cmd in self._links:
return self._links[cmd](self)

View file

@ -603,18 +603,6 @@ def deck_options_ready() -> bytes:
return b""
def editor_ready() -> bytes:
from aqt.editor import Editor
def handle_on_main() -> None:
window = aqt.mw.app.activeWindow()
if window and isinstance(getattr(window, "editor"), Editor):
window.editor._set_ready() # type: ignore
aqt.mw.taskman.run_on_main(handle_on_main)
return b""
def editor_update_note() -> bytes:
from aqt.editor import Editor
@ -648,7 +636,6 @@ post_handler_list = [
search_in_browser,
deck_options_require_close,
deck_options_ready,
editor_ready,
editor_update_note,
]

View file

@ -8,8 +8,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import * as base from "./base";
import { page } from "$app/state";
import type { EditorMode } from "./types";
import { editorReady } from "@generated/backend";
import { globalExport } from "@tslib/globals";
import { bridgeCommand } from "@tslib/bridgecommand";
const mode = (page.url.searchParams.get("mode") ?? "add") as EditorMode;
@ -17,7 +17,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
onMount(() => {
setupEditor(mode).then(() => {
editorReady({});
bridgeCommand("editorReady");
});
});
</script>