Loading ckeditor_codemirror.info.yml +1 −1 Original line number Diff line number Diff line name: CKEditor CodeMirror type: module description: Adds the CKEditor CodeMirror source syntax highlighter plugin (http://ckeditor.com/addon/codemirror). description: Adds syntax highlighting to CKEditor 5 using the CodeMirror library. package: CKEditor core_version_requirement: ^9.2 || ^10 dependencies: Loading ckeditor_codemirror.install +7 −7 Original line number Diff line number Diff line Loading @@ -18,19 +18,19 @@ function ckeditor_codemirror_requirements($phase): array { // If the library is installed. $library_path = _ckeditor_codemirror_get_library_path(); if (file_exists("/$library_path/lib/codemirror.js")) { $return['ckeditor_codemirror_library'] = [ 'title' => t('CKEditor CodeMirror'), $return['codemirror_library'] = [ 'title' => t('CodeMirror'), 'severity' => REQUIREMENT_OK, 'value' => t('CodeMirror version %version installed at %path.', [ '%path' => $library_path, '%version' => _ckeditor_codemirror_get_version(), '%version' => _ckeditor_codemirror_codemirror_get_version(), ]), ]; } else { $return['ckeditor_codemirror_library'] = [ 'title' => t('CKEditor CodeMirror'), $return['codemirror_library'] = [ 'title' => t('CodeMirror'), 'severity' => REQUIREMENT_ERROR, 'value' => t('CodeMirror was not found. Download <a href=":link">the latest version of library</a> and place it in the libraries directory (/libraries/codemirror).', [':link' => 'https://www.npmjs.com/package/codemirror'] Loading @@ -42,13 +42,13 @@ function ckeditor_codemirror_requirements($phase): array { } /** * Gets the version information for the ckeditor_codemirror library. * Gets the version information for the CodeMirror library. * * @return string * A string containing the version of the library or empty if the version * cannot be found. */ function _ckeditor_codemirror_get_version(): string { function _ckeditor_codemirror_codemirror_get_version(): string { // Provide defaults. $options = [ 'file' => 'package.json', Loading ckeditor_codemirror.libraries.yml +6 −6 Original line number Diff line number Diff line Loading @@ -4,9 +4,9 @@ admin: dependencies: - core/jquery - core/drupal - core/jquery.once - core/drupal.vertical-tabs - core/drupalSettings - core/once - core/drupal.vertical-tabs codemirror: license: Loading @@ -23,10 +23,10 @@ codemirror: component: /libraries/codemirror/lib/codemirror.css: {} code_editor: source_editing_code_mirror: js: js/build/codeMirror.js: { preprocess: false, minified: true } js/ckeditor5_plugins/ckeditor5-source-editing-codemirror/build/source-editing-codemirror.js: { preprocess: false, minified: true } dependencies: - ckeditor5/ckeditor5 - ckeditor5/ckeditor5.sourceEditing - core/ckeditor5 - core/ckeditor5.sourceEditing - ckeditor_codemirror/codemirror ckeditor_codemirror.module +2 −28 Original line number Diff line number Diff line Loading @@ -5,41 +5,15 @@ * Main code for CKEditor CodeMirror module. */ use Drupal\Core\Routing\RouteMatchInterface; /** * Implements hook_help(). */ function ckeditor_codemirror_help($route_name, RouteMatchInterface $route_match) { switch ($route_name) { case 'help.page.ckeditor_codemirror': $text = file_get_contents(dirname(__FILE__) . '/README.md'); if (!\Drupal::moduleHandler()->moduleExists('markdown')) { return '<pre>' . $text . '</pre>'; } else { // Use the Markdown filter to render the README. $filter_manager = \Drupal::service('plugin.manager.filter'); $settings = \Drupal::configFactory() ->get('markdown.settings') ->getRawData(); $config = ['settings' => $settings]; $filter = $filter_manager->createInstance('markdown', $config); return $filter->process($text, 'en'); } } return NULL; } /** * Gets the path of a CKEditor CodeMirror library. * * @return bool|string * The path to the specified library or FALSE if the library wasn't found. */ function _ckeditor_codemirror_get_library_path() { function _ckeditor_codemirror_get_library_path(): bool|string { $path = 'libraries/codemirror'; if (file_exists('libraries/codemirror')) { if (file_exists($path)) { return DRUPAL_ROOT . "/$path"; } return FALSE; Loading config/schema/ckeditor_codemirror.schema.yml +1 −1 Original line number Diff line number Diff line ckeditor5.plugin.ckeditor_codemirror_code_editor: ckeditor5.plugin.ckeditor_codemirror_source_editing: type: config_object label: 'CodeMirror Code Editor settings' mapping: Loading Loading
ckeditor_codemirror.info.yml +1 −1 Original line number Diff line number Diff line name: CKEditor CodeMirror type: module description: Adds the CKEditor CodeMirror source syntax highlighter plugin (http://ckeditor.com/addon/codemirror). description: Adds syntax highlighting to CKEditor 5 using the CodeMirror library. package: CKEditor core_version_requirement: ^9.2 || ^10 dependencies: Loading
ckeditor_codemirror.install +7 −7 Original line number Diff line number Diff line Loading @@ -18,19 +18,19 @@ function ckeditor_codemirror_requirements($phase): array { // If the library is installed. $library_path = _ckeditor_codemirror_get_library_path(); if (file_exists("/$library_path/lib/codemirror.js")) { $return['ckeditor_codemirror_library'] = [ 'title' => t('CKEditor CodeMirror'), $return['codemirror_library'] = [ 'title' => t('CodeMirror'), 'severity' => REQUIREMENT_OK, 'value' => t('CodeMirror version %version installed at %path.', [ '%path' => $library_path, '%version' => _ckeditor_codemirror_get_version(), '%version' => _ckeditor_codemirror_codemirror_get_version(), ]), ]; } else { $return['ckeditor_codemirror_library'] = [ 'title' => t('CKEditor CodeMirror'), $return['codemirror_library'] = [ 'title' => t('CodeMirror'), 'severity' => REQUIREMENT_ERROR, 'value' => t('CodeMirror was not found. Download <a href=":link">the latest version of library</a> and place it in the libraries directory (/libraries/codemirror).', [':link' => 'https://www.npmjs.com/package/codemirror'] Loading @@ -42,13 +42,13 @@ function ckeditor_codemirror_requirements($phase): array { } /** * Gets the version information for the ckeditor_codemirror library. * Gets the version information for the CodeMirror library. * * @return string * A string containing the version of the library or empty if the version * cannot be found. */ function _ckeditor_codemirror_get_version(): string { function _ckeditor_codemirror_codemirror_get_version(): string { // Provide defaults. $options = [ 'file' => 'package.json', Loading
ckeditor_codemirror.libraries.yml +6 −6 Original line number Diff line number Diff line Loading @@ -4,9 +4,9 @@ admin: dependencies: - core/jquery - core/drupal - core/jquery.once - core/drupal.vertical-tabs - core/drupalSettings - core/once - core/drupal.vertical-tabs codemirror: license: Loading @@ -23,10 +23,10 @@ codemirror: component: /libraries/codemirror/lib/codemirror.css: {} code_editor: source_editing_code_mirror: js: js/build/codeMirror.js: { preprocess: false, minified: true } js/ckeditor5_plugins/ckeditor5-source-editing-codemirror/build/source-editing-codemirror.js: { preprocess: false, minified: true } dependencies: - ckeditor5/ckeditor5 - ckeditor5/ckeditor5.sourceEditing - core/ckeditor5 - core/ckeditor5.sourceEditing - ckeditor_codemirror/codemirror
ckeditor_codemirror.module +2 −28 Original line number Diff line number Diff line Loading @@ -5,41 +5,15 @@ * Main code for CKEditor CodeMirror module. */ use Drupal\Core\Routing\RouteMatchInterface; /** * Implements hook_help(). */ function ckeditor_codemirror_help($route_name, RouteMatchInterface $route_match) { switch ($route_name) { case 'help.page.ckeditor_codemirror': $text = file_get_contents(dirname(__FILE__) . '/README.md'); if (!\Drupal::moduleHandler()->moduleExists('markdown')) { return '<pre>' . $text . '</pre>'; } else { // Use the Markdown filter to render the README. $filter_manager = \Drupal::service('plugin.manager.filter'); $settings = \Drupal::configFactory() ->get('markdown.settings') ->getRawData(); $config = ['settings' => $settings]; $filter = $filter_manager->createInstance('markdown', $config); return $filter->process($text, 'en'); } } return NULL; } /** * Gets the path of a CKEditor CodeMirror library. * * @return bool|string * The path to the specified library or FALSE if the library wasn't found. */ function _ckeditor_codemirror_get_library_path() { function _ckeditor_codemirror_get_library_path(): bool|string { $path = 'libraries/codemirror'; if (file_exists('libraries/codemirror')) { if (file_exists($path)) { return DRUPAL_ROOT . "/$path"; } return FALSE; Loading
config/schema/ckeditor_codemirror.schema.yml +1 −1 Original line number Diff line number Diff line ckeditor5.plugin.ckeditor_codemirror_code_editor: ckeditor5.plugin.ckeditor_codemirror_source_editing: type: config_object label: 'CodeMirror Code Editor settings' mapping: Loading