发布

  • [OPIK-3486] [FE] support pretty & raw views for the text prompt page (#4496)

    frostbyte_neo 发布于 2025-12-29 12:01:08 +00:00

    • [NA] [FE] Refactor text prompt editor to use shared component
    • Created reusable TextPromptEditor component in pages-shared
    • Replaced duplicate preview/edit logic in AddEditPromptDialog and EditPromptVersionDialog
    • Added Preview/Edit view toggle with markdown rendering
    • Removed ~115 lines of duplicated code across create and edit dialogs
    • Fixed all linter errors and removed unused imports
    • Ensures consistent UI/UX for text prompt editing across the application
    • Revision 2: Remove unused SUPPORTED_LANGUAGE import

    • Revision 3: Restore Preview changes functionality and rename Preview to Pretty view

    • Renamed 'Preview' to 'Pretty view' in TextPromptEditor to avoid naming conflicts
    • Restored 'Preview changes' diff mode in EditPromptVersionDialog
    • Added ToggleGroup with Write, Pretty view, and Preview changes modes
    • Preview changes shows text diff and side-by-side media comparison
    • Pretty view renders markdown formatting
    • Restored all necessary imports and state variables
    • Revision 4: Fix linting issues
    • Remove unused TextPromptEditor import
    • Fix prettier formatting for onChange handler
    • Add audio media type to the prompt views

    • Address baz comments

    • Revision 5: Add HTML sanitization and performance optimizations

    • Add rehype-sanitize package and apply to MarkdownPreview to prevent XSS
    • Fix metadata diff to use edited metadata instead of original
    • Memoize original media parsing in EditPromptVersionDialog
    • Extract plugin arrays as constants in MarkdownPreview to prevent recreation
    下载附件