Opened 6 years ago

Closed 13 months ago

Last modified 13 months ago

#8341 closed Bug (fixed)

Faulty removal of empty spans in paste from word cleaning

Reported by: Tomas Owned by:
Priority: Normal Milestone: CKEditor 4.6.0
Component: Plugin : Paste from Word Version:
Keywords: Cc:

Description

In the paste from word plugin, there is a regexp replace of "<span>" for removing empty spans. The intention is right, but it is done without respect to the end tag. Thus ending up in a faulty DOM and destroying formatting of doc.

e.g. <p>normal <span style="my style"> text <span>with</span> my style.</span></p> Will cause styling to end after "with" instead of at "style."

This can in fact not be cleaned in regexp, it has to be done in the DOM.

The error is at line 1131 in _source\plugins\pastefromword\filter\default.js

The faulty code: Remove the dummy spans ( having no inline style ). data = data.replace( /<span>/g, );

Looked back to version 3.4 its at least that old.

Change History (6)

comment:1 Changed 6 years ago by Jakub Ś

Status: newpending

Are you able to provide a sample word document that causes the problem you are talking about?

The code you have provided explains what you mean but doesn't really help to reproduce the issue

e.g. <p>normal <span style="my style"> text <span>with</span> my style.</span></p>

comment:2 Changed 6 years ago by Tomas

Unfortunately I cant. The thing is, we do some pre-cleaning of the HTML from word, before letting it over to the CK editor word cleaning. For that I have an example that produces empty span tags. Regardless of reproducing or not, it is not correct to remove just a start tag. It has to be removed from the DOM.

Sorry about not being able to reproduce.

comment:3 Changed 6 years ago by Jakub Ś

Status: pendingconfirmed

Although there is no test case, technically @toma25 is right. CKEditor should know which span tag matches which instead of removing the first it finds.

comment:4 Changed 4 years ago by Frederico Caldeira Knabben

Component: Core : PastingPlugin : Paste from Word

comment:5 Changed 13 months ago by Tade0

Resolution: fixed
Status: confirmedclosed

Fixed with new Paste From Word plugin in 4.6.0, thank you, http://docs.ckeditor.com/#!/api/CKEDITOR.htmlParser.

comment:6 Changed 13 months ago by Anna Tomanek

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