1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-31 19:01:54 +02:00
* remove some key usage from core, refactor Operations.apply

* undeprecate some methods

* convert more key usage to paths

* update deprecations

* convert selection commands to use all paths

* refactor word boundary selection logic

* convert many at-range commands to use paths

* convert wrapBlock and wrapInline to not use keys

* cleanup

* remove chainability from editor

* simplify commands, queries and middleware

* convert deleteAtRange

* remove key usage from schema, deprecate *ByKey methods

* migrate *ByKey tests, remove index from *ByPath signatures

* rename at-current-range tests

* deprecate mode key usage, migrate more tests away from keys

* deprecate range and point methods which rely on keys to work

* refactor insertBlock, without fixing warnings

* add pathRef/pointRef, fix insertBlock/Inline deprecations, work on insertFragment

* refactor insertFragment

* get rich-text example rendering

* fix lint

* refactor query files, fix more tests

* remove unused queries, refactor others

* deprecate splitDescendantsByPath

* merge master

* add typescript, convert slate, slate-hyperscript, slate-plain-serializer

* add Point, Path, Range, Annotation tests

* add Annotation, Change, Element, Fragment, Mark, Range, Selection, Value interfaces tests

* add Operation and Text tests

* add Node tests

* get operations and normalization tests working for slate

* get *AtPath command tests passing

* rename *AtPath command tests

* rename

* get *AtPoint tests working

* rename

* rename

* add value queries tests

* add element, mark and path queries tests

* convert most on-selection tests

* convert on-selection commands

* rename

* get addMarks and delete commands working

* rename

* rename

* rename

* refactor value.positions(), work on delete tests

* progress on delete tests

* more delete work

* finish delete tests

* start converting to at-based commands

* restructure query tests

* restructure operations tests

* more work converting to multi-purpose commands

* lots of progress on converting to at-based commands

* add unwrapNodes

* remove setValue

* more progress

* refactor node commands to use consistent matching logic

* cleanup, get non-fragment commands passing

* remove annotations and isAtomic

* rename surround/pluck to cover/uncover

* add location concept, change at-path to from-path for iterables

* refactor batches

* add location-based queries

* refactor hanging logic

* more location query work

* renaming

* use getMatch more

* add split to wrap/unwrap

* flip levels/ancestors ordering

* switch splitNodes to use levels

* change split to always:false by default

* fix tests

* add more queries tests

* fixing more delete logic

* add more splitNodes tests

* get rest of delete tests passing

* fix location-based logic in some commands

* cleanup

* get previous packages tests passing again

* add slate-history package

* start slate-schema work

* start of react working

* rendering fixes

* get rich and plain text examples working

* get image example working with hooks and dropping

* refactor onDrop to be internal

* inline more event handlers

* refactor lots of event-related logic

* change rendering to use render props

* delete unused stuff

* cleanup dom utils

* remove unused deps

* remove unnecessary packages, add placeholder

* remove slate-react-placeholder package

* remove unused dep

* remove unnecessary tests, fix readonly example

* convert checklists example

* switch to next from webpack

* get link example working

* convert more examples

* preserve keys, memoized leafs/texts, fix node lookup

* fix to always useLayoutEffect for ordering

* fix annotations to be maps, memoize elements

* remove Change interface

* remove String interface

* rename Node.entries to Node.nodes

* remove unnecessary value queries

* default to selection when iterating, cleanup

* remove unused files

* update scroll into view logic

* fix undoing, remove constructor types

* dont sync selection while composing

* add workflows

* remove unused deps

* convert mentions example

* tweaks

* convert remaining examples

* rename h to jsx, update schema

* fix schema tests

* fix slate-schema logic and tests

* really fix slate-schema and forced-layout example

* get start of insertFragment tests working

* remove Fragment interface

* remove debugger

* get all non-skipped tests passing

* cleanup deps

* run prettier

* configure eslint for typescript

* more eslint fixes...

* more passing

* update some docs

* fix examples

* port windows undo hotkey change

* fix deps, add basic firefox support

* add event overriding, update walkthroughs

* add commands, remove classes, cleanup examples

* cleanup rollup config

* update tests

* rename queries tests

* update other tests

* update walkthroughs

* cleanup interface exports

* cleanup, change mark transforms to require location

* undo mark transform change

* more

* fix tests

* fix example

* update walkthroughs

* update docs

* update docs

* remove annotations

* remove value, move selection and children to editor

* add migrating doc

* fix lint

* fix tests

* fix DOM types aliasing

* add next export

* update deps, fix prod build

* fix prod build

* update scripts

* update docs and changelogs

* update workflow and pull request template
This commit is contained in:
Ian Storm Taylor
2019-11-27 20:54:42 -05:00
committed by GitHub
parent 02b87d5968
commit 4ff6972096
2367 changed files with 45706 additions and 80698 deletions

View File

@@ -1,72 +0,0 @@
/** @jsx h */
import { createHyperscript } from 'slate-hyperscript'
const h = createHyperscript({
blocks: {
paragraph: 'paragraph',
},
annotations: {
highlight: 'highlight',
},
})
export const input = (
<value>
<document>
<block type="paragraph">
one<highlight>two</highlight>three
</block>
</document>
</value>
)
export const options = {
preserveAnnotations: true,
preserveKeys: true,
}
export const output = {
object: 'value',
document: {
object: 'document',
key: '3',
data: {},
nodes: [
{
object: 'block',
key: '2',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '1',
text: 'onetwothree',
marks: [],
},
],
},
],
},
annotations: {
'0': {
key: '0',
object: 'annotation',
type: 'highlight',
data: {},
anchor: {
object: 'point',
key: '1',
path: [0, 0],
offset: 3,
},
focus: {
object: 'point',
key: '1',
path: [0, 0],
offset: 6,
},
},
},
}

View File

