Bug #27801
closedRTE: Change of block style does not remove previous block styles
0%
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
Updated by Robert Keller over 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); } } },
Updated by Stanislas Rolland over 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.
Updated by Stanislas Rolland over 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.
Updated by Stanislas Rolland over 13 years ago
Is this still an issue? If so, please explain how to reproduce.
Updated by Stanislas Rolland over 13 years ago
- Status changed from New to Needs Feedback
Updated by Mr. Hudson about 13 years ago
Patch set 1 of change Ifc5ca8e4fc07c8627a07fe94854ceda056b2e557 has been pushed to the review server.
It is available at http://review.typo3.org/4572
Updated by Mr. Hudson about 13 years ago
Patch set 1 of change Iaf024309d3626a77304756399e825bfbfed3db94 has been pushed to the review server.
It is available at http://review.typo3.org/4573
Updated by Mr. Hudson about 13 years ago
Patch set 1 of change If81a43cb4768848863bfade78f661eba3331685d has been pushed to the review server.
It is available at http://review.typo3.org/4574
Updated by Mr. Hudson about 13 years ago
Patch set 1 of change I22db8b9d15214aa9fbbebb636bc8deb9e03b138a has been pushed to the review server.
It is available at http://review.typo3.org/4576
Updated by Stanislas Rolland about 13 years ago
- Status changed from Needs Feedback to Under Review
Please test this patch: http://review.typo3.org/4574
Updated by Stanislas Rolland about 13 years ago
- Status changed from Under Review to Resolved