Skip to content
Snippets Groups Projects
Commit e92a06a9 authored by Rajab Natshah's avatar Rajab Natshah
Browse files

Issue #3405819: Add the Anchor Link ~3 module and configure the CKEditor 5...

Issue #3405819: Add the Anchor Link ~3 module and configure the CKEditor 5 Rich editor text format to use it
parent 7c35eefb
No related branches found
No related tags found
No related merge requests found
......@@ -33,17 +33,19 @@
"drupal/core": "~10",
"vardot/entity-definition-update-manager": "~1",
"vardot/module-installer-factory": "~1",
"drupal/pathologic": "~2.0",
"drupal/ckeditor_bidi": "~4.0",
"drupal/ace_editor": "~2.0",
"drupal/extlink": "~1.0",
"drupal/pathologic": "~2",
"drupal/ckeditor_bidi": "~4",
"drupal/ace_editor": "~2",
"drupal/extlink": "~1",
"drupal/linkit": "~6.1.0",
"drupal/editor_advanced_link": "~2.2.0",
"drupal/token": "~1.0",
"drupal/token_filter": "~2.0"
"drupal/token": "~1",
"drupal/token_filter": "~2",
"drupal/anchor_link": "~3"
},
"suggest": {
"npm-asset/ace-builds": "~1.0: Provides JavaScript library necessary for ACE code Editor"
"npm-asset/ace-builds": "~1.0: Provides JavaScript library necessary for ACE code Editor",
"npm-asset/northernco--ckeditor5-anchor-drupal": "^0.4.0: Implements the anchor feature for CKEditor 5."
},
"extra": {
"installer-types": [
......
......@@ -19,6 +19,7 @@ settings:
- insertTable
- '|'
- link
- anchor
- '|'
- code
- codeBlock
......@@ -49,6 +50,50 @@ settings:
- justify
- left
- right
ckeditor5_codeBlock:
languages:
-
label: 'Plain text'
language: plaintext
-
label: C
language: c
-
label: 'C#'
language: cs
-
label: C++
language: cpp
-
label: CSS
language: css
-
label: Diff
language: diff
-
label: HTML
language: html
-
label: Java
language: java
-
label: JavaScript
language: javascript
-
label: PHP
language: php
-
label: Python
language: python
-
label: Ruby
language: ruby
-
label: TypeScript
language: typescript
-
label: XML
language: xml
ckeditor5_heading:
enabled_headings:
- heading2
......
......@@ -4,3 +4,39 @@
* @file
* Contains varbase_editor_update_10###(s) hook updates.
*/
/**
* Issue #3405819: Add the Anchor Link ~3 module.
*
* Configure the CKEditor 5 Rich Editor text format to use it
*/
function varbase_editor_update_100001() {
if (!\Drupal::moduleHandler()->moduleExists('anchor_link')) {
\Drupal::service('module_installer')->install(['anchor_link'], FALSE);
$full_html_config = \Drupal::service('config.factory')->getEditable('editor.editor.full_html');
if (isset($full_html_config)) {
$full_html_data = $full_html_config->get();
if (isset($full_html_data['settings'])
&& isset($full_html_data['settings']['toolbar'])
&& isset($full_html_data['settings']['toolbar']['items'])
&& !in_array('anchor', $full_html_data['settings']['toolbar']['items'])) {
$final_toolbar_items = [];
foreach ($full_html_data['settings']['toolbar']['items'] as $toolbar_item) {
$final_toolbar_items[] = $toolbar_item;
// Add the "anchor" command button after the "link" command button.
if ($toolbar_item == 'link') {
$final_toolbar_items[] = 'anchor';
}
}
$full_html_data['settings']['toolbar']['items'] = $final_toolbar_items;
$full_html_config->setData($full_html_data)->save(TRUE);
}
}
}
}
......@@ -18,3 +18,4 @@ install:
- pathologic
- token
- token_filter
- anchor_link
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment