Project

General

Profile

Actions

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.

Status:
Closed
Priority:
Should have
Category:
RTE (rtehtmlarea + ckeditor)
Target version:
Start date:
2014-12-18
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
7
PHP Version:
5.5
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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:
  1. Add
    ul { line-height: 150%; color: red; }

    to the RTE.default.contentCSS file
  2. Insert a new text element
  3. Type a, ENTER, b
  4. Make sure the text is colored red, i.e. the contentCSS was correctly loaded
  5. Select all text with Ctrl+A
  6. Click the "Bulleted List" button in the toolbar
  7. Copy the text with Ctrl+C
  8. Go to the end of the text with END
  9. Type ENTER two times to generate a new paragraph
  10. Paste the text with Ctrl+V
  11. 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.

Actions #1

Updated by Stanislas Rolland over 9 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?

Actions #2

Updated by Philipp Kerling over 9 years ago

Tough question. Would something like https://core.trac.wordpress.org/changeset/24211 work for pasting?

Actions #3

Updated by Stanislas Rolland over 9 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.

Actions #4

Updated by Stanislas Rolland over 9 years ago

However, if you use the pastebehaviour (and optionally pastetoggle) buttons, then the style attribute will be removed from the pasted content.

Actions #5

Updated by Stanislas Rolland about 9 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
Actions #6

Updated by Gerrit Code Review about 9 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

Actions #7

Updated by Stanislas Rolland about 9 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.

Actions #8

Updated by Stanislas Rolland about 9 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100
Actions #9

Updated by Gerrit Code Review about 9 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

Actions #10

Updated by Stanislas Rolland about 9 years ago

  • Status changed from Under Review to Resolved
Actions #11

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF