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

rename Node.text to Node.string (#3341)

This commit is contained in:
Ian Storm Taylor
2019-12-17 22:17:21 -05:00
committed by GitHub
parent 4ee9f8b4e6
commit 235a578967
19 changed files with 26 additions and 26 deletions

View File

@@ -393,7 +393,7 @@ export const Editable = (props: EditableProps) => {
placeholder &&
editor.children.length === 1 &&
Array.from(Node.texts(editor)).length === 1 &&
Node.text(editor) === ''
Node.string(editor) === ''
) {
const start = Editor.start(editor, [])
decorations.push({

View File

@@ -74,7 +74,7 @@ const Element = (props: {
// If it's a block node with inline children, add the proper `dir` attribute
// for text direction.
if (!isInline && Editor.hasInlines(editor, element)) {
const text = Node.text(element)
const text = Node.string(element)
const dir = getDirection(text)
if (dir === 'rtl') {

View File

@@ -21,7 +21,7 @@ const String = (props: {
// COMPAT: Render text inside void nodes with a zero-width space.
// So the node can contain selection but the text is not visible.
if (editor.isVoid(parent)) {
return <ZeroWidthString length={Node.text(parent).length} />
return <ZeroWidthString length={Node.string(parent).length} />
}
// COMPAT: If this is the last text node in an empty block, render a zero-
@@ -31,7 +31,7 @@ const String = (props: {
leaf.text === '' &&
parent.children[parent.children.length - 1] === text &&
!editor.isInline(parent) &&
Editor.text(editor, parentPath) === ''
Editor.string(editor, parentPath) === ''
) {
return <ZeroWidthString isLineBreak />
}