@@ -1,89 +0,0 @@
/** @jsx h */
import { createHyperscript } from 'slate-hyperscript'
const h = createHyperscript({
blocks: {
paragraph: 'paragraph',
},
annotations: {
highlight: 'highlight',
},
})
export const input = (
<value>
<document>
<block type="paragraph">
o<highlight key="a" />ne
</block>
<block type="paragraph">
tw<highlight key="a" />o
</block>
</document>
</value>
)
export const options = {
preserveAnnotations: true,
preserveKeys: true,
}
export const output = {
object: 'value',
document: {
object: 'document',
key: '4',
data: {},
nodes: [
{
object: 'block',
key: '1',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '0',
text: 'one',
marks: [],
},
],
},
{
object: 'block',
key: '3',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '2',
text: 'two',
marks: [],
},
],
},
],
},
annotations: {
a: {
object: 'annotation',
key: 'a',
type: 'highlight',
data: {},
anchor: {
object: 'point',
key: '0',
path: [0, 0],
offset: 1,
},
focus: {
object: 'point',
key: '2',
path: [1, 0],
offset: 2,
},
},
},
}

View File

@@ -1,12 +0,0 @@
/** @jsx h */
import h from 'slate-hyperscript'
export const input = <block type="paragraph" />
export const output = {
object: 'block',
type: 'paragraph',
data: {},
nodes: [],
}

View File

@@ -1,23 +0,0 @@
/** @jsx h */
import h from 'slate-hyperscript'
export const input = (
<block type="paragraph">
<inline type="link" />
</block>
)
export const output = {
object: 'block',
type: 'paragraph',
data: {},
nodes: [
{
object: 'inline',
type: 'link',
data: {},
nodes: [],
},
],
}

View File

@@ -1,29 +0,0 @@
/** @jsx h */
import h from 'slate-hyperscript'
export const input = (
<block type="paragraph">
<inline type="link">word</inline>
</block>
)
export const output = {
object: 'block',
type: 'paragraph',
data: {},
nodes: [
{
object: 'inline',
type: 'link',
data: {},
nodes: [
{
object: 'text',
text: 'word',
marks: [],
},
],
},
],
}

View File

@@ -1,28 +0,0 @@
/** @jsx h */
import h from 'slate-hyperscript'
export const input = (
<block type="paragraph">
<mark type="bold" />
</block>
)
export const output = {
object: 'block',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
text: '',
marks: [
{
object: 'mark',
type: 'bold',
data: {},
},
],
},
],
}

View File

@@ -1,28 +0,0 @@
/** @jsx h */
import h from 'slate-hyperscript'
export const input = (
<block type="paragraph">
<mark type="bold">word</mark>
</block>
)
export const output = {
object: 'block',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
text: 'word',
marks: [
{
object: 'mark',
type: 'bold',
data: {},
},
],
},
],
}

View File

@@ -1,44 +0,0 @@
/** @jsx h */
import h from 'slate-hyperscript'
export const input = (
<block type="paragraph">
<mark type="bold">one</mark>two<mark type="italic">three</mark>
</block>
)
export const output = {
object: 'block',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
text: 'one',
marks: [
{
object: 'mark',
type: 'bold',
data: {},
},
],
},
{
object: 'text',
text: 'two',
marks: [],
},
{
object: 'text',
text: 'three',
marks: [
{
object: 'mark',
type: 'italic',
data: {},
},
],
},
],
}

View File

@@ -1,59 +0,0 @@
/** @jsx h */
import h from 'slate-hyperscript'
export const input = (
<block type="paragraph">
<mark type="bold">w</mark>
<mark type="bold">
<mark type="italic">or</mark>
</mark>
<mark type="bold">d</mark>
</block>
)
export const output = {
object: 'block',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
text: 'w',
marks: [
{
object: 'mark',
type: 'bold',
data: {},
},
],
},
{
object: 'text',
text: 'or',
marks: [
{
object: 'mark',
type: 'italic',
data: {},
},
{
object: 'mark',
type: 'bold',
data: {},
},
],
},
{
object: 'text',
text: 'd',
marks: [
{
object: 'mark',
type: 'bold',
data: {},
},
],
},
],
}

View File

@@ -1,18 +0,0 @@
/** @jsx h */
import h from 'slate-hyperscript'
export const input = <block type="paragraph">word</block>
export const output = {
object: 'block',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
text: 'word',
marks: [],
},
],
}

View File

@@ -1,22 +0,0 @@
/** @jsx h */
import h from 'slate-hyperscript'
export const input = (
<block type="paragraph">
<text />
</block>
)
export const output = {
object: 'block',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
text: '',
marks: [],
},
],
}

View File

@@ -1,22 +0,0 @@
/** @jsx h */
import h from 'slate-hyperscript'
export const input = (
<block type="paragraph">
<text>word</text>
</block>
)
export const output = {
object: 'block',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
text: 'word',
marks: [],
},
],
}

View File

@@ -1,60 +0,0 @@
/** @jsx h */
import h from 'slate-hyperscript'
export const input = (
<value>
<document>
<block type="paragraph">
w<anchor />or<focus />d
</block>
</document>
</value>
)
export const options = {
preserveSelection: true,
preserveKeys: true,
}
export const output = {
object: 'value',
document: {
object: 'document',
key: '2',
data: {},
nodes: [
{
object: 'block',
key: '1',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '0',
text: 'word',
marks: [],
},
],
},
],
},
selection: {
object: 'selection',
anchor: {
object: 'point',
key: '0',
path: [0, 0],
offset: 1,
},
focus: {
object: 'point',
key: '0',
path: [0, 0],
offset: 3,
},
isFocused: true,
marks: null,
},
}

View File

@@ -1,125 +0,0 @@
/** @jsx h */
import h from 'slate-hyperscript'
export const input = (
<value>
<document>
<block type="paragraph">
<text />
<inline type="link">
on<anchor />e
</inline>
<text />
</block>
<block type="paragraph">
<text />
<inline type="link">
t<focus />wo
</inline>
<text />
</block>
</document>
</value>
)
export const options = {
preserveSelection: true,
preserveKeys: true,
}
export const output = {
object: 'value',
document: {
object: 'document',
key: '10',
data: {},
nodes: [
{
object: 'block',
key: '4',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '0',
text: '',
marks: [],
},
{
object: 'inline',
key: '2',
type: 'link',
data: {},
nodes: [
{
object: 'text',
key: '1',
text: 'one',
marks: [],
},
],
},
{
object: 'text',
key: '3',
text: '',
marks: [],
},
],
},
{
object: 'block',
key: '9',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '5',
text: '',
marks: [],
},
{
object: 'inline',
key: '7',
type: 'link',
data: {},
nodes: [
{
object: 'text',
key: '6',
text: 'two',
marks: [],
},
],
},
{
object: 'text',
key: '8',
text: '',
marks: [],
},
],
},
],
},
selection: {
object: 'selection',
anchor: {
object: 'point',
key: '1',
path: [0, 1, 0],
offset: 2,
},
focus: {
object: 'point',
key: '6',
path: [1, 1, 0],
offset: 1,
},
isFocused: true,
marks: null,
},
}

