@kerebron/extension-codemirror

0.0.12 • Public • Published

Codemirror extension for Kerebron editor kit

Usage as a code only editor

import { CoreEditor } from '@kerebron/editor';
import { ExtensionBasicEditor } from '@kerebron/extension-basic-editor';
import {
  NodeCodeMirror,
  NodeDocumentCode,
} from '@kerebron/extension-codemirror';

this.editor = new CoreEditor({
  topNode: 'doc_code',
  element: document.querySelector('div#editor'),
  extensions: [
    new ExtensionBasicEditor(),
    new NodeDocumentCode({ lang: 'yaml' }),
    new NodeCodeMirror({ languageWhitelist: ['yaml'] }),
  ],
});
this.editor.setDocument(
  '# Multiline string with literal block syntax -preserved new lines\n' +
    'string1: |\n' +
    '   Line1\n' +
    '   line2\n' +
    '   "line3"\n' +
    '  line4\n',
  'text/code-only',
);

const code = this.editor.getDocument('text/code-only');

Readme

Keywords

none

Package Sidebar

Install

npm i @kerebron/extension-codemirror

Weekly Downloads

25

Version

0.0.12

License

MIT

Unpacked Size

180 kB

Total Files

85

Last publish

Collaborators

  • ggodlewski
  • horner