Updated: Comment #N

Problem/Motivation

\Drupal\ckeditor\Plugin\CKEditorPlugin\Internal is testing for some tags in

  protected function generateFormatTagsSetting(Editor $editor) {
    // The <p> tag is always allowed — HTML without <p> tags is nonsensical.
    $format_tags = array('p');

    // Given the list of possible format tags, automatically determine whether
    // the current text format allows this tag, and thus whether it should show
    // up in the "Format" dropdown.
    $possible_format_tags = array('h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'pre');
    foreach ($possible_format_tags as $tag) {
      $input = '<' . $tag . '>TEST</' . $tag . '>';
      $output = trim(check_markup($input, $editor->format));

which calls (almost) all Filter plugins Filter::process().

This seems like a performance penalty esp. when Filter plugins have a complex setup.

Proposed resolution

Should protected function generateFormatTagsSetting(Editor $editor) { use caching?

Remaining tasks

User interface changes

API changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

clemens.tolboom’s picture

Status: Active » Needs review
FileSize
815 bytes
clemens.tolboom’s picture

Title: Filter::process is called for any filter plugin by CKEditor » CKEditor should cache when generateFormatTagsSetting.
Wim Leers’s picture

Title: CKEditor should cache when generateFormatTagsSetting. » CKEditor's Internal::generateFormatTagsSetting() should call check_markup() with caching enabled
Status: Needs review » Reviewed & tested by the community

Good catch! Agreed. Trivial fix. Thank you :)

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.