View File

@@ -1,77 +0,0 @@
/** @jsx h */
import h from 'slate-hyperscript'
export const input = (
<value>
<document>
<block type="paragraph">
one<anchor />
</block>
<block type="paragraph">
two<focus />
</block>
</document>
</value>
)
export const options = {
preserveSelection: true,
preserveKeys: true,
}
export const output = {
object: 'value',
document: {
object: 'document',
key: '4',
data: {},
nodes: [
{
object: 'block',
key: '1',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '0',
text: 'one',
marks: [],
},
],
},
{
object: 'block',
key: '3',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '2',
text: 'two',
marks: [],
},
],
},
],
},
selection: {
object: 'selection',
anchor: {
object: 'point',
key: '0',
path: [0, 0],
offset: 3,
},
focus: {
object: 'point',
key: '2',
path: [1, 0],
offset: 3,
},
isFocused: true,
marks: null,
},
}

View File

@@ -1,77 +0,0 @@
/** @jsx h */
import h from 'slate-hyperscript'
export const input = (
<value>
<document>
<block type="paragraph">
on<anchor />e
</block>
<block type="paragraph">
t<focus />wo
</block>
</document>
</value>
)
export const options = {
preserveSelection: true,
preserveKeys: true,
}
export const output = {
object: 'value',
document: {
object: 'document',
key: '4',
data: {},
nodes: [
{
object: 'block',
key: '1',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '0',
text: 'one',
marks: [],
},
],
},
{
object: 'block',
key: '3',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '2',
text: 'two',
marks: [],
},
],
},
],
},
selection: {
object: 'selection',
anchor: {
object: 'point',
key: '0',
path: [0, 0],
offset: 2,
},
focus: {
object: 'point',
key: '2',
path: [1, 0],
offset: 1,
},
isFocused: true,
marks: null,
},
}

View File

@@ -1,77 +0,0 @@
/** @jsx h */
import h from 'slate-hyperscript'
export const input = (
<value>
<document>
<block type="paragraph">
<anchor />one
</block>
<block type="paragraph">
<focus />two
</block>
</document>
</value>
)
export const options = {
preserveSelection: true,
preserveKeys: true,
}
export const output = {
object: 'value',
document: {
object: 'document',
key: '4',
data: {},
nodes: [
{
object: 'block',
key: '1',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '0',
text: 'one',
marks: [],
},
],
},
{
object: 'block',
key: '3',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '2',
text: 'two',
marks: [],
},
],
},
],
},
selection: {
object: 'selection',
anchor: {
object: 'point',
key: '0',
path: [0, 0],
offset: 0,
},
focus: {
object: 'point',
key: '2',
path: [1, 0],
offset: 0,
},
isFocused: true,
marks: null,
},
}

View File

@@ -0,0 +1,36 @@
/** @jsx jsx */
import { jsx } from 'slate-hyperscript'
export const input = (
<editor>
<element>
w<anchor />
or
<focus />d
</element>
</editor>
)
export const output = {
children: [
{
children: [
{
text: 'word',
marks: [],
},
],
},
],
selection: {
anchor: {
path: [0, 0],
offset: 1,
},
focus: {
path: [0, 0],
offset: 3,
},
},
}

View File

@@ -0,0 +1,49 @@
/** @jsx jsx */
import { jsx } from 'slate-hyperscript'
export const input = (
<editor>
<element>
<text>
<anchor />
</text>
</element>
<element>
<text>
<focus />
</text>
</element>
</editor>
)
export const output = {
children: [
{
children: [
{
text: '',
marks: [],
},
],
},
{
children: [
{
text: '',
marks: [],
},
],
},
],
selection: {
anchor: {
path: [0, 0],
offset: 0,
},
focus: {
path: [1, 0],
offset: 0,
},
},
}

View File

@@ -0,0 +1,47 @@
/** @jsx jsx */
import { jsx } from 'slate-hyperscript'
export const input = (
<editor>
<element>
one
<anchor />
</element>
<element>
two
<focus />
</element>
</editor>
)
export const output = {
children: [
{
children: [
{
text: 'one',
marks: [],
},
],
},
{
children: [
{
text: 'two',
marks: [],
},
],
},
],
selection: {
anchor: {
path: [0, 0],
offset: 3,
},
focus: {
path: [1, 0],
offset: 3,
},
},
}

View File

@@ -0,0 +1,47 @@
/** @jsx jsx */
import { jsx } from 'slate-hyperscript'
export const input = (
<editor>
<element>
on
<anchor />e
</element>
<element>
t<focus />
wo
</element>
</editor>
)
export const output = {
children: [
{
children: [
{
text: 'one',
marks: [],
},
],
},
{
children: [
{
text: 'two',
marks: [],
},
],
},
],
selection: {
anchor: {
path: [0, 0],
offset: 2,
},
focus: {
path: [1, 0],
offset: 1,
},
},
}

View File

@@ -0,0 +1,47 @@
/** @jsx jsx */
import { jsx } from 'slate-hyperscript'
export const input = (
<editor>
<element>
<anchor />
one
</element>
<element>
<focus />
two
</element>
</editor>
)
export const output = {
children: [
{
children: [
{
text: 'one',
marks: [],
},
],
},
{
children: [
{
text: 'two',
marks: [],
},
],
},
],
selection: {
anchor: {
path: [0, 0],
offset: 0,
},
focus: {
path: [1, 0],
offset: 0,
},
},
}

View File

@@ -1,81 +0,0 @@
/** @jsx h */
import h from 'slate-hyperscript'
export const input = (
<value>
<document>
<block type="paragraph">
<text>
<anchor />
</text>
</block>
<block type="paragraph">
<text>
<focus />
</text>
</block>
</document>
</value>
)
export const options = {
preserveSelection: true,
preserveKeys: true,
}
export const output = {
object: 'value',
document: {
object: 'document',
key: '4',
data: {},
nodes: [
{
object: 'block',
key: '1',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '0',
text: '',
marks: [],
},
],
},
{
object: 'block',
key: '3',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '2',
text: '',
marks: [],
},
],
},
],
},
selection: {
object: 'selection',
anchor: {
object: 'point',
key: '0',
path: [0, 0],
offset: 0,
},
focus: {
object: 'point',
key: '2',
path: [1, 0],
offset: 0,
},
isFocused: true,
marks: null,
},
}

