Skip to content

Commit

Permalink
Check for empty path instead of using isEditor
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSpyder committed May 10, 2021
1 parent 00abfe3 commit dfbd20e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/slate/src/transforms/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -940,11 +940,11 @@ export const NodeTransforms: NodeTransforms = {
if (matches.length > 0) {
const [first] = matches
const last = matches[matches.length - 1]
const [firstNode, firstPath] = first
const [lastNode, lastPath] = last
const [, firstPath] = first
const [, lastPath] = last

if (firstNode === lastNode && Editor.isEditor(firstNode)) {
// if the only matching node is an editor, no nodes matched
if (firstPath.length === 0 && lastPath.length === 0) {
// if there's no matching parent - usually means the node is an editor - don't do anything
continue
}

Expand Down

0 comments on commit dfbd20e

Please sign in to comment.