@getguru/slate-yjs-core 1.0.3
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/CHANGELOG.md +67 -0
- package/README.md +3 -0
- package/dist/applyToSlate/index.d.ts +23 -0
- package/dist/applyToSlate/textEvent.d.ts +4 -0
- package/dist/applyToYjs/index.d.ts +4 -0
- package/dist/applyToYjs/node/index.d.ts +4 -0
- package/dist/applyToYjs/node/insertNode.d.ts +4 -0
- package/dist/applyToYjs/node/mergeNode.d.ts +4 -0
- package/dist/applyToYjs/node/moveNode.d.ts +4 -0
- package/dist/applyToYjs/node/removeNode.d.ts +4 -0
- package/dist/applyToYjs/node/setNode.d.ts +4 -0
- package/dist/applyToYjs/node/splitNode.d.ts +4 -0
- package/dist/applyToYjs/text/index.d.ts +4 -0
- package/dist/applyToYjs/text/insertText.d.ts +4 -0
- package/dist/applyToYjs/text/removeText.d.ts +4 -0
- package/dist/applyToYjs/types.d.ts +9 -0
- package/dist/index.cjs +1360 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.global.js +10365 -0
- package/dist/index.global.js.map +1 -0
- package/dist/index.js +1338 -0
- package/dist/index.js.map +1 -0
- package/dist/model/types.d.ts +38 -0
- package/dist/plugins/index.d.ts +4 -0
- package/dist/plugins/withCursors.d.ts +39 -0
- package/dist/plugins/withYHistory.d.ts +20 -0
- package/dist/plugins/withYjs.d.ts +43 -0
- package/dist/utils/clone.d.ts +5 -0
- package/dist/utils/convert.d.ts +8 -0
- package/dist/utils/delta.d.ts +8 -0
- package/dist/utils/errors.d.ts +2 -0
- package/dist/utils/location.d.ts +12 -0
- package/dist/utils/object.d.ts +10 -0
- package/dist/utils/position.d.ts +20 -0
- package/dist/utils/slate.d.ts +3 -0
- package/dist/utils/yjs.d.ts +5 -0
- package/package.json +47 -0
- package/src/applyToSlate/index.ts +118 -0
- package/src/applyToSlate/textEvent.ts +280 -0
- package/src/applyToYjs/index.ts +28 -0
- package/src/applyToYjs/node/index.ts +17 -0
- package/src/applyToYjs/node/insertNode.ts +23 -0
- package/src/applyToYjs/node/mergeNode.ts +82 -0
- package/src/applyToYjs/node/moveNode.ts +57 -0
- package/src/applyToYjs/node/removeNode.ts +16 -0
- package/src/applyToYjs/node/setNode.ts +42 -0
- package/src/applyToYjs/node/splitNode.ts +98 -0
- package/src/applyToYjs/text/index.ts +9 -0
- package/src/applyToYjs/text/insertText.ts +27 -0
- package/src/applyToYjs/text/removeText.ts +16 -0
- package/src/applyToYjs/types.ts +12 -0
- package/src/index.ts +47 -0
- package/src/model/types.ts +50 -0
- package/src/plugins/index.ts +3 -0
- package/src/plugins/withCursors.ts +269 -0
- package/src/plugins/withYHistory.ts +183 -0
- package/src/plugins/withYjs.ts +284 -0
- package/src/utils/clone.ts +29 -0
- package/src/utils/convert.ts +48 -0
- package/src/utils/delta.ts +97 -0
- package/src/utils/errors.ts +20 -0
- package/src/utils/location.ts +157 -0
- package/src/utils/object.ts +93 -0
- package/src/utils/position.ts +300 -0
- package/src/utils/slate.ts +11 -0
- package/src/utils/yjs.ts +10 -0
- 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/inSameParent.tsx +34 -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 +65 -0
- package/test/slate.d.ts +8 -0
- package/test/withTestingElements.ts +46 -0
- package/tsconfig.json +11 -0
- package/tsup.config.ts +32 -0
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
<unstyled id="block2">Welcome to slate-yjs!</unstyled>
|
|
12
|
+
</editor>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export const expected = (
|
|
16
|
+
<editor>
|
|
17
|
+
<unstyled id="block2">Welcome to slate-yjs!</unstyled>
|
|
18
|
+
<unstyled id="block1">
|
|
19
|
+
Hello world!
|
|
20
|
+
<cursor />
|
|
21
|
+
</unstyled>
|
|
22
|
+
</editor>
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export function run(editor: Editor) {
|
|
26
|
+
Transforms.moveNodes(editor, {
|
|
27
|
+
at: [0],
|
|
28
|
+
to: [1],
|
|
29
|
+
});
|
|
30
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
|
10
|
+
<anchor /> world
|
|
11
|
+
<focus />!
|
|
12
|
+
</text>
|
|
13
|
+
</unstyled>
|
|
14
|
+
</editor>
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export const expected = (
|
|
18
|
+
<editor>
|
|
19
|
+
<unstyled>
|
|
20
|
+
<text bold>Hello</text>
|
|
21
|
+
<text>
|
|
22
|
+
<anchor /> world
|
|
23
|
+
<focus />
|
|
24
|
+
</text>
|
|
25
|
+
<text bold>!</text>
|
|
26
|
+
</unstyled>
|
|
27
|
+
</editor>
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
export const inputRemoteEditor = (
|
|
31
|
+
<editor>
|
|
32
|
+
<unstyled>
|
|
33
|
+
<text bold>
|
|
34
|
+
Hello
|
|
35
|
+
<cursor /> world!
|
|
36
|
+
</text>
|
|
37
|
+
</unstyled>
|
|
38
|
+
</editor>
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
export function run(editor: Editor) {
|
|
42
|
+
editor.removeMark('bold');
|
|
43
|
+
}
|
|
@@ -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
|
+
<text italic>
|
|
9
|
+
<anchor />
|
|
10
|
+
Hello
|
|
11
|
+
<focus /> world!
|
|
12
|
+
</text>
|
|
13
|
+
</unstyled>
|
|
14
|
+
</editor>
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export const expected = (
|
|
18
|
+
<editor>
|
|
19
|
+
<unstyled>
|
|
20
|
+
<anchor />
|
|
21
|
+
<text bold>Hello</text>
|
|
22
|
+
<focus />
|
|
23
|
+
<text italic> world!</text>
|
|
24
|
+
</unstyled>
|
|
25
|
+
</editor>
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
export function run(editor: Editor) {
|
|
29
|
+
editor.addMark('bold', true);
|
|
30
|
+
editor.removeMark('italic');
|
|
31
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
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 italic>
|
|
9
|
+
Hello
|
|
10
|
+
<anchor /> world
|
|
11
|
+
<focus />!
|
|
12
|
+
</text>
|
|
13
|
+
</unstyled>
|
|
14
|
+
</editor>
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export const expected = (
|
|
18
|
+
<editor>
|
|
19
|
+
<unstyled>
|
|
20
|
+
<text bold italic>
|
|
21
|
+
Hello
|
|
22
|
+
</text>
|
|
23
|
+
<text italic>
|
|
24
|
+
<anchor /> world
|
|
25
|
+
<focus />
|
|
26
|
+
</text>
|
|
27
|
+
<text bold italic>
|
|
28
|
+
!
|
|
29
|
+
</text>
|
|
30
|
+
</unstyled>
|
|
31
|
+
</editor>
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
export const inputRemoteEditor = (
|
|
35
|
+
<editor>
|
|
36
|
+
<unstyled>
|
|
37
|
+
<text bold italic>
|
|
38
|
+
Hello
|
|
39
|
+
<cursor /> world!
|
|
40
|
+
</text>
|
|
41
|
+
</unstyled>
|
|
42
|
+
</editor>
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
export function run(editor: Editor) {
|
|
46
|
+
editor.removeMark('bold');
|
|
47
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Editor, Transforms } 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 id="myBlockId">Welcome to slate-yjs!</unstyled>
|
|
12
|
+
</editor>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export const expected = (
|
|
16
|
+
<editor>
|
|
17
|
+
<unstyled id="myBlockId">
|
|
18
|
+
<cursor />
|
|
19
|
+
Welcome to slate-yjs!
|
|
20
|
+
</unstyled>
|
|
21
|
+
</editor>
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export function run(editor: Editor) {
|
|
25
|
+
Transforms.removeNodes(editor);
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Editor, Transforms } 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 id="myBlockId">Welcome to slate-yjs!</unstyled>
|
|
12
|
+
</editor>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export const expected = (
|
|
16
|
+
<editor>
|
|
17
|
+
<unstyled>
|
|
18
|
+
<cursor />
|
|
19
|
+
Hello world!
|
|
20
|
+
</unstyled>
|
|
21
|
+
</editor>
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export function run(editor: Editor) {
|
|
25
|
+
Transforms.removeNodes(editor, { at: [1] });
|
|
26
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
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="myBlockId">
|
|
8
|
+
<cursor />
|
|
9
|
+
Hello world!
|
|
10
|
+
</unstyled>
|
|
11
|
+
<ul>
|
|
12
|
+
<ul-li>Welcome to slate-yjs!</ul-li>
|
|
13
|
+
</ul>
|
|
14
|
+
</editor>
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export const expected = (
|
|
18
|
+
<editor>
|
|
19
|
+
<unstyled id="myBlockId">
|
|
20
|
+
<cursor />
|
|
21
|
+
Hello world!
|
|
22
|
+
</unstyled>
|
|
23
|
+
</editor>
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export function run(editor: Editor) {
|
|
27
|
+
Transforms.removeNodes(editor, { at: [1] });
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
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="myBlockId">
|
|
8
|
+
<cursor />
|
|
9
|
+
Hello world!
|
|
10
|
+
</unstyled>
|
|
11
|
+
<ul>
|
|
12
|
+
<ul-li>Welcome to slate-yjs!</ul-li>
|
|
13
|
+
</ul>
|
|
14
|
+
</editor>
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export const expected = (
|
|
18
|
+
<editor>
|
|
19
|
+
<unstyled id="myBlockId">
|
|
20
|
+
<cursor />
|
|
21
|
+
Hello world!
|
|
22
|
+
</unstyled>
|
|
23
|
+
</editor>
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export function run(editor: Editor) {
|
|
27
|
+
Transforms.removeNodes(editor, { at: [1] });
|
|
28
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Editor, Transforms } from 'slate';
|
|
3
|
+
import { jsx } from '../../../../../support/jsx';
|
|
4
|
+
|
|
5
|
+
export const input = (
|
|
6
|
+
<editor>
|
|
7
|
+
<unstyled>
|
|
8
|
+
<anchor />
|
|
9
|
+
Hello world!
|
|
10
|
+
<focus />
|
|
11
|
+
</unstyled>
|
|
12
|
+
</editor>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export const expected = (
|
|
16
|
+
<editor>
|
|
17
|
+
<unstyled>
|
|
18
|
+
<cursor />
|
|
19
|
+
</unstyled>
|
|
20
|
+
</editor>
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export const inputRemoteEditor = (
|
|
24
|
+
<editor>
|
|
25
|
+
<unstyled>
|
|
26
|
+
Hello world!
|
|
27
|
+
<cursor />
|
|
28
|
+
</unstyled>
|
|
29
|
+
</editor>
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
export function run(editor: Editor) {
|
|
33
|
+
Transforms.delete(editor);
|
|
34
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Editor, Transforms } from 'slate';
|
|
3
|
+
import { jsx } from '../../../../../support/jsx';
|
|
4
|
+
|
|
5
|
+
export const input = (
|
|
6
|
+
<editor>
|
|
7
|
+
<unstyled>Hello world!</unstyled>
|
|
8
|
+
<unstyled>
|
|
9
|
+
<anchor />
|
|
10
|
+
Welcome to slate-yjs!
|
|
11
|
+
<focus />
|
|
12
|
+
</unstyled>
|
|
13
|
+
</editor>
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
export const expected = (
|
|
17
|
+
<editor>
|
|
18
|
+
<unstyled>Hello world!</unstyled>
|
|
19
|
+
<unstyled>
|
|
20
|
+
<cursor />
|
|
21
|
+
</unstyled>
|
|
22
|
+
</editor>
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export const inputRemoteEditor = (
|
|
26
|
+
<editor>
|
|
27
|
+
<unstyled>Hello world!</unstyled>
|
|
28
|
+
<unstyled>
|
|
29
|
+
<cursor />
|
|
30
|
+
Welcome to slate-yjs!
|
|
31
|
+
</unstyled>
|
|
32
|
+
</editor>
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
export function run(editor: Editor) {
|
|
36
|
+
Transforms.delete(editor);
|
|
37
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Editor, Transforms } 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
|
+
<anchor />
|
|
10
|
+
{'Iñtërnâtiônàlizætiøn☃💩\uFEFF'}
|
|
11
|
+
<focus />
|
|
12
|
+
{'Iñtërnâtiônàlizætiøn☃💩\uFEFF'}
|
|
13
|
+
</unstyled>
|
|
14
|
+
</editor>
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export const expected = (
|
|
18
|
+
<editor>
|
|
19
|
+
<unstyled>
|
|
20
|
+
{'Iñtërnâtiônàlizætiøn☃💩\uFEFF'}
|
|
21
|
+
<cursor />
|
|
22
|
+
{'Iñtërnâtiônàlizætiøn☃💩\uFEFF'}
|
|
23
|
+
</unstyled>
|
|
24
|
+
</editor>
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
export function run(editor: Editor) {
|
|
28
|
+
Transforms.delete(editor);
|
|
29
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
<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 id="block1">
|
|
18
|
+
<cursor />
|
|
19
|
+
Hello world!
|
|
20
|
+
</h1>
|
|
21
|
+
<unstyled>Welcome to slate-yjs!</unstyled>
|
|
22
|
+
</editor>
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export function run(editor: Editor) {
|
|
26
|
+
Transforms.setNodes(editor, { type: 'header-one' });
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
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">Hello world!</unstyled>
|
|
8
|
+
<h1 id="block2">
|
|
9
|
+
<cursor />
|
|
10
|
+
Welcome to slate-yjs!
|
|
11
|
+
</h1>
|
|
12
|
+
</editor>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export const expected = (
|
|
16
|
+
<editor>
|
|
17
|
+
<unstyled id="block1">Hello world!</unstyled>
|
|
18
|
+
<unstyled id="block2">
|
|
19
|
+
<cursor />
|
|
20
|
+
Welcome to slate-yjs!
|
|
21
|
+
</unstyled>
|
|
22
|
+
</editor>
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export function run(editor: Editor) {
|
|
26
|
+
Transforms.setNodes(editor, { type: 'unstyled', id: 'block2' });
|
|
27
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
<cursor />
|
|
10
|
+
Hello World!
|
|
11
|
+
</ul-li>
|
|
12
|
+
</ul>
|
|
13
|
+
</editor>
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
export const expected = (
|
|
17
|
+
<editor>
|
|
18
|
+
<ul>
|
|
19
|
+
<ul-li id="block1" checked>
|
|
20
|
+
<cursor />
|
|
21
|
+
Hello World!
|
|
22
|
+
</ul-li>
|
|
23
|
+
</ul>
|
|
24
|
+
</editor>
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
export function run(editor: Editor) {
|
|
28
|
+
Transforms.setNodes(
|
|
29
|
+
editor,
|
|
30
|
+
{ checked: true },
|
|
31
|
+
{
|
|
32
|
+
mode: 'lowest',
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Editor, Transforms } from 'slate';
|
|
3
|
+
import { jsx } from '../../../../../support/jsx';
|
|
4
|
+
|
|
5
|
+
export const input = (
|
|
6
|
+
<editor>
|
|
7
|
+
<unstyled>
|
|
8
|
+
<note-link noteId="note1">
|
|
9
|
+
Meeting notes
|
|
10
|
+
<cursor />
|
|
11
|
+
</note-link>
|
|
12
|
+
</unstyled>
|
|
13
|
+
</editor>
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
export const expected = (
|
|
17
|
+
<editor>
|
|
18
|
+
<unstyled>
|
|
19
|
+
<note-link noteId="note2">
|
|
20
|
+
Meeting notes
|
|
21
|
+
<cursor />
|
|
22
|
+
</note-link>
|
|
23
|
+
</unstyled>
|
|
24
|
+
</editor>
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
export function run(editor: Editor) {
|
|
28
|
+
Transforms.setNodes(
|
|
29
|
+
editor,
|
|
30
|
+
{ noteId: 'note2' },
|
|
31
|
+
{
|
|
32
|
+
match: (node) => Editor.isInline(editor, node),
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Editor, Transforms } from 'slate';
|
|
3
|
+
import { jsx } from '../../../../../support/jsx';
|
|
4
|
+
|
|
5
|
+
export const input = (
|
|
6
|
+
<editor>
|
|
7
|
+
<h1 id="block1">
|
|
8
|
+
<cursor />
|
|
9
|
+
Hello world!
|
|
10
|
+
</h1>
|
|
11
|
+
<unstyled>Welcome to slate-yjs!</unstyled>
|
|
12
|
+
</editor>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export const expected = (
|
|
16
|
+
<editor>
|
|
17
|
+
<unstyled id="block2">
|
|
18
|
+
<cursor />
|
|
19
|
+
Hello world!
|
|
20
|
+
</unstyled>
|
|
21
|
+
<unstyled>Welcome to slate-yjs!</unstyled>
|
|
22
|
+
</editor>
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export function run(editor: Editor) {
|
|
26
|
+
Transforms.setNodes(editor, { type: 'unstyled', id: 'block2' });
|
|
27
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
</editor>
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
export const expected = (
|
|
15
|
+
<editor>
|
|
16
|
+
<unstyled id="block1">Hello world!</unstyled>
|
|
17
|
+
<h1>
|
|
18
|
+
<cursor />
|
|
19
|
+
</h1>
|
|
20
|
+
</editor>
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export function run(editor: Editor) {
|
|
24
|
+
editor.insertNode({ type: 'unstyled', children: [{ text: '' }] });
|
|
25
|
+
Transforms.setNodes(editor, { type: 'header-one' });
|
|
26
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
<cursor />
|
|
9
|
+
Hello world!
|
|
10
|
+
</unstyled>
|
|
11
|
+
<unstyled>Welcome to slate-yjs!</unstyled>
|
|
12
|
+
</editor>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export const expected = (
|
|
16
|
+
<editor>
|
|
17
|
+
<unstyled id="block1" />
|
|
18
|
+
<unstyled id="block1">
|
|
19
|
+
<cursor />
|
|
20
|
+
Hello world!
|
|
21
|
+
</unstyled>
|
|
22
|
+
<unstyled>Welcome to slate-yjs!</unstyled>
|
|
23
|
+
</editor>
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export function run(editor: Editor) {
|
|
27
|
+
Transforms.splitNodes(editor, { always: true });
|
|
28
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
<unstyled>Welcome to slate-yjs!</unstyled>
|
|
12
|
+
</editor>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export const expected = (
|
|
16
|
+
<editor>
|
|
17
|
+
<unstyled id="block1">Hello world!</unstyled>
|
|
18
|
+
<unstyled id="block1">
|
|
19
|
+
<cursor />
|
|
20
|
+
</unstyled>
|
|
21
|
+
<unstyled>Welcome to slate-yjs!</unstyled>
|
|
22
|
+
</editor>
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export function run(editor: Editor) {
|
|
26
|
+
Transforms.splitNodes(editor, { always: true });
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Editor, Transforms } from 'slate';
|
|
3
|
+
import { jsx } from '../../../../../support/jsx';
|
|
4
|
+
|
|
5
|
+
export const input = (
|
|
6
|
+
<editor>
|
|
7
|
+
<unstyled>Hello world!</unstyled>
|
|
8
|
+
<unstyled id="block1">
|
|
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 id="block1">Welcome to slate-yjs!</unstyled>
|
|
19
|
+
<unstyled id="block1">
|
|
20
|
+
<cursor />
|
|
21
|
+
</unstyled>
|
|
22
|
+
</editor>
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export function run(editor: Editor) {
|
|
26
|
+
Transforms.splitNodes(editor, { always: true });
|
|
27
|
+
}
|