Ticket #1427 (new New Feature)

Opened 10 months ago

Last modified 7 months ago

Autodetect clipboard contents on Paste

Reported by: alfonsoml Owned by:
Priority: Normal Milestone: CKEditor 3.0
Component: General Version:
Keywords: Discussion Cc:

Description (last modified by alfonsoml) (diff)

I've commented previously on this idea, but I can't find it so I'll leave this open so it doesn't get lost:

The access to the clipboard contents was easy in IE<7, but in IE7 by default the user will be faced with two warnings (#89), and in the rest of the browsers it's even harder.

The idea would be to allow the paste event to take place and compare the snapshot of the source just before and after it happens, the difference is the clipboard content that can be cleaned from Word rubbish, do a full-format clean up or even convert it to plain text. Then it's a matter of revert back to the previous undo state and insert the cleaned up code.

This would also allow more easily to use designMode to highlight the source view.

This page has an implementation of a JS diff algorithm that could be a base for this code: http://en.wikipedia.org/wiki/User:Cacycle/diff it includes references to other implementations that could be worth checking if this doesn't work just as expected.

This same algorithm could be used to mark insertions or deletions in the content.

Change History

Changed 7 months ago by alfonsoml

  • description modified (diff)
  • summary changed from Autodected clipboard contents on Paste to Autodetect clipboard contents on Paste

Changed 7 months ago by fredck

  • keywords Discussion added
  • milestone set to FCKeditor 3.0

The theory is interesting. It is still difficult to catch the "before" and "after" pasting event in all browsers. It's also difficult to achieve it without making the content "flash". But it worths giving it a try.

Note: See TracTickets for help on using tickets.