Extends
Constructor
new CodeMirrorWikiEditor($textarea, langExtension)
#
Parameters:
Name | Type | Description |
---|---|---|
$textarea |
jQuery | The textarea to replace with CodeMirror. |
langExtension |
LanguageSupport | Extension | Language support and its extension(s). |
- Source:
Properties
$oldSearchBtn :jQuery|null
#
null
#
The old WikiEditor search button, to be restored if CodeMirror is disabled.
Type:
-
jQuery
|
null
- Source:
$searchBtn :jQuery|null
#
null
#
The WikiEditor search button, which is usurped to open the CodeMirror search panel.
Type:
-
jQuery
|
null
- Source:
activeLineExtension :Extension
#
Extension for highlighting the active line.
Type:
- Overrides:
- Source:
bracketMatchingExtension :Extension
#
This extension adds bracket matching to the CodeMirror editor.
Type:
- Overrides:
- Source:
contentAttributesExtension :Extension
#
This specifies which attributes get added to the .cm-content
and .cm-editor
elements.
Subclasses are safe to override this method, but attributes here are considered vital.
Type:
.cm-content
and .cm-editor
elements.
defaultExtensions :Extension|Array.<Extension>
#
Default extensions used by CodeMirror. Extensions here should be applicable to all theoretical uses of CodeMirror in MediaWiki.
Type:
- Overrides:
- Source:
- See:
dirCompartment :Compartment
#
Compartment to control the direction of the editor.
Type:
- Overrides:
- Source:
dirExtension :Extension
#
This extension adds the ability to change the direction of the editor.
Type:
- Overrides:
- Source:
editRecoveryHandler :function|null
#
null
#
formSubmitEventHandler :function|null
#
null
#
The form submit
event handler.
Type:
-
function
|
null
- Overrides:
- Source:
submit
event handler.
heightExtension :Extension
#
This extension sets the height of the CodeMirror editor to match the textarea. Override this method to change the height of the editor.
Type:
- Overrides:
- Source:
keymap :CodeMirrorKeymap
#
CodeMirror key mappings and help dialog.
Type:
- Overrides:
- Source:
langExtension :LanguageSupport|Extension
#
Language support and its extension(s).
Type:
- Overrides:
- Source:
phrasesExtension :Extension
#
These are all potential messages used in a full-featured CodeMirror setup. We lump them all here and supply it as default extensions because it is only a small cost and we don't want localization to be overlooked by CodeMirror clients and subclasses.
Type:
- Overrides:
- Source:
- See:
preferences :CodeMirrorPreferences
#
The CodeMirror preferences panel.
Type:
- Overrides:
- Source:
readOnly :boolean
#
Whether the textarea is read-only.
Type:
- boolean
- Overrides:
- Source:
realtimePreviewDisableHandler :function|null
#
null
#
The ext.WikiEditor.realtimepreview.disable
hook handler.
Type:
-
function
|
null
- Source:
ext.WikiEditor.realtimepreview.disable
hook handler.
realtimePreviewEnableHandler :function|null
#
null
#
The ext.WikiEditor.realtimepreview.enable
hook handler.
Type:
-
function
|
null
- Source:
ext.WikiEditor.realtimepreview.enable
hook handler.
realtimePreviewHandler :function|null
#
null
#
The Realtime Preview handler.
searchExtension :Extension
#
Extension for search and goto line functionality.
Type:
- Overrides:
- Source:
specialCharsExtension :Extension
#
We give a small subset of special characters a tooltip explaining what they are. The messages and for what characters are defined here. Any character that does not have a message will instead use CM6 defaults, which is the localization of 'codemirror-control-character' followed by the Unicode number.
Type:
- Overrides:
- Source:
- See:
state :EditorState
#
surface :ve.ui.Surface
#
The VisualEditor surface CodeMirror is bound to.
Type:
- Overrides:
- Source:
textSelection :CodeMirrorTextSelection
#
jQuery.textSelection overrides for CodeMirror.
Type:
- Overrides:
- Source:
updateExtension :Extension
#
This extension listens for changes in the CodeMirror editor and fires
the ext.CodeMirror.input
hook with the ViewUpdate
object.
Type:
- Overrides:
- Source:
Fires:
This extension listens for changes in the CodeMirror editor and fires
the ext.CodeMirror.input
hook with the ViewUpdate
object.
useCodeMirror :boolean
#
view :EditorView
#
The editor user interface.
Type:
- Overrides:
- Source:
Methods
addCodeMirrorToWikiEditor()
#
Adds the CodeMirror button to WikiEditor.
- Source:
destroy()
#
Destroy the CodeMirror instance and revert to the original textarea.
- Overrides:
- Source:
Fires:
enableCodeMirror()
#
Replaces the default textarea with CodeMirror.
- Source:
Fires:
initialize([extensions])
#
setCodeMirrorPreference()
#
- Source:
switchCodeMirror()
#
Enables or disables CodeMirror.
- Source:
Fires:
Events
'ext.CodeMirror.switch'(enabled, $textarea)
#
Called after CodeMirror is enabled or disabled in WikiEditor.
Parameters:
Name | Type | Description |
---|---|---|
enabled |
boolean | Whether CodeMirror is enabled. |
$textarea |
jQuery | The current "editor", either the
original textarea or the |
- Source: