A library of SolidJS primitives to build code editors using CodeMirror 6 @codemirror
MIT License
Bot releases are visible (Hide)
Published by github-actions[bot] over 1 year ago
Warning This version could cause breaking changes due to @codemirror/state and @codemirror/view version update.
Updating @codemirror/state to ^6.2.0 and @codemirror/view to ^6.12.0 it's highly recommended
Published by github-actions[bot] over 1 year ago
Published by riccardoperra over 1 year ago
Full Changelog: https://github.com/riccardoperra/solid-codemirror/compare/[email protected]@2.2.2
Published by github-actions[bot] almost 2 years ago
This version of solid-codemirror introduces a new helper: createLazyCompartmentExtension
. This new helper will not introduce any magic at all, it will just provide a cleaner syntax to support extensions returning a Promise.
// ✅ 1. Remove the static import
// import { largeExtension } from './large-extension';
import { createLazyCompartmentExtension } from './createLazyCompartmentExtension';
import { Show } from 'solid-js';
function App() {
const [code, setCode] = createSignal("console.log('hello world!')");
const { ref, createExtension } = createCodeMirror({ onValueChange: setCode });
// ✅ 2. Call the helper providing a Promise<Extension>
// The extension will be configured only after the Promise resolves
const largeExt = createLazyCompartmentExtension(
() => import('./large-extension').then(res => res.largeExtension)
);
return (
<div>
<div ref={ref} />
{/*✅ 3. You can read the pending state of the Promise*/}
<Show when={largeExt.loading}>
Loading...
</Show>
</div>
)
}
Published by riccardoperra about 2 years ago
Full Changelog: https://github.com/riccardoperra/solid-codemirror/compare/[email protected]@2.1.0
Published by riccardoperra over 2 years ago
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
createCodeMirror
with extension modularity and compartments
supportcreateEditorControlledValue
extension helpercreateEditorFocus
helpercreateEditorReadonly
helperCodeMirror
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.
const {setOptions} = createCodeMirror();
setOptions({extensions: [
basicSetup(),
EditorView.theme([]),
lineNumbers()
]})
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/[email protected]
Published by riccardoperra over 2 years ago
Full Changelog: https://github.com/riccardoperra/solid-codemirror/compare/v1.0.3...v1.1.0
Published by github-actions[bot] over 2 years ago
Published by github-actions[bot] over 2 years ago