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:
@@ -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}
|
||||||
|
@@ -349,7 +349,7 @@ export const Editable = (
|
|||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
|
|
||||||
const decorations = []
|
const decorations = decorate([editor, []])
|
||||||
|
|
||||||
if (
|
if (
|
||||||
placeholder &&
|
placeholder &&
|
||||||
|
Reference in New Issue
Block a user