@seljs/editor-react 1.0.1 → 1.1.0-beta.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/dist/use-sel-editor.cjs
CHANGED
|
@@ -5,6 +5,7 @@ function useSELEditor(config) {
|
|
|
5
5
|
const viewRef = (0, react.useRef)(null);
|
|
6
6
|
const [view, setView] = (0, react.useState)(null);
|
|
7
7
|
const [value, setValue] = (0, react.useState)(config.value ?? "");
|
|
8
|
+
const [valid, setValid] = (0, react.useState)(true);
|
|
8
9
|
const configRef = (0, react.useRef)(config);
|
|
9
10
|
configRef.current = config;
|
|
10
11
|
const ref = (0, react.useCallback)((node) => {
|
|
@@ -18,9 +19,10 @@ function useSELEditor(config) {
|
|
|
18
19
|
const editor = (0, _seljs_editor.createSELEditor)({
|
|
19
20
|
...currentConfig,
|
|
20
21
|
parent: node,
|
|
21
|
-
onChange: (newValue) => {
|
|
22
|
+
onChange: (newValue, isValid) => {
|
|
22
23
|
setValue(newValue);
|
|
23
|
-
|
|
24
|
+
setValid(isValid);
|
|
25
|
+
currentConfig.onChange?.(newValue, isValid);
|
|
24
26
|
}
|
|
25
27
|
});
|
|
26
28
|
viewRef.current = editor;
|
|
@@ -35,7 +37,8 @@ function useSELEditor(config) {
|
|
|
35
37
|
return {
|
|
36
38
|
ref,
|
|
37
39
|
view,
|
|
38
|
-
value
|
|
40
|
+
value,
|
|
41
|
+
valid
|
|
39
42
|
};
|
|
40
43
|
}
|
|
41
44
|
//#endregion
|
package/dist/use-sel-editor.mjs
CHANGED
|
@@ -5,6 +5,7 @@ function useSELEditor(config) {
|
|
|
5
5
|
const viewRef = useRef(null);
|
|
6
6
|
const [view, setView] = useState(null);
|
|
7
7
|
const [value, setValue] = useState(config.value ?? "");
|
|
8
|
+
const [valid, setValid] = useState(true);
|
|
8
9
|
const configRef = useRef(config);
|
|
9
10
|
configRef.current = config;
|
|
10
11
|
const ref = useCallback((node) => {
|
|
@@ -18,9 +19,10 @@ function useSELEditor(config) {
|
|
|
18
19
|
const editor = createSELEditor({
|
|
19
20
|
...currentConfig,
|
|
20
21
|
parent: node,
|
|
21
|
-
onChange: (newValue) => {
|
|
22
|
+
onChange: (newValue, isValid) => {
|
|
22
23
|
setValue(newValue);
|
|
23
|
-
|
|
24
|
+
setValid(isValid);
|
|
25
|
+
currentConfig.onChange?.(newValue, isValid);
|
|
24
26
|
}
|
|
25
27
|
});
|
|
26
28
|
viewRef.current = editor;
|
|
@@ -35,7 +37,8 @@ function useSELEditor(config) {
|
|
|
35
37
|
return {
|
|
36
38
|
ref,
|
|
37
39
|
view,
|
|
38
|
-
value
|
|
40
|
+
value,
|
|
41
|
+
valid
|
|
39
42
|
};
|
|
40
43
|
}
|
|
41
44
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seljs/editor-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.1.0-beta.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"url": "https://github.com/abinnovision/seljs"
|
|
6
6
|
},
|
|
@@ -51,16 +51,16 @@
|
|
|
51
51
|
]
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@seljs/editor": "1.0.
|
|
54
|
+
"@seljs/editor": "1.1.0-beta.2",
|
|
55
55
|
"@seljs/schema": "1.0.1"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@abinnovision/eslint-config-base": "^3.2.0",
|
|
59
59
|
"@abinnovision/prettier-config": "^2.1.5",
|
|
60
60
|
"@seljs-internal/tsconfig": "^0.0.0",
|
|
61
|
-
"@seljs/checker": "1.0.
|
|
62
|
-
"@seljs/env": "^1.0.
|
|
63
|
-
"@seljs/runtime": "^1.0.
|
|
61
|
+
"@seljs/checker": "1.1.0-beta.2",
|
|
62
|
+
"@seljs/env": "^1.1.0-beta.2",
|
|
63
|
+
"@seljs/runtime": "^1.1.0-beta.2",
|
|
64
64
|
"@shazow/whatsabi": "^0.26.0",
|
|
65
65
|
"@storybook/react": "^10.2.19",
|
|
66
66
|
"@storybook/react-vite": "^10.2.19",
|