unwrapNodes
to every parent of block Elements:Editor.nodes
to create a JavaScript Iterator of NodeEntries and a for..of loop to act. For example, to replace all image elements with their alt text:at
Optionat
option.at
option is very versatile, and can be used to implement more complex transforms very easily. Since it is a Location
it can always be either a Path
, Point
, or Range
. And each of those types of locations will result in slightly different transformations.Range
location, the range will first be deleted, collapsing to a single point where your text is then inserted.Path
location, it will expand to a range that covers the entire node at that path. Then, using the range-based behavior it will delete all of the content of the node, and replace it with your text.at
option. It can be hard to wrap your head around at first, but it makes the API very powerful and capable of expressing many subtly different transforms.match
Optionmatch
function option, which restricts the transform to only apply to nodes for which the function returns true
. When combined with at
, match
can also be very powerful.at
option is expanded to be a range representing all of the content inside the node at [2]
. Which might look something like:match
option is defaulted to a function that only matches the specific path, in this case [2]
:match
is defaulted to only match the exact [2]
path, that node is moved.[2]
instead?at
and match
options to match all of the children:at
path (which is expanded to a range), but instead of letting it match just that path by default, we're supplying our own match
function which happens to match only the children of the node.match
can make representing complex logic a lot simpler.match
can solve your use case, and offload the complexity of managing loops to Slate instead. The match
function can examine the children of a node, in node.children
, or use Node.parent
to examine its parent.Editor.withoutNormalizing
if the node tree should not be normalized between Transforms. See Normalization - Implications for Other Code;