View File

@@ -1,92 +0,0 @@
/** @jsx h */
import h from 'slate-hyperscript'
export const input = (
<value>
<document>
<block type="paragraph">
one<anchor />
</block>
<block type="paragraph">two</block>
<block type="paragraph">
three<focus />
</block>
</document>
</value>
)
export const options = {
preserveSelection: true,
preserveKeys: true,
}
export const output = {
object: 'value',
document: {
object: 'document',
key: '6',
data: {},
nodes: [
{
object: 'block',
key: '1',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '0',
text: 'one',
marks: [],
},
],
},
{
object: 'block',
key: '3',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '2',
text: 'two',
marks: [],
},
],
},
{
object: 'block',
key: '5',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '4',
text: 'three',
marks: [],
},
],
},
],
},
selection: {
object: 'selection',
anchor: {
object: 'point',
key: '0',
path: [0, 0],
offset: 3,
},
focus: {
object: 'point',
key: '4',
path: [2, 0],
offset: 5,
},
isFocused: true,
marks: null,
},
}

View File

@@ -1,92 +0,0 @@
/** @jsx h */
import h from 'slate-hyperscript'
export const input = (
<value>
<document>
<block type="paragraph">
on<anchor />e
</block>
<block type="paragraph">two</block>
<block type="paragraph">
t<focus />hree
</block>
</document>
</value>
)
export const options = {
preserveSelection: true,
preserveKeys: true,
}
export const output = {
object: 'value',
document: {
object: 'document',
key: '6',
data: {},
nodes: [
{
object: 'block',
key: '1',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '0',
text: 'one',
marks: [],
},
],
},
{
object: 'block',
key: '3',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '2',
text: 'two',
marks: [],
},
],
},
{
object: 'block',
key: '5',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '4',
text: 'three',
marks: [],
},
],
},
],
},
selection: {
object: 'selection',
anchor: {
object: 'point',
key: '0',
path: [0, 0],
offset: 2,
},
focus: {
object: 'point',
key: '4',
path: [2, 0],
offset: 1,
},
isFocused: true,
marks: null,
},
}

View File

@@ -1,92 +0,0 @@
/** @jsx h */
import h from 'slate-hyperscript'
export const input = (
<value>
<document>
<block type="paragraph">
<anchor />one
</block>
<block type="paragraph">two</block>
<block type="paragraph">
<focus />three
</block>
</document>
</value>
)
export const options = {
preserveSelection: true,
preserveKeys: true,
}
export const output = {
object: 'value',
document: {
object: 'document',
key: '6',
data: {},
nodes: [
{
object: 'block',
key: '1',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '0',
text: 'one',
marks: [],
},
],
},
{
object: 'block',
key: '3',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '2',
text: 'two',
marks: [],
},
],
},
{
object: 'block',
key: '5',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '4',
text: 'three',
marks: [],
},
],
},
],
},
selection: {
object: 'selection',
anchor: {
object: 'point',
key: '0',
path: [0, 0],
offset: 0,
},
focus: {
object: 'point',
key: '4',
path: [2, 0],
offset: 0,
},
isFocused: true,
marks: null,
},
}

View File

@@ -1,60 +0,0 @@
/** @jsx h */
import h from 'slate-hyperscript'
export const input = (
<value>
<document>
<block type="paragraph">
one<cursor />
</block>
</document>
</value>
)
export const options = {
preserveSelection: true,
preserveKeys: true,
}
export const output = {
object: 'value',
document: {
object: 'document',
key: '2',
data: {},
nodes: [
{
object: 'block',
key: '1',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '0',
text: 'one',
marks: [],
},
],
},
],
},
selection: {
object: 'selection',
anchor: {
object: 'point',
key: '0',
path: [0, 0],
offset: 3,
},
focus: {
object: 'point',
key: '0',
path: [0, 0],
offset: 3,
},
isFocused: true,
marks: null,
},
}

View File

@@ -1,60 +0,0 @@
/** @jsx h */
import h from 'slate-hyperscript'
export const input = (
<value>
<document>
<block type="paragraph">
o<cursor />ne
</block>
</document>
</value>
)
export const options = {
preserveSelection: true,
preserveKeys: true,
}
export const output = {
object: 'value',
document: {
object: 'document',
key: '2',
data: {},
nodes: [
{
object: 'block',
key: '1',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '0',
text: 'one',
marks: [],
},
],
},
],
},
selection: {
object: 'selection',
anchor: {
object: 'point',
key: '0',
path: [0, 0],
offset: 1,
},
focus: {
object: 'point',
key: '0',
path: [0, 0],
offset: 1,
},
isFocused: true,
marks: null,
},
}

View File

@@ -1,60 +0,0 @@
/** @jsx h */
import h from 'slate-hyperscript'
export const input = (
<value>
<document>
<block type="paragraph">
<cursor />one
</block>
</document>
</value>
)
export const options = {
preserveSelection: true,
preserveKeys: true,
}
export const output = {
object: 'value',
document: {
object: 'document',
key: '2',
data: {},
nodes: [
{
object: 'block',
key: '1',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '0',
text: 'one',
marks: [],
},
],
},
],
},
selection: {
object: 'selection',
anchor: {
object: 'point',
key: '0',
path: [0, 0],
offset: 0,
},
focus: {
object: 'point',
key: '0',
path: [0, 0],
offset: 0,
},
isFocused: true,
marks: null,
},
}

View File

@@ -1,66 +0,0 @@
/** @jsx h */
import { createHyperscript } from 'slate-hyperscript'
const h = createHyperscript({
blocks: {
paragraph: 'paragraph',
},
})
export const input = (
<value>
<document>
<paragraph>
o<cursor />ne
</paragraph>
</document>
</value>
)
export const options = {
preserveSelection: true,
preserveKeys: true,
}
export const output = {
object: 'value',
document: {
object: 'document',
key: '2',
data: {},
nodes: [
{
object: 'block',
key: '1',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '0',
text: 'one',
marks: [],
},
],
},
],
},
selection: {
object: 'selection',
anchor: {
object: 'point',
key: '0',
path: [0, 0],
offset: 1,
},
focus: {
object: 'point',
key: '0',
path: [0, 0],
offset: 1,
},
isFocused: true,
marks: null,
},
}

