Properties
reconfigValueMap :Map.<string, Map>
#
Map of reconfiguration values and the extensions that should be
applied when a compartmentalized extension is reconfigured with that value.
Keyed by extension name, then by 'reconfig value' and then the implementing Extension.
This is used when we need to pass around the CodeMirrorExtensionRegistry but keep track of the Extension values elsewhere.
Type:
Map of reconfiguration values and the extensions that should be
applied when a compartmentalized extension is reconfigured with that value.
Methods
get(name) → {Extension|undefined}
#
undefined}
#
Get the compartmentalized Extension with the given name.
This should only be used when including registered extensions during
CodeMirror initialization such as with CodeMirrorPreferences#extension.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string |
Returns:
- Type
-
Extension
|
undefined
- Source:
Extension with the given name.
getCompartment(name) → {Compartment|undefined}
#
undefined}
#
Get the Compartment for the extension with the given name.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string |
Returns:
- Type
-
Compartment
|
undefined
- Source:
Compartment for the extension with the given name.
isEnabled(name, editor) → {boolean}
#
Check if an extension is enabled.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | |
editor |
Editor |
Returns:
- Type
- boolean
- Source:
isRegistered(name, editor) → {boolean}
#
Check if the Extension with the given name has been appended to the
EditorState configuration. In the context of CodeMirror, this means
that the extension has been "registered", but not necessarily enabled.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | |
editor |
Editor |
Returns:
- Type
- boolean
- Source:
Check if the Extension with the given name has been appended to the
EditorState configuration.
reconfigure(name, editor, extension)
#
Reconfigure a compartmentalized extension with a new Extension.
Example
const cm = new CodeMirror( ... );
// Register an Extension that sets the tab size to 5 spaces.
cm.extensionRegistry.register( 'tabSize', EditorState.tabSize.of( 5 ), cm.view, true );
// Reconfigure the tab size to 10 spaces.
cm.extensionRegistry.reconfigure( 'tabSize', cm.view, EditorState.tabSize.of( 10 ) );
Parameters:
- Source:
Extension.
reconfigureFromValueMap(name, editor, reconfigValue)
#
Reconfigure a compartmentalized extension with a value from the
reconfiguration value map.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | |
editor |
Editor | |
reconfigValue |
string |
- Source:
Reconfigure a compartmentalized extension with a value from the
reconfiguration value map.
register(name, extension, editor, [enable])
#
Register an Extension, creating a corresponding Compartment.
The Extension can then be reconfigured
such as toggling on and off.
Integrations that can only support some extensions declare which through
CodeMirror#supportedExtensions, and anything else is refused here.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
name |
string | ||
extension |
Extension | ||
editor |
Editor | ||
enable |
boolean |
optional |
|
- Source:
Extension, creating a corresponding Compartment.
registerFromValueMap(name, editor, reconfigValue)
#
Register an extension with an initial value from the
reconfiguration value map.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | |
editor |
Editor | |
reconfigValue |
string |
- Source:
Register an extension with an initial value from the
reconfiguration value map.