This is a migrated thread and some comments may be shown as answers.

Inline Editor - Save editor data into HTML file and reload it into the editor to modify yet

3 Answers 309 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Jean-Marc
Top achievements
Rank 1
Jean-Marc asked on 03 Oct 2013, 09:44 AM
I'm using inline Editor.
I need to save the editor data into an HTML file and eventually reload the HTML file in the editor to modify it more times.

This is part of my aspx page.
<form id="form1" runat="server">
       <div id="example" class="k-content">
            <div id="editor" class="demo-section">
                <div id="topEditor">       
                    <p>Title</p>
                </div>
                <div contentEditable class="column">
                    <p> Description </p>
                </div>
            </div>
        </div>
</form>
And this are the code I used to inizialized editor 
 $(document).ready(function () {
             $("#topEditor").kendoEditor({
                tools: [
                        "bold",
                        "italic",
                        "underline"]
            });

            $(".column").kendoEditor({
                tools: [
                        "bold",
                        "italic",
                        "underline",]
            });
}

Since I don't initialize  $("#editor").kendoEditor() the code 
var editor= $('#editor').data("kendoEditor")
gives me an undefined value of variable 'editor' and I can't retrieve its content value.

Instead, if i use
            $('#editor').find("div").each(function () {
                var editor = $(this).data("kendoEditor");
                html += editor.value();
            });
I've the right content of each <div> .
The HTML I obtain is:
<p>Title</p><p>Description </p>
but 'cause it doesn't contain <div> element I can't reload it into editor and have the originally document.
            
There's a simple way to get HTML editor data in the right format  that I can re-load in the inline editor more times?

Thanks

3 Answers, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 04 Oct 2013, 02:58 PM
Hi Jean-Marc,

I am not sure if I understand you correctly, so please accept my apologizes if my answer is not satisfactory enough.

You can get the inner html of the Editor, using the html() jQuery method, that will return the div's that the contents is wrapped within. Please check the following example:

http://jsbin.com/ebAgONA/1/edit

Regards,
Kiril Nikolov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Jean-Marc
Top achievements
Rank 1
answered on 10 Oct 2013, 08:10 AM
Thanks Kiril,
your solution works perfectly.


0
Kiril Nikolov
Telerik team
answered on 11 Oct 2013, 07:44 AM
Hi Jean-Marc,

I am glad you find the provided solution helpful.

If you need any further assistance, please do not hesitate to contact us.
 
Regards,
Kiril Nikolov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Editor
Asked by
Jean-Marc
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Jean-Marc
Top achievements
Rank 1
Share this question
or