Function createEditor

  • KullnaEditor.createEditor(element, options)

    Creates a new KullnaEditor instance.

    Here is a typical example of how to create an editor:

    import {createEditor} from '@kullna/editor';

    const editor = createEditor('#editor', {
    language: 'javascript',
    // This tells the editor to use Highlight.JS for syntax highlighting:
    highlightElement: hljs.highlightElement,
    // This tells the editor to show a gutter with line numbers and a border:
    gutter: {
    border: true,
    class: 'gutter'
    }
    });
    // Warning! Disabling spellcheck will disable spellcheck for the entire page.
    editor.spellcheck = false;
    editor.wrapsText = true;

    For a list of features and options you can change after creating the editor, see the KullnaEditor interface.

    For a comprehensive examples of the options and how to use them, see the Options interface.

    Returns

    A new KullnaEditor instance.

    Parameters

    • selectorOrElement: string | HTMLElement

      The parent element into which the editor's contents will be isnerted.

    • opt: Partial<Options> = {}

      Options for the editor.

    Returns KullnaEditor

Generated using TypeDoc