react-codemirror2

  • Version 7.2.1
  • Published
  • 70.1 kB
  • No dependencies
  • MIT license

Install

npm i react-codemirror2
yarn add react-codemirror2
pnpm add react-codemirror2

Overview

a tiny react codemirror component wrapper

Index

Classes

class Controlled

class Controlled extends React.Component<IControlledCodeMirror, any> {}

    class UnControlled

    class UnControlled extends React.Component<IUnControlledCodeMirror, any> {}

      Interfaces

      interface DomEvent

      interface DomEvent {}

        call signature

        (editor: codemirror.Editor, event?: any): void;

          interface EditorChangeEvent

          interface EditorChangeEvent {}

            call signature

            (editor: codemirror.Editor, changeObj: codemirror.EditorChange): void;

              interface ICodeMirror

              interface ICodeMirror {}

                property autoCursor

                autoCursor?: boolean;

                  property autoScroll

                  autoScroll?: boolean;

                    property className

                    className?: string;

                      property cursor

                      cursor?: codemirror.Position;

                        property defineMode

                        defineMode?: IDefineModeOptions;

                          property editorDidConfigure

                          editorDidConfigure?: (editor: codemirror.Editor) => void;

                            property editorDidMount

                            editorDidMount?: (
                            editor: codemirror.Editor,
                            value: string,
                            cb: () => void
                            ) => void;

                              property editorWillUnmount

                              editorWillUnmount?: (lib: any) => void;

                                property onBlur

                                onBlur?: DomEvent;

                                  property onChange

                                  onChange?: (
                                  editor: codemirror.Editor,
                                  data: codemirror.EditorChange,
                                  value: string
                                  ) => void;

                                    property onContextMenu

                                    onContextMenu?: DomEvent;

                                      property onCopy

                                      onCopy?: DomEvent;

                                        property onCursor

                                        onCursor?: (editor: codemirror.Editor, data: codemirror.Position) => void;

                                          property onCursorActivity

                                          onCursorActivity?: (editor: codemirror.Editor) => void;

                                            property onCut

                                            onCut?: DomEvent;

                                              property onDblClick

                                              onDblClick?: DomEvent;

                                                property onDragEnter

                                                onDragEnter?: DomEvent;

                                                  property onDragLeave

                                                  onDragLeave?: DomEvent;

                                                    property onDragOver

                                                    onDragOver?: DomEvent;

                                                      property onDragStart

                                                      onDragStart?: DomEvent;

                                                        property onDrop

                                                        onDrop?: DomEvent;

                                                          property onFocus

                                                          onFocus?: DomEvent;

                                                            property onGutterClick

                                                            onGutterClick?: (
                                                            editor: codemirror.Editor,
                                                            lineNumber: number,
                                                            gutter: string,
                                                            event: Event
                                                            ) => void;

                                                              property onInputRead

                                                              onInputRead?: EditorChangeEvent;

                                                                property onKeyDown

                                                                onKeyDown?: DomEvent;

                                                                  property onKeyHandled

                                                                  onKeyHandled?: KeyHandledEvent;

                                                                    property onKeyPress

                                                                    onKeyPress?: DomEvent;

                                                                      property onKeyUp

                                                                      onKeyUp?: DomEvent;

                                                                        property onMouseDown

                                                                        onMouseDown?: DomEvent;

                                                                          property onPaste

                                                                          onPaste?: DomEvent;

                                                                            property onRenderLine

                                                                            onRenderLine?: (
                                                                            editor: codemirror.Editor,
                                                                            line: codemirror.LineHandle,
                                                                            element: HTMLElement
                                                                            ) => void;

                                                                              property onScroll

                                                                              onScroll?: (editor: codemirror.Editor, data: codemirror.ScrollInfo) => void;

                                                                                property onSelection

                                                                                onSelection?: (editor: codemirror.Editor, data: any) => void;

                                                                                  property onTouchStart

                                                                                  onTouchStart?: DomEvent;

                                                                                    property onUpdate

                                                                                    onUpdate?: (editor: codemirror.Editor) => void;

                                                                                      property onViewportChange

                                                                                      onViewportChange?: (
                                                                                      editor: codemirror.Editor,
                                                                                      start: number,
                                                                                      end: number
                                                                                      ) => void;

                                                                                        property options

                                                                                        options?: codemirror.EditorConfiguration;

                                                                                          property scroll

                                                                                          scroll?: ISetScrollOptions;

                                                                                            property selection

                                                                                            selection?: {
                                                                                            ranges: Array<ISetSelectionOptions>;
                                                                                            focus?: boolean;
                                                                                            };

                                                                                              interface IControlledCodeMirror

                                                                                              interface IControlledCodeMirror extends ICodeMirror {}

                                                                                                property onBeforeChange

                                                                                                onBeforeChange: (
                                                                                                editor: codemirror.Editor,
                                                                                                data: codemirror.EditorChange,
                                                                                                value: string
                                                                                                ) => void;

                                                                                                  property value

                                                                                                  value: string;

                                                                                                    interface IDefineModeOptions

                                                                                                    interface IDefineModeOptions {}

                                                                                                      property fn

                                                                                                      fn: () => codemirror.Mode<any>;

                                                                                                        property name

                                                                                                        name: string;

                                                                                                          interface ISetScrollOptions

                                                                                                          interface ISetScrollOptions {}

                                                                                                            property x

                                                                                                            x?: number | null;

                                                                                                              property y

                                                                                                              y?: number | null;

                                                                                                                interface ISetSelectionOptions

                                                                                                                interface ISetSelectionOptions {}

                                                                                                                  property anchor

                                                                                                                  anchor: codemirror.Position;

                                                                                                                    property head

                                                                                                                    head: codemirror.Position;

                                                                                                                      interface IUnControlledCodeMirror

                                                                                                                      interface IUnControlledCodeMirror extends ICodeMirror {}

                                                                                                                        property detach

                                                                                                                        detach?: boolean;

                                                                                                                          property editorDidAttach

                                                                                                                          editorDidAttach?: (editor: codemirror.Editor) => void;

                                                                                                                            property editorDidDetach

                                                                                                                            editorDidDetach?: (editor: codemirror.Editor) => void;

                                                                                                                              property onBeforeChange

                                                                                                                              onBeforeChange?: (
                                                                                                                              editor: codemirror.Editor,
                                                                                                                              data: codemirror.EditorChange,
                                                                                                                              value: string,
                                                                                                                              next: () => void
                                                                                                                              ) => void;

                                                                                                                                property value

                                                                                                                                value?: string;

                                                                                                                                  interface KeyHandledEvent

                                                                                                                                  interface KeyHandledEvent {}

                                                                                                                                    call signature

                                                                                                                                    (editor: codemirror.Editor, name: string, event: any): void;

                                                                                                                                      Package Files (1)

                                                                                                                                      Dependencies (0)

                                                                                                                                      No dependencies.

                                                                                                                                      Dev Dependencies (40)

                                                                                                                                      Peer Dependencies (2)

                                                                                                                                      Badge

                                                                                                                                      To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                      You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/react-codemirror2.

                                                                                                                                      • Markdown
                                                                                                                                        [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/react-codemirror2)
                                                                                                                                      • HTML
                                                                                                                                        <a href="https://www.jsdocs.io/package/react-codemirror2"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>