@@ -6,7 +6,6 @@ import { Item as UiItem } from '@ui/components/editor/settings/Item'
66import { Group as UiGroup } from '@ui/components/editor/settings/Group/Group'
77import { Section as UiSection } from '@ui/components/editor/settings/Section'
88import { TextButton as UiTextButton } from '@ui/components/editor/settings/TextButton'
9- import { IconButton as UiIconButton } from '@ui/components/editor/common/IconButton'
109import { Textarea as UiTextarea } from '@ui/components/editor/common/Textarea'
1110import { EditFormatInstructions } from '@/views/settings/types/messages'
1211import {
@@ -384,19 +383,6 @@ export const GeneralSection = forwardRef<HTMLDivElement, Props>(
384383 expand : t ( 'general.edit-format.expand' ) ,
385384 collapse : t ( 'general.edit-format.collapse' )
386385 } }
387- slot_right = {
388- instructions . whole != '' &&
389- instructions . whole != EDIT_FORMAT_INSTRUCTIONS_WHOLE ? (
390- < UiIconButton
391- codicon_icon = "discard"
392- title = { t ( 'general.action.restore-default' ) }
393- on_click = { ( e ) => {
394- e . stopPropagation ( )
395- handle_reset_instruction ( 'whole' , EDIT_FORMAT_INSTRUCTIONS_WHOLE )
396- } }
397- />
398- ) : undefined
399- }
400386 >
401387 < UiTextarea
402388 value = { instructions . whole }
@@ -405,6 +391,14 @@ export const GeneralSection = forwardRef<HTMLDivElement, Props>(
405391 set_instructions ( ( prev ) => ( { ...prev , whole : value } ) )
406392 }
407393 on_blur = { handle_instructions_blur }
394+ action_icon = {
395+ instructions . whole != '' &&
396+ instructions . whole != EDIT_FORMAT_INSTRUCTIONS_WHOLE
397+ ? 'discard'
398+ : undefined
399+ }
400+ action_title = { t ( 'general.action.restore-default' ) }
401+ on_action_click = { ( ) => handle_reset_instruction ( 'whole' , EDIT_FORMAT_INSTRUCTIONS_WHOLE ) }
408402 />
409403 </ UiItem >
410404
@@ -416,22 +410,6 @@ export const GeneralSection = forwardRef<HTMLDivElement, Props>(
416410 expand : t ( 'general.edit-format.expand' ) ,
417411 collapse : t ( 'general.edit-format.collapse' )
418412 } }
419- slot_right = {
420- instructions . truncated != '' &&
421- instructions . truncated != EDIT_FORMAT_INSTRUCTIONS_TRUNCATED ? (
422- < UiIconButton
423- codicon_icon = "discard"
424- title = { t ( 'general.action.restore-default' ) }
425- on_click = { ( e ) => {
426- e . stopPropagation ( )
427- handle_reset_instruction (
428- 'truncated' ,
429- EDIT_FORMAT_INSTRUCTIONS_TRUNCATED
430- )
431- } }
432- />
433- ) : undefined
434- }
435413 >
436414 < UiTextarea
437415 value = { instructions . truncated }
@@ -443,6 +421,14 @@ export const GeneralSection = forwardRef<HTMLDivElement, Props>(
443421 } ) )
444422 }
445423 on_blur = { handle_instructions_blur }
424+ action_icon = {
425+ instructions . truncated != '' &&
426+ instructions . truncated != EDIT_FORMAT_INSTRUCTIONS_TRUNCATED
427+ ? 'discard'
428+ : undefined
429+ }
430+ action_title = { t ( 'general.action.restore-default' ) }
431+ on_action_click = { ( ) => handle_reset_instruction ( 'truncated' , EDIT_FORMAT_INSTRUCTIONS_TRUNCATED ) }
446432 />
447433 </ UiItem >
448434
@@ -454,23 +440,6 @@ export const GeneralSection = forwardRef<HTMLDivElement, Props>(
454440 expand : t ( 'general.edit-format.expand' ) ,
455441 collapse : t ( 'general.edit-format.collapse' )
456442 } }
457- slot_right = {
458- instructions . search_replace != '' &&
459- instructions . search_replace !=
460- EDIT_FORMAT_INSTRUCTIONS_SEARCH_REPLACE ? (
461- < UiIconButton
462- codicon_icon = "discard"
463- title = { t ( 'general.action.restore-default' ) }
464- on_click = { ( e ) => {
465- e . stopPropagation ( )
466- handle_reset_instruction (
467- 'search_replace' ,
468- EDIT_FORMAT_INSTRUCTIONS_SEARCH_REPLACE
469- )
470- } }
471- />
472- ) : undefined
473- }
474443 >
475444 < UiTextarea
476445 value = { instructions . search_replace }
@@ -482,6 +451,14 @@ export const GeneralSection = forwardRef<HTMLDivElement, Props>(
482451 } ) )
483452 }
484453 on_blur = { handle_instructions_blur }
454+ action_icon = {
455+ instructions . search_replace != '' &&
456+ instructions . search_replace != EDIT_FORMAT_INSTRUCTIONS_SEARCH_REPLACE
457+ ? 'discard'
458+ : undefined
459+ }
460+ action_title = { t ( 'general.action.restore-default' ) }
461+ on_action_click = { ( ) => handle_reset_instruction ( 'search_replace' , EDIT_FORMAT_INSTRUCTIONS_SEARCH_REPLACE ) }
485462 />
486463 </ UiItem >
487464
@@ -493,19 +470,6 @@ export const GeneralSection = forwardRef<HTMLDivElement, Props>(
493470 expand : t ( 'general.edit-format.expand' ) ,
494471 collapse : t ( 'general.edit-format.collapse' )
495472 } }
496- slot_right = {
497- instructions . diff != '' &&
498- instructions . diff != EDIT_FORMAT_INSTRUCTIONS_DIFF ? (
499- < UiIconButton
500- codicon_icon = "discard"
501- title = { t ( 'general.action.restore-default' ) }
502- on_click = { ( e ) => {
503- e . stopPropagation ( )
504- handle_reset_instruction ( 'diff' , EDIT_FORMAT_INSTRUCTIONS_DIFF )
505- } }
506- />
507- ) : undefined
508- }
509473 >
510474 < UiTextarea
511475 value = { instructions . diff }
@@ -514,6 +478,14 @@ export const GeneralSection = forwardRef<HTMLDivElement, Props>(
514478 set_instructions ( ( prev ) => ( { ...prev , diff : value } ) )
515479 }
516480 on_blur = { handle_instructions_blur }
481+ action_icon = {
482+ instructions . diff != '' &&
483+ instructions . diff != EDIT_FORMAT_INSTRUCTIONS_DIFF
484+ ? 'discard'
485+ : undefined
486+ }
487+ action_title = { t ( 'general.action.restore-default' ) }
488+ on_action_click = { ( ) => handle_reset_instruction ( 'diff' , EDIT_FORMAT_INSTRUCTIONS_DIFF ) }
517489 />
518490 </ UiItem >
519491 </ UiGroup >
0 commit comments