@kerebron/editor-react 0.4.31 → 0.5.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/README.md +11 -3
- package/esm/EditorContent.d.ts +1 -1
- package/esm/EditorContent.js +1 -1
- package/esm/mod.d.ts +1 -1
- package/esm/mod.js +1 -1
- package/esm/useEditor.d.ts +3 -3
- package/esm/useEditor.d.ts.map +1 -1
- package/esm/useEditor.js +4 -4
- package/esm/useEditor.js.map +1 -1
- package/package.json +2 -2
- package/src/EditorContent.tsx +1 -1
- package/src/mod.ts +1 -1
- package/src/useEditor.ts +6 -6
package/README.md
CHANGED
|
@@ -26,9 +26,17 @@ number of output npm modules.
|
|
|
26
26
|
|
|
27
27
|
**Work in progress**
|
|
28
28
|
|
|
29
|
-
|
|
30
29
|
## Build
|
|
31
30
|
|
|
31
|
+
###
|
|
32
|
+
|
|
33
|
+
Update git submodules
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
git submodule init
|
|
37
|
+
git submodule update
|
|
38
|
+
```
|
|
39
|
+
|
|
32
40
|
### Build static examples and `.wasm` files
|
|
33
41
|
|
|
34
42
|
```sh
|
|
@@ -72,12 +80,12 @@ docker run -it -p 8000:8000 -v $PWD:/usr/src/app editor-test
|
|
|
72
80
|
|
|
73
81
|
Install deno
|
|
74
82
|
|
|
75
|
-
```
|
|
83
|
+
```sh
|
|
76
84
|
npm install -g deno
|
|
77
85
|
```
|
|
78
86
|
|
|
79
87
|
Install rust
|
|
80
88
|
|
|
81
|
-
```
|
|
89
|
+
```sh
|
|
82
90
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
|
83
91
|
```
|
package/esm/EditorContent.d.ts
CHANGED
package/esm/EditorContent.js
CHANGED
|
@@ -5,7 +5,7 @@ import React, { forwardRef, useEffect, useImperativeHandle, useRef, } from 'reac
|
|
|
5
5
|
*
|
|
6
6
|
* @example
|
|
7
7
|
* ```tsx
|
|
8
|
-
* const editor = useEditor({
|
|
8
|
+
* const editor = useEditor({ editorKits: [StarterKit] })
|
|
9
9
|
* return <EditorContent editor={editor} />
|
|
10
10
|
* ```
|
|
11
11
|
*/
|
package/esm/mod.d.ts
CHANGED
package/esm/mod.js
CHANGED
package/esm/useEditor.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type DependencyList } from 'react';
|
|
2
2
|
import { CoreEditor } from '@kerebron/editor';
|
|
3
|
-
import type {
|
|
3
|
+
import type { Content, EditorKit } from '@kerebron/editor';
|
|
4
4
|
export interface UseEditorOptions {
|
|
5
5
|
/** Array of extensions to use */
|
|
6
|
-
|
|
6
|
+
editorKits?: EditorKit[];
|
|
7
7
|
/** Initial HTML content */
|
|
8
8
|
content?: string;
|
|
9
9
|
/** Initial JSON content */
|
|
@@ -27,7 +27,7 @@ export interface UseEditorOptions {
|
|
|
27
27
|
* @example
|
|
28
28
|
* ```tsx
|
|
29
29
|
* const editor = useEditor({
|
|
30
|
-
*
|
|
30
|
+
* editorKits: [StarterKit],
|
|
31
31
|
* content: '<p>Hello World!</p>',
|
|
32
32
|
* })
|
|
33
33
|
*
|
package/esm/useEditor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEditor.d.ts","sourceRoot":"","sources":["../src/useEditor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAA+B,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"useEditor.d.ts","sourceRoot":"","sources":["../src/useEditor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAA+B,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE3D,MAAM,WAAW,gBAAgB;IAC/B,iCAAiC;IACjC,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB,2BAA2B;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2BAA2B;IAC3B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,6BAA6B;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mBAAmB;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IACvC,kCAAkC;IAClC,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IAC7C,kCAAkC;IAClC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IACxC,gDAAgD;IAChD,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CACvB,OAAO,GAAE,gBAAqB,EAC9B,IAAI,GAAE,cAAmB,GACxB,UAAU,GAAG,IAAI,CAyEnB"}
|
package/esm/useEditor.js
CHANGED
|
@@ -7,7 +7,7 @@ import { CoreEditor } from '@kerebron/editor';
|
|
|
7
7
|
* @example
|
|
8
8
|
* ```tsx
|
|
9
9
|
* const editor = useEditor({
|
|
10
|
-
*
|
|
10
|
+
* editorKits: [StarterKit],
|
|
11
11
|
* content: '<p>Hello World!</p>',
|
|
12
12
|
* })
|
|
13
13
|
*
|
|
@@ -25,13 +25,13 @@ export function useEditor(options = {}, deps = []) {
|
|
|
25
25
|
if (options.immediatelyRender === false && typeof dntShim.dntGlobalThis === 'undefined') {
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
|
-
const {
|
|
28
|
+
const { editorKits = [], content, initialContent, cdnUrl, uri, onReady, onTransaction, onChange, } = optionsRef.current;
|
|
29
29
|
// Create a container element for the editor
|
|
30
30
|
const container = document.createElement('div');
|
|
31
31
|
editorContainerRef.current = container;
|
|
32
|
-
const editorInstance =
|
|
32
|
+
const editorInstance = CoreEditor.create({
|
|
33
33
|
element: container,
|
|
34
|
-
|
|
34
|
+
editorKits,
|
|
35
35
|
content: initialContent,
|
|
36
36
|
cdnUrl,
|
|
37
37
|
uri,
|
package/esm/useEditor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEditor.js","sourceRoot":"","sources":["../src/useEditor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAuB,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAwB9C;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,SAAS,CACvB,UAA4B,EAAE,EAC9B,OAAuB,EAAE;IAEzB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAoB,IAAI,CAAC,CAAC;IAC9D,MAAM,kBAAkB,GAAG,MAAM,CAAqB,IAAI,CAAC,CAAC;IAC5D,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAEnC,2BAA2B;IAC3B,UAAU,CAAC,OAAO,GAAG,OAAO,CAAC;IAE7B,SAAS,CAAC,GAAG,EAAE;QACb,6CAA6C;QAC7C,IAAI,OAAO,CAAC,iBAAiB,KAAK,KAAK,IAAI,OAAO,OAAO,CAAC,aAAa,KAAK,WAAW,EAAE,CAAC;YACxF,OAAO;QACT,CAAC;QAED,MAAM,EACJ,UAAU,GAAG,EAAE,EACf,OAAO,EACP,cAAc,EACd,MAAM,EACN,GAAG,EACH,OAAO,EACP,aAAa,EACb,QAAQ,GACT,GAAG,UAAU,CAAC,OAAO,CAAC;QAEvB,4CAA4C;QAC5C,MAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC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
|
|
14
14
|
"src"
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@kerebron/editor": "0.
|
|
17
|
+
"@kerebron/editor": "0.5.1",
|
|
18
18
|
"react": "^19"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
package/src/EditorContent.tsx
CHANGED
package/src/mod.ts
CHANGED
package/src/useEditor.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as dntShim from "./_dnt.shims.js";
|
|
2
2
|
import { type DependencyList, useEffect, useRef, useState } from 'react';
|
|
3
3
|
import { CoreEditor } from '@kerebron/editor';
|
|
4
|
-
import type {
|
|
4
|
+
import type { Content, EditorKit } from '@kerebron/editor';
|
|
5
5
|
|
|
6
6
|
export interface UseEditorOptions {
|
|
7
7
|
/** Array of extensions to use */
|
|
8
|
-
|
|
8
|
+
editorKits?: EditorKit[];
|
|
9
9
|
/** Initial HTML content */
|
|
10
10
|
content?: string;
|
|
11
11
|
/** Initial JSON content */
|
|
@@ -30,7 +30,7 @@ export interface UseEditorOptions {
|
|
|
30
30
|
* @example
|
|
31
31
|
* ```tsx
|
|
32
32
|
* const editor = useEditor({
|
|
33
|
-
*
|
|
33
|
+
* editorKits: [StarterKit],
|
|
34
34
|
* content: '<p>Hello World!</p>',
|
|
35
35
|
* })
|
|
36
36
|
*
|
|
@@ -55,7 +55,7 @@ export function useEditor(
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
const {
|
|
58
|
-
|
|
58
|
+
editorKits = [],
|
|
59
59
|
content,
|
|
60
60
|
initialContent,
|
|
61
61
|
cdnUrl,
|
|
@@ -69,9 +69,9 @@ export function useEditor(
|
|
|
69
69
|
const container = document.createElement('div');
|
|
70
70
|
editorContainerRef.current = container;
|
|
71
71
|
|
|
72
|
-
const editorInstance =
|
|
72
|
+
const editorInstance = CoreEditor.create({
|
|
73
73
|
element: container,
|
|
74
|
-
|
|
74
|
+
editorKits,
|
|
75
75
|
content: initialContent,
|
|
76
76
|
cdnUrl,
|
|
77
77
|
uri,
|