@slate-yjs/core 1.0.3 → 1.0.4

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.
Files changed (82) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/applyToYjs/node/mergeNode.d.ts.map +1 -1
  3. package/dist/applyToYjs/node/moveNode.d.ts.map +1 -1
  4. package/dist/applyToYjs/node/splitNode.d.ts.map +1 -1
  5. package/dist/index.cjs +19 -20
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.global.js +3907 -5461
  8. package/dist/index.global.js.map +1 -1
  9. package/dist/index.js +19 -20
  10. package/dist/index.js.map +1 -1
  11. package/dist/plugins/withYjs.d.ts.map +1 -1
  12. package/dist/utils/clone.d.ts.map +1 -1
  13. package/dist/utils/convert.d.ts.map +1 -1
  14. package/dist/utils/yjs.d.ts +3 -0
  15. package/dist/utils/yjs.d.ts.map +1 -1
  16. package/package.json +10 -5
  17. package/src/applyToYjs/node/mergeNode.ts +2 -3
  18. package/src/applyToYjs/node/moveNode.ts +2 -1
  19. package/src/applyToYjs/node/splitNode.ts +2 -3
  20. package/src/plugins/withYjs.ts +17 -0
  21. package/src/utils/clone.ts +5 -3
  22. package/src/utils/convert.ts +2 -1
  23. package/src/utils/yjs.ts +6 -0
  24. package/test/collaboration/addMark/acrossMarks.tsx +0 -40
  25. package/test/collaboration/addMark/acrossMarksSame.tsx +0 -36
  26. package/test/collaboration/addMark/atBeginningOfDocument.tsx +0 -27
  27. package/test/collaboration/addMark/atEndOfDocument.tsx +0 -30
  28. package/test/collaboration/addMark/withOtherMarks.tsx +0 -31
  29. package/test/collaboration/insertNode/atBeginningOfDocument.tsx +0 -28
  30. package/test/collaboration/insertNode/atEndOfDocument.tsx +0 -28
  31. package/test/collaboration/insertNode/inTheMiddle.tsx +0 -30
  32. package/test/collaboration/insertText/atBeginningOfBlock.tsx +0 -26
  33. package/test/collaboration/insertText/atBeginningOfDocument.tsx +0 -26
  34. package/test/collaboration/insertText/atEndOfBlock.tsx +0 -26
  35. package/test/collaboration/insertText/atEndOfDocument.tsx +0 -26
  36. package/test/collaboration/insertText/inTheMiddle.tsx +0 -32
  37. package/test/collaboration/insertText/inTheMiddleOfNestedBlock.tsx +0 -30
  38. package/test/collaboration/insertText/insideMarks.tsx +0 -28
  39. package/test/collaboration/insertText/withEmptyString.tsx +0 -25
  40. package/test/collaboration/insertText/withEntities.tsx +0 -28
  41. package/test/collaboration/insertText/withMarks.tsx +0 -25
  42. package/test/collaboration/insertText/withUnicode.tsx +0 -28
  43. package/test/collaboration/mergeNode/afterADeleteBackward.tsx +0 -27
  44. package/test/collaboration/mergeNode/inSameParent.tsx +0 -34
  45. package/test/collaboration/mergeNode/onMixedNestedNodes.tsx +0 -29
  46. package/test/collaboration/mergeNode/onMixedTypeNodes.tsx +0 -27
  47. package/test/collaboration/mergeNode/withUnicode.tsx +0 -25
  48. package/test/collaboration/moveNode/downward/whenBlockBecomesNested.tsx +0 -43
  49. package/test/collaboration/moveNode/downward/whenBlockBecomesNonNested.tsx +0 -41
  50. package/test/collaboration/moveNode/downward/whenBlockStaysNested.tsx +0 -38
  51. package/test/collaboration/moveNode/downward/whenBlockStaysNonNested.tsx +0 -30
  52. package/test/collaboration/moveNode/upward/whenBlockBecomesNested.tsx +0 -43
  53. package/test/collaboration/moveNode/upward/whenBlockBecomesNonNested.tsx +0 -41
  54. package/test/collaboration/moveNode/upward/whenBlockStaysNested.tsx +0 -38
  55. package/test/collaboration/moveNode/upward/whenBlockStaysNonNested.tsx +0 -30
  56. package/test/collaboration/removeMark/inTheMiddleOfText.tsx +0 -43
  57. package/test/collaboration/removeMark/withAddMark.tsx +0 -31
  58. package/test/collaboration/removeMark/withOtherMarks.tsx +0 -47
  59. package/test/collaboration/removeNode/atBeginningOfDocument.tsx +0 -26
  60. package/test/collaboration/removeNode/atEndOfDocument.tsx +0 -26
  61. package/test/collaboration/removeNode/nestedBlock.tsx +0 -28
  62. package/test/collaboration/removeNode/wrapperBlock.tsx +0 -28
  63. package/test/collaboration/removeText/atBeginningOfDocument.tsx +0 -34
  64. package/test/collaboration/removeText/atEndOfDocument.tsx +0 -37
  65. package/test/collaboration/removeText/withUnicode.tsx +0 -29
  66. package/test/collaboration/setNode/atBeginningOfDocument.tsx +0 -27
  67. package/test/collaboration/setNode/atEndOfDocument.tsx +0 -27
  68. package/test/collaboration/setNode/onDataChange.tsx +0 -35
  69. package/test/collaboration/setNode/onDataChangeOnInline.tsx +0 -35
  70. package/test/collaboration/setNode/onResetBlock.tsx +0 -27
  71. package/test/collaboration/setNode/withAChangeOfType.tsx +0 -26
  72. package/test/collaboration/splitNode/atBeginningOfDocument.tsx +0 -28
  73. package/test/collaboration/splitNode/atEndOfBlock.tsx +0 -27
  74. package/test/collaboration/splitNode/atEndOfDocument.tsx +0 -27
  75. package/test/collaboration/splitNode/onNonDefaultBlock.tsx +0 -27
  76. package/test/collaboration/splitNode/withMultipleSubNodes.tsx +0 -32
  77. package/test/collaboration/splitNode/withUnicode.tsx +0 -29
  78. package/test/index.test.ts +0 -65
  79. package/test/slate.d.ts +0 -8
  80. package/test/withTestingElements.ts +0 -46
  81. package/tsconfig.json +0 -11
  82. package/tsup.config.ts +0 -32
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@slate-yjs/core",
3
3
  "sideEffects": false,
