jQWidgets Forums

jQuery UI Widgets Forums Editors Editor Error in Firefox when using setMode on submit

This topic contains 24 replies, has 2 voices, and was last updated by  Peter Stoev 8 years, 4 months ago.

Viewing 10 posts - 16 through 25 (of 25 total)
  • Author

  • greentechie
    Participant

    PS: For some reason the fiddle link was removed. It is : http://jsfiddle.net/jqwidgets/zxaRL/


    Peter Stoev
    Keymaster

    I guess that when you have a string, you can parse it in the way you want your users to see it. We return editor.html(). Also explained you that this depends on the browser because it uses the browser’s editing engine. My suggestion for you is to use the Strings API like indexOf, substring, etc to achieve the output for your users

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    greentechie
    Participant

    Hi Peter,

    It will be difficult to use string slicing if I don’t know what text I am removing, due to it varying by browser.

    The way around this issue is to change the editor back to “rich text mode” (WYSIWYG) before saving the text, which would solve the problem.

    This brings me back to my original problem!

    Here is a fiddle I have made to demonstrate :-

    The fiddle starts in WYSIWYG mode with the text “New <b>Value</b>”, so “Value” is in bold.

    If I click button “Set Rich Text” (which is the current mode) then all formatting is lost! Is this intentional?!

    If I click “Show Value” then the value is displayed, but if I click “Set Rich Text + Show Value” then the mode changes (or loses formatting) but the alert message is never executed! Yet the code is the same as buttons “Set Rich Text” and “Show Value” combined. Is this what you expect?

    I can get everything working with TinyMCE, but I’ve had a jqWidgets Developer License for three years now and I’m trying to make this consistent with the other components I’m using.

    I like the look of jqxEditor, but I don’t see how I can ever use it if there is no way to reliably get what the user typed?

    Best Regards,
    Jamie


    Peter Stoev
    Keymaster

    Hi Jamie,

    I suggest re-reading my answers. I explained what you get as a result. I explained that this editor uses the browser’s editing engine. I explained that it returns the HTML value of the contenteditable element. There is nothing more I can add to this topic. I do not think that it is too much effort to parse a string which is within PRE tag, but that is my humble opinion. We will consider adding an option to get the editor’s value as a RAW Text in future versions, but that is what we have now.

    Best Regards,
    Peter Stoev

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


    greentechie
    Participant

    Hi Peter,

    Thank you, I have re-read all of your responses.

    If I understand you correctly then the

     tag with the ID of "sourceText" is always going to contain the user text, so that is accessible through string parsing. I was not sure how much of the returned text was dependant upon the browser, hence my worry that I could not reliably parse the result.
    
    It would be useful to have a "mode" property or "getMode" function, so I know when I need to parse the text. Although I could test the result text for the "sourceText" ID, it would seem useful to have some way of reading the current mode of the editor.
    
    I feel a little frustrated that there has been no acknowledgement that there is an issue with the "setMode" function. Why does it lose the formatting, as in my example, and why does it prevent the next statement executing as also in my example?
    
    If setMode worked as expected there would be no need to do any special parsing on the result.
    
    Best Regards,
    Jamie

    greentechie
    Participant

    PS: I notice that my last message was slightly corrupted by my use of a pre tag, sorry.

    PPS: The behaviour in my fiddle, where the formatting is lost, is the same in Chrome but the alert message works in Chrome, but fails in Firefox.


    greentechie
    Participant

    That Fiddle link is still wrong, hopefully this one will be correct:

    I have now tested Microsoft Edge too. All browsers lose formatting when “Set Rich Text” button is clicked twice. Edge correctly displays val() of editor following setMode, where Firefox fails.

    Clicking “Set HTML” twice corrupts text by changing it into a text version of the actual HTML. This happens in Firefox, Chrome and Edge.


    greentechie
    Participant

    This is the text of the link. It was removed from my post, although the HTML looked correct: http://jsfiddle.net/greentechie/1vrLmrko/5/


    greentechie
    Participant

    OK, so it failed when I entered the link using the “link” button to enter the link, but worked when I justed pasted it into the text.


    Peter Stoev
    Keymaster

    Hi greentechie,

    Ok, thank you for the feedback. We will look into the reported behavior in future versions of jqxEditor.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

Viewing 10 posts - 16 through 25 (of 25 total)

You must be logged in to reply to this topic.