1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-15 11:44:05 +02:00

fix decorate logic

This commit is contained in:
Ian Storm Taylor
2019-11-29 07:35:12 -05:00
parent cedc7dc2a5
commit e1458c8c1b
2 changed files with 3 additions and 4 deletions

View File

@@ -36,7 +36,6 @@ const Children = (props: {
} = props } = props
const editor = useEditor() const editor = useEditor()
const path = ReactEditor.findPath(editor, node) const path = ReactEditor.findPath(editor, node)
const decs = decorations.concat(decorate([node, path]))
const children = [] const children = []
const isLeafBlock = const isLeafBlock =
Element.isElement(node) && Element.isElement(node) &&
@@ -51,7 +50,7 @@ const Children = (props: {
const sel = selection && Range.intersection(range, selection) const sel = selection && Range.intersection(range, selection)
const ds = decorate([n, p]) const ds = decorate([n, p])
for (const dec of decs) { for (const dec of decorations) {
const d = Range.intersection(dec, range) const d = Range.intersection(dec, range)
if (d) { if (d) {
@@ -75,7 +74,7 @@ const Children = (props: {
} else { } else {
children.push( children.push(
<TextComponent <TextComponent
decorations={decs} decorations={ds}
key={key.id} key={key.id}
isLast={isLeafBlock && i === node.children.length} isLast={isLeafBlock && i === node.children.length}
parent={node} parent={node}

View File

@@ -349,7 +349,7 @@ export const Editable = (
[] []
) )
const decorations = [] const decorations = decorate([editor, []])
if ( if (
placeholder && placeholder &&