Project

General

Profile

Actions

Bug #27801

closed

RTE: Change of block style does not remove previous block styles

Added by Robert Keller almost 13 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Must have
Category:
RTE (rtehtmlarea + ckeditor)
Target version:
-
Start date:
2011-07-01
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.5
PHP Version:
5.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Environment:
I have configured 4 different block styles in RTE.classes and the corresponding css file:

RTE.classes {
bodytext {
name = Standard
value = font: 8pt Verdana, Arial, Helvetica, sans-serif;color: #575758;
}
header {
name = Subheadline
value = font: 8pt Verdana, Arial, Helvetica, sans-serif;color: #3c5a8c;font-weight:bold;
}
list {
name = List with arrows
value = font: 8pt Verdana, Arial, Helvetica, sans-serif;color: #575758;padding-left:14px;
}
small {
name = Small box
value = font: 7pt Verdana, Arial, Helvetica, sans-serif;color: #575758;
}
}

Initially the block style dropdown shows all of those styles.

Problem:
Whenever I change the style the previously selected style is not removed but added. The same time the selected style is removed from the dropdown. When all styles have been used the dropdown gets disabled and I cannot even choose the "Remove block style" option (which one-by-one can remove the styles).
The path in the statusbar finally shows:

Path: body»p.bodytext.header.small.list

We have recently upgraded the project from v4.1 to v4.5.3 and the behaviour was correct in v4.1.
Sorry I cannot be more precise since which version this happens.

Maybe this is not an issue but rather a misconfiguration so I attach the RTE-config.
As more than 100 editors are working with the system this is currently a blocker for us.
Can anyone confirm the bug?

Versions: rtehtmlarea 2.1.6 mode:typical, typo3 v4.5.3, happened in Firefox 3.6.18 (ubuntu) and IE8 (win xp)


Files

rte.tsconfig (1.37 KB) rte.tsconfig Robert Keller, 2011-07-01 17:46

Related issues 1 (0 open1 closed)

Is duplicate of TYPO3 Core - Bug #29064: Incorect behaviour in Block Style in RTEClosedStanislas Rolland2011-08-17

Actions
Actions #1

Updated by Robert Keller almost 13 years ago

  • Target version deleted (4.5.4)
Actions #2

Updated by Robert Keller almost 13 years ago

The culprit seems to be in block-style.js and HTMLArea.BlockStyle.applyClassChange(node, className). Here in the else-branch the new class is only added but not removed.

The quickfix works for me but I guess that other functionality (alternatingClasses, countingClasses) will be broken.

    /*
     * This function applies the class change to the node
     */
    applyClassChange: function (node, className) {
        if (className == "none") {
            var classNames = node.className.trim().split(" ");
            for (var i = classNames.length; --i >= 0;) {
                if (!HTMLArea.reservedClassNames.test(classNames[i])) {
                    HTMLArea.DOM.removeClass(node, classNames[i]);
                    if (node.nodeName.toLowerCase() === "table" && this.getPluginInstance('TableOperations')) {
                        this.getPluginInstance('TableOperations').removeAlternatingClasses(node, classNames[i]);
                        this.getPluginInstance('TableOperations').removeCountingClasses(node, classNames[i]);
                    }
                    break;
                }
            }
        } else {
            var nodeName = node.nodeName.toLowerCase();
            if (this.tags && this.tags[nodeName] && this.tags[nodeName].allowedClasses) {
                if (this.tags[nodeName].allowedClasses.test(className)) {
                    // quick fix begin
                    node.className = "";
                    // quick fix end
                    HTMLArea.DOM.addClass(node, className);
                }
            } else if (this.tags && this.tags.all && this.tags.all.allowedClasses) {
                if (this.tags.all.allowedClasses.test(className)) {
                    // quick fix begin
                    node.className = "";
                    // quick fix end
                    HTMLArea.DOM.addClass(node, className);
                }
            } else {
                // quick fix begin
                node.className = "";
                // quick fix end
                HTMLArea.DOM.addClass(node, className);
            }
            if (nodeName === "table" && this.getPluginInstance('TableOperations')) {
                this.getPluginInstance('TableOperations').reStyleTable(node);
            }
        }
    },
Actions #3

Updated by Stanislas Rolland almost 13 years ago

It is normal that the applied classes accumulate on the element. It is only possible to remove the class that is currently the last in the list, using the "Remove block style" option. The selector displays the last class currently assigned to the element.

What is not normal is that the "Remove block style" option is not present and the selector is disabled when all available classes have been applied. I am not able to reproduce this error.

Note that the selector is disabled if the cursor is positionned in an element of a type for which no class is defined/allowed.

Actions #4

Updated by Stanislas Rolland almost 13 years ago

You should use

RTE.default.buttons.blockstyle.tags.p.allowedClasses = bodytext, header, list, small

rather than

RTE.default.classesParagraph = bodytext, header, list, small

because the later applies to div elements.

Actions #5

Updated by Stanislas Rolland almost 13 years ago

Is this still an issue? If so, please explain how to reproduce.

Actions #6

Updated by Stanislas Rolland almost 13 years ago

  • Status changed from New to Needs Feedback
Actions #7

Updated by Mr. Hudson over 12 years ago

Patch set 1 of change Ifc5ca8e4fc07c8627a07fe94854ceda056b2e557 has been pushed to the review server.
It is available at http://review.typo3.org/4572

Actions #8

Updated by Stanislas Rolland over 12 years ago

  • Target version set to 1341
Actions #9

Updated by Mr. Hudson over 12 years ago

Patch set 1 of change Iaf024309d3626a77304756399e825bfbfed3db94 has been pushed to the review server.
It is available at http://review.typo3.org/4573

Actions #10

Updated by Mr. Hudson over 12 years ago

Patch set 1 of change If81a43cb4768848863bfade78f661eba3331685d has been pushed to the review server.
It is available at http://review.typo3.org/4574

Actions #11

Updated by Mr. Hudson over 12 years ago

Patch set 1 of change I22db8b9d15214aa9fbbebb636bc8deb9e03b138a has been pushed to the review server.
It is available at http://review.typo3.org/4576

Actions #12

Updated by Stanislas Rolland over 12 years ago

  • Status changed from Needs Feedback to Under Review

Please test this patch: http://review.typo3.org/4574

Actions #13

Updated by Stanislas Rolland over 12 years ago

  • Status changed from Under Review to Resolved
Actions #14

Updated by Ernesto Baschny almost 11 years ago

  • Target version deleted (1341)
Actions #15

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF