diff --git a/examples/components.js b/examples/components.js
index d0dcbce80..ef8427e3a 100644
--- a/examples/components.js
+++ b/examples/components.js
@@ -19,6 +19,52 @@ export const Button = React.forwardRef(
)
)
+export const EditorValue = React.forwardRef(
+ ({ className, value, ...props }, ref) => {
+ const textLines = value.document.nodes
+ .map(node => node.text)
+ .toArray()
+ .join('\n')
+ return (
+
+
+ Slate's value as text
+
+
+ {textLines}
+
+
+ )
+ }
+)
+
export const Icon = React.forwardRef(({ className, ...props }, ref) => (
(
/>
)
-const EditorText = props => (
-
-)
-
-const EditorTextCaption = props => (
-
-)
-
-/**
- * Extract lines of text from `Value`
- *
- * @return {String[]}
- */
-
-function getTextLines(value) {
- return value.document.nodes.map(node => node.text).toArray()
-}
-
/**
* Subpages which are each a smoke test.
*
@@ -210,7 +171,7 @@ class RichTextExample extends React.Component {
render() {
const { text } = this.state
if (text == null) return
- const textLines = getTextLines(this.state.value)
+ // const textLines = getTextLines(this.state.value)
return (
@@ -257,12 +218,7 @@ class RichTextExample extends React.Component {
renderBlock={this.renderBlock}
renderMark={this.renderMark}
/>
-
- Text in Slate's `Value`
- {textLines.map((line, index) => (
- {line.length > 0 ? line : ' '}
- ))}
-
+
)
}