@nethru/ui 1.0.25 → 1.0.26
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/Editor.js +4 -3
- package/package.json +1 -1
package/dist/Editor.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import CodeMirror from '@uiw/react-codemirror';
|
|
2
2
|
import { javascript } from '@codemirror/lang-javascript';
|
|
3
3
|
import { json } from '@codemirror/lang-json';
|
|
4
|
+
import { EditorView } from "@codemirror/view";
|
|
4
5
|
import { Box, Typography } from "@mui/material";
|
|
5
6
|
import { useMemo, useState } from "react";
|
|
6
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -19,9 +20,9 @@ export default function Editor({
|
|
|
19
20
|
const [focused, setFocused] = useState(false);
|
|
20
21
|
const styles = useMemo(() => {
|
|
21
22
|
return {
|
|
22
|
-
borderBottom: focused ? `3px solid ${error ? '#d32f2f' : '#1976d2'}` : '2px solid rgba(0, 0, 0, 0.42)
|
|
23
|
+
borderBottom: focused ? `3px solid ${error ? '#d32f2f' : '#1976d2'}` : `${editable ? '2px' : '0px'} solid rgba(0, 0, 0, 0.42)`
|
|
23
24
|
};
|
|
24
|
-
}, [error, focused]);
|
|
25
|
+
}, [editable, error, focused]);
|
|
25
26
|
const handleUpdate = viewUpdate => {
|
|
26
27
|
setFocused(viewUpdate.view.hasFocus);
|
|
27
28
|
if (onUpdate) onUpdate(viewUpdate);
|
|
@@ -31,7 +32,7 @@ export default function Editor({
|
|
|
31
32
|
editable: editable,
|
|
32
33
|
extensions: [jsonFormat ? json() : javascript({
|
|
33
34
|
jsx: true
|
|
34
|
-
}), ...extensions],
|
|
35
|
+
}), EditorView.lineWrapping, ...extensions],
|
|
35
36
|
basicSetup: {
|
|
36
37
|
...basicSetup,
|
|
37
38
|
highlightActiveLineGutter: false,
|