diff --git a/packages/slate/src/interfaces/editor.ts b/packages/slate/src/interfaces/editor.ts index 055a845be..b8618ebab 100644 --- a/packages/slate/src/interfaces/editor.ts +++ b/packages/slate/src/interfaces/editor.ts @@ -1736,4 +1736,3 @@ export type NodeMatch = | ((node: Node, path: Path) => boolean) export type PropsCompare = (prop: Partial, node: Partial) => boolean -export type PropsMerge = (prop: Partial, node: Partial) => object diff --git a/packages/slate/src/transforms/node.ts b/packages/slate/src/transforms/node.ts index ba1c32834..c2747ffa4 100644 --- a/packages/slate/src/transforms/node.ts +++ b/packages/slate/src/transforms/node.ts @@ -11,7 +11,7 @@ import { NodeEntry, Ancestor, } from '..' -import { NodeMatch, PropsCompare, PropsMerge } from '../interfaces/editor' +import { NodeMatch, PropsCompare } from '../interfaces/editor' export interface NodeTransforms { insertNodes: ( @@ -76,7 +76,6 @@ export interface NodeTransforms { split?: boolean voids?: boolean compare?: PropsCompare - merge?: PropsMerge } ) => void splitNodes: ( @@ -571,11 +570,10 @@ export const NodeTransforms: NodeTransforms = { split?: boolean voids?: boolean compare?: PropsCompare - merge?: PropsMerge } = {} ): void { Editor.withoutNormalizing(editor, () => { - let { match, at = editor.selection, compare, merge } = options + let { match, at = editor.selection, compare } = options const { hanging = false, mode = 'lowest', @@ -662,11 +660,7 @@ export const NodeTransforms: NodeTransforms = { // Omit new properties from the old properties list if (node.hasOwnProperty(k)) properties[k] = node[k] // Omit properties that have been removed from the new properties list - if (merge) { - if (props[k] != null) newProperties[k] = merge(node[k], props[k]) - } else { - if (props[k] != null) newProperties[k] = props[k] - } + if (props[k] != null) newProperties[k] = props[k] } } diff --git a/packages/slate/test/transforms/setNodes/merge/text.tsx b/packages/slate/test/transforms/setNodes/merge/text.tsx deleted file mode 100644 index 6fc5c1937..000000000 --- a/packages/slate/test/transforms/setNodes/merge/text.tsx +++ /dev/null @@ -1,26 +0,0 @@ -/** @jsx jsx */ -import { Transforms, Text } from 'slate' -import { jsx } from '../../..' -import _ from 'lodash' - -export const run = editor => { - Transforms.setNodes( - editor, - { a: { b: 2, c: 3 } }, - { at: [0, 0], match: Text.isText, merge: (n, p) => _.defaultsDeep(p, n) } - ) -} -export const input = ( - - - word - - -) -export const output = ( - - - word - - -)