Bug #63982
closedRTE: Webkit may insert line-height style attribute on paste
100%
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.
Updated by Stanislas Rolland almost 10 years ago
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?
Updated by Philipp Kerling almost 10 years ago
Tough question. Would something like https://core.trac.wordpress.org/changeset/24211 work for pasting?
Updated by Stanislas Rolland almost 10 years ago
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.
Updated by Stanislas Rolland almost 10 years ago
However, if you use the pastebehaviour (and optionally pastetoggle) buttons, then the style attribute will be removed from the pasted content.
Updated by Stanislas Rolland almost 10 years ago
- 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
Updated by Gerrit Code Review almost 10 years ago
- 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
Updated by Stanislas Rolland almost 10 years ago
- 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.
Updated by Stanislas Rolland almost 10 years ago
- Status changed from New to Resolved
- % Done changed from 0 to 100
Applied in changeset bbc908b1227008626ab57c879dea0ac9c0e6fa9b.
Updated by Gerrit Code Review almost 10 years ago
- 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
Updated by Stanislas Rolland almost 10 years ago
- Status changed from Under Review to Resolved
Applied in changeset 9f155e210c8a39c8290c6f864a4001a41b52373e.