[WC-3348] Charts: restore highlighted JSON editor in playground#2310
[WC-3348] Charts: restore highlighted JSON editor in playground#2310yordan-st wants to merge 5 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
eea1883 to
cd6e358
Compare
This comment has been minimized.
This comment has been minimized.
cd6e358 to
653519e
Compare
AI Code Review
What was reviewed
Skipped (out of scope): Note: Findings
|
Pull request type
Bug fix (non-breaking change which fixes an issue)
Description
Charts v6.3.0 shipped the playground editor on CodeMirror, which threw a bundling error and broke the playground. As a stopgap (to unblock WC-3345), CodeMirror was replaced with a plain
<textarea>in 6.3.1 — losing syntax highlighting and any feedback on invalid JSON.This restores a real editor without reintroducing a CodeMirror-class bundling dependency.
CodeEditornow usesreact-simple-code-editor+highlight.js(JSON), adapting the lightweight pattern already used inrich-text-web. It adds inline invalid-JSON feedback (a sticky error banner above the editor) and keeps the existing prop contract (value/onChange/readOnly/height) so both playground panels work unchanged.Scope is intentionally limited to the editor component. Leo's earlier review findings on the already-merged custom-chart / playground rework are tracked separately in WC-3488.
react-simple-code-editor,highlight.js(tree-shaken core + JSON language only)CodeEditor(highlighting, JSON lint, readOnly, height, no-CodeMirror guard)What should be covered while testing?
Put a chart (e.g. Line chart) on a page, set Show playground slot = Yes, drop the Chart playground widget into the slot, configure a Series, and run the app (F5). Click Toggle Editor to open the sidebar.
}); a red error banner appears at the top of the editor. Fix it → the banner disappears.{ "title": { "text": "TEST" } }; the chart title updates live.