Make WordPress Core

Opened 14 years ago

Closed 11 years ago

Last modified 11 years ago

#17068 closed defect (bug) (invalid)

Pasting text from Word does not have span tags cleaned anymore

Reported by: mjaning's profile mjaning Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.1
Component: TinyMCE Keywords:
Focuses: Cc:

Description

I usually paste text copied from Word doc using the visual editor in the post page. After upgrading to WP v-3.1 the pasting process has stopped cleaning the <span> tags which normally contains font and style attributes coming from Word doc.

After several tests I concluded (I did not find indeed) that some issue came bundled with WP-v3.1 in the \wp-includes\js\tinymce\plugins\paste\editor_plugin.js which is responsible for taking care of pasting process.

For confirming this theory I have replaced the files under \wp-includes\js\tinymce\plugins\paste\ with the same files from a previous WP version. After that, the pasting process started working again. The cleaning process is now keeping the HTML code perfectly clean, and the span tags were removed.

It does not matter if I am pasting straight to the text or if I am using the Paste From Word button, the cleaning process is just working fine in both ways.

Using WordPress 3.1, Customized Theme, W7 /CentOS release 5.5, FF4 / IE9 / Chrome10 / Opera 11 browsers

Attachments (3)

20110407-PasteFromWord.doc (45.0 KB) - added by mjaning 14 years ago.
File in Word Format that produces not clean HTML in my environment
20110407-PasteFromWord.txt (3.4 KB) - added by mjaning 14 years ago.
File in Text Format Contains the HTML (not well cleaned) resultant of the paste process
tiny-mce-converted.txt (2.4 KB) - added by c3mdigital 11 years ago.
Original Sample .doc file pasted into paste from Word on trunk

Download all attachments as: .zip

Change History (8)

#1 @solarissmoke
14 years ago

  • Keywords reporter-feedback added; needs-testing removed

Can't reproduce this in Win7/Word 2007. But it seems there are known issues with certain combinations of OS/Word, particularly Word 2011. What version of Word are you using?

@mjaning
14 years ago

File in Word Format that produces not clean HTML in my environment

@mjaning
14 years ago

File in Text Format Contains the HTML (not well cleaned) resultant of the paste process

#2 @mjaning
14 years ago

  • Cc mjaning added
  • Keywords needs-testing added; reporter-feedback removed

I attached 2 files you can use in your tests and/or comparisons. The word file was produced originally in a OS Windows XP and MS Word 2007. It was saved with .doc extension which is not the standard format for Word 2007.

The text file was copied from WordPress Editor in HTML mode after the paste process. It's purpose is only for you check about the results over here. Basically the <span> tag with font sytle should have being cleaned, but it remains inside.

I also reproduced the same results in a machine running Windows 7 and MS Word 2007.

I have a personal blog at WordPress.com (free plan) where I reproduced the same issue using the attached file.

Let me know if more info is needed.

PS. I can not reproduce the issue with all Word files I get, even when they come from the same Win XP / Word 2007 environment.

Last edited 14 years ago by mjaning (previous) (diff)

#3 @solarissmoke
14 years ago

  • Keywords needs-testing removed

Confirmed with the file you attached (though I can't create a new file that has the same problem). Tried with TinyMCE 3.4.2 and it still happens. Bug reported upstream, let's see whether someone can figure out what is happening.

Until then, this works for me: Copy all of the text from the problematic file, paste it into a new Word document, and then copy->paste that into TinyMCE, and it works (strips out all the cruft). Weird.

@c3mdigital
11 years ago

Original Sample .doc file pasted into paste from Word on trunk

#4 @c3mdigital
11 years ago

  • Resolution set to invalid
  • Status changed from new to closed

In 3.6 and Trunk I cannot reproduce this using the provided Word document. See upload.

#5 @markoheijnen
11 years ago

  • Milestone Awaiting Review deleted

Clearing out the milestones for closed tickets on Awaiting Review

Note: See TracTickets for help on using tickets.