prosemirror-transform 1.3.3 → 1.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/index.es.js +9 -2
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/map.js +1 -0
- package/src/structure.js +7 -1
package/CHANGELOG.md
CHANGED
package/dist/index.es.js
CHANGED
|
@@ -57,6 +57,7 @@ var MapResult = function MapResult(pos, deleted, recover) {
|
|
|
57
57
|
var StepMap = function StepMap(ranges, inverted) {
|
|
58
58
|
if ( inverted === void 0 ) inverted = false;
|
|
59
59
|
|
|
60
|
+
if (!ranges.length && StepMap.empty) { return StepMap.empty }
|
|
60
61
|
this.ranges = ranges;
|
|
61
62
|
this.inverted = inverted;
|
|
62
63
|
};
|
|
@@ -720,8 +721,14 @@ function findWrappingInside(range, type) {
|
|
|
720
721
|
// probably be computed with [`findWrapping`](#transform.findWrapping).
|
|
721
722
|
Transform.prototype.wrap = function(range, wrappers) {
|
|
722
723
|
var content = Fragment.empty;
|
|
723
|
-
for (var i = wrappers.length - 1; i >= 0; i--)
|
|
724
|
-
|
|
724
|
+
for (var i = wrappers.length - 1; i >= 0; i--) {
|
|
725
|
+
if (content.size) {
|
|
726
|
+
var match = wrappers[i].type.contentMatch.matchFragment(content);
|
|
727
|
+
if (!match || !match.validEnd)
|
|
728
|
+
{ throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper") }
|
|
729
|
+
}
|
|
730
|
+
content = Fragment.from(wrappers[i].type.create(wrappers[i].attrs, content));
|
|
731
|
+
}
|
|
725
732
|
|
|
726
733
|
var start = range.start, end = range.end;
|
|
727
734
|
return this.step(new ReplaceAroundStep(start, end, start, end, new Slice(content, 0, 0), wrappers.length, true))
|