Skip to content

Commit

Permalink
Add hanging option to unsetNodes (#5189)
Browse files Browse the repository at this point in the history
Since this really just calls setNodes, it seems like it should offer the same options.
Without this change, doing something like applying a mark to the contents of a selected block with `hanging` works one way, while trying to do the reverse (remove the mark) cannot include the "hang".
  • Loading branch information
SmilinBrian authored Nov 17, 2022
1 parent 6909a8f commit fbc9838
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/light-moose-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'slate': patch
---

Add hanging option to unsetNodes so it matches setNodes
2 changes: 1 addition & 1 deletion docs/api/transforms.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Options supported: `NodeOptions & {hanging?: boolean, split?: boolean}`. For `op

Unset properties of nodes at the specified location. If no location is specified, use the selection.

Options supported: `NodeOptions & {split?: boolean}`. For `options.mode`, `'all'` is also supported.
Options supported: `NodeOptions & {hanging?: boolean, split?: boolean}`. For `options.mode`, `'all'` is also supported.

#### `Transforms.liftNodes(editor: Editor, options?)`

Expand Down
2 changes: 2 additions & 0 deletions packages/slate/src/transforms/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export interface NodeTransforms {
at?: Location
match?: NodeMatch<T>
mode?: MaximizeMode
hanging?: boolean
split?: boolean
voids?: boolean
}
Expand Down Expand Up @@ -825,6 +826,7 @@ export const NodeTransforms: NodeTransforms = {
at?: Location
match?: NodeMatch<T>
mode?: MaximizeMode
hanging?: boolean
split?: boolean
voids?: boolean
} = {}
Expand Down

0 comments on commit fbc9838

Please sign in to comment.