prosemirror-commands
Advanced tools
Comparing version 1.1.9 to 1.1.10
@@ -0,1 +1,7 @@ | ||
## 1.1.10 (2021-07-05) | ||
### Bug fixes | ||
Make `joinBackward` capable of joining textblocks wrapped in parent nodes when the parent nodes themselves can't be joined (for example two list items which allow only a single paragraph). | ||
## 1.1.9 (2021-06-07) | ||
@@ -2,0 +8,0 @@ |
@@ -65,5 +65,7 @@ import { liftTarget, canJoin, joinPoint, canSplit, ReplaceAroundStep, findWrapping } from 'prosemirror-transform'; | ||
function textblockAt(node, side) { | ||
for (; node; node = (side == "start" ? node.firstChild : node.lastChild)) | ||
{ if (node.isTextblock) { return true } } | ||
function textblockAt(node, side, only) { | ||
for (; node; node = (side == "start" ? node.firstChild : node.lastChild)) { | ||
if (node.isTextblock) { return true } | ||
if (only && node.childCount != 1) { return false } | ||
} | ||
return false | ||
@@ -432,3 +434,3 @@ } | ||
if (canDelAfter && after.isTextblock && textblockAt(before, "end")) { | ||
if (canDelAfter && textblockAt(after, "start", true) && textblockAt(before, "end")) { | ||
var at = before, wrap$1 = []; | ||
@@ -440,3 +442,5 @@ for (;;) { | ||
} | ||
if (at.canReplace(at.childCount, at.childCount, after.content)) { | ||
var afterText = after, afterDepth = 1; | ||
for (; !afterText.isTextblock; afterText = afterText.firstChild) { afterDepth++; } | ||
if (at.canReplace(at.childCount, at.childCount, afterText.content)) { | ||
if (dispatch) { | ||
@@ -446,3 +450,3 @@ var end$1 = Fragment.empty; | ||
var tr$1 = state.tr.step(new ReplaceAroundStep($cut.pos - wrap$1.length, $cut.pos + after.nodeSize, | ||
$cut.pos + 1, $cut.pos + after.nodeSize - 1, | ||
$cut.pos + afterDepth, $cut.pos + after.nodeSize - afterDepth, | ||
new Slice(end$1, wrap$1.length, 0), 0, true)); | ||
@@ -449,0 +453,0 @@ dispatch(tr$1.scrollIntoView()); |
@@ -69,5 +69,7 @@ 'use strict'; | ||
function textblockAt(node, side) { | ||
for (; node; node = (side == "start" ? node.firstChild : node.lastChild)) | ||
{ if (node.isTextblock) { return true } } | ||
function textblockAt(node, side, only) { | ||
for (; node; node = (side == "start" ? node.firstChild : node.lastChild)) { | ||
if (node.isTextblock) { return true } | ||
if (only && node.childCount != 1) { return false } | ||
} | ||
return false | ||
@@ -436,3 +438,3 @@ } | ||
if (canDelAfter && after.isTextblock && textblockAt(before, "end")) { | ||
if (canDelAfter && textblockAt(after, "start", true) && textblockAt(before, "end")) { | ||
var at = before, wrap$1 = []; | ||
@@ -444,3 +446,5 @@ for (;;) { | ||
} | ||
if (at.canReplace(at.childCount, at.childCount, after.content)) { | ||
var afterText = after, afterDepth = 1; | ||
for (; !afterText.isTextblock; afterText = afterText.firstChild) { afterDepth++; } | ||
if (at.canReplace(at.childCount, at.childCount, afterText.content)) { | ||
if (dispatch) { | ||
@@ -450,3 +454,3 @@ var end$1 = prosemirrorModel.Fragment.empty; | ||
var tr$1 = state.tr.step(new prosemirrorTransform.ReplaceAroundStep($cut.pos - wrap$1.length, $cut.pos + after.nodeSize, | ||
$cut.pos + 1, $cut.pos + after.nodeSize - 1, | ||
$cut.pos + afterDepth, $cut.pos + after.nodeSize - afterDepth, | ||
new prosemirrorModel.Slice(end$1, wrap$1.length, 0), 0, true)); | ||
@@ -453,0 +457,0 @@ dispatch(tr$1.scrollIntoView()); |
{ | ||
"name": "prosemirror-commands", | ||
"version": "1.1.9", | ||
"version": "1.1.10", | ||
"description": "Editing commands for ProseMirror", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -64,5 +64,7 @@ import {joinPoint, canJoin, findWrapping, liftTarget, canSplit, ReplaceAroundStep} from "prosemirror-transform" | ||
function textblockAt(node, side) { | ||
for (; node; node = (side == "start" ? node.firstChild : node.lastChild)) | ||
function textblockAt(node, side, only) { | ||
for (; node; node = (side == "start" ? node.firstChild : node.lastChild)) { | ||
if (node.isTextblock) return true | ||
if (only && node.childCount != 1) return false | ||
} | ||
return false | ||
@@ -409,3 +411,3 @@ } | ||
if (canDelAfter && after.isTextblock && textblockAt(before, "end")) { | ||
if (canDelAfter && textblockAt(after, "start", true) && textblockAt(before, "end")) { | ||
let at = before, wrap = [] | ||
@@ -417,3 +419,5 @@ for (;;) { | ||
} | ||
if (at.canReplace(at.childCount, at.childCount, after.content)) { | ||
let afterText = after, afterDepth = 1 | ||
for (; !afterText.isTextblock; afterText = afterText.firstChild) afterDepth++ | ||
if (at.canReplace(at.childCount, at.childCount, afterText.content)) { | ||
if (dispatch) { | ||
@@ -423,3 +427,3 @@ let end = Fragment.empty | ||
let tr = state.tr.step(new ReplaceAroundStep($cut.pos - wrap.length, $cut.pos + after.nodeSize, | ||
$cut.pos + 1, $cut.pos + after.nodeSize - 1, | ||
$cut.pos + afterDepth, $cut.pos + after.nodeSize - afterDepth, | ||
new Slice(end, wrap.length, 0), 0, true)) | ||
@@ -426,0 +430,0 @@ dispatch(tr.scrollIntoView()) |
Sorry, the diff of this file is not supported yet
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
204656
1880