Skip to content

notebooks: Use CodeMirror for markdown block

Administrator requested to merge fkling/experimental/notebook-codemirror into main

Created by: fkling

This PR replaces the Monaco editor with CodeMirror in Notebook Markdown blocks.

  • I moved the core useCodeMirrorEditor hook to the client/shared/.
  • I duplicated the two CSS rules but maybe it makes sense to move shared CodeMirror styling into client/branded.
  • I approximated the existing syntax highlighting.

Note that some behavior that needed to be explicitly configured for Monaco work out of the box with Codemirror (such as blur on Escape).

Depends on https://github.com/sourcegraph/sourcegraph/pull/32950

2022-03-22_22-00

Test plan

  • Go to https://sourcegraph.test:3443/notebooks/ and edit an existing or create a new notebook
  • Create one or more Markdown blocks and enter Markdown. The content has syntax highlighting.
  • Pressing Ctrl+Enter runs the block and exists editing mode.
  • Pressing Escape blurs the input.
  • Pressing Tab to insert Tabs.
  • Typing lines that are longer than the editor is wide will wrap the line.

Merge request reports

Loading