4
- "version": "1.0.3",
4
+ "version": "1.0.4",
5
5
  "description": "Yjs binding for Slate.",
6
6
  "keywords": [
7
7
  "slate",
@@ -17,17 +17,22 @@
17
17
  "module": "dist/index.js",
18
18
  "unpkg": "dist/index.global.js",
19
19
  "types": "dist/index.d.ts",
20
+ "files": [
21
+ "dist",
22
+ "src",
23
+ "CHANGELOG.md"
24
+ ],
20
25
  "repository": {
21
26
  "type": "git",
22
27
  "url": "https://github.com/slate-yjs/slate-yjs.git"
23
28
  },
24
29
  "license": "MIT",
25
30
  "devDependencies": {
26
- "slate": "^0.82.1",
27
- "slate-hyperscript": "^0.67.0",
31
+ "slate": "^0.147.4",
32
+ "slate-hyperscript": "^0.138.3",
28
33
  "tsup": "^5.12.1",
29
34
  "typescript": "^4.6.3",
30
- "yjs": "^13.5.29"
35
+ "yjs": "^13.6.33"
31
36
  },
32
37
  "peerDependencies": {
33
38
  "slate": ">=0.70.0",
@@ -38,7 +43,7 @@
38
43
  },
39
44
  "homepage": "https://github.com/slate-yjs/slate-yjs#readme",
40
45
  "dependencies": {
41
- "y-protocols": "^1.0.5"
46
+ "y-protocols": "^1.0.7"
42
47
  },
43
48
  "scripts": {
44
49
  "build": "tsup && tsc --emitDeclarationOnly",
@@ -9,6 +9,7 @@ import {
9
9
  restoreStoredPositionsWithDeltaAbsolute,
10
10
  } from '../../utils/position';
11
11
  import { getProperties } from '../../utils/slate';
12
+ import { PRESERVE_CONTENT } from '../../utils/yjs';
12
13
 
13
14
  export function mergeNode(
14
15
  sharedRoot: Y.XmlText,
@@ -63,9 +64,7 @@ export function mergeNode(
63
64
 
64
65
  const applyDelta: Delta = [{ retain: deltaApplyYOffset }, ...clonedDelta];
65
66
 
66
- prev.yTarget.applyDelta(applyDelta, {
67
- sanitize: false,
68
- });
67
+ prev.yTarget.applyDelta(applyDelta, PRESERVE_CONTENT);
69
68
 
70
69
  target.yParent.delete(
71
70
  target.textRange.start,
@@ -8,6 +8,7 @@ import {
8
8
  getStoredPositionsInDeltaAbsolute,
9
9
  restoreStoredPositionsWithDeltaAbsolute,
10
10
  } from '../../utils/position';
11
+ import { PRESERVE_CONTENT } from '../../utils/yjs';
11
12
 
12
13
  export function moveNode(
13
14
  sharedRoot: Y.XmlText,
@@ -44,7 +45,7 @@ export function moveNode(
44
45
  const deltaApplyYOffset = Math.min(target.textRange.start, targetLength);
45
46
  const applyDelta: Delta = [{ retain: deltaApplyYOffset }, ...insertDelta];
46
47
 
47
- target.yParent.applyDelta(applyDelta, { sanitize: false });
48
+ target.yParent.applyDelta(applyDelta, PRESERVE_CONTENT);
48
49
 
49
50
  restoreStoredPositionsWithDeltaAbsolute(
50
51
  sharedRoot,
@@ -7,6 +7,7 @@ import {
7
7
  getStoredPositionsInDeltaAbsolute,
8
8
  restoreStoredPositionsWithDeltaAbsolute,
9
9
  } from '../../utils/position';
10
+ import { PRESERVE_CONTENT } from '../../utils/yjs';
10
11
 
11
12
  export function splitNode(
12
13
  sharedRoot: Y.XmlText,
@@ -72,9 +73,7 @@ export function splitNode(
72
73
  );
73
74
 
74
75
  const toInsert = new Y.XmlText();
75
- toInsert.applyDelta(clonedDelta, {
76
- sanitize: false,
77
- });
76
+ toInsert.applyDelta(clonedDelta, PRESERVE_CONTENT);
78
77
 
79
78
  Object.entries(op.properties).forEach(([key, value]) => {
80
79
  toInsert.setAttribute(key, value);
@@ -170,7 +170,18 @@ export function withYjs<T extends Editor>(
170
170
  e.positionStorageOrigin =
171
171
  positionStorageOrigin ?? DEFAULT_POSITION_STORAGE_ORIGIN;
172
172
 
173
+ let warnedAboutQueuedChanges = false;
173
174
  e.applyRemoteEvents = (events, origin) => {
175
+ // Local changes still queued here were recorded against the tree before
176
+ // this remote update, so flushing them can target the wrong nodes. Flush
177
+ // local changes (or call onChange) before applying remote updates.
178
+ if (!warnedAboutQueuedChanges && YjsEditor.localChanges(e).length > 0) {
179
+ warnedAboutQueuedChanges = true;
180
+ // eslint-disable-next-line no-console
181
+ console.warn(
182
+ '[slate-yjs] A remote update was applied while local changes were still queued. Call YjsEditor.flushLocalChanges(editor) before applying remote updates in the same task as local edits, or the document can be corrupted.'
183
+ );
184
+ }
174
185
  YjsEditor.flushLocalChanges(e);
175
186
 
176
187
  Editor.withoutNormalizing(e, () => {
@@ -178,6 +189,12 @@ export function withYjs<T extends Editor>(
178
189
  applyYjsEvents(e.sharedRoot, e, events);
179
190
  });
180
191
  });
192
+
193
+ // Normalizing the remote change can queue local changes. Write them now,
194
+ // while Yjs still matches the tree they were recorded against. If another
195
+ // remote update were applied first, their paths could point at different
196
+ // nodes.
197
+ YjsEditor.flushLocalChanges(e);
181
198
  };
182
199
 
183
200
  e.isLocalOrigin = (origin) => origin === e.localOrigin;
@@ -1,6 +1,7 @@
1
1
  import * as Y from 'yjs';
2
2
  import { InsertDelta } from '../model/types';
3
3
  import { yTextToInsertDelta } from './delta';
4
+ import { PRESERVE_CONTENT } from './yjs';
4
5
 
5
6
  export function cloneInsertDeltaDeep(delta: InsertDelta): InsertDelta {
6
7
  return delta.map((element) => {
@@ -21,9 +22,10 @@ export function cloneDeep(yText: Y.XmlText): Y.XmlText {
21
22
  clone.setAttribute(key, value);
22
23
  });
23
24
 
24
- clone.applyDelta(cloneInsertDeltaDeep(yTextToInsertDelta(yText)), {
25
- sanitize: false,
26
- });
25
+ clone.applyDelta(
26
+ cloneInsertDeltaDeep(yTextToInsertDelta(yText)),
27
+ PRESERVE_CONTENT
28
+ );
27
29
 
28
30
  return clone;
29
31
  }
@@ -3,6 +3,7 @@ import * as Y from 'yjs';
3
3
  import { DeltaInsert, InsertDelta } from '../model/types';
4
4
  import { yTextToInsertDelta } from './delta';
5
5
  import { getProperties } from './slate';
6
+ import { PRESERVE_CONTENT } from './yjs';
6
7
 
7
8
  export function yTextToSlateElement(yText: Y.XmlText): Element {
8
9
  const delta = yTextToInsertDelta(yText);
@@ -43,6 +44,6 @@ export function slateElementToYText({
43
44
  yElement.setAttribute(key, value);
44
45
  });
45
46
 
46
- yElement.applyDelta(slateNodesToInsertDelta(children), { sanitize: false });
47
+ yElement.applyDelta(slateNodesToInsertDelta(children), PRESERVE_CONTENT);
47
48
  return yElement;
48
49
  }
package/src/utils/yjs.ts CHANGED
@@ -8,3 +8,9 @@ export function assertDocumentAttachment<T extends Y.AbstractType<any>>(
8
8
  throw new Error("shared type isn't attached to a document");
9
9
  }
10
10
  }
11
+
12
+ // Options for Y.Text#applyDelta that keep the content exactly as given. Yjs
13
+ // strips a trailing "\n" from the last insert at the end of the text when
14
+ // `sanitize` is false (the reverse of what the name suggests), which drops
15
+ // soft line breaks. See https://github.com/yjs/yjs/issues/848.
16
+ export const PRESERVE_CONTENT = { sanitize: true };
@@ -1,40 +0,0 @@
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>
9
- Hel
10
- <anchor />l
11
- </text>
12
- <text bold>o</text>
13
- <text>
14
- {' '}
15
- w<focus />
16
- orld!
17
- </text>
18
- </unstyled>
19
- </editor>
20
- );
21
-
22
- export const expected = (
23
- <editor>
24
- <unstyled>
25
- <text>Hel</text>
26
- <anchor />
27
- <text italic>l</text>
28
- <text italic bold>
29
- o
30
- </text>
31
- <text italic> w</text>
32
- <focus />
33
- <text>orld!</text>
34
- </unstyled>
35
- </editor>
36
- );
37
-
38
- export function run(editor: Editor) {
39
- editor.addMark('italic', true);
40
- }
@@ -1,36 +0,0 @@
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>
9
- Hel
10
- <anchor />l
11
- </text>
12
- <text bold>o</text>
13
- <text>
14
- {' '}
15
- w<focus />
16
- orld!
17
- </text>
18
- </unstyled>
19
- </editor>
20
- );
21
-
22
- export const expected = (
23
- <editor>
24
- <unstyled>
25
- <text>Hel</text>
26
- <anchor />
27
- <text bold>lo w</text>
28
- <focus />
29
- <text>orld!</text>
30
- </unstyled>
31
- </editor>
32
- );
33
-
34
- export function run(editor: Editor) {
35
- editor.addMark('bold', true);
36
- }
@@ -1,27 +0,0 @@
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
- Hello
10
- <focus /> world!
11
- </unstyled>
12
- </editor>
13
- );
14
-
15
- export const expected = (
16
- <editor>
17
- <unstyled>
18
- <anchor />
19
- <text bold>Hello</text>
20
- <focus /> world!
21
- </unstyled>
22
- </editor>
23
- );
24
-
25
- export function run(editor: Editor) {
26
- editor.addMark('bold', true);
27
- }
@@ -1,30 +0,0 @@
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 <anchor />
9
- world!
10
- <focus />
11
- </unstyled>
12
- </editor>
13
- );
14
-
15
- export const expected = (
16
- <editor>
17
- <unstyled>
18
- Hello{' '}
19
- <text bold>
20
- <anchor />
21
- world!
22
- </text>
23
- <focus />
24
- </unstyled>
25
- </editor>
26
- );
27
-
28
- export function run(editor: Editor) {
29
- editor.addMark('bold', true);
30
- }
@@ -1,31 +0,0 @@
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
- }
@@ -1,28 +0,0 @@
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
- }
@@ -1,28 +0,0 @@
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
- }
@@ -1,30 +0,0 @@
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
- }
@@ -1,26 +0,0 @@
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
- }
@@ -1,26 +0,0 @@
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
- }
@@ -1,26 +0,0 @@
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
- }
@@ -1,26 +0,0 @@
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
- }
@@ -1,32 +0,0 @@
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
- }
@@ -1,30 +0,0 @@
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
- }
@@ -1,28 +0,0 @@
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
- }
@@ -1,25 +0,0 @@
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
- }