1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-30 02:19:52 +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

@@ -8,7 +8,7 @@ describe('slate-history', () => {
const { input, run, output } = module
const editor = withTest(withHistory(input))
run(editor)
editor.exec({ type: 'undo' })
editor.undo()
assert.deepEqual(editor.children, output.children)
assert.deepEqual(editor.selection, output.selection)
})

View File

@@ -3,7 +3,7 @@
import { jsx } from '../..'
export const run = editor => {
editor.exec({ type: 'delete_backward' })
editor.deleteBackward()
}
export const input = (

View File

@@ -3,7 +3,7 @@
import { jsx } from '../..'
export const run = editor => {
editor.exec({ type: 'delete_backward' })
editor.deleteBackward()
}
export const input = (

View File

@@ -1,10 +1,10 @@
/** @jsx jsx */
import { Editor } from 'slate'
import { Transforms } from 'slate'
import { jsx } from '../..'
export const run = editor => {
Editor.delete(editor)
Transforms.delete(editor)
}
export const input = (

View File

@@ -1,10 +1,10 @@
/** @jsx jsx */
import { Editor } from 'slate'
import { Transforms } from 'slate'
import { jsx } from '../..'
export const run = editor => {
Editor.delete(editor)
Transforms.delete(editor)
}
export const input = (

View File

@@ -1,10 +1,10 @@
/** @jsx jsx */
import { Editor } from 'slate'
import { Transforms } from 'slate'
import { jsx } from '../..'
export const run = editor => {
Editor.delete(editor)
Transforms.delete(editor)
}
export const input = (

View File

@@ -4,7 +4,7 @@ import { Editor } from 'slate'
import { jsx } from '../..'
export const run = editor => {
editor.exec({ type: 'insert_break' })
editor.insertBreak()
}
export const input = (

View File

@@ -22,7 +22,7 @@ const fragment = (
)
export const run = editor => {
editor.exec({ type: 'insert_fragment', fragment })
editor.insertFragment(fragment)
}
export const input = (
@@ -38,3 +38,5 @@ export const input = (
)
export const output = input
export const skip = true

View File

@@ -3,7 +3,7 @@
import { jsx } from '../..'
export const run = editor => {
editor.exec({ type: 'insert_text', text: 'text' })
editor.insertText('text')
}
export const input = (

View File

@@ -3,9 +3,9 @@
import { jsx } from '../..'
export const run = editor => {
editor.exec({ type: 'insert_text', text: 't' })
editor.exec({ type: 'insert_text', text: 'w' })
editor.exec({ type: 'insert_text', text: 'o' })
editor.insertText('t')
editor.insertText('w')
editor.insertText('o')
}
export const input = (

View File

@@ -1,14 +1,14 @@
/** @jsx jsx */
import { Editor } from 'slate'
import { Transforms } from 'slate'
import { jsx } from '../..'
export const run = editor => {
editor.exec({ type: 'insert_text', text: 't' })
Editor.move(editor, { reverse: true })
editor.exec({ type: 'insert_text', text: 'w' })
Editor.move(editor, { reverse: true })
editor.exec({ type: 'insert_text', text: 'o' })
editor.insertText('t')
Transforms.move(editor, { reverse: true })
editor.insertText('w')
Transforms.move(editor, { reverse: true })
editor.insertText('o')
}
export const input = (