-
-
-
- {options.map((field, index) => (
- |
- {field.label}
- |
- ))}
-
-
-
- {renderTreeRows(root)}
-
-
+
+
+
+
+ #
+ ID
+ Parent
+ 항목명(영문)
+ 항목설명
+ 깊이
+ 아이템 유형
+ 반복 횟수
+ 반복 참조 필드
+ 데이터 길이
+ 값
+
+
+
+ {/* treeRoot는 일반적으로 Root 노드(예: id가 0 또는 첫번째 parent)로 생성되므로,
+ 실제 렌더링은 Root의 자식부터 시작 */}
+ {treeRoot && treeRoot.children.map((child) => renderTreeRows(child))}
+
+
);
};
diff --git a/TestMasterUI/src/components/shared/MonacoEditor.jsx b/TestMasterUI/src/components/shared/MonacoEditor.jsx
index ff4b312..fccc673 100644
--- a/TestMasterUI/src/components/shared/MonacoEditor.jsx
+++ b/TestMasterUI/src/components/shared/MonacoEditor.jsx
@@ -1,6 +1,6 @@
import React, { useEffect, useRef, memo } from 'react';
import * as monaco from 'monaco-editor';
-import {loader} from '@monaco-editor/react';
+import { loader } from '@monaco-editor/react';
loader.config({
paths: {
@@ -9,8 +9,7 @@ loader.config({
'vs/nls': {
availableLanguages: {},
},
- // Specify which languages to load
- languages: ['javascript', 'json', 'xml','plaintext']
+ languages: ['javascript', 'json', 'xml', 'plaintext']
});
const MonacoEditor = memo(({
@@ -95,12 +94,28 @@ const MonacoEditor = memo(({
schemas: []
});
- const action = editor.getAction('editor.action.formatDocument');
- if (action) {
- setTimeout(() => {
- action.run();
- }, 100);
- }
+ // Use a ref to track if component is mounted
+ const isMounted = { current: true };
+
+ // Format after a short delay to ensure editor is ready
+ const timeoutId = setTimeout(() => {
+ if (isMounted.current && editorRef.current) {
+ const action = editorRef.current.getAction('editor.action.formatDocument');
+ if (action) {
+ try {
+ action.run();
+ } catch (e) {
+ // Ignore formatting errors
+ console.debug('Format action failed:', e);
+ }
+ }
+ }
+ }, 100);
+
+ return () => {
+ isMounted.current = false;
+ clearTimeout(timeoutId);
+ };
} catch (e) {
console.warn('Failed to format JSON:', e);
}
@@ -116,7 +131,6 @@ const MonacoEditor = memo(({
resizeObserver.disconnect();
subscription.dispose();
- // Ensure proper cleanup
if (editor) {
try {
const model = editor.getModel();
@@ -128,9 +142,14 @@ const MonacoEditor = memo(({
console.warn('Editor disposal error:', e);
}
}
+ if (editorRef.current) {
+ editorRef.current.dispose();
+ editorRef.current = null;
+ }
};
}, [language]); // Only recreate when language changes
+
// Handle value updates
useEffect(() => {
if (editorRef.current) {
@@ -141,11 +160,6 @@ const MonacoEditor = memo(({
}
}, [normalizedValue]);
- // Convert height to pixel value if it's a number
- // const containerHeight = typeof height === 'number'
- // ? `${height}px`
- // : height.endsWith('px') ? height : `${height}px`;
-
const getHeightStyle = (height) => {
if (height === 'full') {
return '100%';