public class CodeMirrorOptions
extends org.fujion.ancillary.Options
| Modifier and Type | Class and Description |
|---|---|
static class |
CodeMirrorOptions.InputStyleEnum |
| Modifier and Type | Field and Description |
|---|---|
Boolean |
addModeClass
When enabled, an extra CSS class will be added to each token, indicating the (inner) mode
that produced it, prefixed with "cm-m-".
|
String[] |
allowDropFileTypes
When set, only files whose type is in the array can be dropped into the editor.
|
Boolean |
autofocus
Can be used to make CodeMirror focus itself on initialization.
|
Boolean |
coverGutterNextToScrollbar
When fixedGutter is on, and there is a horizontal scrollbar, by default the gutter will be
visible to the left of this scrollbar.
|
Integer |
cursorBlinkRate
Half-period in milliseconds used for cursor blinking.
|
Double |
cursorHeight
Determines the height of the cursor.
|
Integer |
cursorScrollMargin
How much extra space to always keep above and below the cursor when approaching the top or
bottom of the visible view in a scrollable document.
|
Boolean |
dragDrop
Controls whether drag-and-drop is enabled.
|
Boolean |
electricChars
Configures whether the editor should re-indent the current line when a character is typed
that might change its proper indentation (only works if the mode supports indentation).
|
Integer |
firstLineNumber
At which number to start counting lines.
|
Boolean |
fixedGutter
Determines whether the gutter scrolls along with the content horizontally (false) or whether
it stays fixed (true) during horizontal scrolling.
|
Boolean |
flattenSpans
By default, CodeMirror will combine adjacent tokens into a single span if they have the same
class.
|
Integer |
historyEventDelay
The period of inactivity (in milliseconds) that will cause a new history event to be started
when typing or deleting.
|
Integer |
indentUnit
How many spaces a block (whatever that means in the edited language) should be indented.
|
Boolean |
indentWithTabs
Whether, when indenting, the first N*tabSize spaces should be replaced by N tabs.
|
CodeMirrorOptions.InputStyleEnum |
inputStyle
Selects the way CodeMirror handles input and focus.
|
org.fujion.ancillary.JavaScript |
lineNumberFormatter
A function used to format line numbers.
|
Boolean |
lineNumbers
Whether to show line numbers to the left of the editor.
|
String |
lineSeparator
Explicitly set the line separator for the editor.
|
Boolean |
lineWiseCopyCut
When enabled, doing copy or cut when there is no selection will copy or cut the whole lines
that have cursors on them.
|
Boolean |
lineWrapping
Whether CodeMirror should scroll (false) or wrap (true) for long lines.
|
Integer |
maxHighlightLength
When highlighting long lines, in order to stay responsive, the editor will give up and simply
style the rest of the line as plain text when it reaches a certain position.
|
protected String |
mode
The mode to use.
|
Boolean |
pasteLinesPerSelection
When pasting something from an external source (not from the editor itself), if the number of
lines matches the number of selection, CodeMirror will by default insert one line per
selection.
|
String |
placeholder
Can be used to make content appear in the editor when it is empty and not focused.
|
Integer |
pollInterval
Indicates how quickly (in milliseconds) CodeMirror should poll its input textarea for changes
(when focused).
|
Boolean |
readonly
This disables editing of the editor content by the user.
|
Boolean |
resetSelectionOnContextMenu
Controls whether, when the context menu is opened with a click outside of the current
selection, the cursor is moved to the point of the click.
|
Boolean |
rtlMoveVisually
Determines whether horizontal cursor movement through right-to-left (Arabic, Hebrew) text is
visual (pressing the left arrow moves the cursor left) or logical (pressing the left arrow
moves to the next lower index in the string, which is visually right in right-to-left text).
|
String |
scrollbarStyle
Chooses a scrollbar implementation.
|
Boolean |
showCursorWhenSelecting
Whether the cursor should be drawn when a selection is active.
|
Boolean |
smartIndent
Whether to use the context-sensitive indentation that the mode provides (or just indent the
same as the line before).
|
org.fujion.ancillary.JavaScript |
specialCharPlaceholder
A function that, given a special character identified by the specialChars option, produces a
DOM node that is used to represent the character.
|
Pattern |
specialChars
A regular expression used to determine which characters should be replaced by a special
placeholder.
|
Integer |
tabSize
The width of a tab character.
|
Integer |
undoDepth
The maximum number of undo levels that the editor stores.
|
Integer |
viewportMargin
Specifies the amount of lines that are rendered above and below the part of the document
that's currently scrolled into view.
|
Integer |
workDelay
Highlighting is done by a pseudo background-thread that will work for workTime milliseconds,
and then use timeout to sleep for workDelay milliseconds.
|
Integer |
workTime
Highlighting is done by a pseudo background-thread that will work for workTime milliseconds,
and then use timeout to sleep for workDelay milliseconds.
|
| Constructor and Description |
|---|
CodeMirrorOptions(String mode)
Create options instance with specified mode.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
addKeyBinding(String key,
org.fujion.ancillary.JavaScript javascript)
Binds a key combination to a JavaScript function.
|
Object |
addKeyBinding(String key,
String command)
Binds a key combination to a registered command.
|
Object |
getKeyBinding(String key)
Returns the current key binding.
|
Object |
removeKeyBinding(String key)
Removes the current key binding, if any.
|
@Option public Boolean addModeClass
Default: false
@Option public String[] allowDropFileTypes
@Option public Boolean autofocus
Default: false
@Option public Boolean coverGutterNextToScrollbar
Default: false
@Option public Integer cursorBlinkRate
Default: 530
@Option public Double cursorHeight
Default: 1.0
@Option public Integer cursorScrollMargin
Default: 0
@Option public Boolean dragDrop
Default: true
@Option public Boolean electricChars
Default: true
@Option public Integer firstLineNumber
Default: 1
@Option public Boolean fixedGutter
Default: true
@Option public Boolean flattenSpans
Default: true
@Option public Integer historyEventDelay
Default: 1250
@Option public Integer indentUnit
Default: 2
@Option public Boolean indentWithTabs
Default: false
@Option public CodeMirrorOptions.InputStyleEnum inputStyle
@Option public org.fujion.ancillary.JavaScript lineNumberFormatter
@Option public Boolean lineNumbers
@Option public String lineSeparator
@Option public Boolean lineWiseCopyCut
Default: true
@Option public Boolean lineWrapping
Default: false
@Option public Integer maxHighlightLength
Default: 10000
@Option protected String mode
@Option public Boolean pasteLinesPerSelection
Default: true
@Option public String placeholder
@Option public Integer pollInterval
Default: 100.
@Option public Boolean readonly
Default: false
@Option public Boolean resetSelectionOnContextMenu
Default: true
@Option public Boolean rtlMoveVisually
@Option public String scrollbarStyle
Default: "native"
@Option public Boolean showCursorWhenSelecting
Default: false
@Option public Boolean smartIndent
Default: true
@Option public org.fujion.ancillary.JavaScript specialCharPlaceholder
Default: A red dot (•) is shown, with a title tooltip to indicate the character code.
@Option public Pattern specialChars
Default: [ --- ]
@Option public Integer tabSize
Default: 4
@Option public Integer undoDepth
Default: 200
@Option public Integer viewportMargin
Default: 10
@Option public Integer workDelay
Default: 300
@Option public Integer workTime
Default: 200
public CodeMirrorOptions(String mode)
mode - Desired mode.public Object addKeyBinding(String key, String command)
key - Key combination mnemonic.command - Name of registered command.public Object addKeyBinding(String key, org.fujion.ancillary.JavaScript javascript)
key - Key combination mnemonic.javascript - JavaScript code to be invoked.public Object getKeyBinding(String key)
key - Key combination mnemonic.Copyright © 2023 Fujion Framework. All rights reserved.