CodeMirror manifest¶
From its registred Codemirror configurations, a manifest instance is able to:
- Return needed js files, either for all registred configs or a single one;
- Return needed css files, either for all registred configs or a single one;
- Return Codemirror configuration parameters as a dict for a registred config.
A Codemirror config is selected from its name in
settings.CODEMIRROR_SETTINGS
.
-
class
djangocodemirror.manifest.
CodeMirrorManifest
[source]¶ CodeMirror configurations manifest.
A configuration contains every parameters and assets to use with a CodeMirror instance.
-
registry
¶ dict – Configuration registry.
-
default_internal_config
¶ dict – Default internal parameters.
-
_internal_only
¶ list – Names of internal parameters only that will be exluded from CodeMirror parameters.
-
css
(name=None)[source]¶ Returns all needed CSS filepaths for given config name (if given) or every registred config instead (if no name is given).
Keyword Arguments: name (string) – Specific config name to use instead of all. Returns: List of CSS file paths. Return type: list
-
css_bundle_names
(name=None)[source]¶ Returns all needed CSS Bundle names for given config name (if given) or every registred config instead (if no name is given).
Keyword Arguments: name (string) – Specific config name to use instead of all. Returns: List of webasset bundle names. Return type: list
-
get_codemirror_parameters
(name)[source]¶ Return CodeMirror parameters for given configuration name.
This is a reduced configuration from internal parameters.
Parameters: name (string) – Config name from available ones in settings.CODEMIRROR_SETTINGS
.Returns: Parameters. Return type: dict
-
get_config
(name)[source]¶ Return a registred configuration for given config name.
Parameters: name (string) – A registred config name.
Raises: NotRegisteredError
– If given config name does not exist inregistry.
Returns: Configuration.
Return type: dict
-
get_configs
(name=None)[source]¶ Returns registred configurations.
- If
name
argument is not given, default behavior is to return every config from all registred config; - If
name
argument is given, just return its config and nothing else;
Keyword Arguments: name (string) – Specific configuration name to return.
Raises: NotRegisteredError
– If given config name does not exist inregistry.
Returns: Configurations.
Return type: dict
- If
-
js
(name=None)[source]¶ Returns all needed Javascript filepaths for given config name (if given) or every registred config instead (if no name is given).
Keyword Arguments: name (string) – Specific config name to use instead of all. Returns: List of Javascript file paths. Return type: list
-
js_bundle_names
(name=None)[source]¶ Returns all needed Javascript Bundle names for given config name (if given) or every registred config instead (if no name is given).
Keyword Arguments: name (string) – Specific config name to use instead of all. Returns: List of webasset bundle names. Return type: list
-
register
(name)[source]¶ Register configuration for an editor instance.
Parameters: name (string) – Config name from available ones in settings.CODEMIRROR_SETTINGS
.Raises: UnknowConfigError
– If given config name does not exist insettings.CODEMIRROR_SETTINGS
.Returns: Registred config dict. Return type: dict
-
register_many
(*args)[source]¶ Register many configuration names.
Parameters: *args – Config names as strings. Returns: List of registered configs. Return type: list
-