@getguru/slate-yjs-react 1.1.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/CHANGELOG.md +47 -0
- package/README.md +3 -0
- package/dist/hooks/useDecorateRemoteCursors.d.ts +24 -0
- package/dist/hooks/useDecorateRemoteCursors.d.ts.map +1 -0
- package/dist/hooks/useRemoteCursorEditor.d.ts +4 -0
- package/dist/hooks/useRemoteCursorEditor.d.ts.map +1 -0
- package/dist/hooks/useRemoteCursorOverlayPositions.d.ts +19 -0
- package/dist/hooks/useRemoteCursorOverlayPositions.d.ts.map +1 -0
- package/dist/hooks/useRemoteCursorStateStore.d.ts +5 -0
- package/dist/hooks/useRemoteCursorStateStore.d.ts.map +1 -0
- package/dist/hooks/useRemoteCursorStates.d.ts +4 -0
- package/dist/hooks/useRemoteCursorStates.d.ts.map +1 -0
- package/dist/hooks/useUnsetCursorPositionOnBlur.d.ts +2 -0
- package/dist/hooks/useUnsetCursorPositionOnBlur.d.ts.map +1 -0
- package/dist/hooks/utils.d.ts +4 -0
- package/dist/hooks/utils.d.ts.map +1 -0
- package/dist/index.cjs +453 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.global.js +31900 -0
- package/dist/index.global.js.map +1 -0
- package/dist/index.js +450 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +5 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/getCursorRange.d.ts +4 -0
- package/dist/utils/getCursorRange.d.ts.map +1 -0
- package/dist/utils/getOverlayPosition.d.ts +24 -0
- package/dist/utils/getOverlayPosition.d.ts.map +1 -0
- package/dist/utils/react-editor-to-dom-range-safe.d.ts +4 -0
- package/dist/utils/react-editor-to-dom-range-safe.d.ts.map +1 -0
- package/package.json +55 -0
- package/src/hooks/useDecorateRemoteCursors.ts +125 -0
- package/src/hooks/useRemoteCursorEditor.ts +15 -0
- package/src/hooks/useRemoteCursorOverlayPositions.tsx +144 -0
- package/src/hooks/useRemoteCursorStateStore.ts +89 -0
- package/src/hooks/useRemoteCursorStates.ts +28 -0
- package/src/hooks/useUnsetCursorPositionOnBlur.ts +48 -0
- package/src/hooks/utils.ts +61 -0
- package/src/index.ts +26 -0
- package/src/types.ts +4 -0
- package/src/utils/getCursorRange.ts +45 -0
- package/src/utils/getOverlayPosition.ts +111 -0
- package/src/utils/react-editor-to-dom-range-safe.ts +13 -0
- package/tsconfig.json +11 -0
- package/tsup.config.ts +32 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactEditor } from 'slate-react';
|
|
2
|
+
import { BaseRange } from 'slate';
|
|
3
|
+
|
|
4
|
+
export function reactEditorToDomRangeSafe(
|
|
5
|
+
editor: ReactEditor,
|
|
6
|
+
range: BaseRange
|
|
7
|
+
): Range | null {
|
|
8
|
+
try {
|
|
9
|
+
return ReactEditor.toDOMRange(editor, range);
|
|
10
|
+
} catch (e) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
}
|
package/tsconfig.json
ADDED
package/tsup.config.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/* eslint-disable import/no-default-export */
|
|
2
|
+
/* eslint-disable import/no-extraneous-dependencies */
|
|
3
|
+
import { defineConfig, Options } from 'tsup';
|
|
4
|
+
|
|
5
|
+
export default defineConfig(
|
|
6
|
+
({ watch }) => <Options[]>[
|
|
7
|
+
{
|
|
8
|
+
entry: ['src/index.ts'],
|
|
9
|
+
outDir: 'dist',
|
|
10
|
+
format: ['cjs', 'iife', 'esm'],
|
|
11
|
+
globalName: 'SlateYjsReact',
|
|
12
|
+
platform: 'browser',
|
|
13
|
+
splitting: false,
|
|
14
|
+
bundle: true,
|
|
15
|
+
sourcemap: true,
|
|
16
|
+
minify: false,
|
|
17
|
+
clean: !watch,
|
|
18
|
+
},
|
|
19
|
+
!!watch && {
|
|
20
|
+
entry: ['src'],
|
|
21
|
+
outDir: 'dist',
|
|
22
|
+
format: [],
|
|
23
|
+
platform: 'browser',
|
|
24
|
+
splitting: false,
|
|
25
|
+
bundle: false,
|
|
26
|
+
sourcemap: true,
|
|
27
|
+
dts: true,
|
|
28
|
+
minify: false,
|
|
29
|
+
clean: false,
|
|
30
|
+
},
|
|
31
|
+
].filter(Boolean)
|
|
32
|
+
);
|