Skip to content

Commit

Permalink
Support spec.keepAdjacent in joinForwards and joinBackwards
Browse files Browse the repository at this point in the history
  • Loading branch information
tslocke committed Nov 25, 2021
1 parent ca85fa2 commit 1b21a1c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function joinBackward(state, dispatch, view) {

let before = $cut.nodeBefore
// Apply the joining algorithm
if (!before.type.spec.isolating && deleteBarrier(state, $cut, dispatch))
if (!before.type.spec.isolating && !before.type.spec.keepAdjacent && deleteBarrier(state, $cut, dispatch))
return true

// If the node below has no content and the node above is
Expand Down Expand Up @@ -118,7 +118,7 @@ export function joinForward(state, dispatch, view) {

let after = $cut.nodeAfter
// Try the joining algorithm
if (deleteBarrier(state, $cut, dispatch)) return true
if (!after.type.spec.keepAdjacent && deleteBarrier(state, $cut, dispatch)) return true

// If the node above has no content and the node below is
// selectable, delete the node above and select the one below.
Expand Down

0 comments on commit 1b21a1c

Please sign in to comment.