@nethru/ui 1.0.59 → 1.0.60

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 (2) hide show
  1. package/dist/Editor.js +9 -9
  2. package/package.json +1 -1
package/dist/Editor.js CHANGED
@@ -3,10 +3,9 @@ import { Box, Typography } from "@mui/material";
3
3
  import CodeMirror from '@uiw/react-codemirror';
4
4
  import { javascript } from '@codemirror/lang-javascript';
5
5
  import { json } from '@codemirror/lang-json';
6
- import { EditorView } from "@codemirror/view";
6
+ import { Decoration, EditorView } from "@codemirror/view";
7
7
  import { RegExpCursor, SearchCursor } from '@codemirror/search';
8
8
  import { StateEffect, StateField } from "@codemirror/state";
9
- import { Decoration } from "@codemirror/view";
10
9
  import { jsx as _jsx } from "react/jsx-runtime";
11
10
  import { jsxs as _jsxs } from "react/jsx-runtime";
12
11
  export default function Editor({
@@ -20,6 +19,7 @@ export default function Editor({
20
19
  keyword,
21
20
  isRegExp = false,
22
21
  autoScrollToBottom = false,
22
+ restrictWidth = true,
23
23
  onUpdate,
24
24
  style,
25
25
  ...props
@@ -30,7 +30,7 @@ export default function Editor({
30
30
  const [focused, setFocused] = useState(false);
31
31
  const styles = useMemo(() => {
32
32
  return {
33
- maxWidth: ref.current ? `${ref.current.offsetWidth}px` : 'unset',
33
+ maxWidth: restrictWidth && ref.current ? `${ref.current.offsetWidth}px` : 'unset',
34
34
  borderBottom: focused ? `3px solid ${error ? '#d32f2f' : '#1976d2'}` : `${!readOnly ? '2px' : '0px'} solid rgba(0, 0, 0, 0.42)`
35
35
  };
36
36
  // eslint-disable-next-line
@@ -93,12 +93,12 @@ export default function Editor({
93
93
  });
94
94
  }, [view, autoScrollToBottom]);
95
95
  useEffect(() => {
96
- setTimeout(() => {
97
- setContent(value);
98
- highlightKeyword();
99
- scrollToBottom();
100
- }, 100);
101
- }, [value, view, highlightKeyword, scrollToBottom]);
96
+ setContent(value);
97
+ }, [value]);
98
+ useEffect(() => {
99
+ highlightKeyword();
100
+ scrollToBottom();
101
+ }, [content, view, highlightKeyword, scrollToBottom]);
102
102
  return /*#__PURE__*/_jsxs(Box, {
103
103
  ref: ref,
104
104
  children: [/*#__PURE__*/_jsx(CodeMirror, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nethru/ui",
3
- "version": "1.0.59",
3
+ "version": "1.0.60",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "/dist"