prosemirror-transform
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -0,1 +1,7 @@ | ||
## 1.1.3 (2018-07-03) | ||
### Bug fixes | ||
Replacing from a code block into a paragraph that has marks, or similar scenarios that would join content with the wrong marks into a node, no longer crashes. | ||
## 1.1.2 (2018-06-29) | ||
@@ -2,0 +8,0 @@ |
{ | ||
"name": "prosemirror-transform", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "ProseMirror document transformations", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -90,8 +90,9 @@ import {Fragment, Slice} from "prosemirror-model" | ||
let match, count = content.childCount, matchCount = count - (openEnd > 0 ? 1 : 0) | ||
let parentNode = openStart < 0 ? parent : $from.node(depth) | ||
if (openStart < 0) | ||
match = parent.contentMatchAt(matchCount) | ||
match = parentNode.contentMatchAt(matchCount) | ||
else if (count == 1 && openEnd > 0) | ||
match = $from.node(depth).contentMatchAt(openStart ? $from.index(depth) : $from.indexAfter(depth)) | ||
match = parentNode.contentMatchAt(openStart ? $from.index(depth) : $from.indexAfter(depth)) | ||
else | ||
match = $from.node(depth).contentMatchAt($from.indexAfter(depth)) | ||
match = parentNode.contentMatchAt($from.indexAfter(depth)) | ||
.matchFragment(content, count > 0 && openStart ? 1 : 0, matchCount) | ||
@@ -126,2 +127,4 @@ | ||
let joinable = match.fillBefore(toNode.content, true, toIndex) | ||
for (let i = toIndex; joinable && i < toNode.content.childCount; i++) | ||
if (!parentNode.type.allowsMarks(toNode.content.child(i).marks)) joinable = null | ||
if (!joinable) return null | ||
@@ -188,13 +191,13 @@ | ||
let parent = slice.openEnd ? nodeRight(slice.content, slice.openEnd) | ||
: $from.node($from.depth - (slice.openStart - slice.openEnd)) | ||
if (!parent.isTextblock) return false | ||
for (let i = $to.index(); i < $to.parent.childCount; i++) | ||
if (!parent.type.allowsMarks($to.parent.child(i).marks)) return false | ||
let match | ||
if (!slice.openEnd) { | ||
let parent = $from.node($from.depth - (slice.openStart - slice.openEnd)) | ||
if (!parent.isTextblock) return false | ||
if (slice.openEnd) { | ||
match = parent.contentMatchAt(parent.childCount) | ||
if (slice.size) | ||
match = match.matchFragment(slice.content, slice.openStart ? 1 : 0) | ||
} else { | ||
let parent = nodeRight(slice.content, slice.openEnd) | ||
if (!parent.isTextblock) return false | ||
match = parent.contentMatchAt(parent.childCount) | ||
if (slice.size) match = match.matchFragment(slice.content, slice.openStart ? 1 : 0) | ||
} | ||
@@ -201,0 +204,0 @@ match = match.matchFragment($to.parent.content, $to.index()) |
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
285695
3007