@php-script/editor-react 0.1.0 → 0.1.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 +30 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# @php-script/editor-react
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@php-script/editor-react)
|
|
4
|
+
[](https://www.npmjs.com/package/@php-script/editor-react)
|
|
5
|
+
|
|
6
|
+
Documentation: https://php-script.github.io/php-script-editor/packages/react.html
|
|
7
|
+
|
|
8
|
+
React 18 and 19 wrapper for the `<php-script-editor>` web component. Loads the element on the client only, so it is safe with SSR.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm i @php-script/editor-react monaco-editor
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
import { useState } from 'react';
|
|
20
|
+
import { PhpScriptEditor } from '@php-script/editor-react';
|
|
21
|
+
|
|
22
|
+
export function ScriptEditor() {
|
|
23
|
+
const [code, setCode] = useState('echo "Hello";');
|
|
24
|
+
|
|
25
|
+
return <PhpScriptEditor value={code} onChange={setCode} configUrl="/php-script/config" />;
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
See the [documentation](https://php-script.github.io/php-script-editor/packages/react.html) for all props, events and methods, and
|
|
30
|
+
[Server and language config](https://php-script.github.io/php-script-editor/server.html) for the endpoints.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@php-script/editor-react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "React wrapper for the <php-script-editor> web component.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"dist"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@php-script/editor": "^0.1.
|
|
20
|
+
"@php-script/editor": "^0.1.1"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"monaco-editor": ">=0.55.0 <1.0.0",
|