@lexion-rte/next 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 +8 -0
- package/README.md +30 -3
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Next.js adapter for Lexion.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Overview
|
|
6
6
|
|
|
7
|
-
`@lexion-rte/next` exports `LexionNextEditorView`,
|
|
7
|
+
`@lexion-rte/next` exports `LexionNextEditorView`, which wraps the React adapter as a client component.
|
|
8
|
+
|
|
9
|
+
This package is ideal for Next App Router and can also be used in Pages Router client components.
|
|
8
10
|
|
|
9
11
|
## Install
|
|
10
12
|
|
|
@@ -12,7 +14,7 @@ Next.js adapter for Lexion.
|
|
|
12
14
|
pnpm add @lexion-rte/next next react react-dom
|
|
13
15
|
```
|
|
14
16
|
|
|
15
|
-
##
|
|
17
|
+
## Basic Example
|
|
16
18
|
|
|
17
19
|
```tsx
|
|
18
20
|
"use client";
|
|
@@ -24,3 +26,28 @@ export default function EditorPage() {
|
|
|
24
26
|
}
|
|
25
27
|
```
|
|
26
28
|
|
|
29
|
+
## Controlled Example
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
"use client";
|
|
33
|
+
|
|
34
|
+
import { useState } from "react";
|
|
35
|
+
import type { JSONDocument } from "@lexion-rte/core";
|
|
36
|
+
import { LexionNextEditorView } from "@lexion-rte/next";
|
|
37
|
+
|
|
38
|
+
export default function EditorPage() {
|
|
39
|
+
const [value, setValue] = useState<JSONDocument | undefined>(undefined);
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<LexionNextEditorView
|
|
43
|
+
value={value}
|
|
44
|
+
onChange={(nextValue) => setValue(nextValue)}
|
|
45
|
+
/>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Notes
|
|
51
|
+
|
|
52
|
+
- Keep `"use client"` at the top of files that render the component.
|
|
53
|
+
- Component props are the same as `@lexion-rte/react` `LexionEditorViewProps`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lexion-rte/next",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Next.js adapter for the Lexion editor.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"react-dom": "^18.2.0 || ^19.0.0"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@lexion-rte/react": "0.1.
|
|
42
|
+
"@lexion-rte/react": "0.1.2"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"build": "tsc -p tsconfig.json",
|