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

View File

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