Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 355230

Summary: Pasted contents are erased (or never existed)
Product: [ECD] Orion Reporter: John J. Barton <johnjbarton>
Component: EditorAssignee: Silenio Quarti <Silenio_Quarti>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: eclipse.felipe, john.arthorne, kid, mihai.sucan, Silenio_Quarti
Version: unspecified   
Target Milestone: 0.3 RC1   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description John J. Barton CLA 2011-08-19 11:14:41 EDT
1. Open in Firefox: http://code.google.com/google_bsd_license.html
2. Select and copy the license
3. in Orion create a new file license.txt,
4. paste into license.txt.
5. save

The file is empty.
Comment 1 Felipe Heidrich CLA 2011-08-23 16:37:05 EDT
I can reproduce the problem on my machine.

This happens because in our implementation of paste we change the selection (insertion point) to a specific element (PRE) and we let the paste be performed by the user agent. Later, in a timeout, we removed all the text content from this element and insert it in the editor.

In this case, because of the presence of UL/IL elements, the native paste inserts content in places we do not expect them (in the parent of the PRE).

We have tried several different approaches (like using a textarea instead of PRE) but all of them had problems.
Comment 2 Kevin Dangoor CLA 2011-09-21 15:45:38 EDT
Is it possible that this bug report is the same thing?

https://bugzilla.mozilla.org/show_bug.cgi?id=687860

(I tried following the steps to reproduce listed in that bug on eclipse.org/orion and failed to even paste the initial file!)

Here's another report that I think is a case of this bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=687850
Comment 3 Kevin Dangoor CLA 2011-09-22 12:42:34 EDT
(In reply to comment #1)
> We have tried several different approaches (like using a textarea instead of
> PRE) but all of them had problems.

What kinds of problems did you encounter with textareas?

I just reviewed handful of bugs related to our integration of Orion in Firefox and, in my opinion, the pasting problems were the most painful of the bugs.
Comment 4 Felipe Heidrich CLA 2011-09-26 16:26:05 EDT
(In reply to comment #3)
> (In reply to comment #1)
> > We have tried several different approaches (like using a textarea instead of
> > PRE) but all of them had problems.
> 
> What kinds of problems did you encounter with textareas?


See bug 342452

- On Firefox 4 it stopped working. First we thought that it was textArea.select() that changed behaviour, but it was not only that. In your case: creating textarea, selecting it, and letting the paste to run, caused Firefox to pasted the wrong text in (can't remember all details, it was very weird). That is when we gave up using textarea (to avoid switching focus during paste).
Comment 5 Felipe Heidrich CLA 2011-09-27 11:56:46 EDT
We are releasing a new solution for paste. It is still not the code we like, so I have entered his request https://bugzilla.mozilla.org/show_bug.cgi?id=689590 so we can work with the firefox team  for a better (more stable) solution.