Constructor
new CodeMirrorTextSelection(view)
#
Properties
view :EditorView
#
Methods
encapsulateSelection(options) → {jQuery}
#
Encapsulate the selected text with the given values.
This is intentionally a near-identical implementation to jQuery.textSelection, except it uses CodeMirror's EditorState.changeByRange when there are multiple selections.
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties:
|
- Source:
- To do:
-
- Add support for 'ownline' option, and complete support for 'selectPeri'.
Returns:
- Type
- jQuery
getCaretPosition([options]) → {Array.<number>|number}
#
Get the current caret position.
Parameters:
Name | Type | Attributes | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
optional |
Properties:
|
- Source:
Returns:
- Type
- Array.<number> | number
getContents() → {string}
#
getSelection() → {string}
#
replaceSelection(value) → {jQuery}
#
Replace the selected text with the given value.
Parameters:
Name | Type | Description |
---|---|---|
value |
string |
- Source:
Returns:
- Type
- jQuery
scrollToCaretPosition() → {jQuery}
#
setContents(content) → {jQuery}
#
Set the contents of the editor.
Parameters:
Name | Type | Description |
---|---|---|
content |
string |
- Source:
Returns:
- Type
- jQuery