Opened 11 years ago

Closed 9 years ago

#10032 closed Bug (fixed)

Paste from Word - forceFromWord flag is not reset

Reported by: Wiktor Walc Owned by: Piotr Jasiun
Priority: Normal Milestone: CKEditor 4.4.7
Component: Plugin : Paste from Word Version: 4.0 Beta
Keywords: Cc:

Description (last modified by Jakub Ś)

Steps to reproduce:

  1. Copy some unstyled text
  2. Press "Paste from Word" button
  3. Don't allow clipboard access
  4. Hit "Cancel" when the dialog window opens
  5. Press Ctrl + V inside the editing area
  6. The paste from Word command is executed although there is no reason for that. This can be easily tested by pasting simple alert in filter code.

Change History (9)

comment:1 Changed 11 years ago by Jakub Ś

Description: modified (diff)

comment:2 Changed 11 years ago by Jakub Ś

Status: newconfirmed
Version: 4.0 Beta

I was able to reproduce this in every browser in CKEditor 4 only and from CKE 4.x beta.

comment:3 Changed 10 years ago by Frederico Caldeira Knabben

Component: GeneralPlugin : Paste from Word

comment:4 Changed 9 years ago by Piotr Jasiun

Owner: set to Piotr Jasiun
Status: confirmedassigned

comment:5 Changed 9 years ago by Piotr Jasiun

Status: assignedreview

Test and change in t/10032.

comment:6 Changed 9 years ago by Piotrek Koszuliński

Status: reviewreview_failed

Comment out the first tests in the pastefromword file and the new test still fails.

The reason is that if the filter file must be loaded, then forceFromWord must be reset later.

BTW. In the test you should use a custom filter file, which will change the content in a way that you'll be sure that it was it. You base now on a fact that content is changed in a specific way by the default filter and that may change.

comment:7 Changed 9 years ago by Piotr Jasiun

Status: review_failedreview

I have updated tests to better cover scenarios. They are a little overcomplicated for the on line change, but they seams to test all cases now.

I also moved reset forceFromWord to the loadFilterRules callback, so it will be called after fire( 'paste' ) and work in both cases: if filter have been already loaded or not.

The problem is that because forceFromWord is cleaned directly after fire( 'paste') pasteFromWord command will work only if paste will be finished synchronously, so no other plugin will do hack similar to this in pasteFromWord plugin.

Alternatively we could reset forceFromWord on afterPaste listener, but in this case, if paste even will be canceled, forceFromWord will not be reset.

I choose the first option, because I assume that it is less probable that paste will work asynchronously than it will be canceled.

By the way, I realized that the hack used in pastefromword to make paste works asynchronously is pretty bad, because it fire paste from the very begging with data at current stage of the transformation, what means that every transformation on data, which were executed before the listener in pastefromword plugin, will be executed twice on the same data.

comment:8 Changed 9 years ago by Piotrek Koszuliński

Status: reviewreview_passed

"Yes" to every paragraph of your comment :).

comment:9 Changed 9 years ago by Piotrek Koszuliński

Milestone: CKEditor 4.4.7
Resolution: fixed
Status: review_passedclosed

Fixed on master with git:13fd47c.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy