1
0
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:
adjourn
2019-05-22 21:23:32 +03:00
committed by Ian Storm Taylor
parent 1639e8da49
commit d7b37a8dca
2 changed files with 9 additions and 9 deletions

View File

@@ -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 }
}
/**

View File

@@ -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
}