diff --git a/anki/cards.py b/anki/cards.py
index a0c5c5d54..820d4b261 100644
--- a/anki/cards.py
+++ b/anki/cards.py
@@ -135,10 +135,6 @@ lapses=?, left=?, odue=?, odid=?, did=? where id = ?""",
else:
args = tuple()
self._qa = self.col._renderQA(data, *args)
- if m.get("prewrap", False):
- wsdiv = "
{}
"
- self._qa['q'] = wsdiv.format(self._qa['q'])
- self._qa['a'] = wsdiv.format(self._qa['a'])
return self._qa
def note(self, reload=False):
diff --git a/aqt/editor.py b/aqt/editor.py
index bf372f8c7..a2a55ec38 100644
--- a/aqt/editor.py
+++ b/aqt/editor.py
@@ -297,14 +297,11 @@ class Editor:
self.web.setFocus()
runHook("loadNote", self)
- self.web.evalWithCallback("setFields(%s, %s); setFonts(%s); focusField(%s)" % (
- json.dumps(data), json.dumps(self.prewrapMode()),
+ self.web.evalWithCallback("setFields(%s); setFonts(%s); focusField(%s)" % (
+ json.dumps(data),
json.dumps(self.fonts()), json.dumps(focusTo)),
oncallback)
- def prewrapMode(self):
- return self.note.model().get('prewrap', False)
-
def fonts(self):
return [(f['font'], f['size'], f['rtl'])
for f in self.note.model()['flds']]
@@ -616,10 +613,9 @@ to a cloze type first, via Edit>Change Note Type."""))
for node in doc(tag):
node.decompose()
- if not self.prewrapMode():
- # convert p tags to divs
- for node in doc("p"):
- node.name = "div"
+ # convert p tags to divs
+ for node in doc("p"):
+ node.name = "div"
for tag in doc("img"):
try:
diff --git a/aqt/models.py b/aqt/models.py
index f8581563e..9911d3491 100644
--- a/aqt/models.py
+++ b/aqt/models.py
@@ -110,7 +110,6 @@ class Models(QDialog):
frm.latexsvg.setChecked(self.model.get("latexsvg", False))
frm.latexHeader.setText(self.model['latexPre'])
frm.latexFooter.setText(self.model['latexPost'])
- frm.newStyleWhitespace.setChecked(self.model.get("prewrap", False))
d.setWindowTitle(_("Options for %s") % self.model['name'])
frm.buttonBox.helpRequested.connect(lambda: openHelp("latex"))
restoreGeom(d, "modelopts")
@@ -119,7 +118,6 @@ class Models(QDialog):
self.model['latexsvg'] = frm.latexsvg.isChecked()
self.model['latexPre'] = str(frm.latexHeader.toPlainText())
self.model['latexPost'] = str(frm.latexFooter.toPlainText())
- self.model['prewrap'] = frm.newStyleWhitespace.isChecked()
def saveModel(self):
self.mm.save(self.model)
diff --git a/designer/modelopts.ui b/designer/modelopts.ui
index 80b755b84..60c09ca50 100644
--- a/designer/modelopts.ui
+++ b/designer/modelopts.ui
@@ -64,33 +64,6 @@
-
-
- General
-
-
- -
-
-
- New style whitespace handling (EXPERIMENTAL)
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
-
-
-
diff --git a/web/editor.css b/web/editor.css
index d0fd651a2..133d99a09 100644
--- a/web/editor.css
+++ b/web/editor.css
@@ -64,10 +64,6 @@ body {
border-bottom: 3px solid #000;
}
-.prewrap {
- white-space: pre-wrap;
-}
-
#fields {
margin-top: 35px;
}
diff --git a/web/editor.js b/web/editor.js
index b1632eebe..400599775 100644
--- a/web/editor.js
+++ b/web/editor.js
@@ -1,7 +1,6 @@
var currentField = null;
var changeTimer = null;
var dropTarget = null;
-var prewrapMode = false;
String.prototype.format = function () {
var args = arguments;
@@ -27,12 +26,6 @@ function onKey() {
currentField.blur();
return;
}
- // catch enter key in prewrap mode
- if (window.event.which === 13 && prewrapMode) {
- window.event.preventDefault();
- insertNewline();
- return;
- }
// shift+tab goes to previous field
if (navigator.platform === "MacIntel" &&
window.event.which === 9 && window.event.shiftKey) {
@@ -264,7 +257,7 @@ function onCutOrCopy() {
return true;
}
-function setFields(fields, prewrap) {
+function setFields(fields) {
var txt = "";
for (var i = 0; i < fields.length; i++) {
var n = fields[i][0];
@@ -282,10 +275,6 @@ function setFields(fields, prewrap) {
}
$("#fields").html("");
maybeDisableButtons();
- prewrapMode = prewrap;
- if (prewrap) {
- $(".field").addClass("prewrap");
- }
}
function setBackgrounds(cols) {
@@ -345,29 +334,6 @@ allowedTags["TD"] = {"attrs": ["COLSPAN", "ROWSPAN"]};
allowedTags["TH"] = {"attrs": ["COLSPAN", "ROWSPAN"]};
allowedTags["IMG"] = {"attrs": ["SRC"]};
-var blockRegex = /^(address|blockquote|br|center|div|dl|h[1-6]|hr|ol|p|pre|table|ul|dd|dt|li|tbody|td|tfoot|th|thead|tr)$/i;
-function isBlockLevel(n) {
- return blockRegex.test(n.nodeName);
-}
-
-function isInlineElement(n) {
- return n && !isBlockLevel(n);
-}
-
-function convertDivToNewline(node, isParagraph) {
- var html = node.innerHTML;
- if (isInlineElement(node.previousSibling) && html) {
- html = "\n" + html;
- }
- if (isInlineElement(node.nextSibling)) {
- html += "\n";
- }
- if (isParagraph) {
- html += "\n";
- }
- node.outerHTML = html;
-}
-
// filtering from another field
var filterInternalNode = function (node) {
if (node.tagName === "SPAN") {
@@ -385,15 +351,6 @@ var filterInternalNode = function (node) {
var filterNode = function (node) {
// text node?
if (node.nodeType === 3) {
- if (prewrapMode) {
- // collapse standard whitespace
- var val = node.nodeValue.replace(/^[ \r\n\t]+$/g, " ");
-
- // non-breaking spaces can be represented as normal spaces
- val = val.replace(/ |\u00a0/g, " ");
-
- node.nodeValue = val;
- }
return;
}
@@ -420,12 +377,6 @@ var filterNode = function (node) {
} else {
node.outerHTML = node.innerHTML;
}
- } else if (prewrapMode && node.tagName === "BR") {
- node.outerHTML = "\n";
- } else if (prewrapMode && node.tagName === "DIV") {
- convertBlockToNewline(node, false);
- } else if (prewrapMode && node.tagName === "P") {
- convertBlockToNewline(node, true);
} else {
// allowed, filter out attributes
var toRemove = [];