Skip to content
Snippets Groups Projects
Commit 25c989f8 authored by Liam Morland's avatar Liam Morland
Browse files

Merge branch 'feature/ISTWCMS-4656-l26yan-Add-anchor-link-in-CKEditor' into '8.x-1.x'

ISTWCMS-4656: Add ability to create anchors in CKEditor

See merge request !81
parents b4a16bcb 31535bda
No related branches found
No related tags found
1 merge request!81ISTWCMS-4656: Add ability to create anchors in CKEditor
...@@ -30,6 +30,7 @@ settings: ...@@ -30,6 +30,7 @@ settings:
items: items:
- DrupalLink - DrupalLink
- DrupalUnlink - DrupalUnlink
- Anchor
plugins: plugins:
language: language:
language_list: un language_list: un
......
...@@ -26,6 +26,7 @@ settings: ...@@ -26,6 +26,7 @@ settings:
items: items:
- DrupalLink - DrupalLink
- DrupalUnlink - DrupalUnlink
- Anchor
- -
name: Lists name: Lists
items: items:
......
...@@ -44,6 +44,7 @@ settings: ...@@ -44,6 +44,7 @@ settings:
items: items:
- DrupalLink - DrupalLink
- DrupalUnlink - DrupalUnlink
- Anchor
- -
name: Inserts name: Inserts
items: items:
......
...@@ -21,7 +21,7 @@ filters: ...@@ -21,7 +21,7 @@ filters:
status: true status: true
weight: -46 weight: -46
settings: settings:
allowed_html: '<a class href hreflang download rel rev name target<_self> <img src alt longdesc width height> <table width> <th abbr axis headers scope colspan rowspan width> <td abbr axis headers scope colspan rowspan width> <colgroup span width> <col span width> <abbr/acronym> <sub> <sup> <dfn> <samp> <kbd> <var> <ol start> <em> <i> <strong> <b> <strike> <s> <del> <ins> <cite> <blockquote> <address> <code> <pre> <ul> <li value> <dl> <dt> <dd> <p class> <h2> <h3> <h4> <h5> <h6> <span><thead> <tfoot> <tbody> <tr> <caption> <hr> <br> <div title id lang class=" "> ' allowed_html: '<a class href hreflang download rel rev id name target<_self> <img src alt longdesc width height> <table width> <th abbr axis headers scope colspan rowspan width> <td abbr axis headers scope colspan rowspan width> <colgroup span width> <col span width> <abbr/acronym> <sub> <sup> <dfn> <samp> <kbd> <var> <ol start> <em> <i> <strong> <b> <strike> <s> <del> <ins> <cite> <blockquote> <address> <code> <pre> <ul> <li value> <dl> <dt> <dd> <p class> <h2> <h3> <h4> <h5> <h6> <span><thead> <tfoot> <tbody> <tr> <caption> <hr> <br> <div title id lang class=" "> '
filter_html_help: true filter_html_help: true
filter_html_nofollow: false filter_html_nofollow: false
editor_file_reference: editor_file_reference:
......
...@@ -15,7 +15,7 @@ filters: ...@@ -15,7 +15,7 @@ filters:
status: true status: true
weight: -46 weight: -46
settings: settings:
allowed_html: '<a class href hreflang download rel rev name target<_self> <img src alt longdesc width height> <uwvideo href> <table width> <th abbr axis headers scope colspan rowspan width> <td abbr axis headers scope colspan rowspan width> <colgroup span width> <col span width> <div data-reveal-id tabindex role> <abbr/acronym> <sub> <sup> <dfn> <samp> <kbd> <var> <ol start> <em> <i> <strong> <b> <strike> <s> <del> <ins> <footer> <cite> <blockquote> <address> <code> <pre> <ul> <li value> <dl> <dt> <dd> <p class> <h2> <h3> <h4> <h5> <h6> <span><span class><thead> <tfoot> <tbody> <tr> <caption> <hr> <br> <ckcalltoaction data-calltoaction-nid> <cktwitter data-type data-username data-listname data-search data-displayname data-widget-id data-tweet data-url data-timeline> <ckfacebook data-username data-displayname> <ckfactsfigures data-factsfigures-nid data-usecarousel data-numberpercarousel> <ckimagegallery data-imagegallerynid data-gallerytype> <cklivestream data-username data-displayname> <ckmailchimp data-sourcecode> <ckmailman data-listname data-servername> <cktableau data-url data-height data-tabs data-server data-site> <cktdx data-tdx-id data-tdx-show-project-title> <cktint data-id data-keywords data-height data-columns> <cktimeline data-restfulurl> <ckvimeo data-url> <ckembeddedmaps data-type data-src data-height> <ckhootsuite data-subdomain data-height> <div title id lang class=" "><drupal-media data-entity-type data-entity-uuid data-view-mode data-align data-caption alt title>' allowed_html: '<a class href hreflang download rel rev id name target<_self> <img src alt longdesc width height> <uwvideo href> <table width> <th abbr axis headers scope colspan rowspan width> <td abbr axis headers scope colspan rowspan width> <colgroup span width> <col span width> <div data-reveal-id tabindex role> <abbr/acronym> <sub> <sup> <dfn> <samp> <kbd> <var> <ol start> <em> <i> <strong> <b> <strike> <s> <del> <ins> <footer> <cite> <blockquote> <address> <code> <pre> <ul> <li value> <dl> <dt> <dd> <p class> <h2> <h3> <h4> <h5> <h6> <span><span class><thead> <tfoot> <tbody> <tr> <caption> <hr> <br> <ckcalltoaction data-calltoaction-nid> <cktwitter data-type data-username data-listname data-search data-displayname data-widget-id data-tweet data-url data-timeline> <ckfacebook data-username data-displayname> <ckfactsfigures data-factsfigures-nid data-usecarousel data-numberpercarousel> <ckimagegallery data-imagegallerynid data-gallerytype> <cklivestream data-username data-displayname> <ckmailchimp data-sourcecode> <ckmailman data-listname data-servername> <cktableau data-url data-height data-tabs data-server data-site> <cktdx data-tdx-id data-tdx-show-project-title> <cktint data-id data-keywords data-height data-columns> <cktimeline data-restfulurl> <ckvimeo data-url> <ckembeddedmaps data-type data-src data-height> <ckhootsuite data-subdomain data-height> <div title id lang class=" "><drupal-media data-entity-type data-entity-uuid data-view-mode data-align data-caption alt title>'
filter_html_help: true filter_html_help: true
filter_html_nofollow: true filter_html_nofollow: true
filter_htmlcorrector: filter_htmlcorrector:
......
<?php
namespace Drupal\uw_cfg_common\Plugin\CKEditorPlugin;
use Drupal\ckeditor\CKEditorPluginBase;
use Drupal\Core\Asset\LibrariesDirectoryFileFinder;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\editor\Entity\Editor;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Defines the "fakeobjects" plugin.
*
* @CKEditorPlugin(
* id = "fakeobjects",
* label = @Translation("FakeObjects")
* )
*/
class FakeObjectPlugin extends CKEditorPluginBase implements ContainerFactoryPluginInterface {
/**
* Library file finder.
*
* @var \Drupal\Core\Asset\LibrariesDirectoryFileFinder
*/
protected $libFileFinder;
/**
* Constructs a BlockComponentRenderArray object.
*
* @param array $configuration
* A configuration array containing information about the plugin instance.
* @param string $plugin_id
* The plugin ID for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Drupal\Core\Asset\LibrariesDirectoryFileFinder $libFileFinder
* The library file finder.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, LibrariesDirectoryFileFinder $libFileFinder) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->libFileFinder = $libFileFinder;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container->get('library.libraries_directory_file_finder'));
}
/**
* {@inheritdoc}
*/
public function getConfig(Editor $editor) {
return [];
}
/**
* {@inheritdoc}
*/
public function getButtons() {
return [];
}
/**
* {@inheritdoc}
*/
public function getFile() {
return $this->libFileFinder->find('ckeditor.fakeobjects') . '/plugin.js';
}
}
<?php
namespace Drupal\uw_cfg_common\Plugin\CKEditorPlugin;
use Drupal\ckeditor\CKEditorPluginBase;
use Drupal\Core\Asset\LibrariesDirectoryFileFinder;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\editor\Entity\Editor;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Defines the "link" plugin.
*
* @CKEditorPlugin(
* id = "link",
* label = @Translation("link")
* )
*/
class LinkPlugin extends CKEditorPluginBase implements ContainerFactoryPluginInterface {
/**
* Library file finder.
*
* @var \Drupal\Core\Asset\LibrariesDirectoryFileFinder
*/
protected $libFileFinder;
/**
* Constructs a BlockComponentRenderArray object.
*
* @param array $configuration
* A configuration array containing information about the plugin instance.
* @param string $plugin_id
* The plugin ID for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Drupal\Core\Asset\LibrariesDirectoryFileFinder $libFileFinder
* The library file finder.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, LibrariesDirectoryFileFinder $libFileFinder) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->libFileFinder = $libFileFinder;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container->get('library.libraries_directory_file_finder'));
}
/**
* {@inheritdoc}
*/
public function getDependencies(Editor $editor) {
return [
'fakeobjects',
];
}
/**
* {@inheritdoc}
*/
public function getLibraries(Editor $editor) {
return [];
}
/**
* {@inheritdoc}
*/
public function getConfig(Editor $editor) {
return [];
}
/**
* {@inheritdoc}
*/
public function getButtons() {
$libraryUrl = $this->libFileFinder->find('ckeditor.link');
return [
'Link' => [
'label' => $this->t('Link'),
'image' => $libraryUrl . '/icons/link.png',
],
'Unlink' => [
'label' => $this->t('Unlink'),
'image' => $libraryUrl . '/icons/unlink.png',
],
'Anchor' => [
'label' => $this->t('Anchor'),
'image' => $libraryUrl . '/icons/anchor.png',
],
];
}
/**
* {@inheritdoc}
*/
public function getFile() {
return $this->libFileFinder->find('ckeditor.link') . '/plugin.js';
}
/**
* {@inheritdoc}
*/
public function isInternal() {
return FALSE;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment