isawnyu / isaw.web

Isaw website buildout
http://isaw.nyu.edu
1 stars 3 forks source link

Discovery: Is it quick to fix MSWord Paste into Body Text not working #456

Open paregorios opened 1 year ago

paregorios commented 1 year ago

The WYSIWYG editor for rich text fields has a button that's supposed to make pasting content from Microsoft Word safe by stripping all the evil. It doesn't work anymore. We need it to work.

paregorios commented 1 year ago

Steps to reproduce

  1. Create a new (or edit an existing) Page.
  2. Switch focus to a Microsoft Word document, select and copy some text, and return to the browser window in which the "Add/Edit Page" form is displayed.
  3. On the Add/Edit Page form, scroll down to the "Body Text" textbox and insert the text cursor in the field.
  4. On the textbox toolbar, select the icon for "Paste from Word".
  5. On the "Past from Word" dialog box, follow the instructions to "use ctrl-v (or cmd-v)on your keyboard to paste the text into the window."
  6. Select the "insert" button on the "Paste from Word" dialog box.
  7. Gaze in horror at the result:

Screen Shot 2022-11-18 at 10 25 11 AM

Problem tested/confirmed in

paregorios commented 1 year ago

What we want to get is the old behavior, i.e., just basic HTML character-level formatting comes through (bold, italic, underline, links).

alecpm commented 1 year ago

It probably makes sense to test out some of the paste plugin options for the TinyMCE version we are using to see if a more restrictive set of options will help resolve issues with the current version.

There are some tips here which seem to be oriented towards TinyMCE versions 4 and 5, but they may be instructive if we need to do some customization. They could also be useful if/when we do upgrade the TinyMCE version (either using plone.app.widgets or upgrading to Plone 5.x).

Support for improved paste from Word on TinyMCE 4 and 5 is now provided by a commercial add-on which requires a TinyMCE subscription, though at some point it seems to have been available as a standalone purchase for TinyMCE 4. I think that means it's unlikely that we'd get better support out of the box by upgrading Plone/TinyMCE.

paregorios commented 1 year ago

@alecpm I assume that testing these options out is a codebase/buildout tasks, yes? I don't see them surfaced in the control panel for the plugin.

alecpm commented 1 year ago

@paregorios Yeah, it's JS config of the widget, which probably requires a ZPT/DTML template customization (and there's no guarantee that there's a way to make the editor work with recent versions of Word). This document seems to imply that the only way to make this work reliably is to use Notepad as an intermediary for the paste (or better yet as the original rich text document source). Maybe that could be a "solution"?