Skip to content

Conversation

@urmauur
Copy link
Member

@urmauur urmauur commented Dec 12, 2024

Note

Based on the latest discussion with @imtuyethan , we observed user behavior and concluded that highlighting code inline in the chat input box is an unnecessary feature. However, we will still allow text formatting like bold and italic. Users will be able to type code blocks by using the backticks for starting and closing, and we will render those as code blocks in the user’s message.

Describe Your Changes

  1. Removal of the highlight.js import:

    -import hljs from 'highlight.js'
  2. Elimination of a large block of code responsible for syntax highlighting within the rich text editor. This block handled:

    • Parsing lines for code blocks using regular expressions.
    • Managing language state for highlighted code blocks.
    • Applying syntax highlighting to code within the text editor using highlight.js.
    • Parsing highlighted HTML and mapping it back to Slate's text structure.
  3. The dependency of the decorate function on currentPrompt has been removed, leaving it dependent only on editor:

    -    [currentPrompt, editor]
    +    [editor]

Overall, these changes primarily involve removing the syntax highlighting logic and the associated import from the module.

Fixes Issues

CleanShot 2024-12-12 at 13 59 21
CleanShot 2024-12-12 at 13 59 33

Self Checklist

  • Added relevant comments, esp in complex areas
  • Updated docs (for bug fixes / features)
  • Created issues for follow-up changes or refactoring needed

@urmauur urmauur added this to the v0.5.12 milestone Dec 12, 2024
@urmauur urmauur requested a review from louis-jan December 12, 2024 07:02
@urmauur urmauur self-assigned this Dec 12, 2024
Copy link
Contributor

@louis-jan louis-jan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

YAY

@github-actions
Copy link
Contributor

Barecheck - Code coverage report

Total: 69.04%

Your code coverage diff: 0.40% ▴

Uncovered files and lines
FileLines
web/screens/Thread/ThreadCenterPanel/ChatInput/RichTextEditor.tsx87-88, 90-92, 95-98, 100, 113-115, 118-121, 123, 136, 183, 186, 188, 192, 203, 228-233, 241-242, 244, 260, 276, 282, 295

@github-actions
Copy link
Contributor

This is the build for this pull request. You can download it from the Artifacts section here: Build URL.

@urmauur urmauur merged commit 14737b7 into dev Dec 12, 2024
21 checks passed
@urmauur urmauur deleted the fix/markdown-input-box branch December 12, 2024 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: [UI Bug] Another markdown in input box issue

3 participants