DAUM Editor

Folder: /web/ext/daumeditor

Example pages: /ml/sample/daumeditor/main.jsp /ml/doc2/DocEdit.jsp, /ml/doc2/DocView.jsp, ...

load content

Editor initialization:

Editor.init({
    form: "formId", // required form id ( default: "form" )
    canvas: {
        readonly: true // readonly view
    }
});

Set content editor:

//NO AJAX CALL:

Editor.modify({
    "content": "test"
});
...

//AJAX CALL:

$.ajax({
    url: "/Common/FileView.action",
    data: {
        "fileForm.revid": "${view.revid}"
    },
    type: "POST",
    dataType: "html"
}).done( function(data){
    Editor.modify({
        "content": data
    });
});
<div class="editor-container">
<%@ include file="/ext/daumeditor/editor.jsp"%>
</div>

save content

$.ajax({
    url: ...,
    data: {
        "content" : Editor.getContent(),
        ...
    },
    ...
});

Custom available functions:

  1. Editor.init();

    required to inizialize the editor

  2. Editor.readonly(param);

    put the editor in readonly mode parameter: true|false

  3. Editor.resize(height);

    resize the editor

  4. Editor.onReady().done(function(){//do something});

    using this function ensures the editor is ready

  5. Editor.getDocument();

    return the Document object of the editor ( https://developer.mozilla.org/en-US/docs/Web/API/Document )

  6. Editor.download(filename);

    will save the content of the editor in a temporary file parameter filename // default value: template.html

  7. Editor.print()

    will print the content of the editor