View File

@@ -0,0 +1,34 @@
/** @jsx jsx */
import { jsx } from 'slate-hyperscript'
export const input = (
<editor>
<element>
<cursor />
</element>
</editor>
)
export const output = {
children: [
{
children: [
{
text: '',
marks: [],
},
],
},
],
selection: {
anchor: {
path: [0, 0],
offset: 0,
},
focus: {
path: [0, 0],
offset: 0,
},
},
}

View File

@@ -0,0 +1,35 @@
/** @jsx jsx */
import { jsx } from 'slate-hyperscript'
export const input = (
<editor>
<element>
one
<cursor />
</element>
</editor>
)
export const output = {
children: [
{
children: [
{
text: 'one',
marks: [],
},
],
},
],
selection: {
anchor: {
path: [0, 0],
offset: 3,
},
focus: {
path: [0, 0],
offset: 3,
},
},
}

View File

@@ -0,0 +1,35 @@
/** @jsx jsx */
import { jsx } from 'slate-hyperscript'
export const input = (
<editor>
<element>
o<cursor />
ne
</element>
</editor>
)
export const output = {
children: [
{
children: [
{
text: 'one',
marks: [],
},
],
},
],
selection: {
anchor: {
path: [0, 0],
offset: 1,
},
focus: {
path: [0, 0],
offset: 1,
},
},
}

View File

@@ -0,0 +1,41 @@
/** @jsx jsx */
import { jsx } from 'slate-hyperscript'
export const input = (
<editor>
<element>
<element>
word
<cursor />
</element>
</element>
</editor>
)
export const output = {
children: [
{
children: [
{
children: [
{
text: 'word',
marks: [],
},
],
},
],
},
],
selection: {
anchor: {
path: [0, 0, 0],
offset: 4,
},
focus: {
path: [0, 0, 0],
offset: 4,
},
},
}

View File

@@ -0,0 +1,42 @@
/** @jsx jsx */
import { jsx } from 'slate-hyperscript'
export const input = (
<editor>
<element>
<element>
wo
<cursor />
rd
</element>
</element>
</editor>
)
export const output = {
children: [
{
children: [
{
children: [
{
text: 'word',
marks: [],
},
],
},
],
},
],
selection: {
anchor: {
path: [0, 0, 0],
offset: 2,
},
focus: {
path: [0, 0, 0],
offset: 2,
},
},
}

View File

@@ -0,0 +1,41 @@
/** @jsx jsx */
import { jsx } from 'slate-hyperscript'
export const input = (
<editor>
<element>
<element>
<cursor />
word
</element>
</element>
</editor>
)
export const output = {
children: [
{
children: [
{
children: [
{
text: 'word',
marks: [],
},
],
},
],
},
],
selection: {
anchor: {
path: [0, 0, 0],
offset: 0,
},
focus: {
path: [0, 0, 0],
offset: 0,
},
},
}

View File

@@ -0,0 +1,35 @@
/** @jsx jsx */
import { jsx } from 'slate-hyperscript'
export const input = (
<editor>
<element>
<cursor />
one
</element>
</editor>
)
export const output = {
children: [
{
children: [
{
text: 'one',
marks: [],
},
],
},
],
selection: {
anchor: {
path: [0, 0],
offset: 0,
},
focus: {
path: [0, 0],
offset: 0,
},
},
}

View File

@@ -1,62 +0,0 @@
/** @jsx h */
import h from 'slate-hyperscript'
export const input = (
<value>
<document>
<block type="paragraph">
<text key="a">
<cursor />
</text>
</block>
</document>
</value>
)
export const options = {
preserveSelection: true,
preserveKeys: true,
}
export const output = {
object: 'value',
document: {
object: 'document',
key: '2',
data: {},
nodes: [
{
object: 'block',
key: '1',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: 'a',
text: '',
marks: [],
},
],
},
],
},
selection: {
object: 'selection',
anchor: {
object: 'point',
key: 'a',
path: [0, 0],
offset: 0,
},
focus: {
object: 'point',
key: 'a',
path: [0, 0],
offset: 0,
},
isFocused: true,
marks: null,
},
}

View File

@@ -1,62 +0,0 @@
/** @jsx h */
import h from 'slate-hyperscript'
export const input = (
<value>
<document>
<block type="paragraph">
<text>
<cursor />
</text>
</block>
</document>
</value>
)
export const options = {
preserveSelection: true,
preserveKeys: true,
}
export const output = {
object: 'value',
document: {
object: 'document',
key: '2',
data: {},
nodes: [
{
object: 'block',
key: '1',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '0',
text: '',
marks: [],
},
],
},
],
},
selection: {
object: 'selection',
anchor: {
object: 'point',
key: '0',
path: [0, 0],
offset: 0,
},
focus: {
object: 'point',
key: '0',
path: [0, 0],
offset: 0,
},
isFocused: true,
marks: null,
},
}

View File

@@ -1,84 +0,0 @@
/** @jsx h */
import h from 'slate-hyperscript'
export const input = (
<value>
<document>
<block type="paragraph">
one
<inline type="link">
two<cursor />
</inline>
three
</block>
</document>
</value>
)
export const options = {
preserveSelection: true,
preserveKeys: true,
}
export const output = {
object: 'value',
document: {
object: 'document',
data: {},
key: '5',
nodes: [
{
object: 'block',
key: '4',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '2',
text: 'one',
marks: [],
},
{
object: 'inline',
key: '1',
type: 'link',
data: {},
nodes: [
{
object: 'text',
key: '0',
text: 'two',
marks: [],
},
],
},
{
object: 'text',
key: '3',
text: 'three',
marks: [],
},
],
},
],
},
selection: {
object: 'selection',
anchor: {
object: 'point',
key: '0',
path: [0, 1, 0],
offset: 3,
},
focus: {
object: 'point',
key: '0',
path: [0, 1, 0],
offset: 3,
},
isFocused: true,
marks: null,
},
}

View File

