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 ti = lambda x: x
base = getBase(self.mw.col) base = getBase(self.mw.col)
self._previewWeb.stdHtml( 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, bodyClass="card card%d" % (c.ord+1), head=base,
js=anki.js.browserSel) js=anki.js.browserSel)
clearAudioQueue() clearAudioQueue()

View file

@ -222,11 +222,11 @@ Please create a new card type first."""))
ti = self.maybeTextInput ti = self.maybeTextInput
base = getBase(self.mw.col) base = getBase(self.mw.col)
self.tab['pform'].frontWeb.stdHtml( 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, bodyClass="card card%d" % (c.ord+1), head=base,
js=anki.js.browserSel) js=anki.js.browserSel)
self.tab['pform'].backWeb.stdHtml( 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, bodyClass="card card%d" % (c.ord+1), head=base,
js=anki.js.browserSel) js=anki.js.browserSel)
clearAudioQueue() clearAudioQueue()

View file

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

View file

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