feat(editor): add language selector to code block node view - #9800
feat(editor): add language selector to code block node view#9800Liewzheng wants to merge 1 commit into
Conversation
Code blocks created via slash command, paste, or markdown import get a null language and there is no UI to set or change it afterwards — the only path is retyping the ```lang fence from scratch. This adds a small dropdown at the top-left of code blocks (editable mode only) listing every grammar registered in lowlight plus a Plain text (null) option, writing through to the node's language attribute so highlighting updates immediately.
◈ PR Lens
Architecture 1 component touched across 1 lane. Data flow No data-flow sequence changed in this PR. Drill down
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Description
Adds a language selector dropdown to the code block node view, closing #9799.
In CE, code blocks created via slash command / paste / import get
language: nulland there is no UI to set or change the language afterwards — the only workaround is retyping the```langfence. This PR renders a compact<select>at the top-left of code blocks (editable mode only):listLanguages()), so the list always matches the registered grammars, plus a "Plain text" (null) option.updateAttributes({ language }), so lowlight highlighting updates in place.contentEditable={false}wrapper with mousedown propagation stopped, so it doesn't disturb the editor selection; the<pre>gets extra top padding in editable mode so the control never overlaps the first line of code.Read-only rendering is unchanged (no selector, no extra padding).
Type of Change
Screenshots and Media (if applicable)
Tested locally on the CE dev server: created code blocks via slash command,
```tsfence, and plain paste; switched languages via the selector and confirmed highlighting follows the selection; verified the selector is hidden in read-only mode.Test Scenarios
pnpm turbo run check:types --filter=@plane/editorpassesoxlinton the changed file: 0 warnings, 0 errorsReferences
Closes #9799