Skip to content

Commit 61cc4d5

Browse files
committed
fix disable text content cause update not working
1 parent b3d5db1 commit 61cc4d5

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

frontend/src/components/chat/code-engine/component-inspector/index.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,6 @@ export function ComponentInspector({
6767
// Reset content editing state when component changes
6868
setIsContentEdited(false);
6969

70-
// If there's no content or it's empty, make sure we initialize properly
71-
if (!selectedComponent.textContent || selectedComponent.textContent.trim() === '') {
72-
setEditableContent('');
73-
setOriginalContent('');
74-
}
7570
}
7671
}, [selectedComponent]);
7772

frontend/src/components/chat/code-engine/component-inspector/tabs/ContentTab.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@ export const ContentTab: React.FC<ContentTabProps> = ({
2525
}) => {
2626
// Check if content has changed from original
2727
const hasContentChanged = editableContent !== originalContent;
28-
29-
// Check if the component has text content to edit
30-
const hasTextContent = originalContent !== undefined && originalContent !== null && originalContent.trim() !== '';
28+
// Either the tag is text-editable or it actually has text content
29+
const hasTextContent = Boolean(originalContent.trim());
3130

3231
// Reset content to original
3332
const resetContent = () => {
@@ -95,7 +94,7 @@ export const ContentTab: React.FC<ContentTabProps> = ({
9594
size="sm"
9695
className="text-xs h-8"
9796
onClick={resetContent}
98-
disabled={!hasContentChanged || applyingChanges || !hasTextContent}
97+
disabled={!hasContentChanged || applyingChanges}
9998
>
10099
<RotateCcw className="w-3.5 h-3.5 mr-1.5" />
101100
Reset
@@ -105,7 +104,7 @@ export const ContentTab: React.FC<ContentTabProps> = ({
105104
size="sm"
106105
className="text-xs h-8"
107106
onClick={handleContentSave}
108-
disabled={!hasContentChanged || applyingChanges || !hasTextContent}
107+
disabled={!hasContentChanged || applyingChanges}
109108
>
110109
<Save className="w-3.5 h-3.5 mr-1.5" />
111110
Save Content

0 commit comments

Comments
 (0)