@gdquest/codemirror-freeze
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

@gdquest/codemirror-freeze

freeze() extension

Purpose

This extension setup a Codemirror view to "freeze" code between specific comment tags.

By default, freeze() has "start-freeze" and "end-freeze" as keywords, but it is customizable by passing the new names in parameter.

Usage

import { basicSetup } from "codemirror";
import { EditorView } from "@codemirror/view";
import { javascript } from "@codemirror/lang-javascript";
import { freeze } from "@gdquest/codemirror-freeze";

new EditorView({
  extensions: [basicSetup, javascript(), freeze()],
  doc: `
Hello. This is editable.

// start-freeze
This is frozen. Cannot change this line.
// end-freeze

This part is editable.
`.trim(),
});

Package Sidebar

Install

npm i @gdquest/codemirror-freeze

Weekly Downloads

3

Version

0.1.2

License

MIT

Unpacked Size

101 kB

Total Files

23

Last publish

Collaborators

  • adamscott
  • razcore-rad
  • nathan_gdquest
  • xananax