SetHTMLCode ?

Last post 03-06-2014, 11:09 PM by khosango. 4 replies.
Sort Posts: Previous Next
  •  01-20-2014, 1:28 PM 78793

    SetHTMLCode ?

     Hi

     

    I have used GetPointNode to get the HTML out of a UL list by the user just clicking somewhere in it.

    After doing some work I would like to update the UL list, however while I can get GetHTMLCode there doesn't seem to be a method to update the HTML of an object selected by GetPointNode. 

     

    I tried using SetInnerText() but that strips out all the HTML and just inserts text. In the previous editor I just used innerHTML, but this is not on your object neither is SetHtmlCode which would have been the logical one.

     

    Do you have any suggestions please.

     

    Thanks 

     
  •  01-20-2014, 11:11 PM 78795 in reply to 78793

    Re: SetHTMLCode ?

    Dear AndyFel,

     

    1.             var html = editor.ExtractRangeHTML(true);  
    2.             var newhtml= xxxxxxxxx;  
    3.             editor.InsertHTML(newhtml); 

     

    ExtractRangeHTML will remove the range html when the argument is true

    please refer to 

    http://www.richtexteditor.com/test/jsmethod/extractrangehtml.aspx 

     

    for more Javascript Method of RTE,

    please go to http://www.richtexteditor.com/test/

    See  Js Methods section 

     

    Regards,

    Jeff 

  •  01-22-2014, 6:03 AM 78802 in reply to 78795

    Re: SetHTMLCode ?

    Hi

     

    Thanks to the link to the full javascript list I was able to achieve what I wanted. I am afraid the example jeff gave did not work because ExtractRangeHTML and InsertHTML only affect the selected text. As we have nothing selected just a point where its clicked ExtractRangeHTML returned nothing and InsertHTML just wacked the html into the middle of the stuff I wanted replacing. However I did find a function that helped.....

     

    var node = editor.GetPointNode();

    editor.SelectControl(node);

    editor.InsertHTML(html);

     

    By using the selectcontrol I was able to highlight the control I wanted to replace then InsertHTML worked as we wanted.

  •  01-25-2014, 6:52 AM 78833 in reply to 78793

    Re: SetHTMLCode ?

    Hi,

     

    Some API maybe doesn't work as expected 

     

    I will do some research on it and reply you next week.

     

    Regards,

    Terry

     

  •  03-06-2014, 11:09 PM 80033 in reply to 78793

    Re: SetHTMLCode ?

View as RSS news feed in XML