@@ -1,84 +0,0 @@
/** @jsx h */
import h from 'slate-hyperscript'
export const input = (
<value>
<document>
<block type="paragraph">
one
<inline type="link">
<cursor />two
</inline>
three
</block>
</document>
</value>
)
export const options = {
preserveSelection: true,
preserveKeys: true,
}
export const output = {
object: 'value',
document: {
object: 'document',
data: {},
key: '5',
nodes: [
{
object: 'block',
key: '4',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '2',
text: 'one',
marks: [],
},
{
object: 'inline',
key: '1',
type: 'link',
data: {},
nodes: [
{
object: 'text',
key: '0',
text: 'two',
marks: [],
},
],
},
{
object: 'text',
key: '3',
text: 'three',
marks: [],
},
],
},
],
},
selection: {
object: 'selection',
anchor: {
object: 'point',
key: '0',
path: [0, 1, 0],
offset: 0,
},
focus: {
object: 'point',
key: '0',
path: [0, 1, 0],
offset: 0,
},
isFocused: true,
marks: null,
},
}

View File

@@ -1,84 +0,0 @@
/** @jsx h */
import h from 'slate-hyperscript'
export const input = (
<value>
<document>
<block type="paragraph">
one
<inline type="link">
t<cursor />wo
</inline>
three
</block>
</document>
</value>
)
export const options = {
preserveSelection: true,
preserveKeys: true,
}
export const output = {
object: 'value',
document: {
object: 'document',
data: {},
key: '5',
nodes: [
{
object: 'block',
key: '4',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '2',
text: 'one',
marks: [],
},
{
object: 'inline',
key: '1',
type: 'link',
data: {},
nodes: [
{
object: 'text',
key: '0',
text: 'two',
marks: [],
},
],
},
{
object: 'text',
key: '3',
text: 'three',
marks: [],
},
],
},
],
},
selection: {
object: 'selection',
anchor: {
object: 'point',
key: '0',
path: [0, 1, 0],
offset: 1,
},
focus: {
object: 'point',
key: '0',
path: [0, 1, 0],
offset: 1,
},
isFocused: true,
marks: null,
},
}

View File

@@ -1,60 +1,34 @@
/** @jsx h */
/** @jsx jsx */
import h from 'slate-hyperscript'
import { jsx } from 'slate-hyperscript'
export const input = (
<value>
<document>
<block type="paragraph">
<cursor isFocused={false} />one
</block>
</document>
</value>
<editor>
<element>
<cursor focused={false} />
</element>
</editor>
)
export const options = {
preserveSelection: true,
preserveKeys: true,
}
export const output = {
object: 'value',
document: {
object: 'document',
key: '2',
data: {},
nodes: [
{
object: 'block',
key: '1',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '0',
text: 'one',
marks: [],
},
],
},
],
},
children: [
{
children: [
{
text: '',
marks: [],
},
],
},
],
selection: {
object: 'selection',
anchor: {
object: 'point',
key: '0',
path: [0, 0],
offset: 0,
},
focus: {
object: 'point',
key: '0',
path: [0, 0],
offset: 0,
},
isFocused: false,
marks: null,
},
}

View File

@@ -1,73 +1,40 @@
/** @jsx h */
/** @jsx jsx */
import h from 'slate-hyperscript'
import { jsx } from 'slate-hyperscript'
export const input = (
<value>
<document>
<block type="paragraph">
<mark type="bold">one</mark>
<cursor />two
</block>
</document>
</value>
<editor>
<element>
<mark>one</mark>
<cursor />
two
</element>
</editor>
)
export const options = {
preserveSelection: true,
preserveKeys: true,
}
export const output = {
object: 'value',
document: {
object: 'document',
data: {},
key: '3',
nodes: [
{
object: 'block',
key: '2',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
text: 'one',
key: '0',
marks: [
{
object: 'mark',
type: 'bold',
data: {},
},
],
},
{
object: 'text',
key: '1',
text: 'two',
marks: [],
},
],
},
],
},
children: [
{
children: [
{
text: 'one',
marks: [{}],
},
{
text: 'two',
marks: [],
},
],
},
],
selection: {
object: 'selection',
anchor: {
object: 'point',
key: '1',
path: [0, 1],
offset: 0,
path: [0, 0],
offset: 3,
},
focus: {
object: 'point',
key: '1',
path: [0, 1],
offset: 0,
path: [0, 0],
offset: 3,
},
isFocused: true,
marks: null,
},
}

View File

@@ -1,82 +1,42 @@
/** @jsx h */
/** @jsx jsx */
import h from 'slate-hyperscript'
import { jsx } from 'slate-hyperscript'
export const input = (
<value>
<document>
<block type="paragraph">
<editor>
<element>
<mark>
one
<mark type="bold">
two<cursor />
</mark>
three
</block>
</document>
</value>
<cursor />
</mark>
two
</element>
</editor>
)
export const options = {
preserveSelection: true,
preserveKeys: true,
}
export const output = {
object: 'value',
document: {
object: 'document',
data: {},
key: '4',
nodes: [
{
object: 'block',
key: '3',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '1',
text: 'one',
marks: [],
},
{
object: 'text',
text: 'two',
key: '0',
marks: [
{
object: 'mark',
type: 'bold',
data: {},
},
],
},
{
object: 'text',
key: '2',
text: 'three',
marks: [],
},
],
},
],
},
children: [
{
children: [
{
text: 'one',
marks: [{}],
},
{
text: 'two',
marks: [],
},
],
},
],
selection: {
object: 'selection',
anchor: {
object: 'point',
key: '0',
path: [0, 1],
path: [0, 0],
offset: 3,
},
focus: {
object: 'point',
key: '0',
path: [0, 1],
path: [0, 0],
offset: 3,
},
isFocused: true,
marks: null,
},
}

View File

@@ -0,0 +1,42 @@
/** @jsx jsx */
import { jsx } from 'slate-hyperscript'
export const input = (
<editor>
<element>
<mark>
o<cursor />
ne
</mark>
two
</element>
</editor>
)
export const output = {
children: [
{
children: [
{
text: 'one',
marks: [{}],
},
{
text: 'two',
marks: [],
},
],
},
],
selection: {
anchor: {
path: [0, 0],
offset: 1,
},
focus: {
path: [0, 0],
offset: 1,
},
},
}

View File

