1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fixed Pasting to the editor clears all the information after the pasted phrase

Discussion in 'Resolved Bug Reports' started by Moshe1010, Apr 2, 2014.

  1. Moshe1010

    Moshe1010 Well-Known Member

    I've tried to test it here:

    See this gif for more info:

    It looks like I can reproduce it only once for every page refresh. Meaning, if I try to copy-paste again without refreshing the page, it would work fine. If I refresh the page and do the above, it would happen again.
    It was tested with Chrome 33, OS X 10.9.2
    I've tried to test with FireFox, but couldn't reproduce it, so looks like Chrome specific.

  2. Mike

    Mike XenForo Developer Staff Member

    Can you still reproduce this now, here? There have been a couple changes that may be relevant.

    Do you think you could give as simplified a test case as possible? I'll need to reproduce this consistently. I'm not sure if my inability to reproduce it was actually from not doing the steps correctly. There's some ambiguity in a gif/video and the exact position of the selection markers may be important.
  3. Moshe1010

    Moshe1010 Well-Known Member

    Steps to reproduce:

    1. Copy-Paste:
    * 40 Apples/ 43 Cucumbers/ 440 peanuts/ 10 toys/ 42 candy crushes
    * 40 Ice creams/ 322 dogs/ 492 elephants/ 449 cats/ 4 rats
    * 540 editors/ 100 add-ons/ 500 hackers/ 45 galaxies/ 19 milky ways/ 1 earth/ 11 countries
    * 400 plants/ 30 genetics/ 11 phones/ 99 iPhones/ 11 androids/ 11 laptops/ 66 pencils/ 99 speakers
    * 44 displays/ 55 tvs/ 11 cables/ 44 air conditioners/ 44 iPads/ 44 nonsense

    2. Not sure if it's relevant, but comment with the above in a thread, then copy-pate it to the editor again.

    3. Change the one from the last row from 400 plants to 1, then add to the end (write it, don't copy-paste):
    / 44 cats/ 33 rats/ 33 whatever

    4. Double click on this row (in chrome double clicking = selecting the entire row. I think this is the key for the bug)

    5. Ctrl+B (or in my case CMD+B)

    6. Change the color to red

    7. Go the the 2nd row (the one with 40 Ice reams), double click on the row to select the entire row, and Paste it with Ctrl + V (or CMD + V).

    I can reproduce it here right now.
    It sometimes can be not consistent, so try to refresh the page and try again with different row (last one for example, bold it, color it and paste it instead of the second or third one).

    As you can see here:

    First time it didn't work for me, but after a page refresh it did. The only difference was, I guess, is that I deselected and selected the text again before copy-pasting it (after applying the color).
    Last edited: Apr 3, 2014
  4. Mike

    Mike XenForo Developer Staff Member

    I haven't been able to reproduce this exactly, though I did see a potential issue when pasting over the first line which may be relevant to your case -- it depends on the exact HTML the browser generated.

    I've just rolled out a change that should fix this issue. Would you mind trying to reproduce this issue again? If it still happens and I can't reproduce it, it's going to be very hard to fix -- this is very nuanced code.
  5. TheBigK

    TheBigK Well-Known Member

    I'm not sure if this is relevant: However on OSX (Mavericks)+Chrome (latest) ; copy+paste does not work. I couldn't come up with exact steps to reproduce the issue; but it happens randomly if you just copy something from a post above and try to paste it in the quick-reply editor.

    Pressing CMD+V basically does nothing for 3-5 tries and when you do it with mouse; it works.
  6. Moshe1010

    Moshe1010 Well-Known Member

    Looks like your change did the trick.

    On a different note. when pasting the same line several times, note that when pasting it instead of the previous line, it brings the second line up (meaning it's erasing the space in between, while in other lines/rows it doesn't). Is this as expected?
  7. Mike

    Mike XenForo Developer Staff Member

    It's sort of expected given the HTML that was generated. In some cases it's:
    <p>line 1<br />line 2</p>
    In other cases it's:
    <p>line 1</p><p>line 2</p>
    With the bold parts being what's selected. So in the first case, you actually have the line break selected and you're pasting inline content into an allowed area. In the second case, you have a whole block element selected so we manipulate the HTML as necessary (but either way line 2 is in its own block).
    Moshe1010 likes this.

Share This Page