Inserting [tt] is broken.

  • Adding the tt bbcode via the button is broken in Chrome Version 39.0.2171.71 m after a quote, see this example:


    Although, is this intended to be done directly from the database class? You used $this, which implies that you're inside a class.


    Read up on object-oriented programming, and you wouldn't have this question.


    $this denotes the scope of



    ---
    Marking $this above and clicking the button for the tt-bbcode results in it being inserted at seemingly random locations.

    "A life is like a garden. Perfect moments can be had, but not preserved, except in memory. LLAP" — Leonard Nimoy

  • I already nuked my cache, but I also did a hard reload just now. But as I said, seemingly random locations happen also, this is the result this time:

    "A life is like a garden. Perfect moments can be had, but not preserved, except in memory. LLAP" — Leonard Nimoy

  • I can reproduce it with the newest Chrome.


    Step 1: Copy

    Code
    Read up on object-oriented programming, and you wouldn't have this question.
    $this denotes the scope of


    into the editor.
    Step 2: Mark $this
    Step 3: Press the Inline-Code button
    Result:

    Code
    Read up on object-oriented programming, and you wouldn't have this question.
    $this denotes the scope of[tt]$this[/tt]


    Only seems to happen with the first word of every line.


    EDIT: Also happens with the [code]-BBCode.

    • Official Post

    Could you try some debugging with the beta please? I honestly cannot reproduce this no matter what I try :(


    http://screencast.com/t/wi7hyEkQd1F


    For debugging purpose modify wcf/js/3rdParty/redactor/plugins/wbutton.js and add after line 156: console.debug(this.wutil._range);. It will expose the stored range to console before calling this.insert.html().

    • Official Post

    That's strange, the first range (stored one) still points to the end of the pasted text, while the current selection refers to the correct position. How do you mark the word, by keyboard or by mouse? I'm asking because it saves the current selection on mousedown, mouseup and keyup?

  • By mouse.
    Btw. it happens with every word, and not only when copy and paste something into the editor. I can just write two lines, mark the first word (of any line) and the same error occurs.

  • By mouse.


    Btw. it happens with every word, and not only when copy and paste something into the editor. I can just write two lines, mark the first word (of any line) and the same error occurs.


    I just tried this out, I can not reproduce that on my end.


    Line one
    Line two
    line three


    -> works ;)


    Line one
    line two


    -> works


    And I've had this behavior not only with the first word in a line. And sometimes I can't even reproduce it with the same text. It might be soemthing about c&p, since it mostly affects posts where I copied something.

    "A life is like a garden. Perfect moments can be had, but not preserved, except in memory. LLAP" — Leonard Nimoy

    • Official Post

    This is getting ridicilous, I even tried it with Chrome 41/Canary to ensure it's not related to my Chrome installation. Yet the result is the same, I can mark any word I like (both w/ mouse and keyboard) and the result is always correct. Looking at the code it doesn't even make sense that the stored selection is flawed, simply because it is updated in almost every possible scenario.


    @Christopher Walz On what OS are you running Chrome on? I'm testing on Windows 7?

  • I'm testing on Windows 7?


    Windows 8.1.


    Quote

    If you look closely at 0:33 I accidentally only mark die instead of dies. After correctly marking dies, the s is somehow duplicated. Maybe it used the old selection and mixed something up?


    I am getting that a lot, too.

    "A life is like a garden. Perfect moments can be had, but not preserved, except in memory. LLAP" — Leonard Nimoy

    • Official Post

    I just spotted a major difference, you're releasing the mouse button outside of the editor which can cause the mouseup event to be undetected. If I repeat the steps exactly as shown, I'm able to reproduce this.


    Looks like I should use some shitty mouse instead of a high precision Razer for testing :P

  • Looks like I should use some shitty mouse instead of a high precision Razer for testing


    Logitech MX 518 is the only trve mouse. Mine approches it's 10th anniversary in 2015! Actually, now that Im thinking about it, I should throw a party.



    Glad that you could reproduce this now. I started to think I need to tear apart my Chrome installation...

    "A life is like a garden. Perfect moments can be had, but not preserved, except in memory. LLAP" — Leonard Nimoy

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!