From 7815ab23c3582123120b9b0d47b79628caf3224b Mon Sep 17 00:00:00 2001 From: Landon Epps Date: Sat, 5 Oct 2024 14:56:36 -0400 Subject: [PATCH 1/2] Fix Qt6 crash --- cloze_anything/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloze_anything/__init__.py b/cloze_anything/__init__.py index 8f4806c..abc5f87 100644 --- a/cloze_anything/__init__.py +++ b/cloze_anything/__init__.py @@ -120,7 +120,7 @@ def onCloze(editor): if cloze_nums: next_cloze_num = max(cloze_nums) # Unless we are reusing, then increment to the next greatest cloze number. - if not editor.mw.app.keyboardModifiers() & Qt.AltModifier: + if not editor.mw.app.keyboardModifiers() & Qt.KeyboardModifier.AltModifier: next_cloze_num += 1 else: next_cloze_num = 1 From 64119601e43328c0ba260a0293f51b505de172f4 Mon Sep 17 00:00:00 2001 From: Landon Epps Date: Sat, 5 Oct 2024 14:57:54 -0400 Subject: [PATCH 2/2] Fix issue where note is not saved after field is changed --- cloze_anything/__init__.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cloze_anything/__init__.py b/cloze_anything/__init__.py index abc5f87..fc4608b 100644 --- a/cloze_anything/__init__.py +++ b/cloze_anything/__init__.py @@ -137,12 +137,8 @@ def onCloze(editor): missing_cloze_num = cloze_nums - found_cloze_nums - # There doesn't seem to be an easy way to programmatically update the editor with some arbitrary content - # due to how this is set up in OldEditorAdapter.svelte. - # It seems the best way is to call setField with all the note data, which is basically like reloading the - # editor with all the note content. The downside is that the focus is reset to the beginning of the field. def callback(arg): - editor.web.eval(get_set_fields_command(editor)) + editor.saveNow(lambda: None) editor.web.evalWithCallback(wrap_command, callback)