\CMIRR
Wrapper for CodeMirror editor
Synopsis
class CMIRR
{
- // members
- protected string $editorId = '';
- protected bool $headersRendered = false;
- protected string $mode = 'text/x-php';
- protected string $theme = 'dracula';
- protected bool $lineWrapping = true;
- protected bool $lineNumbers = true;
- protected bool $matchBrackets = true;
- protected bool $autoCloseBrackets = true;
- protected bool $styleActiveLine = true;
- protected string $hintOptions = 'anyword';
- protected bool $disableAutocomplete = false;
- protected bool $enableFullscreen = true;
- protected bool $enableSearch = false;
- protected bool|string $readOnly = false;
- protected string $headers = '';
- protected string $script = '';
- protected string $style = '';
- protected string $cmLibPath = 'modules/jsc/cmirr/';
- // methods
- public void __construct()
- public void setTheme()
- public void setLineWrapping()
- public void setLineNumbers()
- public void setMatchBrackets()
- public void setAutoCloseBrackets()
- public void setStyleActiveLine()
- public void setHintOptions()
- public void setDisableAutocomplete()
- public void setEnableFullscreen()
- public void setEnableSearch()
- public void setReadOnly()
- public void setHeaders()
- public void setMode()
- protected void setEditorId()
- protected void setScript()
- public void setStyle()
- public string getEditorArea()
Members
protected
- $autoCloseBrackets
—
bool
Auto-close brackets - $cmLibPath
—
string
Path to CodeMirror library - $disableAutocomplete
—
bool
When true, autocomplete (Ctrl-Space) and hintOptions are not applied. - $editorId
—
string
Contains unique editor ID - $enableFullscreen
—
bool
Enable F11 fullscreen and Esc to exit. - $enableSearch
—
bool
Enable editor search dialog and related hotkeys. - $headers
—
string
Contains the necessary stylesheets and scripts for CodeMirror integration. - $headersRendered
—
bool
Indicates whether the headers have been rendered. - $hintOptions
—
string
Hint function for autocomplete (short name, e.g. anyword, sql, javascript, css). - $lineNumbers
—
bool
Show line numbers - $lineWrapping
—
bool
Enable line wrapping - $matchBrackets
—
bool
Highlight matching brackets - $mode
—
string
The default mode of editor - $readOnly
—
bool|string
Enables read-only mode for syntax-highlighted content viewing. - $script
—
string
Contains code mirror init JS script with some unique ID - $style
—
string
Contains editor area custom styling - $styleActiveLine
—
bool
Highlight the line where the cursor is. - $theme
—
string
CodeMirror theme name
Methods
protected
- setEditorId() — Sets the editor ID.
- setScript() — This method is responsible for configuring the JS script that will be used to init editor
public
- __construct()
- getEditorArea() — Returns text editing area with initialized code mirror editor
- setAutoCloseBrackets() — Enables or disables auto-closing of brackets and quotes.
- setDisableAutocomplete() — Disables or enables autocomplete (Ctrl-Space and hint dropdown).
- setEnableFullscreen() — Enables or disables fullscreen (F11 / Esc).
- setEnableSearch() — Enables or disables search feature (Ctrl-F / Ctrl-G / Shift-Ctrl-G).
- setHeaders() — Sets the editor headers.
- setHintOptions() — Sets the hint function used for autocomplete by short name.
- setLineNumbers() — Shows or hides line numbers in the gutter.
- setLineWrapping() — Enables or disables line wrapping in the editor.
- setMatchBrackets() — Enables or disables highlighting of matching brackets.
- setMode() — Sets the editor language mode (syntax highlighting and parsing).
- setReadOnly() — Enables or disables read-only mode.
- setStyle() — Sets or overrides some custom editor styling
- setStyleActiveLine() — Enables or disables highlighting of the current line.
- setTheme() — Sets CodeMirror theme (e.g. dracula, default).