mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-30 10:29:48 +02:00
Fix placeholder not rendering (#2819)
This commit is contained in:
committed by
Ian Storm Taylor
parent
1639e8da49
commit
d7b37a8dca
@@ -70,10 +70,10 @@ function SlateReactPlaceholder(options = {}) {
|
||||
* @return {Element}
|
||||
*/
|
||||
|
||||
function renderMark(props, editor, next) {
|
||||
const { children, mark } = props
|
||||
function renderDecoration(props, editor, next) {
|
||||
const { children, decoration: deco } = props
|
||||
|
||||
if (mark.type === 'placeholder' && mark.data.get('key') === instanceId) {
|
||||
if (deco.type === 'placeholder' && deco.data.get('key') === instanceId) {
|
||||
const placeHolderStyle = {
|
||||
pointerEvents: 'none',
|
||||
display: 'inline-block',
|
||||
@@ -103,7 +103,7 @@ function SlateReactPlaceholder(options = {}) {
|
||||
* @return {Object}
|
||||
*/
|
||||
|
||||
return { decorateNode, renderMark }
|
||||
return { decorateNode, renderDecoration }
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -186,15 +186,15 @@ class Text extends Record(DEFAULTS) {
|
||||
const offset = o
|
||||
o += length
|
||||
|
||||
// If the range starts after the leaf, or ends before it, continue.
|
||||
if (start.offset > offset + length || end.offset <= offset) {
|
||||
// If the range encompases the entire leaf, add the format.
|
||||
if (start.offset <= offset && end.offset >= offset + length) {
|
||||
leaf[kind].push(format)
|
||||
next.push(leaf)
|
||||
continue
|
||||
}
|
||||
|
||||
// If the range encompases the entire leaf, add the format.
|
||||
if (start.offset <= offset && end.offset >= offset + length) {
|
||||
leaf[kind].push(format)
|
||||
// If the range starts after the leaf, or ends before it, continue.
|
||||
if (start.offset > offset + length || end.offset <= offset) {
|
||||
next.push(leaf)
|
||||
continue
|
||||
}
|
||||
|
Reference in New Issue
Block a user