jQWidgets Forums

jQuery UI Widgets Forums Editors Editor Linbreak br produces unexpected character

This topic contains 3 replies, has 3 voices, and was last updated by  Peter Stoev 10 years, 5 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author

  • mattsbg
    Participant

    Hi,

    Using your linebreak fiddle example I thought I could easily modify it to use br as line breaks.

    
    $('#editor').jqxEditor({
        height: 400,
        width: 800,
        theme: 'energyblue', 
        lineBreak: 'br'
    });
    

    But as soon as I changed it, in Chrome and FF it seems to insert and additional character 8203 on linebreak. You even recognize it on Backspace that it takes one more keypress to return back to previous line.

    For reproducing I extended your fiddle demo so that after a timeout it prints the character codes in question compared to the value.
    So just enter “aa” {enter} and “aa” (without the quotes) again and wait for the alert to appear.

    
    $('#editor').jqxEditor({
        height: 400,
        width: 800,
        theme: 'energyblue', 
        lineBreak: 'br'
    });
    setTimeout(function () {
        var s = "";
        var content = $('#editor').val();
        for (var i=0;i<6;i++)
        {
            s+="," + content.charCodeAt(3+i);
        }
        alert(content + "\n" + s);
        }, 10000);
    

    As you’ll see after <br> it inserted the character code 8203 which is known as so called Zero Width Character.

    Did I do something wrong? Do I have to set lineBreak to something different?

    thanks,
    Matt


    Nadezhda
    Participant

    Hello Matt,

    It does not matter which html (BR, P or DIV) tag you will use to determine line break because the number 8203 is in the three versions.

    Best Regards,
    Nadezhda

    jQWidgets team
    http://www.jqwidgets.com/


    mattsbg
    Participant

    Hi Nadezhda,

    but why is this character here (it’s causing problems saving the data in a database)? Also I think also for the user its confusing doing backspace on a linebreak as he has to do it twice for no visible reason?!

    thanks for your opinion,
    Matt


    Peter Stoev
    Keymaster

    Hi Matt,

    If the property is doing problems for you, just don’t set it and leave the browser to handle line breaks.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.