prosemirror-state
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -489,6 +489,8 @@ 'use strict'; | ||
var last = tr.steps.length - 1; | ||
if (last < startLen || !(tr.steps[last] instanceof prosemirrorTransform.ReplaceStep)) { return } | ||
if (last < startLen) { return } | ||
var step = tr.steps[last]; | ||
if (!(step instanceof prosemirrorTransform.ReplaceStep || step instanceof prosemirrorTransform.ReplaceAroundStep)) { return } | ||
var map = tr.mapping.maps[last], end; | ||
map.forEach(function (_from, _to, _newFrom, newTo) { return end = newTo; }); | ||
if (end != null) { tr.setSelection(Selection.near(tr.doc.resolve(end), bias)); } | ||
map.forEach(function (_from, _to, _newFrom, newTo) { if (end == null) { end = newTo; } }); | ||
tr.setSelection(Selection.near(tr.doc.resolve(end), bias)); | ||
} | ||
@@ -636,3 +638,3 @@ | ||
if (inheritMarks !== false) | ||
{ node = node.mark(this.storedMarks || (selection.empty ? selection.$from.marks() : selection.$from.marksAcross(selection.$to))); } | ||
{ node = node.mark(this.storedMarks || (selection.empty ? selection.$from.marks() : (selection.$from.marksAcross(selection.$to) || prosemirrorModel.Mark.none))); } | ||
selection.replaceWith(this, node); | ||
@@ -639,0 +641,0 @@ return this |
{ | ||
"name": "prosemirror-state", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "ProseMirror editor state", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
import {Slice, Fragment} from "prosemirror-model" | ||
import {ReplaceStep} from "prosemirror-transform" | ||
import {ReplaceStep, ReplaceAroundStep} from "prosemirror-transform" | ||
@@ -459,6 +459,8 @@ const classesById = Object.create(null) | ||
let last = tr.steps.length - 1 | ||
if (last < startLen || !(tr.steps[last] instanceof ReplaceStep)) return | ||
if (last < startLen) return | ||
let step = tr.steps[last] | ||
if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep)) return | ||
let map = tr.mapping.maps[last], end | ||
map.forEach((_from, _to, _newFrom, newTo) => end = newTo) | ||
if (end != null) tr.setSelection(Selection.near(tr.doc.resolve(end), bias)) | ||
map.forEach((_from, _to, _newFrom, newTo) => { if (end == null) end = newTo }) | ||
tr.setSelection(Selection.near(tr.doc.resolve(end), bias)) | ||
} |
@@ -136,3 +136,3 @@ import {Transform} from "prosemirror-transform" | ||
if (inheritMarks !== false) | ||
node = node.mark(this.storedMarks || (selection.empty ? selection.$from.marks() : selection.$from.marksAcross(selection.$to))) | ||
node = node.mark(this.storedMarks || (selection.empty ? selection.$from.marks() : (selection.$from.marksAcross(selection.$to) || Mark.none))) | ||
selection.replaceWith(this, node) | ||
@@ -139,0 +139,0 @@ return this |
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
156732
1952