1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-29 18:09:49 +02:00

Remove commands (#3351)

* remove commands in favor of editor-level functions

* update examples

* fix lint
This commit is contained in:
Ian Storm Taylor
2019-12-18 15:00:42 -05:00
committed by GitHub
parent c2d7905e19
commit 0bbe121d76
578 changed files with 3532 additions and 3370 deletions

View File

@@ -36,7 +36,7 @@ const App = () => {
const [match] = Editor.nodes(editor, {
match: n => n.type === 'code',
})
Editor.setNodes(
Transforms.setNodes(
editor,
{ type: match ? 'paragraph' : 'code' },
{ match: n => Editor.isBlock(editor, n) }
@@ -86,7 +86,7 @@ const App = () => {
const [match] = Editor.nodes(editor, {
match: n => n.type === 'code',
})
Editor.setNodes(
Transforms.setNodes(
editor,
{ type: match ? 'paragraph' : 'code' },
{ match: n => Editor.isBlock(editor, n) }
@@ -97,7 +97,7 @@ const App = () => {
// When "B" is pressed, bold the text in the selection.
case 'b': {
event.preventDefault()
Editor.setNodes(
Transforms.setNodes(
editor,
{ bold: true },
// Apply it to text nodes, and split the text node up if the
@@ -177,7 +177,7 @@ const App = () => {
const [match] = Editor.nodes(editor, {
match: n => n.type === 'code',
})
Editor.setNodes(
Transforms.setNodes(
editor,
{ type: match ? null : 'code' },
{ match: n => Editor.isBlock(editor, n) }
@@ -187,7 +187,7 @@ const App = () => {
case 'b': {
event.preventDefault()
Editor.setNodes(
Transforms.setNodes(
editor,
{ bold: true },
{ match: n => Text.isText(n), split: true }