mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-30 18:39:51 +02:00
fix docs pages and plugins example
This commit is contained in:
@@ -43,7 +43,7 @@
|
||||
- [Placeholder](./reference/slate-react/placeholder.md)
|
||||
- [Custom Nodes](./reference/slate-react/custom-nodes.md)
|
||||
- [Plugins](./reference/slate-react/plugins.md)
|
||||
- [Core Plugin](./reference/slate-react/core-plugin.md)
|
||||
- [Core Plugins](./reference/slate-react/core-plugins.md)
|
||||
- [findDOMNode](./reference/slate-react/utils.md)
|
||||
|
||||
|
||||
|
@@ -3,15 +3,14 @@ import Plain from 'slate-plain-serializer'
|
||||
import { Editor } from 'slate-react'
|
||||
|
||||
import React from 'react'
|
||||
import AutoReplaceText from 'slate-auto-replace-text'
|
||||
import CollapseOnEscape from 'slate-collapse-on-escape'
|
||||
import SoftBreak from 'slate-soft-break'
|
||||
|
||||
/**
|
||||
* Word Count plugin
|
||||
* A simple word count plugin.
|
||||
*
|
||||
* Example of using plugin.render to create a HOC
|
||||
* https://docs.slatejs.org/reference/plugins/plugin.html#render
|
||||
* @param {Object} options
|
||||
* @return {Object}
|
||||
*/
|
||||
|
||||
function WordCount(options) {
|
||||
@@ -31,15 +30,11 @@ function WordCount(options) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Plugins.
|
||||
*/
|
||||
|
||||
const plugins = [
|
||||
AutoReplaceText('(c)', '©'),
|
||||
AutoReplaceText('(r)', '®'),
|
||||
AutoReplaceText('(tm)', '™'),
|
||||
CollapseOnEscape(),
|
||||
SoftBreak(),
|
||||
WordCount()
|
||||
@@ -62,13 +57,11 @@ 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 an "auto replacer". Try typing "(c)" and you'll see it turn into a copyright symbol automatically!
|
||||
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 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 another simple plugin that inserts a "soft" break when enter is pressed instead of creating a new block. Try pressing enter!
|
||||
|
||||
The fourth is an example of using the plugin.render property to create a higher-order-component.`)
|
||||
The third is an example of using the plugin.render property to create a higher-order-component.`)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -48,9 +48,8 @@
|
||||
"react-router-dom": "^4.1.1",
|
||||
"read-metadata": "^1.0.0",
|
||||
"read-yaml-promise": "^1.0.2",
|
||||
"slate-auto-replace-text": "^0.3.0",
|
||||
"slate-collapse-on-escape": "^0.2.0",
|
||||
"slate-soft-break": "^0.2.0",
|
||||
"slate-collapse-on-escape": "^0.5.0",
|
||||
"slate-soft-break": "^0.5.0",
|
||||
"slate-sugar": "^0.6.1",
|
||||
"source-map-support": "^0.4.0",
|
||||
"to-camel-case": "^1.0.0",
|
||||
|
27
yarn.lock
27
yarn.lock
@@ -1601,10 +1601,6 @@ compare-func@^1.3.1:
|
||||
array-ify "^1.0.0"
|
||||
dot-prop "^3.0.0"
|
||||
|
||||
component-type@^1.2.1:
|
||||
version "1.2.1"
|
||||
resolved "https://registry.yarnpkg.com/component-type/-/component-type-1.2.1.tgz#8a47901700238e4fc32269771230226f24b415a9"
|
||||
|
||||
concat-map@0.0.1:
|
||||
version "0.0.1"
|
||||
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
|
||||
@@ -2243,10 +2239,6 @@ es6-weak-map@^2.0.1:
|
||||
es6-iterator "^2.0.1"
|
||||
es6-symbol "^3.1.1"
|
||||
|
||||
escape-regex-string@^1.0.4:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/escape-regex-string/-/escape-regex-string-1.0.4.tgz#3a35d77e209d26b6724bc1e8dcd4120b175b88dd"
|
||||
|
||||
escape-regexp-component@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/escape-regexp-component/-/escape-regexp-component-1.0.2.tgz#9c63b6d0b25ff2a88c3adbd18c5b61acc3b9faa2"
|
||||
@@ -5504,22 +5496,15 @@ slash@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55"
|
||||
|
||||
slate-auto-replace-text@^0.3.0:
|
||||
version "0.3.1"
|
||||
resolved "https://registry.yarnpkg.com/slate-auto-replace-text/-/slate-auto-replace-text-0.3.1.tgz#3e5ed40e2fc36e84f090a75a47377028a588bec8"
|
||||
dependencies:
|
||||
component-type "^1.2.1"
|
||||
escape-regex-string "^1.0.4"
|
||||
|
||||
slate-collapse-on-escape@^0.2.0:
|
||||
version "0.2.1"
|
||||
resolved "https://registry.yarnpkg.com/slate-collapse-on-escape/-/slate-collapse-on-escape-0.2.1.tgz#988f474439f0a21f94cc0016da52ea3c1a061100"
|
||||
slate-collapse-on-escape@^0.5.0:
|
||||
version "0.5.0"
|
||||
resolved "https://registry.yarnpkg.com/slate-collapse-on-escape/-/slate-collapse-on-escape-0.5.0.tgz#4eee1d8e7d065dc2eed5bbcf78d5fa3dba5b1c95"
|
||||
dependencies:
|
||||
to-pascal-case "^1.0.0"
|
||||
|
||||
slate-soft-break@^0.2.0:
|
||||
version "0.2.1"
|
||||
resolved "https://registry.yarnpkg.com/slate-soft-break/-/slate-soft-break-0.2.1.tgz#88a37cb6832afee2d6d9b55af213ea37bbaec586"
|
||||
slate-soft-break@^0.5.0:
|
||||
version "0.5.0"
|
||||
resolved "https://registry.yarnpkg.com/slate-soft-break/-/slate-soft-break-0.5.0.tgz#f1c14f4bcf01ba534f285c59d5a9be52b42c3c5e"
|
||||
|
||||
slate-sugar@^0.6.1:
|
||||
version "0.6.1"
|
||||
|
Reference in New Issue
Block a user