feat: add markdown/preview toggle to task editor & fix code block highlighting #1943
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Changes
Markdown/Preview Toggle
Added a toggle in the task form dialog that allows switching between:
This gives users flexibility to edit markdown directly or use the visual editor.
Code Block Fixes
Problem: Code blocks were not being syntax-highlighted when viewing task descriptions. The code appeared as plain monospace text without language-specific coloring.
Root cause: Lexical's
registerCodeHighlightingregisters node transforms that only trigger on future mutations. When markdown is parsed on initial load,CodeNodes are created but the transform doesn't run on them.Solution: After registering code highlighting, explicitly mark existing
CodeNodes as dirty to force the transform to run and apply syntax highlighting.Additional fix: Trim empty lines from code block content to prevent unnecessary
<br>elements at start/end.Inline Code Styling
Updated inline code styling for better visibility with pink color and border.
How it looks in the task panel:
Files Changed
frontend/src/components/dialogs/tasks/TaskFormDialog.tsx- Add markdown/preview togglefrontend/src/components/ui/toggle-group.tsx- Addactiveandsizepropsfrontend/src/components/ui/wysiwyg.tsx- Update inline code and code block stylingfrontend/src/components/ui/wysiwyg/plugins/code-highlight-plugin.tsx- Fix initial highlightingfrontend/src/components/ui/wysiwyg/transformers/code-block-transformer.ts- Trim empty linesfrontend/src/i18n/locales/en/tasks.json- Add translation keys🤖 Generated with Opencode
Let me know if I need to change or add anything (like translations in other languages for the 2 new labels)