Opened 10 years ago
Closed 10 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: |
Description
Following PR https://github.com/ckeditor/ckeditor-dev/pull/116.
In default filter's addStyle
the following optimization is performed:
this.attributes.style = styleText.replace( /^;|;(?=;)/, '' );
Still, I managed to reproduce a case (http://tests.ckeditor.dev:1030/tests/tickets/9456/1), which isn't entirely covered by that RegExp as it either removes leading ";" OR redundant ";;":
;;font-family:calibri;font-size:medium
will produce
;font-family:calibri;font-size:medium
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 CKEDITOR.tools.normalizeCssText()
instead of any (even improved) RegExp to avoid any (further) problems and make sure styles are properly normalized.
Change History (4)
comment:1 Changed 10 years ago by
Owner: | set to Olek Nowodziński |
---|---|
Status: | new → assigned |
Type: | Bug → Task |
comment:2 Changed 10 years ago by
Status: | assigned → review |
---|
comment:3 Changed 10 years ago by
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 10 years ago by
Resolution: | → fixed |
---|---|
Status: | review → closed |
I changed the regexp a little bit so it consumes multiple leading semicolons properly. Fixed on master with git:18c6781.
Pushed improved code to branch:t/12263.