Opened 4 years ago

Closed 4 years ago

#12263 closed Task (fixed)

Improvements to style handling in default Paste from Word filter

Reported by: Olek Nowodziński Owned by: Olek Nowodziński
Priority: Normal Milestone: CKEditor 4.4.4
Component: Plugin : Paste from Word Version:
Keywords: Cc:


Following PR

In default filter's addStyle the following optimization is performed: = styleText.replace( /^;|;(?=;)/, '' );

Still, I managed to reproduce a case (, which isn't entirely covered by that RegExp as it either removes leading ";" OR redundant ";;":


will produce


because RegExp is satisfied by removing leading ";".

While I'm not sure whether it really matters if some leading ";" remains, I'm for the use of instead of any (even improved) RegExp to avoid any (further) problems and make sure styles are properly normalized.

Change History (4)

comment:1 Changed 4 years ago by Olek Nowodziński

Owner: set to Olek Nowodziński
Status: newassigned
Type: BugTask

comment:2 Changed 4 years ago by Olek Nowodziński

Status: assignedreview

Pushed improved code to branch:t/12263.

comment:3 Changed 4 years ago by Piotrek Koszuliński

Using tools.normalizeStyleText may lead to unpredictable behaviour changes, because this function completely parses and rebuilds style text. This is too far for a change that it's not based on any real scenario. I'll remove this commit and leave only initial PR, because it will be safe.

comment:4 Changed 4 years ago by Piotrek Koszuliński

Resolution: fixed
Status: reviewclosed

I changed the regexp a little bit so it consumes multiple leading semicolons properly. Fixed on master with git:18c6781.

Note: See TracTickets for help on using tickets.
© 2003 – 2017 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy