@portabletext/editor 0.0.0
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/LICENSE +21 -0
- package/README.md +3 -0
- package/lib/index.d.mts +911 -0
- package/lib/index.d.ts +911 -0
- package/lib/index.esm.js +4896 -0
- package/lib/index.esm.js.map +1 -0
- package/lib/index.js +4874 -0
- package/lib/index.js.map +1 -0
- package/lib/index.mjs +4896 -0
- package/lib/index.mjs.map +1 -0
- package/package.json +119 -0
- package/src/editor/Editable.tsx +683 -0
- package/src/editor/PortableTextEditor.tsx +308 -0
- package/src/editor/__tests__/PortableTextEditor.test.tsx +386 -0
- package/src/editor/__tests__/PortableTextEditorTester.tsx +116 -0
- package/src/editor/__tests__/RangeDecorations.test.tsx +115 -0
- package/src/editor/__tests__/handleClick.test.tsx +218 -0
- package/src/editor/__tests__/pteWarningsSelfSolving.test.tsx +389 -0
- package/src/editor/__tests__/utils.ts +39 -0
- package/src/editor/components/DraggableBlock.tsx +287 -0
- package/src/editor/components/Element.tsx +279 -0
- package/src/editor/components/Leaf.tsx +288 -0
- package/src/editor/components/SlateContainer.tsx +81 -0
- package/src/editor/components/Synchronizer.tsx +190 -0
- package/src/editor/hooks/usePortableTextEditor.ts +23 -0
- package/src/editor/hooks/usePortableTextEditorKeyGenerator.ts +24 -0
- package/src/editor/hooks/usePortableTextEditorSelection.ts +22 -0
- package/src/editor/hooks/usePortableTextEditorValue.ts +16 -0
- package/src/editor/hooks/usePortableTextReadOnly.ts +20 -0
- package/src/editor/hooks/useSyncValue.test.tsx +125 -0
- package/src/editor/hooks/useSyncValue.ts +372 -0
- package/src/editor/nodes/DefaultAnnotation.tsx +16 -0
- package/src/editor/nodes/DefaultObject.tsx +15 -0
- package/src/editor/nodes/index.ts +189 -0
- package/src/editor/plugins/__tests__/withEditableAPIDelete.test.tsx +244 -0
- package/src/editor/plugins/__tests__/withEditableAPIGetFragment.test.tsx +142 -0
- package/src/editor/plugins/__tests__/withEditableAPIInsert.test.tsx +346 -0
- package/src/editor/plugins/__tests__/withEditableAPISelectionsOverlapping.test.tsx +162 -0
- package/src/editor/plugins/__tests__/withHotkeys.test.tsx +212 -0
- package/src/editor/plugins/__tests__/withInsertBreak.test.tsx +204 -0
- package/src/editor/plugins/__tests__/withPlaceholderBlock.test.tsx +133 -0
- package/src/editor/plugins/__tests__/withPortableTextLists.test.tsx +65 -0
- package/src/editor/plugins/__tests__/withPortableTextMarkModel.test.tsx +1377 -0
- package/src/editor/plugins/__tests__/withPortableTextSelections.test.tsx +91 -0
- package/src/editor/plugins/__tests__/withUndoRedo.test.tsx +115 -0
- package/src/editor/plugins/createWithEditableAPI.ts +573 -0
- package/src/editor/plugins/createWithHotKeys.ts +304 -0
- package/src/editor/plugins/createWithInsertBreak.ts +45 -0
- package/src/editor/plugins/createWithInsertData.ts +359 -0
- package/src/editor/plugins/createWithMaxBlocks.ts +24 -0
- package/src/editor/plugins/createWithObjectKeys.ts +63 -0
- package/src/editor/plugins/createWithPatches.ts +274 -0
- package/src/editor/plugins/createWithPlaceholderBlock.ts +36 -0
- package/src/editor/plugins/createWithPortableTextBlockStyle.ts +91 -0
- package/src/editor/plugins/createWithPortableTextLists.ts +160 -0
- package/src/editor/plugins/createWithPortableTextMarkModel.ts +441 -0
- package/src/editor/plugins/createWithPortableTextSelections.ts +65 -0
- package/src/editor/plugins/createWithSchemaTypes.ts +76 -0
- package/src/editor/plugins/createWithUndoRedo.ts +494 -0
- package/src/editor/plugins/createWithUtils.ts +81 -0
- package/src/editor/plugins/index.ts +155 -0
- package/src/index.ts +11 -0
- package/src/patch/PatchEvent.ts +33 -0
- package/src/patch/applyPatch.ts +29 -0
- package/src/patch/array.ts +89 -0
- package/src/patch/arrayInsert.ts +27 -0
- package/src/patch/object.ts +39 -0
- package/src/patch/patches.ts +53 -0
- package/src/patch/primitive.ts +43 -0
- package/src/patch/string.ts +51 -0
- package/src/types/editor.ts +576 -0
- package/src/types/options.ts +17 -0
- package/src/types/patch.ts +65 -0
- package/src/types/slate.ts +25 -0
- package/src/utils/__tests__/dmpToOperations.test.ts +181 -0
- package/src/utils/__tests__/operationToPatches.test.ts +421 -0
- package/src/utils/__tests__/patchToOperations.test.ts +293 -0
- package/src/utils/__tests__/ranges.test.ts +18 -0
- package/src/utils/__tests__/valueNormalization.test.tsx +62 -0
- package/src/utils/__tests__/values.test.ts +253 -0
- package/src/utils/applyPatch.ts +407 -0
- package/src/utils/bufferUntil.ts +15 -0
- package/src/utils/debug.ts +12 -0
- package/src/utils/getPortableTextMemberSchemaTypes.ts +100 -0
- package/src/utils/operationToPatches.ts +357 -0
- package/src/utils/patches.ts +36 -0
- package/src/utils/paths.ts +60 -0
- package/src/utils/ranges.ts +77 -0
- package/src/utils/schema.ts +8 -0
- package/src/utils/selection.ts +65 -0
- package/src/utils/ucs2Indices.ts +67 -0
- package/src/utils/validateValue.ts +394 -0
- package/src/utils/values.ts +208 -0
- package/src/utils/weakMaps.ts +24 -0
- package/src/utils/withChanges.ts +25 -0
- package/src/utils/withPreserveKeys.ts +14 -0
- package/src/utils/withoutPatching.ts +14 -0
package/package.json
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@portabletext/editor",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "Portable Text Editor made in React",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"sanity",
|
|
7
|
+
"cms",
|
|
8
|
+
"headless",
|
|
9
|
+
"realtime",
|
|
10
|
+
"content",
|
|
11
|
+
"portable-text-editor",
|
|
12
|
+
"structure",
|
|
13
|
+
"api",
|
|
14
|
+
"collaborative",
|
|
15
|
+
"editor",
|
|
16
|
+
"text",
|
|
17
|
+
"portable-text"
|
|
18
|
+
],
|
|
19
|
+
"homepage": "https://www.sanity.io/",
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/portabletext/editor/issues"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/portabletext/editor.git",
|
|
26
|
+
"directory": "packages/editor"
|
|
27
|
+
},
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"author": "Sanity.io <hello@sanity.io>",
|
|
30
|
+
"sideEffects": false,
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"source": "./src/index.ts",
|
|
34
|
+
"import": "./lib/index.mjs",
|
|
35
|
+
"require": "./lib/index.js",
|
|
36
|
+
"default": "./lib/index.js"
|
|
37
|
+
},
|
|
38
|
+
"./package.json": "./package.json"
|
|
39
|
+
},
|
|
40
|
+
"main": "./lib/index.js",
|
|
41
|
+
"module": "./lib/index.esm.js",
|
|
42
|
+
"types": "./lib/index.d.ts",
|
|
43
|
+
"files": [
|
|
44
|
+
"lib",
|
|
45
|
+
"src"
|
|
46
|
+
],
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@sanity/block-tools": "^3.47.0",
|
|
49
|
+
"@sanity/schema": "^3.47.0",
|
|
50
|
+
"@sanity/types": "^3.47.0",
|
|
51
|
+
"@sanity/util": "^3.47.0",
|
|
52
|
+
"debug": "^3.2.7",
|
|
53
|
+
"is-hotkey-esm": "^1.0.0",
|
|
54
|
+
"lodash": "^4.17.21",
|
|
55
|
+
"slate": "0.100.0",
|
|
56
|
+
"slate-react": "0.101.0"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
60
|
+
"@jest/globals": "^29.7.0",
|
|
61
|
+
"@playwright/test": "1.41.2",
|
|
62
|
+
"@portabletext/toolkit": "^2.0.15",
|
|
63
|
+
"@sanity/diff-match-patch": "^3.1.1",
|
|
64
|
+
"@sanity/pkg-utils": "^6.10.0",
|
|
65
|
+
"@sanity/test": "0.0.1-alpha.1",
|
|
66
|
+
"@sanity/ui": "^2.4.0",
|
|
67
|
+
"@testing-library/react": "^13.4.0",
|
|
68
|
+
"@types/debug": "^4.1.5",
|
|
69
|
+
"@types/express": "^4.17.21",
|
|
70
|
+
"@types/express-ws": "^3.0.1",
|
|
71
|
+
"@types/lodash": "^4.14.149",
|
|
72
|
+
"@types/node": "^18.19.8",
|
|
73
|
+
"@types/node-ipc": "^9.2.0",
|
|
74
|
+
"@types/react": "^18.3.3",
|
|
75
|
+
"@types/react-dom": "^18.3.0",
|
|
76
|
+
"@types/ws": "~8.5.3",
|
|
77
|
+
"@vitejs/plugin-react": "^4.3.1",
|
|
78
|
+
"dotenv": "^16.4.5",
|
|
79
|
+
"express": "^4.18.3",
|
|
80
|
+
"express-ws": "^5.0.2",
|
|
81
|
+
"jest": "^29.7.0",
|
|
82
|
+
"jest-dev-server": "^9.0.1",
|
|
83
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
84
|
+
"jest-environment-node": "^29.7.0",
|
|
85
|
+
"node-ipc": "npm:@node-ipc/compat@9.2.5",
|
|
86
|
+
"react": "^18.3.1",
|
|
87
|
+
"react-dom": "^18.3.1",
|
|
88
|
+
"rimraf": "^3.0.2",
|
|
89
|
+
"rxjs": "^7.8.1",
|
|
90
|
+
"styled-components": "^6.1.11",
|
|
91
|
+
"tsx": "^4.10.3",
|
|
92
|
+
"typescript": "^5.4.5",
|
|
93
|
+
"vite": "^4.5.3",
|
|
94
|
+
"@repo/package.config": "^0.0.0",
|
|
95
|
+
"@repo/tsconfig": "^0.0.0"
|
|
96
|
+
},
|
|
97
|
+
"peerDependencies": {
|
|
98
|
+
"react": "^16.9 || ^17 || ^18",
|
|
99
|
+
"rxjs": "^7",
|
|
100
|
+
"styled-components": "^6.1"
|
|
101
|
+
},
|
|
102
|
+
"engines": {
|
|
103
|
+
"node": ">=18"
|
|
104
|
+
},
|
|
105
|
+
"publishConfig": {
|
|
106
|
+
"access": "public"
|
|
107
|
+
},
|
|
108
|
+
"scripts": {
|
|
109
|
+
"build": "pkg-utils build --strict --check --clean",
|
|
110
|
+
"check:types": "tsc --project tsconfig.lib.json",
|
|
111
|
+
"clean": "rimraf lib",
|
|
112
|
+
"dev": "cd ./e2e-tests/ && tsx serve",
|
|
113
|
+
"lint": "eslint .",
|
|
114
|
+
"test": "jest",
|
|
115
|
+
"test:e2e": "jest --config=e2e-tests/e2e.config.cjs",
|
|
116
|
+
"test:watch": "jest --watch",
|
|
117
|
+
"watch": "pkg-utils watch"
|
|
118
|
+
}
|
|
119
|
+
}
|