[BUGFIX] RTE: In Chrome RTE inserts weird span tags 58/33658/2
authorStanislas Rolland <typo3@sjbr.ca>
Fri, 31 Oct 2014 04:41:30 +0000 (00:41 -0400)
committerStanislas Rolland <typo3@sjbr.ca>
Sat, 1 Nov 2014 15:04:28 +0000 (16:04 +0100)
Remove the span tags inserted by Chrome or Opera on execution of native
execCommand. The attributes of these span tags have evolved...
This is a follow-up change to http://review.typo3.org/33392.

Releases: master, 6.2
Resolves: #52470
Change-Id: Ib3c2fa3a1a8f0e378bfa2ca4a5f6e78d1fdf3da7
Reviewed-on: http://review.typo3.org/33658
Reviewed-by: Stanislas Rolland <typo3@sjbr.ca>
Tested-by: Stanislas Rolland <typo3@sjbr.ca>
typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/BlockElements/block-elements.js

index 0afdf5a..c295606 100644 (file)
@@ -5070,7 +5070,7 @@ HTMLArea.DOM.Node = Ext.extend(HTMLArea.DOM.Node, {
                                if (HTMLArea.DOM.hasClass(spans[i], 'Apple-style-span')) {
                                        this.removeMarkup(spans[i]);
                                }
-                               if (spans[i].style.cssText.indexOf('line-height') !== -1) {
+                               if (/^(li)$/i.test(spans[i].parentNode.nodeName) && (spans[i].style.cssText.indexOf('line-height') !== -1 || spans[i].style.cssText.indexOf('font-family') !== -1 || spans[i].style.cssText.indexOf('font-size') !== -1)) {
                                        this.removeMarkup(spans[i]);
                                }
                        }
index f4e77ea..d18dcfb 100644 (file)
@@ -511,6 +511,9 @@ HTMLArea.BlockElements = Ext.extend(HTMLArea.Plugin, {
                                var bookmark = this.editor.getBookMark().get(range);
                                var newBlock = this.wrapSelectionInBlockElement(buttonId, className, null, true);
                                this.editor.getSelection().selectRange(this.editor.getBookMark().moveTo(bookmark));
+                               if (Ext.isWebKit || Ext.isOpera) {
+                                       this.editor.getDomNode().cleanAppleStyleSpans(newBlock);
+                               }
                                break;
                        case "JustifyLeft"   :
                        case "JustifyCenter" :