mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
adjust media regexp to not trigger on mce_src
otherwise pasting the following will cause an error: <img src="..." mce_src="/foo.png">
This commit is contained in:
parent
1f05392113
commit
0372f30220
2 changed files with 7 additions and 7 deletions
|
@ -22,9 +22,9 @@ class MediaManager(object):
|
||||||
soundRegexps = ["(?i)(\[sound:(?P<fname>[^]]+)\])"]
|
soundRegexps = ["(?i)(\[sound:(?P<fname>[^]]+)\])"]
|
||||||
imgRegexps = [
|
imgRegexps = [
|
||||||
# src element quoted case
|
# src element quoted case
|
||||||
"(?i)(<img[^>]+src=(?P<str>[\"'])(?P<fname>[^>]+?)(?P=str)[^>]*>)",
|
"(?i)(<img[^>]+ src=(?P<str>[\"'])(?P<fname>[^>]+?)(?P=str)[^>]*>)",
|
||||||
# unquoted case
|
# unquoted case
|
||||||
"(?i)(<img[^>]+src=(?!['\"])(?P<fname>[^ >]+)[^>]*?>)",
|
"(?i)(<img[^>]+ src=(?!['\"])(?P<fname>[^ >]+)[^>]*?>)",
|
||||||
]
|
]
|
||||||
regexps = soundRegexps + imgRegexps
|
regexps = soundRegexps + imgRegexps
|
||||||
|
|
||||||
|
|
|
@ -1092,11 +1092,11 @@ class EditorWebView(AnkiWebView):
|
||||||
self.savedClip = n
|
self.savedClip = n
|
||||||
|
|
||||||
def _processMime(self, mime):
|
def _processMime(self, mime):
|
||||||
print "html=%s image=%s urls=%s txt=%s" % (
|
# print "html=%s image=%s urls=%s txt=%s" % (
|
||||||
mime.hasHtml(), mime.hasImage(), mime.hasUrls(), mime.hasText())
|
# mime.hasHtml(), mime.hasImage(), mime.hasUrls(), mime.hasText())
|
||||||
print "html", mime.html()
|
# print "html", mime.html()
|
||||||
print "urls", mime.urls()
|
# print "urls", mime.urls()
|
||||||
print "text", mime.text()
|
# print "text", mime.text()
|
||||||
if mime.hasHtml():
|
if mime.hasHtml():
|
||||||
return self._processHtml(mime)
|
return self._processHtml(mime)
|
||||||
elif mime.hasUrls():
|
elif mime.hasUrls():
|
||||||
|
|
Loading…
Reference in a new issue