@@ -1,82 +1,42 @@
/** @jsx h */
/** @jsx jsx */
import h from 'slate-hyperscript'
import { jsx } from 'slate-hyperscript'
export const input = (
<value>
<document>
<block type="paragraph">
<editor>
<element>
<mark>
<cursor />
one
<mark type="bold">
<cursor />two
</mark>
three
</block>
</document>
</value>
</mark>
two
</element>
</editor>
)
export const options = {
preserveSelection: true,
preserveKeys: true,
}
export const output = {
object: 'value',
document: {
object: 'document',
data: {},
key: '4',
nodes: [
{
object: 'block',
key: '3',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '1',
text: 'one',
marks: [],
},
{
object: 'text',
key: '0',
text: 'two',
marks: [
{
object: 'mark',
type: 'bold',
data: {},
},
],
},
{
object: 'text',
key: '2',
text: 'three',
marks: [],
},
],
},
],
},
children: [
{
children: [
{
text: 'one',
marks: [{}],
},
{
text: 'two',
marks: [],
},
],
},
],
selection: {
object: 'selection',
anchor: {
object: 'point',
key: '0',
path: [0, 1],
path: [0, 0],
offset: 0,
},
focus: {
object: 'point',
key: '0',
path: [0, 1],
path: [0, 0],
offset: 0,
},
isFocused: true,
marks: null,
},
}

View File

@@ -1,82 +0,0 @@
/** @jsx h */
import h from 'slate-hyperscript'
export const input = (
<value>
<document>
<block type="paragraph">
one
<mark type="bold">
t<cursor />wo
</mark>
three
</block>
</document>
</value>
)
export const options = {
preserveSelection: true,
preserveKeys: true,
}
export const output = {
object: 'value',
document: {
object: 'document',
data: {},
key: '4',
nodes: [
{
object: 'block',
key: '3',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '1',
text: 'one',
marks: [],
},
{
object: 'text',
key: '0',
text: 'two',
marks: [
{
object: 'mark',
type: 'bold',
data: {},
},
],
},
{
object: 'text',
key: '2',
text: 'three',
marks: [],
},
],
},
],
},
selection: {
object: 'selection',
anchor: {
object: 'point',
key: '0',
path: [0, 1],
offset: 1,
},
focus: {
object: 'point',
key: '0',
path: [0, 1],
offset: 1,
},
isFocused: true,
marks: null,
},
}

View File

@@ -1,60 +1,34 @@
/** @jsx h */
/** @jsx jsx */
import h from 'slate-hyperscript'
import { jsx } from 'slate-hyperscript'
export const input = (
<value>
<document>
<block type="paragraph">
<cursor marks={[]} />one
</block>
</document>
</value>
<editor>
<element>
<cursor marks={[]} />
</element>
</editor>
)
export const options = {
preserveSelection: true,
preserveKeys: true,
}
export const output = {
object: 'value',
document: {
object: 'document',
key: '2',
data: {},
nodes: [
{
object: 'block',
key: '1',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: '0',
text: 'one',
marks: [],
},
],
},
],
},
children: [
{
children: [
{
text: '',
marks: [],
},
],
},
],
selection: {
object: 'selection',
anchor: {
object: 'point',
key: '0',
path: [0, 0],
offset: 0,
},
focus: {
object: 'point',
key: '0',
path: [0, 0],
offset: 0,
},
isFocused: true,
marks: [],
},
}

View File

@@ -0,0 +1,36 @@
/** @jsx jsx */
import { jsx } from 'slate-hyperscript'
export const input = (
<editor>
<element>
<text>
<cursor />
</text>
</element>
</editor>
)
export const output = {
children: [
{
children: [
{
text: '',
marks: [],
},
],
},
],
selection: {
anchor: {
path: [0, 0],
offset: 0,
},
focus: {
path: [0, 0],
offset: 0,
},
},
}

View File

@@ -1,68 +0,0 @@
/** @jsx h */
import { createHyperscript } from 'slate-hyperscript'
const h = createHyperscript({
blocks: {
paragraph: 'paragraph',
},
marks: {
b: 'bold',
},
})
export const input = (
<value>
<document>
<paragraph>
<text>one</text>
<b>two</b>
<b>three</b>
</paragraph>
</document>
</value>
)
export const output = {
object: 'value',
document: {
object: 'document',
data: {},
nodes: [
{
object: 'block',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
text: 'one',
marks: [],
},
{
object: 'text',
text: 'two',
marks: [
{
object: 'mark',
type: 'bold',
data: {},
},
],
},
{
object: 'text',
text: 'three',
marks: [
{
object: 'mark',
type: 'bold',
data: {},
},
],
},
],
},
],
},
}

View File

@@ -1,93 +0,0 @@
/** @jsx h */
import { createHyperscript } from 'slate-hyperscript'
const h = createHyperscript({
blocks: {
paragraph: 'paragraph',
image: 'image',
},
inlines: {
link: 'link',
},
marks: {
b: 'bold',
},
})
export const input = (
<value>
<document>
<paragraph>
A string of <b>bold</b> in a <link src="http://slatejs.org">Slate</link>{' '}
editor!
</paragraph>
<image src="https://..." />
</document>
</value>
)
export const output = {
object: 'value',
document: {
object: 'document',
data: {},
nodes: [
{
object: 'block',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
text: 'A string of ',
marks: [],
},
{
object: 'text',
text: 'bold',
marks: [
{
object: 'mark',
type: 'bold',
data: {},
},
],
},
{
object: 'text',
text: ' in a ',
marks: [],
},
{
object: 'inline',
type: 'link',
data: {
src: 'http://slatejs.org',
},
nodes: [
{
object: 'text',
text: 'Slate',
marks: [],
},
],
},
{
object: 'text',
text: ' editor!',
marks: [],
},
],
},
{
object: 'block',
type: 'image',
data: {
src: 'https://...',
},
nodes: [],
},
],
},
}

View File

@@ -1,11 +0,0 @@
/** @jsx h */
import h from 'slate-hyperscript'
export const input = <document />
export const output = {
object: 'document',
data: {},
nodes: [],
}

View File

@@ -0,0 +1,21 @@
/** @jsx jsx */
import { createHyperscript } from 'slate-hyperscript'
const jsx = createHyperscript({
elements: {
paragraph: { type: 'paragraph' },
},
})
export const input = <paragraph>word</paragraph>
export const output = {
type: 'paragraph',
children: [
{
text: 'word',
marks: [],
},
],
}

