@@ -108,40 +108,42 @@ const IDE = () => {
108108 }
109109 } ;
110110
111- const toast = ( message , type = 'toast-success' ) => {
112- const existingToasts = document . querySelectorAll ( '.toast' ) ;
113- existingToasts . forEach ( toast => {
114- document . getElementById ( 'toast-container' ) ?. removeChild ( toast ) ;
115- } ) ;
111+ const toast = useCallback ( ( message , type = 'toast-success' ) => {
112+ const containerId = 'toast-container' ;
113+
114+ document
115+ . querySelectorAll ( '.toast' )
116+ . forEach ( existing => {
117+ document . getElementById ( containerId ) ?. removeChild ( existing ) ;
118+ } ) ;
116119
117120 const toastElement = document . createElement ( 'div' ) ;
118121 toastElement . className = `toast ${ type } ` ;
119122 toastElement . textContent = message ;
120123
121- const container = document . getElementById ( 'toast-container' ) ;
124+ let container = document . getElementById ( containerId ) ;
122125 if ( ! container ) {
123- const newContainer = document . createElement ( 'div' ) ;
124- newContainer . id = 'toast-container' ;
125- document . body . appendChild ( newContainer ) ;
126- newContainer . appendChild ( toastElement ) ;
127- } else {
128- container . appendChild ( toastElement ) ;
126+ container = document . createElement ( 'div' ) ;
127+ container . id = containerId ;
128+ document . body . appendChild ( container ) ;
129129 }
130130
131+ container . appendChild ( toastElement ) ;
132+
131133 setTimeout ( ( ) => {
132134 toastElement . classList . add ( 'show' ) ;
133135 } , 10 ) ;
134136
135137 setTimeout ( ( ) => {
136138 toastElement . classList . remove ( 'show' ) ;
137139 setTimeout ( ( ) => {
138- const container = document . getElementById ( 'toast-container' ) ;
139- if ( container && container . contains ( toastElement ) ) {
140- container . removeChild ( toastElement ) ;
140+ const holder = document . getElementById ( containerId ) ;
141+ if ( holder && holder . contains ( toastElement ) ) {
142+ holder . removeChild ( toastElement ) ;
141143 }
142144 } , 300 ) ;
143145 } , 3000 ) ;
144- } ;
146+ } , [ ] ) ;
145147
146148 // 🆕 파일 아이콘 생성 함수 (원본 유지)
147149 const getFileIcon = ( filename ) => {
@@ -468,8 +470,43 @@ const IDE = () => {
468470 handleSave ( ) ;
469471 } ) ;
470472
471- monaco . editor . defineTheme ( 'custom-dark' , { /* ... */ } ) ;
472- monaco . editor . defineTheme ( 'custom-light' , { /* ... */ } ) ;
473+ monaco . editor . defineTheme ( 'custom-dark' , {
474+ base : 'vs-dark' ,
475+ inherit : true ,
476+ rules : [
477+ { token : '' , foreground : 'D4D4D4' , background : '1E1E1E' } ,
478+ { token : 'comment' , foreground : '6A9955' } ,
479+ { token : 'string' , foreground : 'CE9178' } ,
480+ { token : 'keyword' , foreground : '569CD6' } ,
481+ { token : 'number' , foreground : 'B5CEA8' }
482+ ] ,
483+ colors : {
484+ 'editor.background' : '#1E1E1E' ,
485+ 'editorLineNumber.foreground' : '#858585' ,
486+ 'editorCursor.foreground' : '#AEAFAD' ,
487+ 'editor.selectionBackground' : '#264F78' ,
488+ 'editor.lineHighlightBackground' : '#2A2D2E'
489+ }
490+ } ) ;
491+
492+ monaco . editor . defineTheme ( 'custom-light' , {
493+ base : 'vs' ,
494+ inherit : true ,
495+ rules : [
496+ { token : '' , foreground : '2D2D2D' , background : 'FFFFFF' } ,
497+ { token : 'comment' , foreground : '008000' } ,
498+ { token : 'string' , foreground : 'A31515' } ,
499+ { token : 'keyword' , foreground : '0000FF' } ,
500+ { token : 'number' , foreground : '098658' }
501+ ] ,
502+ colors : {
503+ 'editor.background' : '#FFFFFF' ,
504+ 'editorLineNumber.foreground' : '#237893' ,
505+ 'editorCursor.foreground' : '#000000' ,
506+ 'editor.selectionBackground' : '#ADD6FF' ,
507+ 'editor.lineHighlightBackground' : '#F5F5F5'
508+ }
509+ } ) ;
473510
474511 const updateEditorTheme = ( monaco ) => {
475512 if ( ! monaco && ! editorRef . current ) return ;
0 commit comments