mirror of
https://github.com/ankitects/anki.git
synced 2025-09-23 16:26:40 -04:00
pre-wrap spaces, support indentation by user / programming etc
This commit is contained in:
parent
d9b9840cce
commit
e63b7ef06d
2 changed files with 4 additions and 3 deletions
|
@ -281,7 +281,7 @@ class FactEditor(object):
|
||||||
old = tidyHTML(unicode(w.toHtml()))
|
old = tidyHTML(unicode(w.toHtml()))
|
||||||
# only update if something has changed, to preserve the cursor
|
# only update if something has changed, to preserve the cursor
|
||||||
if new != old:
|
if new != old:
|
||||||
w.setHtml(new)
|
w.setHtml('<meta name="qrichtext" content="1"/>' + new)
|
||||||
if font:
|
if font:
|
||||||
# apply fonts
|
# apply fonts
|
||||||
font = QFont()
|
font = QFont()
|
||||||
|
@ -594,7 +594,7 @@ class FactEdit(QTextEdit):
|
||||||
html = re.sub('<style type="text/css">.*?</style>', "", html)
|
html = re.sub('<style type="text/css">.*?</style>', "", html)
|
||||||
html = stripHTML(html)
|
html = stripHTML(html)
|
||||||
html = html.replace("\n", "<br>")
|
html = html.replace("\n", "<br>")
|
||||||
html = re.sub("\s\s+", " ", html).strip()
|
html = html.strip()
|
||||||
return html
|
return html
|
||||||
|
|
||||||
def focusOutEvent(self, evt):
|
def focusOutEvent(self, evt):
|
||||||
|
|
|
@ -87,7 +87,8 @@ class View(object):
|
||||||
(base, family, size, color))
|
(base, family, size, color))
|
||||||
s += ("body { background-color: " +
|
s += ("body { background-color: " +
|
||||||
self.main.config["backgroundColour"] +
|
self.main.config["backgroundColour"] +
|
||||||
"; }")
|
";}\n")
|
||||||
|
s += "div { white-space: pre-wrap; }"
|
||||||
s += "</style>"
|
s += "</style>"
|
||||||
return s
|
return s
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue