mirror of
https://github.com/ankitects/anki.git
synced 2025-12-31 07:43:02 -05:00
drop potentially slow regex usage in cloze check
Closes #956, thanks to Henrik.
This commit is contained in:
parent
2199ca8662
commit
9e5dc3f645
1 changed files with 2 additions and 1 deletions
|
|
@ -20,6 +20,7 @@ from bs4 import BeautifulSoup
|
|||
import aqt
|
||||
import aqt.sound
|
||||
from anki.cards import Card
|
||||
from anki.consts import MODEL_CLOZE
|
||||
from anki.hooks import runFilter
|
||||
from anki.httpclient import HttpClient
|
||||
from anki.notes import Note
|
||||
|
|
@ -655,7 +656,7 @@ class Editor:
|
|||
|
||||
def _onCloze(self):
|
||||
# check that the model is set up for cloze deletion
|
||||
if not re.search("{{(.*:)*cloze:", self.note.model()["tmpls"][0]["qfmt"]):
|
||||
if self.note.model()["type"] != MODEL_CLOZE:
|
||||
if self.addMode:
|
||||
tooltip(tr(TR.EDITING_WARNING_CLOZE_DELETIONS_WILL_NOT_WORK))
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in a new issue