escape image links in clayout and preview as well (#903)

This commit is contained in:
Damien Elmes 2013-06-10 15:28:34 +09:00
parent c7b31d28e4
commit 51121f6e86
4 changed files with 6 additions and 6 deletions

View file

@ -1044,7 +1044,7 @@ where id in %s""" % ids2str(sf))
ti = lambda x: x
base = getBase(self.mw.col)
self._previewWeb.stdHtml(
ti(mungeQA(txt)), self.mw.reviewer._styles(),
ti(mungeQA(self.col, txt)), self.mw.reviewer._styles(),
bodyClass="card card%d" % (c.ord+1), head=base,
js=anki.js.browserSel)
clearAudioQueue()

View file

@ -222,11 +222,11 @@ Please create a new card type first."""))
ti = self.maybeTextInput
base = getBase(self.mw.col)
self.tab['pform'].frontWeb.stdHtml(
ti(mungeQA(c.q(reload=True))), self.mw.reviewer._styles(),
ti(mungeQA(self.mw.col, c.q(reload=True))), self.mw.reviewer._styles(),
bodyClass="card card%d" % (c.ord+1), head=base,
js=anki.js.browserSel)
self.tab['pform'].backWeb.stdHtml(
ti(mungeQA(c.a()), type='a'), self.mw.reviewer._styles(),
ti(mungeQA(self.mw.col, c.a()), type='a'), self.mw.reviewer._styles(),
bodyClass="card card%d" % (c.ord+1), head=base,
js=anki.js.browserSel)
clearAudioQueue()

View file

@ -181,8 +181,7 @@ function _typeAnsPress() {
##########################################################################
def _mungeQA(self, buf):
return self.mw.col.media.escapeImages(
self.typeAnsFilter(mungeQA(buf)))
return self.typeAnsFilter(mungeQA(self.mw.col, buf))
def _showQuestion(self):
self._reps += 1

View file

@ -317,7 +317,8 @@ def restoreHeader(widget, key):
if aqt.mw.pm.profile.get(key):
widget.restoreState(aqt.mw.pm.profile[key])
def mungeQA(txt):
def mungeQA(col, txt):
txt = col.media.escapeImages(txt)
txt = stripSounds(txt)
# osx webkit doesn't understand font weight 600
txt = re.sub("font-weight: *600", "font-weight:bold", txt)