Skip to content

solid-codemirror@2.0.0

Compare
Choose a tag to compare
@riccardoperra riccardoperra released this 05 Jul 21:38
· 47 commits to main since this release

This version of solid-codemirror has many breaking changes due to the update to official v6 release and support for compartments. For more detailed informations about CodeMirror6 and extension/compartments, see the official documentation

What's Changed

  • Refactor createCodeMirror with extension modularity and compartments support
  • Allows to control editor value with createEditorControlledValue extension helper
  • Allows to observe and update focused state with createEditorFocus helper
  • Allows to update the readOnly state with createEditorReadonly helper

Breaking Changes

  • Remove CodeMirror component (BREAKING!!)

The createCodeMirror has been refactored removing the setOptions function which allowed to do a top-level reconfiguration. Instead, it has been relpaced with the createExtension function which create a compartment for the given extension/s.

Old

const {setOptions} = createCodeMirror();

setOptions({extensions: [
  basicSetup(),
  EditorView.theme([]),
  lineNumbers()
]})

New

const {createExtension} = createCodeMirror();

// Single-extension compartment
const reconfigurebasicSetup = createExtension(basicSetup());
const reconfigureTheme = createExtension(EditorView.theme([]);
const reconfigureLineNumbers = createExtension(lineNumbers());

// Multi-extension compartment
const configureExtensions = createExtension([
  basicSetup(),
  EditorView.theme([]),
  lineNumbers()
])

Full Changelog: https://github.com/riccardoperra/solid-codemirror/compare/v1.1.0...solid-codemirror@2.0.0