@kerebron/editor-react 0.4.30 → 0.5.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.
@@ -18,7 +18,7 @@ export interface EditorContentRef {
18
18
  *
19
19
  * @example
20
20
  * ```tsx
21
- * const editor = useEditor({ extensions: [StarterKit] })
21
+ * const editor = useEditor({ editorKits: [StarterKit] })
22
22
  * return <EditorContent editor={editor} />
23
23
  * ```
24
24
  */
@@ -5,7 +5,7 @@ import React, { forwardRef, useEffect, useImperativeHandle, useRef, } from 'reac
5
5
  *
6
6
  * @example
7
7
  * ```tsx
8
- * const editor = useEditor({ extensions: [StarterKit] })
8
+ * const editor = useEditor({ editorKits: [StarterKit] })
9
9
  * return <EditorContent editor={editor} />
10
10
  * ```
11
11
  */
package/esm/mod.d.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * const MyEditor = () => {
10
10
  * const editor = useEditor({
11
- * extensions: [StarterKit],
11
+ * editorKits: [StarterKit],
12
12
  * content: '<p>Hello World!</p>',
13
13
  * })
14
14
  *
package/esm/mod.js CHANGED
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * const MyEditor = () => {
10
10
  * const editor = useEditor({
11
- * extensions: [StarterKit],
11
+ * editorKits: [StarterKit],
12
12
  * content: '<p>Hello World!</p>',
13
13
  * })
14
14
  *
@@ -1,9 +1,9 @@
1
1
  import { type DependencyList } from 'react';
2
2
  import { CoreEditor } from '@kerebron/editor';
3
- import type { AnyExtensionOrReq, Content } from '@kerebron/editor';
3
+ import type { Content, EditorKit } from '@kerebron/editor';
4
4
  export interface UseEditorOptions {
5
5
  /** Array of extensions to use */
6
- extensions?: AnyExtensionOrReq[];
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
- * extensions: [StarterKit],
30
+ * editorKits: [StarterKit],
31
31
  * content: '<p>Hello World!</p>',
32
32
  * })
33
33
  *
@@ -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,iBAAiB,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEnE,MAAM,WAAW,gBAAgB;IAC/B,iCAAiC;IACjC,UAAU,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACjC,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"}
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
- * extensions: [StarterKit],
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 { extensions = [], content, initialContent, cdnUrl, uri, onReady, onTransaction, onChange, } = optionsRef.current;
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 = new CoreEditor({
32
+ const editorInstance = CoreEditor.create({
33
33
  element: container,
34
- extensions,
34
+ editorKits,
35
35
  content: initialContent,
36
36
  cdnUrl,
37
37
  uri,
@@ -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,CAAC;QAChD,kBAAkB,CAAC,OAAO,GAAG,SAAS,CAAC;QA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QAED,IAAI,QAAQ,EAAE,CAAC;YACb,cAAc,CAAC,gBAAgB,CAAC,SAAS,EAAE,GAAG,EAAE;gBAC9C,QAAQ,CAAC,cAAc,CAAC,CAAC;YAC3B,CAAC,CAAC,CAAC;QACL,CAAC;QAED,gCAAgC;QAChC,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YACjD,cAAc,CAAC,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE;gBAC1D,mDAAmD;gBACnD,OAAO,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;YAC9C,CAAC,CAAC,CAAC;QACL,CAAC;QAED,SAAS,CAAC,cAAc,CAAC,CAAC;QAE1B,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,CAAC,cAAc,CAAC,CAAC;QAC1B,CAAC;QAED,UAAU;QACV,OAAO,GAAG,EAAE;YACV,cAAc,CAAC,OAAO,EAAE,CAAC;YACzB,SAAS,CAAC,IAAI,CAAC,CAAC;QAClB,CAAC,CAAC;IACJ,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,kDAAkD;IAE5D,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kerebron/editor-react",
3
- "version": "0.4.30",
3
+ "version": "0.5.0",
4
4
  "license": "MIT",
5
5
  "module": "./esm/mod.js",
6
6
  "exports": {
@@ -14,7 +14,7 @@
14
14
  "src"
15
15
  ],
16
16
  "dependencies": {
17
- "@kerebron/editor": "0.4.30",
17
+ "@kerebron/editor": "0.5.0",
18
18
  "react": "^19"
19
19
  },
20
20
  "devDependencies": {
@@ -26,7 +26,7 @@ export interface EditorContentRef {
26
26
  *
27
27
  * @example
28
28
  * ```tsx
29
- * const editor = useEditor({ extensions: [StarterKit] })
29
+ * const editor = useEditor({ editorKits: [StarterKit] })
30
30
  * return <EditorContent editor={editor} />
31
31
  * ```
32
32
  */
package/src/mod.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * const MyEditor = () => {
10
10
  * const editor = useEditor({
11
- * extensions: [StarterKit],
11
+ * editorKits: [StarterKit],
12
12
  * content: '<p>Hello World!</p>',
13
13
  * })
14
14
  *
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 { AnyExtensionOrReq, Content } from '@kerebron/editor';
4
+ import type { Content, EditorKit } from '@kerebron/editor';
5
5
 
6
6
  export interface UseEditorOptions {
7
7
  /** Array of extensions to use */
8
- extensions?: AnyExtensionOrReq[];
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
- * extensions: [StarterKit],
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
- extensions = [],
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 = new CoreEditor({
72
+ const editorInstance = CoreEditor.create({
73
73
  element: container,
74
- extensions,
74
+ editorKits,
75
75
  content: initialContent,
76
76
  cdnUrl,
77
77
  uri,