Constructor
new CodeMirrorPreferences(extensionRegistry, [isVisualEditor])
#
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
extensionRegistry |
CodeMirrorExtensionRegistry | |||
isVisualEditor |
boolean |
optional |
false | Whether the VE 2017 editor is being used. |
- Source:
Fires:
Properties
extension
#
- Source:
extensionRegistry :CodeMirrorExtensionRegistry
#
isVisualEditor :boolean
#
optionName :string
#
panel
#
- Source:
panelStateField :StateField
#
prefsToggleEffect :StateEffectType
#
Methods
fetchPreferences() → {Object}
#
Fetch the user's CodeMirror preferences from the user options API, or clientside storage for unnamed users.
- Source:
Returns:
- Type
- Object
Fetch the user's CodeMirror preferences from the user options API, or clientside storage for unnamed users.
firePreferencesApplyHook(prefName)
#
Parameters:
Name | Type | Description |
---|---|---|
prefName |
string |
- Source:
Fires:
getCheckbox()
#
- Source:
getDefaultPreferences() → {Object}
#
The default CodeMirror preferences, as defined by $wgCodeMirrorPreferences
and taking into account the page namespace and content model.
- Source:
Returns:
- Type
- Object
The default CodeMirror preferences, as defined by $wgCodeMirrorPreferences
and taking into account the page namespace and content model.
getPreference(prefName) → {boolean}
#
Get the value of the given CodeMirror preference.
Parameters:
Name | Type | Description |
---|---|---|
prefName |
string |
- Source:
Returns:
- Type
- boolean
hasNonDefaultPreferences() → {boolean}
#
Check if the user has any preferences that differ from the defaults. This is used to determine whether EventLogging should happen.
- Source:
Returns:
- Type
- boolean
onKeydown(event)
#
Handle keydown events on the preferences panel.
Parameters:
Name | Type | Description |
---|---|---|
event |
KeyboardEvent |
- Source:
registerExtension(name, extension, view)
#
Register an Extension
with CodeMirrorExtensionRegistry
and enable it if the corresponding preference is set.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | |
extension |
Extension | |
view |
EditorView |
- Source:
Register an Extension
with CodeMirrorExtensionRegistry
and enable it if the corresponding preference is set.
setPreference(key, value)
#
Set the given CodeMirror preference and update the user option in the database, or clientside storage for unnamed users.
Parameters:
Name | Type | Description |
---|---|---|
key |
string | |
value |
boolean |
- Source:
Set the given CodeMirror preference and update the user option in the database, or clientside storage for unnamed users.
toggle(view, [force]) → {boolean}
#
Toggle display of the preferences panel.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
view |
EditorView | ||
force |
boolean |
optional |
Force the panel to open or close. |
- Source:
Returns:
- Type
- boolean
toggleExtension(name, view)
#
Toggle an Extension
on or off with CodeMirrorExtensionRegistry
and update the preference.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | |
view |
EditorView |
- Source:
Toggle an Extension
on or off with CodeMirrorExtensionRegistry
and update the preference.