Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: markdown inline inputbox #4269

Merged
merged 1 commit into from
Dec 12, 2024
Merged

fix: markdown inline inputbox #4269

merged 1 commit into from
Dec 12, 2024

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 the type: bug Something isn't working label Dec 12, 2024
@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

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

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
type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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