Project

General

Profile

Actions

Bug #87400

open

CKEditor: assign correct CSS class to tags with entryHTMLparser_db

Added by Benedikt Imminger about 5 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
RTE (rtehtmlarea + ckeditor)
Target version:
-
Start date:
2019-01-11
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
9
PHP Version:
7.2
Tags:
ckeditor
Complexity:
Is Regression:
Sprint Focus:

Description

I would like to assign CSS classes to tags in CKEditor (h1 should have the class .c-rte__h1, h2 should have .c-rte__h2 and so on). This can be done with fixAttrib:class:default: (see snippet below).

The problem occurs when switching between the paragraph style (e.g. from h1 to h2 -> see attached video). Only the tag gets updated, the class will stay the same (<h2 class=“c-rte__h1”>).

editor:

  config:
    stylesSet:
      # Inline styles
      - { name: 'Normal text', element: 'p', attributes: { 'class': 'c-rte__text' }}
      - { name: 'Intro text', element: 'p', attributes: { 'class': 'c-rte__text c-rte__text--intro' }}
      - { name: 'Small text', element: 'p', attributes: { 'class': 'c-rte__text c-rte__text--small' }}

    format_tags: "p;h1;h2;h3;h4;h5" 

processing:

  # Set classes for RTE elements
  entryHTMLparser_db:
    tags:
      br:
        fixAttrib:
          class:
            default: c-rte__br
      h1:
        fixAttrib:
          class:
            default: u-h1 c-rte__h1
      h2:
        fixAttrib:
          class:
            default: u-h2 c-rte__h2
      p:
        fixAttrib:
          class:
            default: c-rte__text
…

(An alternative method would be fixAttrib:class:set, but it overrides the classes assigned with stlyesSet.)


Files

RTE Bug.mov (3.6 MB) RTE Bug.mov Benedikt Imminger, 2019-01-11 11:01

Related issues 2 (2 open0 closed)

Related to TYPO3 Core - Feature #87314: allowedAttribs / allowAttributes usage in configNew2018-12-31

Actions
Related to TYPO3 Core - Bug #92943: RTE ckeditor does not respect YAML configurationNew2020-11-27

Actions
Actions #1

Updated by Benni Mack about 2 years ago

  • Related to Feature #87314: allowedAttribs / allowAttributes usage in config added
Actions #2

Updated by Benni Mack about 2 years ago

  • Related to Bug #92943: RTE ckeditor does not respect YAML configuration added
Actions

Also available in: Atom PDF