@@ -26,6 +26,9 @@ export const ContentTab: React.FC<ContentTabProps> = ({
2626 // Check if content has changed from original
2727 const hasContentChanged = editableContent !== originalContent ;
2828
29+ // Check if the component has text content to edit
30+ const hasTextContent = originalContent !== undefined && originalContent !== null && originalContent . trim ( ) !== '' ;
31+
2932 // Reset content to original
3033 const resetContent = ( ) => {
3134 setEditableContent ( originalContent ) ;
@@ -92,7 +95,7 @@ export const ContentTab: React.FC<ContentTabProps> = ({
9295 size = "sm"
9396 className = "text-xs h-8"
9497 onClick = { resetContent }
95- disabled = { ! hasContentChanged || applyingChanges }
98+ disabled = { ! hasContentChanged || applyingChanges || ! hasTextContent }
9699 >
97100 < RotateCcw className = "w-3.5 h-3.5 mr-1.5" />
98101 Reset
@@ -102,7 +105,7 @@ export const ContentTab: React.FC<ContentTabProps> = ({
102105 size = "sm"
103106 className = "text-xs h-8"
104107 onClick = { handleContentSave }
105- disabled = { ! hasContentChanged || applyingChanges }
108+ disabled = { ! hasContentChanged || applyingChanges || ! hasTextContent }
106109 >
107110 < Save className = "w-3.5 h-3.5 mr-1.5" />
108111 Save Content
@@ -112,13 +115,20 @@ export const ContentTab: React.FC<ContentTabProps> = ({
112115
113116 { /* Content editor */ }
114117 < div className = "mb-4" >
115- < Textarea
116- value = { editableContent }
117- onChange = { handleContentChange }
118- placeholder = "Enter content text..."
119- className = "min-h-[120px] text-sm font-mono"
120- disabled = { applyingChanges }
121- />
118+ { hasTextContent ? (
119+ < Textarea
120+ value = { editableContent }
121+ onChange = { handleContentChange }
122+ placeholder = "Enter content text..."
123+ className = "min-h-[120px] text-sm font-mono"
124+ disabled = { applyingChanges }
125+ />
126+ ) : (
127+ < div className = "border rounded-md p-4 bg-gray-50 dark:bg-zinc-900/50 text-center" >
128+ < p className = "text-muted-foreground text-sm" > This component doesn't have editable text content.</ p >
129+ < p className = "text-xs text-muted-foreground mt-1" > You can still edit styles and classes for this element.</ p >
130+ </ div >
131+ ) }
122132 </ div >
123133
124134 { /* Typography section */ }
0 commit comments