@nethru/ui 1.0.70 → 1.0.72

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.
@@ -1,4 +1,4 @@
1
- import { Button, Stack } from "@mui/material";
1
+ import { Box, Button, Stack } from "@mui/material";
2
2
  import DialogContent from "@mui/material/DialogContent";
3
3
  import DialogContentText from "@mui/material/DialogContentText";
4
4
  import DialogActions from "@mui/material/DialogActions";
@@ -15,10 +15,14 @@ export default function ConfirmDialog({
15
15
  cancelText = '아니오'
16
16
  }) {
17
17
  return /*#__PURE__*/_jsxs(Dialog, {
18
+ fullWidth: true,
18
19
  contentFontSize: 15,
19
20
  open: open,
20
21
  onClose: onCancel,
21
22
  children: [/*#__PURE__*/_jsx(DialogContent, {
23
+ sx: {
24
+ pt: 4
25
+ },
22
26
  children: /*#__PURE__*/_jsxs(Stack, {
23
27
  direction: "row",
24
28
  alignItems: "center",
@@ -32,14 +36,18 @@ export default function ConfirmDialog({
32
36
  }
33
37
  }), /*#__PURE__*/_jsx(DialogContentText, {
34
38
  component: "div",
35
- children: /*#__PURE__*/_jsx("pre", {
39
+ children: /*#__PURE__*/_jsx(Box, {
40
+ component: "div",
41
+ sx: {
42
+ whiteSpace: 'pre-wrap'
43
+ },
36
44
  children: content.replace(/(\\n)/g, '\n')
37
45
  })
38
46
  })]
39
47
  })
40
48
  }), /*#__PURE__*/_jsxs(DialogActions, {
41
49
  sx: {
42
- mt: 0,
50
+ mr: 1.5,
43
51
  mb: 1
44
52
  },
45
53
  children: [/*#__PURE__*/_jsx(Button, {
package/dist/Editor.js CHANGED
@@ -21,6 +21,7 @@ export default function Editor({
21
21
  autoScrollToBottom = false,
22
22
  restrictWidth = true,
23
23
  onUpdate,
24
+ onScroll,
24
25
  style,
25
26
  ...props
26
27
  }) {
@@ -75,6 +76,21 @@ export default function Editor({
75
76
  extension: extension
76
77
  };
77
78
  }, []);
79
+ const extensionList = useMemo(() => {
80
+ const result = [jsonFormat ? json() : javascript({
81
+ jsx: true
82
+ }), EditorView.lineWrapping, highlight.extension];
83
+ if (onScroll) {
84
+ result.push(EditorView.domEventHandlers({
85
+ scroll(event, view) {
86
+ if (!event.target?.className.includes('cm-scroller')) return;
87
+ onScroll(event, view.scrollDOM);
88
+ }
89
+ }));
90
+ }
91
+ result.push(...extensions);
92
+ return result;
93
+ }, [jsonFormat, highlight.extension, extensions, onScroll]);
78
94
  const handleUpdate = viewUpdate => {
79
95
  setFocused(viewUpdate.view.hasFocus);
80
96
  if (onUpdate) onUpdate(viewUpdate);
@@ -112,9 +128,7 @@ export default function Editor({
112
128
  children: [/*#__PURE__*/_jsx(CodeMirror, {
113
129
  value: content,
114
130
  editable: !readOnly,
115
- extensions: [jsonFormat ? json() : javascript({
116
- jsx: true
117
- }), EditorView.lineWrapping, highlight.extension, ...extensions],
131
+ extensions: extensionList,
118
132
  basicSetup: {
119
133
  ...basicSetup,
120
134
  highlightActiveLineGutter: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nethru/ui",
3
- "version": "1.0.70",
3
+ "version": "1.0.72",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "/dist"