prosemirror-model
Advanced tools
Comparing version 1.7.2 to 1.7.3
@@ -0,1 +1,7 @@ | ||
## 1.7.3 (2019-10-03) | ||
### Bug fixes | ||
Fix an issue where _any_ whitespace (not just the characters that HTML collapses) was collapsed by the parser in non-whitespace-preserving mode. | ||
## 1.7.2 (2019-09-04) | ||
@@ -2,0 +8,0 @@ |
{ | ||
"name": "prosemirror-model", | ||
"version": "1.7.2", | ||
"version": "1.7.3", | ||
"description": "ProseMirror's document model", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -311,6 +311,6 @@ import {Fragment} from "./fragment" | ||
finish(openEnd) { | ||
finish(openEnd) { | ||
if (!(this.options & OPT_PRESERVE_WS)) { // Strip trailing whitespace | ||
let last = this.content[this.content.length - 1], m | ||
if (last && last.isText && (m = /\s+$/.exec(last.text))) { | ||
if (last && last.isText && (m = /[ \t\r\n\u000c]+$/.exec(last.text))) { | ||
if (last.text.length == m[0].length) this.content.pop() | ||
@@ -375,9 +375,9 @@ else this.content[this.content.length - 1] = last.withText(last.text.slice(0, last.text.length - m[0].length)) | ||
let top = this.top | ||
if ((top.type ? top.type.inlineContent : top.content.length && top.content[0].isInline) || /\S/.test(value)) { | ||
if ((top.type ? top.type.inlineContent : top.content.length && top.content[0].isInline) || /[^ \t\r\n\u000c]/.test(value)) { | ||
if (!(top.options & OPT_PRESERVE_WS)) { | ||
value = value.replace(/\s+/g, " ") | ||
value = value.replace(/[ \t\r\n\u000c]+/g, " ") | ||
// If this starts with whitespace, and there is no node before it, or | ||
// a hard break, or a text node that ends with whitespace, strip the | ||
// leading space. | ||
if (/^\s/.test(value) && this.open == this.nodes.length - 1) { | ||
if (/^[ \t\r\n\u000c]/.test(value) && this.open == this.nodes.length - 1) { | ||
let nodeBefore = top.content[top.content.length - 1] | ||
@@ -387,3 +387,3 @@ let domNodeBefore = dom.previousSibling | ||
(domNodeBefore && domNodeBefore.nodeName == 'BR') || | ||
(nodeBefore.isText && /\s$/.test(nodeBefore.text))) | ||
(nodeBefore.isText && /[ \t\r\n\u000c]$/.test(nodeBefore.text))) | ||
value = value.slice(1) | ||
@@ -390,0 +390,0 @@ } |
@@ -78,3 +78,3 @@ import {Mark} from "./mark" | ||
// The (absolute) position directly before the wrapping node at the | ||
// given level, or, when `level` is `this.depth + 1`, the original | ||
// given level, or, when `depth` is `this.depth + 1`, the original | ||
// position. | ||
@@ -89,3 +89,3 @@ before(depth) { | ||
// The (absolute) position directly after the wrapping node at the | ||
// given level, or the original position when `level` is `this.depth + 1`. | ||
// given level, or the original position when `depth` is `this.depth + 1`. | ||
after(depth) { | ||
@@ -92,0 +92,0 @@ depth = this.resolveDepth(depth) |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
497338