Bug #63982
closed
RTE: Webkit may insert line-height style attribute on paste
Added by Philipp Kerling over 9 years ago.
Updated over 5 years ago.
Category:
RTE (rtehtmlarea + ckeditor)
Description
When copying some elements (I don't know the exact conditions yet) that have a custom line-height set by CSS rules, htmlarea inserts unneeded and unwanted inline style attributes to elements.
Steps to reproduce:
- Add
ul { line-height: 150%; color: red; }
to the RTE.default.contentCSS file
- Insert a new text element
- Type a, ENTER, b
- Make sure the text is colored red, i.e. the contentCSS was correctly loaded
- Select all text with Ctrl+A
- Click the "Bulleted List" button in the toolbar
- Copy the text with Ctrl+C
- Go to the end of the text with END
- Type ENTER two times to generate a new paragraph
- Paste the text with Ctrl+V
- Look at the generated HTML source. It will be:
<ul><li>a</li><li>b</li></ul><ul style="line-height: 27px; "><li>a</li><li>b</li></ul>
The style="" is unnecessary.
It only happens in Webkit browsers (tested in epiphany). Happens every time.
Well, webkit browsers are adding all kinds of span and font tags on paste. The RTE is removing those. Now I see that a style attribute is added on a ul element. But, how to detect that this was added by the browser?
Philipp Kerling wrote:
Tough question. Would something like https://core.trac.wordpress.org/changeset/24211 work for pasting?
This applies to the creation of a list in the RTE. I think you can verify that in such case htmlArea RTE is already removing any span tags or style attributes on ol, ul or li tags.
However, if you use the pastebehaviour (and optionally pastetoggle) buttons, then the style attribute will be removed from the pasted content.
- Subject changed from RTE inserts line-height inline style on copy in webkit browsers to RTE: Webkit may insert line-height style attribute on paste
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36749
- Status changed from Under Review to New
- Assignee set to Stanislas Rolland
- Target version set to next-patchlevel
- PHP Version set to 5.5
With this change http://review.typo3.org/36749, if RTE.default.enableWordClean is set, then the line-height style attribute will be removed from ul/ol elements on a paste operation in a WebKit browser.
However, if RTE.default.enableWordClean.HTMLparser is also set, then it will depend on the HTMLparser configuration provided.
If one of the clean paste behaviours is enabled, then the style attribute is already removed on any paste operation.
- Status changed from New to Resolved
- % Done changed from 0 to 100
- Status changed from Resolved to Under Review
Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36750
- Status changed from Under Review to Resolved
- Status changed from Resolved to Closed
Also available in: Atom
PDF