@lexion-rte/react 0.1.0 → 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.
Files changed (3) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +82 -0
  3. package/package.json +6 -6
package/CHANGELOG.md ADDED
@@ -0,0 +1,23 @@
1
+ # @lexion-rte/react
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
+
12
+ ## 0.1.1
13
+
14
+ ### Patch Changes
15
+
16
+ - Update package metadata and documentation for the `@lexion-rte` package set.
17
+
18
+ - Align repository/homepage/bugs metadata with the current GitHub repository owner.
19
+ - Add package-level README files with package purpose and usage examples.
20
+
21
+ - Updated dependencies
22
+ - @lexion-rte/core@0.1.1
23
+ - @lexion-rte/extensions@0.1.1
package/README.md ADDED
@@ -0,0 +1,82 @@
1
+ # @lexion-rte/react
2
+
3
+ React adapter for Lexion.
4
+
5
+ ## Overview
6
+
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
15
+
16
+ ## Install
17
+
18
+ ```bash
19
+ pnpm add @lexion-rte/react react react-dom
20
+ ```
21
+
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
46
+
47
+ ```tsx
48
+ import { useState } from "react";
49
+ import type { JSONDocument } from "@lexion-rte/core";
50
+ import { LexionEditorView } from "@lexion-rte/react";
51
+
52
+ export function ControlledEditor({ initial }: { initial: JSONDocument }) {
53
+ const [value, setValue] = useState(initial);
54
+
55
+ return (
56
+ <LexionEditorView
57
+ value={value}
58
+ onChange={(nextValue) => setValue(nextValue)}
59
+ readOnly={false}
60
+ />
61
+ );
62
+ }
63
+ ```
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.0",
3
+ "version": "0.1.2",
4
4
  "description": "React adapter for the Lexion editor platform.",
5
5
  "private": false,
6
6
  "type": "module",
@@ -15,12 +15,12 @@
15
15
  "license": "GPL-3.0-only",
16
16
  "repository": {
17
17
  "type": "git",
18
- "url": "https://github.com/lexion-rte/lexion.git",
18
+ "url": "https://github.com/dariusve/lexion.git",
19
19
  "directory": "packages/react"
20
20
  },
21
- "homepage": "https://github.com/lexion-rte/lexion/tree/main/packages/react",
21
+ "homepage": "https://github.com/dariusve/lexion/tree/main/packages/react",
22
22
  "bugs": {
23
- "url": "https://github.com/lexion-rte/lexion/issues"
23
+ "url": "https://github.com/dariusve/lexion/issues"
24
24
  },
25
25
  "keywords": [
26
26
  "lexion",
@@ -35,8 +35,8 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "prosemirror-view": "^1.37.2",
38
- "@lexion-rte/core": "0.1.0",
39
- "@lexion-rte/extensions": "0.1.0"
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",