@@ -56,6 +56,7 @@ function AgentAIPromptSection({accountID, parentScrollViewRef}: AgentAIPromptSec
5656 const [ isLoadingApp ] = useOnyx ( ONYXKEYS . IS_LOADING_APP ) ;
5757 const [ draftPrompt , setDraftPrompt ] = useState ( '' ) ;
5858 const [ showEmptyError , setShowEmptyError ] = useState ( false ) ;
59+ const [ showHtmlError , setShowHtmlError ] = useState ( false ) ;
5960 const [ showSavedConfirmation , setShowSavedConfirmation ] = useState ( false ) ;
6061 const [ isUserInitiatedSave , setIsUserInitiatedSave ] = useState ( false ) ;
6162 const inputRef = useRef < BaseTextInputRef > ( null ) ;
@@ -70,7 +71,7 @@ function AgentAIPromptSection({accountID, parentScrollViewRef}: AgentAIPromptSec
7071 let errorText = '' ;
7172 if ( showEmptyError ) {
7273 errorText = translate ( 'profilePage.aiPromptSection.promptCannotBeEmpty' ) ;
73- } else if ( hasHtmlTag ) {
74+ } else if ( showHtmlError && hasHtmlTag ) {
7475 errorText = translate ( 'common.error.invalidCharacter' ) ;
7576 }
7677 const storedPrompt = Str . htmlDecode ( agentPrompt ?. prompt ?? '' ) ;
@@ -166,6 +167,7 @@ function AgentAIPromptSection({accountID, parentScrollViewRef}: AgentAIPromptSec
166167 return ;
167168 }
168169 if ( containsHtmlTag ( trimmed ) ) {
170+ setShowHtmlError ( true ) ;
169171 inputRef . current ?. focus ( ) ;
170172 return ;
171173 }
@@ -186,6 +188,9 @@ function AgentAIPromptSection({accountID, parentScrollViewRef}: AgentAIPromptSec
186188 if ( showEmptyError && text . trim ( ) ) {
187189 setShowEmptyError ( false ) ;
188190 }
191+ if ( showHtmlError && ! containsHtmlTag ( text ) ) {
192+ setShowHtmlError ( false ) ;
193+ }
189194 } ;
190195
191196 const handleKeyPress = ( e : TextInputKeyPressEvent ) => {
@@ -227,7 +232,7 @@ function AgentAIPromptSection({accountID, parentScrollViewRef}: AgentAIPromptSec
227232 icon = { showSavedConfirmation ? icons . Checkmark : undefined }
228233 onPress = { handleSave }
229234 isLoading = { isSaving && isUserInitiatedSave }
230- isDisabled = { hasHtmlTag || ( isSaving && isUserInitiatedSave ) }
235+ isDisabled = { isSaving && isUserInitiatedSave }
231236 style = { [ styles . alignSelfStart ] }
232237 testID = "save-prompt-button"
233238 />
0 commit comments