@wangeditor-next/yjs 0.1.2-beta.0 → 0.1.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/dist/applyToYjs/types.d.ts +2 -2
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/module/custom-types.d.ts +11 -11
- package/dist/plugins/withCursors.d.ts +5 -5
- package/dist/plugins/withYHistory.d.ts +2 -2
- package/dist/plugins/withYjs.d.ts +3 -3
- package/dist/utils/object.d.ts +4 -4
- package/package.json +2 -2
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import type { Descendant, Editor, Element, Node } from 'slate';
|
|
2
2
|
import type Y from 'yjs';
|
|
3
|
-
export
|
|
3
|
+
export type DeltaAttributes = {
|
|
4
4
|
retain: number;
|
|
5
5
|
attributes: Record<string, unknown>;
|
|
6
6
|
};
|
|
7
|
-
export
|
|
7
|
+
export type DeltaRetain = {
|
|
8
8
|
retain: number;
|
|
9
9
|
};
|
|
10
|
-
export
|
|
10
|
+
export type DeltaDelete = {
|
|
11
11
|
delete: number;
|
|
12
12
|
};
|
|
13
|
-
export
|
|
13
|
+
export type DeltaInsert = {
|
|
14
14
|
insert: string | Y.XmlText;
|
|
15
15
|
attributes?: Record<string, unknown>;
|
|
16
16
|
};
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
17
|
+
export type InsertDelta = Array<DeltaInsert>;
|
|
18
|
+
export type Delta = Array<DeltaRetain | DeltaDelete | DeltaInsert | DeltaAttributes>;
|
|
19
|
+
export type TextRange = {
|
|
20
20
|
start: number;
|
|
21
21
|
end: number;
|
|
22
22
|
};
|
|
23
|
-
export
|
|
23
|
+
export type HistoryStackItem = {
|
|
24
24
|
meta: Map<string, unknown>;
|
|
25
25
|
};
|
|
26
|
-
export
|
|
26
|
+
export type YTarget = {
|
|
27
27
|
textRange: TextRange;
|
|
28
28
|
yParent: Y.XmlText;
|
|
29
29
|
slateParent: Element | Editor;
|
|
@@ -31,11 +31,11 @@ export declare type YTarget = {
|
|
|
31
31
|
slateTarget?: Node;
|
|
32
32
|
targetDelta: InsertDelta;
|
|
33
33
|
};
|
|
34
|
-
export
|
|
34
|
+
export type RelativeRange = {
|
|
35
35
|
anchor: Y.RelativePosition;
|
|
36
36
|
focus: Y.RelativePosition;
|
|
37
37
|
};
|
|
38
|
-
export
|
|
38
|
+
export type NodeElement = {
|
|
39
39
|
type: string;
|
|
40
40
|
children: Descendant[];
|
|
41
41
|
};
|
|
@@ -3,18 +3,18 @@ import { Awareness } from 'y-protocols/awareness';
|
|
|
3
3
|
import * as Y from 'yjs';
|
|
4
4
|
import { RelativeRange } from '../module/custom-types';
|
|
5
5
|
import { YjsEditor } from './withYjs';
|
|
6
|
-
export
|
|
6
|
+
export type CursorStateChangeEvent = {
|
|
7
7
|
added: number[];
|
|
8
8
|
updated: number[];
|
|
9
9
|
removed: number[];
|
|
10
10
|
};
|
|
11
|
-
export
|
|
12
|
-
export
|
|
11
|
+
export type RemoteCursorChangeEventListener = (event: CursorStateChangeEvent) => void;
|
|
12
|
+
export type CursorState<TCursorData extends Record<string, unknown> = Record<string, unknown>> = {
|
|
13
13
|
relativeSelection: RelativeRange | null;
|
|
14
14
|
data?: TCursorData;
|
|
15
15
|
clientId: number;
|
|
16
16
|
};
|
|
17
|
-
export
|
|
17
|
+
export type CursorEditor<TCursorData extends Record<string, unknown> = Record<string, unknown>> = YjsEditor & {
|
|
18
18
|
awareness: Awareness;
|
|
19
19
|
cursorDataField: string;
|
|
20
20
|
selectionStateField: string;
|
|
@@ -30,7 +30,7 @@ export declare const CursorEditor: {
|
|
|
30
30
|
cursorState<TCursorData_4 extends Record<string, unknown>>(editor: CursorEditor<TCursorData_4>, clientId: number): CursorState<TCursorData_4> | null;
|
|
31
31
|
cursorStates<TCursorData_5 extends Record<string, unknown>>(editor: CursorEditor<TCursorData_5>): Record<string, CursorState<TCursorData_5>>;
|
|
32
32
|
};
|
|
33
|
-
export
|
|
33
|
+
export type WithCursorsOptions<TCursorData extends Record<string, unknown> = Record<string, unknown>> = {
|
|
34
34
|
cursorStateField?: string;
|
|
35
35
|
cursorDataField?: string;
|
|
36
36
|
data?: TCursorData;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Y from 'yjs';
|
|
2
2
|
import { YjsEditor } from './withYjs';
|
|
3
|
-
export
|
|
3
|
+
export type YHistoryEditor = YjsEditor & {
|
|
4
4
|
undoManager: Y.UndoManager;
|
|
5
5
|
withoutSavingOrigin: unknown;
|
|
6
6
|
undo: () => void;
|
|
@@ -13,7 +13,7 @@ export declare const YHistoryEditor: {
|
|
|
13
13
|
isSaving(editor: YHistoryEditor): boolean;
|
|
14
14
|
withoutSaving(editor: YHistoryEditor, fn: () => void): void;
|
|
15
15
|
};
|
|
16
|
-
export
|
|
16
|
+
export type WithYHistoryOptions = NonNullable<ConstructorParameters<typeof Y.UndoManager>[1]> & {
|
|
17
17
|
withoutSavingOrigin?: unknown;
|
|
18
18
|
};
|
|
19
19
|
export declare function withYHistory(options?: WithYHistoryOptions): <T extends YjsEditor>(editor: T) => T & import("slate").BaseEditor & {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { BaseEditor, Descendant, Operation, Point } from 'slate';
|
|
2
2
|
import * as Y from 'yjs';
|
|
3
|
-
|
|
3
|
+
type LocalChange = {
|
|
4
4
|
op: Operation;
|
|
5
5
|
doc: Descendant[];
|
|
6
6
|
origin: unknown;
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type YjsEditor = BaseEditor & {
|
|
9
9
|
sharedRoot: Y.XmlText;
|
|
10
10
|
localOrigin: unknown;
|
|
11
11
|
positionStorageOrigin: unknown;
|
|
@@ -33,7 +33,7 @@ export declare const YjsEditor: {
|
|
|
33
33
|
position(editor: YjsEditor, key: string): Point | null | undefined;
|
|
34
34
|
storedPositionsRelative(editor: YjsEditor): Record<string, Y.RelativePosition>;
|
|
35
35
|
};
|
|
36
|
-
export
|
|
36
|
+
export type WithYjsOptions = {
|
|
37
37
|
autoConnect?: boolean;
|
|
38
38
|
localOrigin?: unknown;
|
|
39
39
|
positionStorageOrigin?: unknown;
|
package/dist/utils/object.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
type InspectableObject = Record<string | number | symbol, unknown>;
|
|
2
2
|
export declare function isPlainObject(o: unknown): o is InspectableObject;
|
|
3
3
|
export declare function deepEquals(node: InspectableObject, another: InspectableObject): boolean;
|
|
4
|
-
export declare function pick<TObj, TKeys extends keyof TObj>(obj: TObj, ...keys: TKeys[]): Pick<TObj, TKeys>;
|
|
5
|
-
export declare function omit<TObj, TKeys extends keyof TObj>(obj: TObj, ...keys: TKeys[]): Omit<TObj, TKeys>;
|
|
6
|
-
export declare function omitNullEntries<TObj>(obj: TObj): {
|
|
4
|
+
export declare function pick<TObj extends Object, TKeys extends keyof TObj>(obj: TObj, ...keys: TKeys[]): Pick<TObj, TKeys>;
|
|
5
|
+
export declare function omit<TObj extends Object, TKeys extends keyof TObj>(obj: TObj, ...keys: TKeys[]): Omit<TObj, TKeys>;
|
|
6
|
+
export declare function omitNullEntries<TObj extends Object>(obj: TObj): {
|
|
7
7
|
[K in keyof TObj]: TObj[K] extends null ? never : K;
|
|
8
8
|
};
|
|
9
9
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wangeditor-next/yjs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"author": "cycleccc <2991205548@qq.com>",
|
|
5
5
|
"contributors": [],
|
|
6
6
|
"description": "Yjs binding for wangeditor-next.",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"size-stats": "cross-env NODE_ENV=production:size_stats rollup -c rollup.config.js"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@wangeditor-next/core": "1.
|
|
51
|
+
"@wangeditor-next/core": "1.7.5",
|
|
52
52
|
"slate": "^0.72.0",
|
|
53
53
|
"yjs": "^13.5.29"
|
|
54
54
|
},
|