View File

@@ -0,0 +1,9 @@
/** @jsx jsx */
import { jsx } from 'slate-hyperscript'
export const input = <element />
export const output = {
children: [],
}

View File

@@ -0,0 +1,17 @@
/** @jsx jsx */
import { jsx } from 'slate-hyperscript'
export const input = (
<element>
<element />
</element>
)
export const output = {
children: [
{
children: [],
},
],
}

View File

@@ -0,0 +1,22 @@
/** @jsx jsx */
import { jsx } from 'slate-hyperscript'
export const input = (
<element>
<element>word</element>
</element>
)
export const output = {
children: [
{
children: [
{
text: 'word',
marks: [],
},
],
},
],
}

View File

@@ -0,0 +1,14 @@
/** @jsx jsx */
import { jsx } from 'slate-hyperscript'
export const input = <element>word</element>
export const output = {
children: [
{
text: 'word',
marks: [],
},
],
}

View File

@@ -0,0 +1,18 @@
/** @jsx jsx */
import { jsx } from 'slate-hyperscript'
export const input = (
<element>
<text />
</element>
)
export const output = {
children: [
{
text: '',
marks: [],
},
],
}

View File

@@ -0,0 +1,18 @@
/** @jsx jsx */
import { jsx } from 'slate-hyperscript'
export const input = (
<element>
<text>word</text>
</element>
)
export const output = {
children: [
{
text: 'word',
marks: [],
},
],
}

View File

@@ -0,0 +1,20 @@
/** @jsx jsx */
import { jsx } from 'slate-hyperscript'
export const input = (
<fragment>
<element>word</element>
</fragment>
)
export const output = [
{
children: [
{
text: 'word',
marks: [],
},
],
},
]

View File

@@ -0,0 +1,7 @@
/** @jsx jsx */
import { jsx } from 'slate-hyperscript'
export const input = <fragment />
export const output = []

View File

@@ -0,0 +1,12 @@
/** @jsx jsx */
import { jsx } from 'slate-hyperscript'
export const input = <fragment>word</fragment>
export const output = [
{
text: 'word',
marks: [],
},
]

View File

@@ -1,12 +0,0 @@
/** @jsx h */
import h from 'slate-hyperscript'
export const input = <inline type="link" />
export const output = {
object: 'inline',
type: 'link',
data: {},
nodes: [],
}

View File

@@ -1,18 +0,0 @@
/** @jsx h */
import h from 'slate-hyperscript'
export const input = <inline type="link">word</inline>
export const output = {
object: 'inline',
type: 'link',
data: {},
nodes: [
{
object: 'text',
text: 'word',
marks: [],
},
],
}

View File

@@ -0,0 +1,16 @@
/** @jsx jsx */
import { createHyperscript } from 'slate-hyperscript'
const jsx = createHyperscript({
marks: {
b: { type: 'bold' },
},
})
export const input = <b>word</b>
export const output = {
text: 'word',
marks: [{ type: 'bold' }],
}

View File

@@ -0,0 +1,14 @@
/** @jsx jsx */
import { jsx } from 'slate-hyperscript'
export const input = (
<mark type="a">
<mark type="b">word</mark>
</mark>
)
export const output = {
text: 'word',
marks: [{ type: 'b' }, { type: 'a' }],
}

View File

@@ -0,0 +1,10 @@
/** @jsx jsx */
import { jsx } from 'slate-hyperscript'
export const input = <mark>word</mark>
export const output = {
text: 'word',
marks: [{}],
}

View File

@@ -0,0 +1,14 @@
/** @jsx jsx */
import { jsx } from 'slate-hyperscript'
export const input = (
<mark>
<text>word</text>
</mark>
)
export const output = {
text: 'word',
marks: [{}],
}

View File

@@ -1,64 +1,36 @@
/** @jsx h */
/** @jsx jsx */
import h from 'slate-hyperscript'
import { jsx } from 'slate-hyperscript'
export const input = (
<value>
<document>
<block type="paragraph">
<text key="a">two</text>
</block>
</document>
<editor>
<element>word</element>
<selection>
<anchor key="a" offset={1} />
<focus key="a" offset={2} />
<anchor path={[0, 0]} offset={1} />
<focus path={[0, 0]} offset={2} />
</selection>
</value>
</editor>
)
export const options = {
preserveSelection: true,
preserveKeys: true,
}
export const output = {
object: 'value',
document: {
object: 'document',
key: '2',
data: {},
nodes: [
{
object: 'block',
key: '1',
type: 'paragraph',
data: {},
nodes: [
{
object: 'text',
key: 'a',
text: 'two',
marks: [],
},
],
},
],
},
children: [
{
children: [
{
text: 'word',
marks: [],
},
],
},
],
selection: {
object: 'selection',
anchor: {
object: 'point',
key: 'a',
path: [0, 0],
offset: 1,
},
focus: {
object: 'point',
key: 'a',
path: [0, 0],
offset: 2,
},
isFocused: false,
marks: null,
},
}

View File

@@ -1,11 +1,10 @@
/** @jsx h */
/** @jsx jsx */
import h from 'slate-hyperscript'
import { jsx } from 'slate-hyperscript'
export const input = <text />
export const output = {
object: 'text',
text: '',
marks: [],
}

View File

@@ -1,11 +1,10 @@
/** @jsx h */
/** @jsx jsx */
import h from 'slate-hyperscript'
import { jsx } from 'slate-hyperscript'
export const input = <text>word</text>
export const output = {
object: 'text',
text: 'word',
marks: [],
}

View File

@@ -1,6 +1,6 @@
/** @jsx h */
/** @jsx jsx */
import h from 'slate-hyperscript'
import { jsx } from 'slate-hyperscript'
export const input = (
<text>
@@ -9,7 +9,6 @@ export const input = (
)
export const output = {
object: 'text',
text: 'word',
marks: [],
}

View File

@@ -1,16 +0,0 @@
/** @jsx h */
import h from 'slate-hyperscript'
export const input = <text key="a">word</text>
export const options = {
preserveKeys: true,
}
export const output = {
object: 'text',
key: 'a',
text: 'word',
marks: [],
}

View File

@@ -0,0 +1,10 @@
/** @jsx jsx */
import { jsx } from 'slate-hyperscript'
export const input = <editor />
export const output = {
children: [],
selection: null,
}