Hot answers tagged

21 votes
Accepted

How to set target="_blank" for links in CKEditor

D8 Editor Advanced link module Enhances the link Dialog in D8 CKEditor. Allows to define the following attributes: title class id target rel
No Sssweat's user avatar
  • 31.1k
15 votes

How to load theme style(s) in CKEditor?

Here is one way to do it... not sure if there are others (admin based): use Drupal\editor\Entity\Editor; /** * Implements hook_ckeditor_css_alter(). * * Injects our CSS sheets anytime CKEditor has ...
Kevin's user avatar
  • 27.8k
13 votes

Drupal 8 CKeditor behaves LTR in an RTL site

The default CKEditor text language direction is LTR. To change it to RTL, you can try setting the JS config setting: config.contentsLangDirection = 'rtl'; Reference: http://docs.cksource.com/...
David Thomas's user avatar
  • 21.8k
13 votes

How to load theme style(s) in CKEditor?

Unless you want to load styles for specific formats, you can easily add CSS within your MODULE.info.yml file, like so: ckeditor_stylesheets: - css/application.css - css/ckeditor.css Use @import ...
Steven's user avatar
  • 241
12 votes
Accepted

How to disable H1 heading in CKeditor?

1) Take a look at the editors you're using on your site at /admin/config/content/formats 2) For each editor, you'll need to update the allowed tags. Let's edit the FULL HTML format for this example, ...
oknate's user avatar
  • 14.2k
12 votes
Accepted

Is there advanced configuration for CKEditor in Drupal 8?

In regards to "allowedContent", this is set to true if you don't check "Limit allowed HTML tags and correct faulty HTML"( or another filter of type of FilterInterface::TYPE_HTML_RESTRICTOR) on your ...
oknate's user avatar
  • 14.2k
10 votes

How to print text (formatted, long) in twig without raw filter?

With the excellent Twig Tweak module you can do this: {{ node.FIELD_NAME.value | check_markup(node.FIELD_NAME.format) }} This feature (and more) is well documented on the module's cheat sheet.
Joel Stein's user avatar
10 votes

CKeditor stripping allowed style attribute

Your problem comes from the "Limit allowed HTML tags" option. According to this post (for Drupal 7, but the same logic applies on D8), setting this option triggers XSS filter in order to remove ...
misterdidi's user avatar
  • 1,041
10 votes
Accepted

How can I change allowed tags in CKEditor 5?

Like in earlier Drupal versions WYSIWYG editor settings can be configured per text format. For example, under /admin/config/content/formats/manage/basic_html you configure the editor used for the &...
leymannx's user avatar
  • 18k
9 votes
Accepted

Ckeditor strips <i> tags

Add an empty space -   <i class="fa fa-drupal">&nbsp;</i>
Damir Dimić's user avatar
9 votes

How do I change the default height?

I rolled a module for that now: https://www.drupal.org/project/ckeditorheight This module changes all ckeditor text fields to respect the "rows" setting of the field. How rows translate into pixels ...
geek-merlin's user avatar
9 votes
Accepted

How to configure CkEditor's styles dropdown?

1. Your Custom style should be present in your CSS file. 2. Your FILTER SETTING should be proper. To check, same way as yours, I just enabled style and and put h1.heading-a|Title(which I took from css/...
CodeNext's user avatar
  • 3,721
8 votes
Accepted

How do I modify the "Formats" dropdown in CKEditor

I would use Styles instead of Formats, because styles are fully controlled by you, from admin interface, no need for editing files. When you add it to the toolbar you can configure it and add as many ...
otarza's user avatar
  • 954
8 votes
Accepted

drupal_render() is deprecated. What replaces it?

It was replaced with the renderer service. $render_service = \Drupal::service('renderer'); As mpdonadio and 4k4 have pointed out in the comments, to prevent metadata from bubbling up to the main ...
Clive's user avatar
  • 167k
7 votes

How do I make an internal link with CKEditor?

Yes, what you're looking for is covered by the LinkIt project. Linkit provides an easy interface for internal and external linking with wysiwyg editors by using an autocomplete field. Linkit has ...
Shawn Conn's user avatar
  • 26.8k
7 votes

How to load theme style(s) in CKEditor?

Here is a simple solution for this in Drupal 8, when you are using a custom theme or custom admin theme. Open your custom theme info file *.info.yml and add the line above libraries or below ...
Someshver Thakur's user avatar
6 votes

How to set target="_blank" for links in CKEditor

You can use the Linkit module and add a "target" attribute at admin/config/content/linkit/manage/default/attributes/add It has two options: Selectlist with predefined targets. Simple checkbox to ...
Hugo's user avatar
  • 663
6 votes

Ckeditor strips <i> tags

I suggest the following. <i class="icon icon-classname">&zwnj;</i> &zwnj; is the HTML entity for the zero-width non-joiner character, which avoids playing with left-...
Denis K's user avatar
  • 404
6 votes
Accepted

how to managed form '#type' => 'text_format' toolbar

You need to +Add new text format over at /admin/config/content/formats Then Configure your new text format and remove those icons by grabing them and dragging them from the active toolbar to the ...
No Sssweat's user avatar
  • 31.1k
6 votes
Accepted

How do I change the default height?

Like the comments to the previous answer mention, changing the amount of text area rows displayed in the form display doesn't change the height of the CKEditor attached to those fields. I haven't ...
Juhani's user avatar
  • 104
6 votes
Accepted

Wrapping content in anchor tags with CKEditor

I found a solution. As @Clive said CKEDITOR.dtd.a.h2 = 1; and CKEDITOR.dtd.a.h3 = 1; is the solution. These need to be declared in a my_module.module file: function my_module_editor_js_settings_alter(...
jmzea's user avatar
  • 962
5 votes
Accepted

Allow empty tags

Rather than modify the Drupal 8 core, you should do this using some Javascript like the sample below. This can be loaded from your admin theme or other module. (function ($, Drupal) { Drupal....
CG Monroe's user avatar
  • 3,076
5 votes

How to set target="_blank" for links in CKEditor

If you want every link to open in a new window, it'd be better to not use the Editor Advanced Link module, but instead add a filter to your text format that sets target=_blank on every <a>.
Wim Leers's user avatar
  • 1,043
5 votes

Installing extra/additional plugins for standalone CKEditor module library

Here are the steps about how I am doing it: install CKEditor using the CKEditor module and NOT through using the wysiwyg module. Put plugin in sites/all/modules/ckeditor/plugins and NOT in /sites/all/...
No Sssweat's user avatar
  • 31.1k
5 votes

How do I modify the "Formats" dropdown in CKEditor

You modify the "Formats" dropdown by changing the list of allowed HTML tags. Any block-level HTML tags are shown in the "Formats" dropdown by CKEditor automatically. For a tutorial/full explanation, ...
Wim Leers's user avatar
  • 1,043
5 votes
Accepted

How to change text format of summary/trimmed field?

You can't, it always has the same format. The field only stores a single format. And it has bugs with ckeditor, as you've found. I would definitely recommend to use two fields. We'd like to remove ...
Berdir's user avatar
  • 83.1k
5 votes

How do I change the default height?

Anyone using Drupal 8-- this has changed now that Autogrow is built into core, but is still useful if you want to set the default minHeight and maxHeight. See my code below to replace code found in ...
toomanychrises's user avatar
5 votes
Accepted

Adding font-size and color buttons

You are looking for the ColorButton and CKEditor Font Size and Family plugins. Follow the instructions on the project pages and you'll have the option to add those back to the toolbar. Beware that ...
TwoD's user avatar
  • 732
5 votes

Is there a way to avoid CkEditor is used for some form elements, for example the body form element used for nodes?

The problem you experienced with configuring the field is that in core there is no option to select the allowed text formats. When this module is installed https://www.drupal.org/project/...
4uk4's user avatar
  • 99.2k
5 votes
Accepted

Change ckeditor table dialogue defaults

You can achieve this in several ways with a script we can call, for example, ckeditor_settings_modifier.js containing: CKEDITOR.on('dialogDefinition', function(ev) { var dialogName = ev.data.name; ...
Nicoschi's user avatar
  • 146

Only top scored, non community-wiki answers of a minimum length are eligible