diff --git a/examples/plugins/index.js b/examples/plugins/index.js
index 13a7195fc..b95d18acf 100644
--- a/examples/plugins/index.js
+++ b/examples/plugins/index.js
@@ -15,7 +15,7 @@ import SoftBreak from 'slate-soft-break'
function WordCount(options) {
return {
- render(props) {
+ renderEditor(props) {
return (
@@ -56,11 +56,8 @@ class Plugins extends React.Component {
state = {
state: Plain.deserialize(`This example shows how you can extend Slate with plugins! It uses four fairly simple plugins, but you can use any plugins you want, or write your own!
-
The first is a simple plugin to collapse the selection whenever the escape key is pressed. Try selecting some text and pressing escape.
-
The second is another simple plugin that inserts a "soft" break when enter is pressed instead of creating a new block. Try pressing enter!
-
The third is an example of using the plugin.render property to create a higher-order-component.`)
}
diff --git a/packages/slate-react/Changelog.md b/packages/slate-react/Changelog.md
index bfb90c8dc..69253a850 100644
--- a/packages/slate-react/Changelog.md
+++ b/packages/slate-react/Changelog.md
@@ -15,6 +15,8 @@ This document maintains a list of changes to the `slate-react` package with each
- **The `plugin.onBeforeChange` function was removed.** Previously there was both an `onBeforeChange` handler and an `onChange` handler. Now there is just an `onChange` handler, and the core plugin adds it's own logic before others.
+- **The `plugin.render` function was renamed to `plugin.renderEditor`.** It performs the same function, but has been renamed to disambiguate between all of the other new rendering functions available to plugins.
+
###### NEW
- **`State` objects now have an embedded `state.schema` property.** This new schema property is used to automatically normalize the state as it changes, according to the editor's current schema. This makes normalization much easier.
diff --git a/packages/slate-react/src/components/content.js b/packages/slate-react/src/components/content.js
index da32435d2..67f149235 100644
--- a/packages/slate-react/src/components/content.js
+++ b/packages/slate-react/src/components/content.js
@@ -38,7 +38,7 @@ class Content extends React.Component {
static propTypes = {
autoCorrect: Types.bool.isRequired,
autoFocus: Types.bool.isRequired,
- children: Types.array.isRequired,
+ children: Types.any.isRequired,
className: Types.string,
editor: Types.object.isRequired,
readOnly: Types.bool.isRequired,
diff --git a/packages/slate/src/changes/with-schema.js b/packages/slate/src/changes/with-schema.js
index 80eb9bfc1..ed4d31fb0 100644
--- a/packages/slate/src/changes/with-schema.js
+++ b/packages/slate/src/changes/with-schema.js
@@ -40,9 +40,18 @@ Changes.normalizeDocument = (change) => {
Changes.normalizeNodeByKey = (change, key) => {
const { state } = change
- const { document, schema } = state
+ let { document, schema } = state
const node = document.assertNode(key)
+
normalizeNodeAndChildren(change, node, schema)
+
+ document = change.state.document
+ const ancestors = document.getAncestors(key)
+ if (!ancestors) return
+
+ ancestors.forEach((ancestor) => {
+ normalizeNode(change, ancestor, schema)
+ })
}
/**