@slate-yjs/core 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/applyToSlate/index.d.ts +2 -2
- package/dist/applyToSlate/index.d.ts.map +1 -1
- package/dist/applyToSlate/index.js +3 -1
- package/dist/applyToSlate/index.js.map +1 -1
- package/dist/applyToSlate/textEvent.d.ts.map +1 -1
- package/dist/applyToSlate/textEvent.js +17 -15
- package/dist/applyToSlate/textEvent.js.map +1 -1
- package/dist/applyToYjs/node/splitNode.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +1 -1
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +1 -1
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/plugins/withCursors.js +30 -29
- package/dist/plugins/withCursors.js.map +1 -1
- package/dist/plugins/withYHistory.d.ts +7 -2
- package/dist/plugins/withYHistory.d.ts.map +1 -1
- package/dist/plugins/withYHistory.js +20 -10
- package/dist/plugins/withYHistory.js.map +1 -1
- package/dist/plugins/withYjs.d.ts +9 -6
- package/dist/plugins/withYjs.d.ts.map +1 -1
- package/dist/plugins/withYjs.js +60 -38
- package/dist/plugins/withYjs.js.map +1 -1
- package/dist/utils/delta.d.ts +1 -0
- package/dist/utils/delta.d.ts.map +1 -1
- package/dist/utils/delta.js +26 -1
- package/dist/utils/delta.js.map +1 -1
- package/dist/utils/object.d.ts +7 -4
- package/dist/utils/object.d.ts.map +1 -1
- package/dist/utils/object.js +54 -15
- package/dist/utils/object.js.map +1 -1
- package/dist/utils/position.d.ts.map +1 -1
- package/dist/utils/slate.d.ts +2 -2
- package/dist/utils/slate.d.ts.map +1 -1
- package/dist/utils/slate.js.map +1 -1
- package/package.json +5 -5
- package/src/applyToSlate/index.ts +2 -2
- package/src/applyToSlate/textEvent.ts +21 -20
- package/src/plugins/withYHistory.ts +26 -5
- package/src/plugins/withYjs.ts +68 -33
- package/src/utils/delta.ts +36 -1
- package/src/utils/object.ts +65 -20
- package/src/utils/position.ts +1 -1
- package/src/utils/slate.ts +3 -3
- package/test/collaboration/addMark/acrossMarks.tsx +40 -0
- package/test/collaboration/addMark/acrossMarksSame.tsx +36 -0
- package/test/collaboration/addMark/atBeginningOfDocument.tsx +27 -0
- package/test/collaboration/addMark/atEndOfDocument.tsx +30 -0
- package/test/collaboration/addMark/withOtherMarks.tsx +31 -0
- package/test/collaboration/insertNode/atBeginningOfDocument.tsx +28 -0
- package/test/collaboration/insertNode/atEndOfDocument.tsx +28 -0
- package/test/collaboration/insertNode/inTheMiddle.tsx +30 -0
- package/test/collaboration/insertText/atBeginningOfBlock.tsx +26 -0
- package/test/collaboration/insertText/atBeginningOfDocument.tsx +26 -0
- package/test/collaboration/insertText/atEndOfBlock.tsx +26 -0
- package/test/collaboration/insertText/atEndOfDocument.tsx +26 -0
- package/test/collaboration/insertText/inTheMiddle.tsx +32 -0
- package/test/collaboration/insertText/inTheMiddleOfNestedBlock.tsx +30 -0
- package/test/collaboration/insertText/insideMarks.tsx +28 -0
- package/test/collaboration/insertText/withEmptyString.tsx +25 -0
- package/test/collaboration/insertText/withEntities.tsx +28 -0
- package/test/collaboration/insertText/withMarks.tsx +25 -0
- package/test/collaboration/insertText/withUnicode.tsx +28 -0
- package/test/collaboration/mergeNode/afterADeleteBackward.tsx +27 -0
- package/test/collaboration/mergeNode/onMixedNestedNodes.tsx +29 -0
- package/test/collaboration/mergeNode/onMixedTypeNodes.tsx +27 -0
- package/test/collaboration/mergeNode/withUnicode.tsx +25 -0
- package/test/collaboration/moveNode/downward/whenBlockBecomesNested.tsx +43 -0
- package/test/collaboration/moveNode/downward/whenBlockBecomesNonNested.tsx +41 -0
- package/test/collaboration/moveNode/downward/whenBlockStaysNested.tsx +38 -0
- package/test/collaboration/moveNode/downward/whenBlockStaysNonNested.tsx +30 -0
- package/test/collaboration/moveNode/upward/whenBlockBecomesNested.tsx +43 -0
- package/test/collaboration/moveNode/upward/whenBlockBecomesNonNested.tsx +41 -0
- package/test/collaboration/moveNode/upward/whenBlockStaysNested.tsx +38 -0
- package/test/collaboration/moveNode/upward/whenBlockStaysNonNested.tsx +30 -0
- package/test/collaboration/removeMark/inTheMiddleOfText.tsx +43 -0
- package/test/collaboration/removeMark/withAddMark.tsx +31 -0
- package/test/collaboration/removeMark/withOtherMarks.tsx +47 -0
- package/test/collaboration/removeNode/atBeginningOfDocument.tsx +26 -0
- package/test/collaboration/removeNode/atEndOfDocument.tsx +26 -0
- package/test/collaboration/removeNode/nestedBlock.tsx +28 -0
- package/test/collaboration/removeNode/wrapperBlock.tsx +28 -0
- package/test/collaboration/removeText/atBeginningOfDocument.tsx +34 -0
- package/test/collaboration/removeText/atEndOfDocument.tsx +37 -0
- package/test/collaboration/removeText/withUnicode.tsx +29 -0
- package/test/collaboration/setNode/atBeginningOfDocument.tsx +27 -0
- package/test/collaboration/setNode/atEndOfDocument.tsx +27 -0
- package/test/collaboration/setNode/onDataChange.tsx +35 -0
- package/test/collaboration/setNode/onDataChangeOnInline.tsx +35 -0
- package/test/collaboration/setNode/onResetBlock.tsx +27 -0
- package/test/collaboration/setNode/withAChangeOfType.tsx +26 -0
- package/test/collaboration/splitNode/atBeginningOfDocument.tsx +28 -0
- package/test/collaboration/splitNode/atEndOfBlock.tsx +27 -0
- package/test/collaboration/splitNode/atEndOfDocument.tsx +27 -0
- package/test/collaboration/splitNode/onNonDefaultBlock.tsx +27 -0
- package/test/collaboration/splitNode/withMultipleSubNodes.tsx +32 -0
- package/test/collaboration/splitNode/withUnicode.tsx +29 -0
- package/test/index.test.ts +66 -0
- package/test/{types.d.ts → slate.d.ts} +0 -0
- package/test/withTestingElements.ts +46 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/test/collaboration.test.ts +0 -395
- package/test/concurrent.test.ts +0 -233
- package/test/testEditor.ts +0 -134
- package/test/utils.ts +0 -64
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Editor } from 'slate';
|
|
3
|
+
import { jsx } from '../../../../../support/jsx';
|
|
4
|
+
|
|
5
|
+
export const input = (
|
|
6
|
+
<editor>
|
|
7
|
+
<unstyled>
|
|
8
|
+
<anchor />
|
|
9
|
+
<text italic>Hello world</text>
|
|
10
|
+
<focus />
|
|
11
|
+
<text bold>!</text>
|
|
12
|
+
</unstyled>
|
|
13
|
+
</editor>
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
export const expected = (
|
|
17
|
+
<editor>
|
|
18
|
+
<unstyled>
|
|
19
|
+
<anchor />
|
|
20
|
+
<text italic bold>
|
|
21
|
+
Hello world
|
|
22
|
+
</text>
|
|
23
|
+
<focus />
|
|
24
|
+
<text bold>!</text>
|
|
25
|
+
</unstyled>
|
|
26
|
+
</editor>
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
export function run(editor: Editor) {
|
|
30
|
+
editor.addMark('bold', true);
|
|
31
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Editor } from 'slate';
|
|
3
|
+
import { jsx } from '../../../../../support/jsx';
|
|
4
|
+
|
|
5
|
+
export const input = (
|
|
6
|
+
<editor>
|
|
7
|
+
<unstyled>
|
|
8
|
+
<cursor />
|
|
9
|
+
Hello world!
|
|
10
|
+
</unstyled>
|
|
11
|
+
<unstyled>Welcome to slate-yjs!</unstyled>
|
|
12
|
+
</editor>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export const expected = (
|
|
16
|
+
<editor>
|
|
17
|
+
<h1>
|
|
18
|
+
Foo bar!
|
|
19
|
+
<cursor />
|
|
20
|
+
</h1>
|
|
21
|
+
<unstyled>Hello world!</unstyled>
|
|
22
|
+
<unstyled>Welcome to slate-yjs!</unstyled>
|
|
23
|
+
</editor>
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export function run(editor: Editor) {
|
|
27
|
+
editor.insertNode(<h1>Foo bar!</h1>);
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Editor } from 'slate';
|
|
3
|
+
import { jsx } from '../../../../../support/jsx';
|
|
4
|
+
|
|
5
|
+
export const input = (
|
|
6
|
+
<editor>
|
|
7
|
+
<unstyled>Hello world!</unstyled>
|
|
8
|
+
<unstyled>
|
|
9
|
+
Welcome to slate-yjs!
|
|
10
|
+
<cursor />
|
|
11
|
+
</unstyled>
|
|
12
|
+
</editor>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export const expected = (
|
|
16
|
+
<editor>
|
|
17
|
+
<unstyled>Hello world!</unstyled>
|
|
18
|
+
<unstyled>Welcome to slate-yjs!</unstyled>
|
|
19
|
+
<h1>
|
|
20
|
+
Foo bar!
|
|
21
|
+
<cursor />
|
|
22
|
+
</h1>
|
|
23
|
+
</editor>
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export function run(editor: Editor) {
|
|
27
|
+
editor.insertNode(<h1>Foo bar!</h1>);
|
|
28
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Editor } from 'slate';
|
|
3
|
+
import { jsx } from '../../../../../support/jsx';
|
|
4
|
+
|
|
5
|
+
export const input = (
|
|
6
|
+
<editor>
|
|
7
|
+
<unstyled>Hello world!</unstyled>
|
|
8
|
+
<unstyled>
|
|
9
|
+
Welcome
|
|
10
|
+
<cursor />
|
|
11
|
+
to slate-yjs!
|
|
12
|
+
</unstyled>
|
|
13
|
+
</editor>
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
export const expected = (
|
|
17
|
+
<editor>
|
|
18
|
+
<unstyled>Hello world!</unstyled>
|
|
19
|
+
<unstyled>Welcome</unstyled>
|
|
20
|
+
<h1>
|
|
21
|
+
Foo bar!
|
|
22
|
+
<cursor />
|
|
23
|
+
</h1>
|
|
24
|
+
<unstyled>to slate-yjs!</unstyled>
|
|
25
|
+
</editor>
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
export function run(editor: Editor) {
|
|
29
|
+
editor.insertNode(<h1>Foo bar!</h1>);
|
|
30
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Editor } from 'slate';
|
|
3
|
+
import { jsx } from '../../../../../support/jsx';
|
|
4
|
+
|
|
5
|
+
export const input = (
|
|
6
|
+
<editor>
|
|
7
|
+
<unstyled>Hello world!</unstyled>
|
|
8
|
+
<unstyled>
|
|
9
|
+
<cursor />
|
|
10
|
+
</unstyled>
|
|
11
|
+
</editor>
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
export const expected = (
|
|
15
|
+
<editor>
|
|
16
|
+
<unstyled>Hello world!</unstyled>
|
|
17
|
+
<unstyled>
|
|
18
|
+
Welcome to slate-yjs!
|
|
19
|
+
<cursor />
|
|
20
|
+
</unstyled>
|
|
21
|
+
</editor>
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export function run(editor: Editor) {
|
|
25
|
+
editor.insertText('Welcome to slate-yjs!');
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Editor } from 'slate';
|
|
3
|
+
import { jsx } from '../../../../../support/jsx';
|
|
4
|
+
|
|
5
|
+
export const input = (
|
|
6
|
+
<editor>
|
|
7
|
+
<unstyled>
|
|
8
|
+
<cursor />
|
|
9
|
+
</unstyled>
|
|
10
|
+
<unstyled>Welcome to slate-yjs!</unstyled>
|
|
11
|
+
</editor>
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
export const expected = (
|
|
15
|
+
<editor>
|
|
16
|
+
<unstyled>
|
|
17
|
+
Hello world!
|
|
18
|
+
<cursor />
|
|
19
|
+
</unstyled>
|
|
20
|
+
<unstyled>Welcome to slate-yjs!</unstyled>
|
|
21
|
+
</editor>
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export function run(editor: Editor) {
|
|
25
|
+
editor.insertText('Hello world!');
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Editor } from 'slate';
|
|
3
|
+
import { jsx } from '../../../../../support/jsx';
|
|
4
|
+
|
|
5
|
+
export const input = (
|
|
6
|
+
<editor>
|
|
7
|
+
<unstyled>
|
|
8
|
+
Hello <cursor />
|
|
9
|
+
</unstyled>
|
|
10
|
+
<unstyled>Welcome to slate-yjs!</unstyled>
|
|
11
|
+
</editor>
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
export const expected = (
|
|
15
|
+
<editor>
|
|
16
|
+
<unstyled>
|
|
17
|
+
Hello world!
|
|
18
|
+
<cursor />
|
|
19
|
+
</unstyled>
|
|
20
|
+
<unstyled>Welcome to slate-yjs!</unstyled>
|
|
21
|
+
</editor>
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export function run(editor: Editor) {
|
|
25
|
+
editor.insertText('world!');
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Editor } from 'slate';
|
|
3
|
+
import { jsx } from '../../../../../support/jsx';
|
|
4
|
+
|
|
5
|
+
export const input = (
|
|
6
|
+
<editor>
|
|
7
|
+
<unstyled>Hello world!</unstyled>
|
|
8
|
+
<unstyled>
|
|
9
|
+
Welcome to <cursor />
|
|
10
|
+
</unstyled>
|
|
11
|
+
</editor>
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
export const expected = (
|
|
15
|
+
<editor>
|
|
16
|
+
<unstyled>Hello world!</unstyled>
|
|
17
|
+
<unstyled>
|
|
18
|
+
Welcome to slate-yjs!
|
|
19
|
+
<cursor />
|
|
20
|
+
</unstyled>
|
|
21
|
+
</editor>
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export function run(editor: Editor) {
|
|
25
|
+
editor.insertText('slate-yjs!');
|
|
26
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Editor } from 'slate';
|
|
3
|
+
import { jsx } from '../../../../../support/jsx';
|
|
4
|
+
|
|
5
|
+
export const input = (
|
|
6
|
+
<editor>
|
|
7
|
+
<unstyled>
|
|
8
|
+
Hello <cursor />!
|
|
9
|
+
</unstyled>
|
|
10
|
+
</editor>
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export const expected = (
|
|
14
|
+
<editor>
|
|
15
|
+
<unstyled>
|
|
16
|
+
Hello world
|
|
17
|
+
<cursor />!
|
|
18
|
+
</unstyled>
|
|
19
|
+
</editor>
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
export const inputRemoteEditor = (
|
|
23
|
+
<editor>
|
|
24
|
+
<unstyled>
|
|
25
|
+
Hello !<cursor />
|
|
26
|
+
</unstyled>
|
|
27
|
+
</editor>
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
export function run(editor: Editor) {
|
|
31
|
+
editor.insertText('world');
|
|
32
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Editor } from 'slate';
|
|
3
|
+
import { jsx } from '../../../../../support/jsx';
|
|
4
|
+
|
|
5
|
+
export const input = (
|
|
6
|
+
<editor>
|
|
7
|
+
<ul>
|
|
8
|
+
<ul-li>Hello world!</ul-li>
|
|
9
|
+
<ul-li>
|
|
10
|
+
Welcome to <cursor />
|
|
11
|
+
</ul-li>
|
|
12
|
+
</ul>
|
|
13
|
+
</editor>
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
export const expected = (
|
|
17
|
+
<editor>
|
|
18
|
+
<ul>
|
|
19
|
+
<ul-li>Hello world!</ul-li>
|
|
20
|
+
<ul-li>
|
|
21
|
+
Welcome to slate-yjs!
|
|
22
|
+
<cursor />
|
|
23
|
+
</ul-li>
|
|
24
|
+
</ul>
|
|
25
|
+
</editor>
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
export function run(editor: Editor) {
|
|
29
|
+
editor.insertText('slate-yjs!');
|
|
30
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Editor } from 'slate';
|
|
3
|
+
import { jsx } from '../../../../../support/jsx';
|
|
4
|
+
|
|
5
|
+
export const input = (
|
|
6
|
+
<editor>
|
|
7
|
+
<unstyled>
|
|
8
|
+
<text bold>
|
|
9
|
+
Hello <cursor />!
|
|
10
|
+
</text>
|
|
11
|
+
</unstyled>
|
|
12
|
+
</editor>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export const expected = (
|
|
16
|
+
<editor>
|
|
17
|
+
<unstyled>
|
|
18
|
+
<text bold>
|
|
19
|
+
Hello world
|
|
20
|
+
<cursor />!
|
|
21
|
+
</text>
|
|
22
|
+
</unstyled>
|
|
23
|
+
</editor>
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export function run(editor: Editor) {
|
|
27
|
+
editor.insertText('world');
|
|
28
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Editor } from 'slate';
|
|
3
|
+
import { jsx } from '../../../../../support/jsx';
|
|
4
|
+
|
|
5
|
+
export const input = (
|
|
6
|
+
<editor>
|
|
7
|
+
<unstyled>
|
|
8
|
+
Hello world!
|
|
9
|
+
<cursor />
|
|
10
|
+
</unstyled>
|
|
11
|
+
</editor>
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
export const expected = (
|
|
15
|
+
<editor>
|
|
16
|
+
<unstyled>
|
|
17
|
+
Hello world!
|
|
18
|
+
<cursor />
|
|
19
|
+
</unstyled>
|
|
20
|
+
</editor>
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export function run(editor: Editor) {
|
|
24
|
+
editor.insertText('');
|
|
25
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Editor } from 'slate';
|
|
3
|
+
import { jsx } from '../../../../../support/jsx';
|
|
4
|
+
|
|
5
|
+
export const input = (
|
|
6
|
+
<editor>
|
|
7
|
+
<unstyled>
|
|
8
|
+
<note-link entityId="myEntity">
|
|
9
|
+
Hello <cursor />!
|
|
10
|
+
</note-link>
|
|
11
|
+
</unstyled>
|
|
12
|
+
</editor>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export const expected = (
|
|
16
|
+
<editor>
|
|
17
|
+
<unstyled>
|
|
18
|
+
<note-link entityId="myEntity">
|
|
19
|
+
Hello world
|
|
20
|
+
<cursor />!
|
|
21
|
+
</note-link>
|
|
22
|
+
</unstyled>
|
|
23
|
+
</editor>
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export function run(editor: Editor) {
|
|
27
|
+
editor.insertText('world');
|
|
28
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Editor } from 'slate';
|
|
3
|
+
import { jsx } from '../../../../../support/jsx';
|
|
4
|
+
|
|
5
|
+
export const input = (
|
|
6
|
+
<editor>
|
|
7
|
+
<unstyled>
|
|
8
|
+
Hello <cursor />!
|
|
9
|
+
</unstyled>
|
|
10
|
+
</editor>
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export const expected = (
|
|
14
|
+
<editor>
|
|
15
|
+
<unstyled>
|
|
16
|
+
Hello <text bold>world</text>
|
|
17
|
+
<cursor />!
|
|
18
|
+
</unstyled>
|
|
19
|
+
</editor>
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
export function run(editor: Editor) {
|
|
23
|
+
editor.addMark('bold', true);
|
|
24
|
+
editor.insertText('world');
|
|
25
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Editor } from 'slate';
|
|
3
|
+
import { jsx } from '../../../../../support/jsx';
|
|
4
|
+
|
|
5
|
+
export const input = (
|
|
6
|
+
<editor>
|
|
7
|
+
<unstyled>
|
|
8
|
+
{'Iñtërnâtiônàlizætiøn☃💩\uFEFF'}
|
|
9
|
+
<cursor />
|
|
10
|
+
{'Iñtërnâtiônàlizætiøn☃💩\uFEFF'}
|
|
11
|
+
</unstyled>
|
|
12
|
+
</editor>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export const expected = (
|
|
16
|
+
<editor>
|
|
17
|
+
<unstyled>
|
|
18
|
+
{'Iñtërnâtiônàlizætiøn☃💩\uFEFF'}
|
|
19
|
+
{'Iñtërnâtiônàlizætiøn☃💩\uFEFF'}
|
|
20
|
+
<cursor />
|
|
21
|
+
{'Iñtërnâtiônàlizætiøn☃💩\uFEFF'}
|
|
22
|
+
</unstyled>
|
|
23
|
+
</editor>
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export function run(editor: Editor) {
|
|
27
|
+
editor.insertText('Iñtërnâtiônàlizætiøn☃💩\uFEFF');
|
|
28
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Editor } from 'slate';
|
|
3
|
+
import { jsx } from '../../../../../support/jsx';
|
|
4
|
+
|
|
5
|
+
export const input = (
|
|
6
|
+
<editor>
|
|
7
|
+
<unstyled>Hello world!</unstyled>
|
|
8
|
+
<unstyled>
|
|
9
|
+
<cursor />
|
|
10
|
+
Welcome to slate-yjs!
|
|
11
|
+
</unstyled>
|
|
12
|
+
</editor>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export const expected = (
|
|
16
|
+
<editor>
|
|
17
|
+
<unstyled>
|
|
18
|
+
Hello world!
|
|
19
|
+
<cursor />
|
|
20
|
+
Welcome to slate-yjs!
|
|
21
|
+
</unstyled>
|
|
22
|
+
</editor>
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export function run(editor: Editor) {
|
|
26
|
+
editor.deleteBackward('character');
|
|
27
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Editor } from 'slate';
|
|
3
|
+
import { jsx } from '../../../../../support/jsx';
|
|
4
|
+
|
|
5
|
+
export const input = (
|
|
6
|
+
<editor>
|
|
7
|
+
<unstyled id="block1">Hello world!</unstyled>
|
|
8
|
+
<ul>
|
|
9
|
+
<ul-li>
|
|
10
|
+
<cursor />
|
|
11
|
+
Welcome to slate-yjs!
|
|
12
|
+
</ul-li>
|
|
13
|
+
</ul>
|
|
14
|
+
</editor>
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export const expected = (
|
|
18
|
+
<editor>
|
|
19
|
+
<unstyled id="block1">
|
|
20
|
+
Hello world!
|
|
21
|
+
<cursor />
|
|
22
|
+
Welcome to slate-yjs!
|
|
23
|
+
</unstyled>
|
|
24
|
+
</editor>
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
export function run(editor: Editor) {
|
|
28
|
+
editor.deleteBackward('character');
|
|
29
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Editor } from 'slate';
|
|
3
|
+
import { jsx } from '../../../../../support/jsx';
|
|
4
|
+
|
|
5
|
+
export const input = (
|
|
6
|
+
<editor>
|
|
7
|
+
<unstyled id="block1">Hello world!</unstyled>
|
|
8
|
+
<h1>
|
|
9
|
+
<cursor />
|
|
10
|
+
Welcome to slate-yjs!
|
|
11
|
+
</h1>
|
|
12
|
+
</editor>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export const expected = (
|
|
16
|
+
<editor>
|
|
17
|
+
<unstyled id="block1">
|
|
18
|
+
Hello world!
|
|
19
|
+
<cursor />
|
|
20
|
+
Welcome to slate-yjs!
|
|
21
|
+
</unstyled>
|
|
22
|
+
</editor>
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export function run(editor: Editor) {
|
|
26
|
+
editor.deleteBackward('character');
|
|
27
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Editor } from 'slate';
|
|
3
|
+
import { jsx } from '../../../../../support/jsx';
|
|
4
|
+
|
|
5
|
+
export const input = (
|
|
6
|
+
<editor>
|
|
7
|
+
<unstyled id="block1">{'Iñtërnâtiônàlizætiøn☃💩\uFEFF'}</unstyled>
|
|
8
|
+
<unstyled id="block2">
|
|
9
|
+
<cursor />H{'Iñtërnâtiônàlizætiøn☃💩\uFEFF'}
|
|
10
|
+
</unstyled>
|
|
11
|
+
</editor>
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
export const expected = (
|
|
15
|
+
<editor>
|
|
16
|
+
<unstyled id="block1">
|
|
17
|
+
{'Iñtërnâtiônàlizætiøn☃💩\uFEFF'}
|
|
18
|
+
<cursor />H{'Iñtërnâtiônàlizætiøn☃💩\uFEFF'}
|
|
19
|
+
</unstyled>
|
|
20
|
+
</editor>
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export function run(editor: Editor) {
|
|
24
|
+
editor.deleteBackward('character');
|
|
25
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Editor, Transforms } from 'slate';
|
|
3
|
+
import { jsx } from '../../../../../../support/jsx';
|
|
4
|
+
|
|
5
|
+
export const input = (
|
|
6
|
+
<editor>
|
|
7
|
+
<unstyled id="block1">
|
|
8
|
+
Hello world!
|
|
9
|
+
<cursor />
|
|
10
|
+
</unstyled>
|
|
11
|
+
<ul>
|
|
12
|
+
<ul-li id="block2">Welcome to slate-yjs!</ul-li>
|
|
13
|
+
</ul>
|
|
14
|
+
</editor>
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export const expected = (
|
|
18
|
+
<editor>
|
|
19
|
+
<ul>
|
|
20
|
+
<ul-li id="block2">Welcome to slate-yjs!</ul-li>
|
|
21
|
+
<ul-li id="block1">
|
|
22
|
+
Hello world!
|
|
23
|
+
<cursor />
|
|
24
|
+
</ul-li>
|
|
25
|
+
</ul>
|
|
26
|
+
</editor>
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
export function run(editor: Editor) {
|
|
30
|
+
Editor.withoutNormalizing(editor, () => {
|
|
31
|
+
Transforms.setNodes(
|
|
32
|
+
editor,
|
|
33
|
+
{ type: 'unordered-list-item' },
|
|
34
|
+
{
|
|
35
|
+
at: [0],
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
Transforms.moveNodes(editor, {
|
|
39
|
+
at: [0],
|
|
40
|
+
to: [1, 1],
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Editor, Transforms } from 'slate';
|
|
3
|
+
import { jsx } from '../../../../../../support/jsx';
|
|
4
|
+
|
|
5
|
+
export const input = (
|
|
6
|
+
<editor>
|
|
7
|
+
<ul>
|
|
8
|
+
<ul-li id="block1">
|
|
9
|
+
Hello world!
|
|
10
|
+
<cursor />
|
|
11
|
+
</ul-li>
|
|
12
|
+
</ul>
|
|
13
|
+
<unstyled id="block2">Welcome to slate-yjs!</unstyled>
|
|
14
|
+
</editor>
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export const expected = (
|
|
18
|
+
<editor>
|
|
19
|
+
<unstyled id="block2">Welcome to slate-yjs!</unstyled>
|
|
20
|
+
<unstyled id="block1">
|
|
21
|
+
Hello world!
|
|
22
|
+
<cursor />
|
|
23
|
+
</unstyled>
|
|
24
|
+
</editor>
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
export function run(editor: Editor) {
|
|
28
|
+
Editor.withoutNormalizing(editor, () => {
|
|
29
|
+
Transforms.setNodes(
|
|
30
|
+
editor,
|
|
31
|
+
{ type: 'unstyled' },
|
|
32
|
+
{
|
|
33
|
+
at: [0, 0],
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
Transforms.moveNodes(editor, {
|
|
37
|
+
at: [0, 0],
|
|
38
|
+
to: [2],
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Editor, Transforms } from 'slate';
|
|
3
|
+
import { jsx } from '../../../../../../support/jsx';
|
|
4
|
+
|
|
5
|
+
export const input = (
|
|
6
|
+
<editor>
|
|
7
|
+
<ul>
|
|
8
|
+
<ul-li id="block1">
|
|
9
|
+
Hello world!
|
|
10
|
+
<cursor />
|
|
11
|
+
</ul-li>
|
|
12
|
+
</ul>
|
|
13
|
+
<unstyled />
|
|
14
|
+
<ul>
|
|
15
|
+
<ul-li id="block2">Welcome to slate-yjs!</ul-li>
|
|
16
|
+
</ul>
|
|
17
|
+
</editor>
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export const expected = (
|
|
21
|
+
<editor>
|
|
22
|
+
<unstyled />
|
|
23
|
+
<ul>
|
|
24
|
+
<ul-li id="block2">Welcome to slate-yjs!</ul-li>
|
|
25
|
+
<ul-li id="block1">
|
|
26
|
+
Hello world!
|
|
27
|
+
<cursor />
|
|
28
|
+
</ul-li>
|
|
29
|
+
</ul>
|
|
30
|
+
</editor>
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
export function run(editor: Editor) {
|
|
34
|
+
Transforms.moveNodes(editor, {
|
|
35
|
+
at: [0, 0],
|
|
36
|
+
to: [2, 1],
|
|
37
|
+
});
|
|
38
|
+
}
|