mirror of
https://github.com/ankitects/anki.git
synced 2025-11-09 14:17:13 -05:00
Remove editorReady()
bridgeCommand() looks cleaner here
This commit is contained in:
parent
48fb272700
commit
3073ef02b5
4 changed files with 4 additions and 16 deletions
|
|
@ -30,7 +30,6 @@ service FrontendService {
|
||||||
rpc deckOptionsReady(generic.Empty) returns (generic.Empty);
|
rpc deckOptionsReady(generic.Empty) returns (generic.Empty);
|
||||||
|
|
||||||
// Editor
|
// Editor
|
||||||
rpc editorReady(generic.Empty) returns (generic.Empty);
|
|
||||||
rpc editorUpdateNote(notes.UpdateNotesRequest) returns (generic.Empty);
|
rpc editorUpdateNote(notes.UpdateNotesRequest) returns (generic.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -496,6 +496,8 @@ require("anki/ui").loaded.then(() => require("anki/NoteEditor").instances[0].too
|
||||||
gui_hooks.editor_mask_editor_did_load_image(
|
gui_hooks.editor_mask_editor_did_load_image(
|
||||||
self, NoteId(int(path_or_nid))
|
self, NoteId(int(path_or_nid))
|
||||||
)
|
)
|
||||||
|
elif cmd == "editorReady":
|
||||||
|
self._set_ready()
|
||||||
|
|
||||||
elif cmd in self._links:
|
elif cmd in self._links:
|
||||||
return self._links[cmd](self)
|
return self._links[cmd](self)
|
||||||
|
|
|
||||||
|
|
@ -603,18 +603,6 @@ def deck_options_ready() -> bytes:
|
||||||
return b""
|
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:
|
def editor_update_note() -> bytes:
|
||||||
from aqt.editor import Editor
|
from aqt.editor import Editor
|
||||||
|
|
||||||
|
|
@ -648,7 +636,6 @@ post_handler_list = [
|
||||||
search_in_browser,
|
search_in_browser,
|
||||||
deck_options_require_close,
|
deck_options_require_close,
|
||||||
deck_options_ready,
|
deck_options_ready,
|
||||||
editor_ready,
|
|
||||||
editor_update_note,
|
editor_update_note,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
import * as base from "./base";
|
import * as base from "./base";
|
||||||
import { page } from "$app/state";
|
import { page } from "$app/state";
|
||||||
import type { EditorMode } from "./types";
|
import type { EditorMode } from "./types";
|
||||||
import { editorReady } from "@generated/backend";
|
|
||||||
import { globalExport } from "@tslib/globals";
|
import { globalExport } from "@tslib/globals";
|
||||||
|
import { bridgeCommand } from "@tslib/bridgecommand";
|
||||||
|
|
||||||
const mode = (page.url.searchParams.get("mode") ?? "add") as EditorMode;
|
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(() => {
|
onMount(() => {
|
||||||
setupEditor(mode).then(() => {
|
setupEditor(mode).then(() => {
|
||||||
editorReady({});
|
bridgeCommand("editorReady");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue