Skip to content

DBA: replace CodeMirror 5 with CodeMirror 6 + Lezer XQuery - #2731

Closed
GuntherRademacher wants to merge 8 commits into
BaseXdb:mainfrom
GuntherRademacher:cm6
Closed

DBA: replace CodeMirror 5 with CodeMirror 6 + Lezer XQuery#2731
GuntherRademacher wants to merge 8 commits into
BaseXdb:mainfrom
GuntherRademacher:cm6

Conversation

@GuntherRademacher

Copy link
Copy Markdown
Member

The changes here replace the DBA's CodeMirror 5 editor with CodeMirror 6, driven by the Lezer-based XQuery language pack:

  • Lezer syntax highlighting, code folding, autocomplete, and function tooltips with documentation links
  • parse-error gutter (error markers + underlines) from the Lezer tree
  • Material-Light / One-Dark themes (as in the Fiddle), following prefers-color-scheme
  • XML highlighting for the XML panels (query output, resource editor, Jobs viewer, Users)

Changes in basex-api (dba/):

  • add static/codemirror6/cm6.js - a self-contained IIFE (window.CM6) bundling CM6 + the XQuery language pack + @codemirror/lang-xml + themes + the parse-error gutter. Replaces the CM5 files.

  • static/js.js - loadCodeMirror rewritten to build CM6 behind a CM5-compatible handle (setValue/getValue/historySize/clearHistory/setCursor/setOption/focus + a hidden-textarea mirror), so editor.js is untouched. Non-resized editors (Users/User) get the fixed 300px height CM5 used; Android/no-CM6 textarea fallback kept.

  • lib/html.xqm - swap the three CM5 <script> + CSS <link> for the single cm6.js; add img-src 'self' data: to the CSP (lint markers are inline data: SVGs)

  • static/style.css - CM5 .CodeMirror* rules replaced by CM6.

  • remove static/codemirror/* (CM5 assets).

  • cm6.js - the bundle is built outside this repo in nuxt-codemirror-lezer/dba-bundle as one IIFE, which is committed here.

Licensing: all bundled libraries are MIT; the minified cm6.js carries a /*! … */ banner with their copyright + MIT notices (as the old codemirror.js did).

@ChristianGruen

Copy link
Copy Markdown
Member

(merged)

@ChristianGruen
ChristianGruen deleted the cm6 branch August 6, 2026 12:43
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.

2 participants