@lexion-rte/react 0.1.1 → 0.1.2

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 CHANGED
@@ -1,5 +1,14 @@
1
1
  # @lexion-rte/react
2
2
 
3
+ ## 0.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Refresh package metadata links and expand package-level README documentation.
8
+ - Updated dependencies
9
+ - @lexion-rte/core@0.1.2
10
+ - @lexion-rte/extensions@0.1.2
11
+
3
12
  ## 0.1.1
4
13
 
5
14
  ### Patch Changes
package/README.md CHANGED
@@ -2,9 +2,16 @@
2
2
 
3
3
  React adapter for Lexion.
4
4
 
5
- ## What It Is
5
+ ## Overview
6
6
 
7
- `@lexion-rte/react` exposes `LexionEditorView`, a React component that supports controlled and uncontrolled usage.
7
+ `@lexion-rte/react` exports `LexionEditorView`, a component that wraps ProseMirror wiring for React.
8
+
9
+ It supports:
10
+
11
+ - controlled mode (`value`)
12
+ - uncontrolled mode (`defaultValue`)
13
+ - custom external editor instances
14
+ - read-only mode
8
15
 
9
16
  ## Install
10
17
 
@@ -12,22 +19,64 @@ React adapter for Lexion.
12
19
  pnpm add @lexion-rte/react react react-dom
13
20
  ```
14
21
 
15
- ## Usage
22
+ ## Component Props
23
+
24
+ `LexionEditorViewProps`:
25
+
26
+ - `editor?: LexionEditor`
27
+ - `value?: JSONDocument`
28
+ - `defaultValue?: JSONDocument`
29
+ - `onChange?: (value, editor) => void`
30
+ - `onReady?: (editor) => void`
31
+ - `readOnly?: boolean`
32
+ - `className?: string`
33
+ - `style?: CSSProperties`
34
+
35
+ ## Uncontrolled Example
36
+
37
+ ```tsx
38
+ import { LexionEditorView } from "@lexion-rte/react";
39
+
40
+ export function EditorScreen() {
41
+ return <LexionEditorView defaultValue={initialDoc} />;
42
+ }
43
+ ```
44
+
45
+ ## Controlled Example
16
46
 
17
47
  ```tsx
18
48
  import { useState } from "react";
19
49
  import type { JSONDocument } from "@lexion-rte/core";
20
50
  import { LexionEditorView } from "@lexion-rte/react";
21
51
 
22
- export function EditorScreen() {
23
- const [value, setValue] = useState<JSONDocument | undefined>(undefined);
52
+ export function ControlledEditor({ initial }: { initial: JSONDocument }) {
53
+ const [value, setValue] = useState(initial);
24
54
 
25
55
  return (
26
56
  <LexionEditorView
27
57
  value={value}
28
58
  onChange={(nextValue) => setValue(nextValue)}
59
+ readOnly={false}
29
60
  />
30
61
  );
31
62
  }
32
63
  ```
33
64
 
65
+ ## External Editor Instance Example
66
+
67
+ ```tsx
68
+ import { useMemo } from "react";
69
+ import { LexionEditor } from "@lexion-rte/core";
70
+ import { starterKitExtension } from "@lexion-rte/extensions";
71
+ import { LexionEditorView } from "@lexion-rte/react";
72
+
73
+ export function SharedEditor() {
74
+ const editor = useMemo(() => new LexionEditor({ extensions: [starterKitExtension] }), []);
75
+ return <LexionEditorView editor={editor} />;
76
+ }
77
+ ```
78
+
79
+ ## Notes
80
+
81
+ - In controlled mode, pass updated `value` back on every `onChange` call.
82
+ - The component renders the same footer message as other adapters.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lexion-rte/react",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "React adapter for the Lexion editor platform.",
5
5
  "private": false,
6
6
  "type": "module",
@@ -35,8 +35,8 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "prosemirror-view": "^1.37.2",
38
- "@lexion-rte/core": "0.1.1",
39
- "@lexion-rte/extensions": "0.1.1"
38
+ "@lexion-rte/core": "0.1.2",
39
+ "@lexion-rte/extensions": "0.1.2"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "react": "^18.2.0 || ^19.0.0",