jakiestfu/Medium.js

order of lines inversed on paste

pat123456 opened this issue · 5 comments

Hello,

when copy a text, for example this one :
a
b
c

and paste it, it became :
c
b
a

this seem to resolve the problem ?, but don't know if it will have some bad repercussions in the rest of the code :
(in Medium.Injector.prototype line 1732 )

    if (isConverted) {
        //make an array of elements that are about to be inserted, can't use html because they will
        while (i < html.length) {
            nodes.push(html[i]);
            i++;
        }
        /*while (html.length > 0) {
            console.log(html[html.length - 1])
            parent.insertBefore(html[html.length - 1], wedge);
        }*/
        for (var j=0; j<nodes.length ;j++) {
            parent.insertBefore(nodes[j], wedge);
        }
    }

sorry, didn't saw that the bug was already reported in the "closed issues"
#133
but the code doesn't seem to have been changed in the official medium.js file and in the doc page ?
http://jakiestfu.github.io/Medium.js/docs/

@pat123456 I believe this specific bug is still open. Bug #133 (which I just ran into) was causing the ability to paste to not work at all. (I saw this in release 1.0.1.)

I am still seeing this specific issue with copy and paste reversing the order.

Edit: Nevermind. I see you are referencing f8abd15 within that chain. My mistake. I'm going to take a look at that now.

vhmth commented

I am seeing this issue when inserting HTML as well via insertHTML('<ul><li></li></ul>');.