mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Add a hook to execute after pasting in a field
I expect to use it to ensure that images are resizable after they get pasted in a field
This commit is contained in:
parent
bbddc79da4
commit
3dbe44217b
2 changed files with 11 additions and 0 deletions
|
@ -954,6 +954,7 @@ $editorToolbar.then(({{ toolbar }}) => toolbar.appendGroup({{
|
|||
else:
|
||||
ext = "false"
|
||||
self.web.eval(f"pasteHTML({json.dumps(html)}, {json.dumps(internal)}, {ext});")
|
||||
gui_hooks.editor_did_paste(self, html, internal, extended)
|
||||
|
||||
def doDrop(self, html: str, internal: bool, extended: bool = False) -> None:
|
||||
def pasteIfField(ret: bool) -> None:
|
||||
|
|
|
@ -843,6 +843,16 @@ gui_hooks.webview_did_inject_style_into_page.append(mytest)
|
|||
doc="""Allows changing the javascript commands to load note before
|
||||
executing it and do change in the QT editor.""",
|
||||
),
|
||||
Hook(
|
||||
name="editor_did_paste",
|
||||
args=[
|
||||
"editor: aqt.editor.Editor",
|
||||
"html: str",
|
||||
"internal: bool",
|
||||
"extended: bool",
|
||||
],
|
||||
doc="""Called after some data is pasted by python into an editor field.""",
|
||||
),
|
||||
# Tag
|
||||
###################
|
||||
Hook(name="tag_editor_did_process_key", args=["tag_edit: TagEdit", "evt: QEvent"]),
|
||||
|
|
Loading…
Reference in a new issue