Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#27771 closed defect (bug) (fixed)

Update the TinyMCE paste plugin

Reported by: azaozz's profile azaozz Owned by: azaozz's profile azaozz
Milestone: 3.9 Priority: normal
Severity: normal Version: 3.9
Component: TinyMCE Keywords: has-patch commit
Focuses: Cc:

Description

The latest development version of the 'paste' plugin includes a fix for pasting from Word. In addition to the cleanup, inline comments and change tracking are removed. This prevents unintentionally exposing unwanted content when pasting.

Attachments (1)

27771.patch (27.9 KB) - added by azaozz 11 years ago.

Download all attachments as: .zip

Change History (16)

@azaozz
11 years ago

#1 @azaozz
11 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 3.9

Moving to 3.9 for quick consideration. Would be great if we can get this tested and included.

#2 @nacin
11 years ago

  • Keywords commit added

Did some light testing and looks good.

I couldn't get track changes to show up in 3.8, whether with "Paste from Word" or a clean paste (as in, it worked fine then too). I could reproduce an improvement in cleaning up comments.

Microsoft Word automatically renders comments as pseudo-footnotes. Trying out a comment in 3.8 produced something like this:

This is a test of a paste with comments <a href="#_msocom_1">[AN1]</a> from Microsoft Word.
<div>

<hr align="left" size="1" width="33%" />

<div>
<div>

 <a href="#_msoanchor_1">[AN1]</a>This is the comment.

</div>
</div>
</div>

While this is clever, editorial comments should not be rendered as footnotes. I'm definitely good with this change.

I've asked netweb to take a look at this and see if he can test anything. But let's get it in immediately, so we can test it more.

#3 follow-up: @azaozz
11 years ago

  • Owner set to azaozz
  • Resolution set to fixed
  • Status changed from new to closed

In 28089:

Update the TinyMCE paste plugin to the latest development version. It includes a fix for pasting from Word: removes inline comments and change tracking.
Changeset: https://github.com/tinymce/tinymce/commit/f8cffdf34287afaa54ffbf7d6b0eb7b22a8c27ac
Fixes #27771

This ticket was mentioned in IRC in #wordpress-dev by nacin. View the logs.


11 years ago

#5 @netweb
11 years ago

In Word Testing cut and paste (See WP#27771) and comments from Word with a comment on WP#27771

Result:

Testing cut and paste (See WP#27771 ) and comments from Word

<a href="#_msoanchor_1">[SE1]</a>WP TRAC #27771 Update the TinyMCE paste plugin 
  • An extra space is added (See WP#27771 ) rather than (See WP#27771)
  • The comment is no longer linked as per @nacin's test above in 3.8 with <a href="#_msocom_1">[AN1]</a>

Other than that I did some cut and paste tests like I did per #27160 all good.

This ticket was mentioned in IRC in #wordpress-dev by netweb. View the logs.


11 years ago

#7 in reply to: ↑ 3 @alleynoah
11 years ago

There's one part of the updated upstream code added in revision 28089 that's introduced a bug: the code that appears to be meant to filter out "Toc" anchors is also removing unrelated and valid links and anchors. I submitted a pull request upstream but figured I should also mention the issue here: https://github.com/tinymce/tinymce/pull/362

Not sure if it makes sense to reopen this issue or create a new one for this?

This ticket was mentioned in IRC in #wordpress-dev by nacin. View the logs.


11 years ago

#9 @netweb
11 years ago

Using MS Word 2013 (Desktop) pasting into Chrome without a 'Table of Comments' works fine....

https://cloudup.com/cH4fCB6a9rY

<h1>Section One</h1>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. <a href="http://example.com/one">http://example.com/one</a>

<h1>Section Two</h1>
Vivamus fermentum semper porta. Nunc diam velit, adipiscing ut tristique vitae, sagittis vel odio. Maecenas convallis ullamcorper ultricies. <a href="http://example.com/two">http://example.com/two</a>

<h1>Section Three</h1>
Suspendisse lectus leo, consectetur in tempor sit amet, placerat quis neque. Etiam luctus porttitor lorem, sed suscipit est rutrum non. <a href="http://example.com/three">http://example.com/three</a>

Will add a TOC to this same doc now....

#10 @netweb
11 years ago

With a TOC

<a href="#_Toc385400155">Section One. 1</a>

<a href="#_Toc385400156">Section Two. 1</a>

<a href="#_Toc385400157">Section Three. 1</a>

<h1>Section One</h1>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. <a href="http://example.com/one">http://example.com/one</a>

<h1>Section Two</h1>
Vivamus fermentum semper porta. Nunc diam velit, adipiscing ut tristique vitae, sagittis vel odio. Maecenas convallis ullamcorper ultricies. <a href="http://example.com/two">http://example.com/two</a>

<h1>Section Three</h1>
Suspendisse lectus leo, consectetur in tempor sit amet, placerat quis neque. Etiam luctus porttitor lorem, sed suscipit est rutrum non. <a href="http://example.com/three">http://example.com/three</a>

Note the hyperlinks are at the end of each line

#11 @netweb
11 years ago

The same cut and paste as comment 10 above using 'Paste into Word' in WP 3.8.3

Section One. 1

Section Two. 1

Section Three. 1
<h1></h1>
<h1>Section One</h1>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. <a href="http://example.com/one">http://example.com/one</a>
<h1>Section Two</h1>
Vivamus fermentum semper porta. Nunc diam velit, adipiscing ut tristique vitae, sagittis vel odio. Maecenas convallis ullamcorper ultricies. <a href="http://example.com/two">http://example.com/two</a>
<h1>Section Three</h1>
Suspendisse lectus leo, consectetur in tempor sit amet, placerat quis neque. Etiam luctus porttitor lorem, sed suscipit est rutrum non. <a href="http://example.com/three">http://example.com/three</a>

#12 @netweb
11 years ago

Aside from each section not keeping it's relevant anchor name from the TOC link I can't reproduce what @alleynoah outlined above 'unless' I am missing something in my Word Doc.

We should file an issue upstream for TinyMCE to keep the TOC anchors and anchor name:

Currently:

<a href="#_Toc385400155">Section One. 1</a>
....
<h1>Section One</h1>

Proposed:

<a href="#_Toc385400155">Section One. 1</a>
...
<h1>
  <a name="_Toc385400155">Section One</a>
</h1>

For Reference: Here is the sample MS Word 2013 doc I used above and the full HTML clipboard source is here.

This ticket was mentioned in IRC in #wordpress-dev by netweb. View the logs.


11 years ago

#14 @alleynoah
11 years ago

Thanks @netweb! I extended your sample document with the endnote and footnote samples for my issue: http://1drv.ms/1paoCoP

I also extended spocke's fix for the issue you discovered to work for my issue as well, and submitted that upstream (revising my original pull request): https://github.com/tinymce/tinymce/pull/362

#15 @netweb
11 years ago

@alleynoah Kind of moved the ongoing discussion of this to #27909 if you want to help test the latest changes.

Note: See TracTickets for help on using tickets.