Baidu Editor Ueditor initialize loading content failure resolution

Source: Internet
Author: User

The project is useful to the Baidu text editor Ueditor, when the page loads when initializing the editor content, use

$.document.ready (function ()

{

Ue.geteditor (' editor '). SetContent (' welcome ');

})

The SetContent method failed to load the content, prompted the editor to empty, and later thought that the editor might not have finished loading the script to cause it to execute. After looking for information on the Internet, you can judge the Ueditor editor to finish loading and then load the content:

The core content is as follows

var editor_a=New Baidu.editor. ui. editor (Editoroption     Editor_a.render ( ' myeditor ' )     Editor_a.ready (function ()  {
        Editor_a.setcontent ($ ( ' #content ' val     }

Specific examples:

$(document).Ready(function(){
Custom Editor configuration item, where the configuration item defined here overrides the configuration with the same name in Editor_config.js
var editoroption={
Here you can choose the name of the tool button you need, here only the following five
Toolbars:[[' Fullscreen ',' Source ',' Undo ',' Redo ',' Bold ',' ForeColor ',' Link ',' Highlightcode ']],
Automatically empties content when initializing at focus
Autoclearinitialcontent:True,
Close ElementPath
Elementpathenabled:False
};
var editor_a=New Baidu.Editor.Ui.Editor(editoroption);
Editor_a.Render(' Myeditor ');
Editor_a.ready (function ({
        Editor_a.setcontent ($ ' #content ' Val () ) ;  / /Assign to Ueditor
    })     $ ' #title ' Val (Title) ; //title assignment
})

try{
Ue.geteditor (' Ueditor '). Ready (function () {
Ue.geteditor (' Ueditor '). SetContent ("content"); Assign a value to Ueditor
});
}
catch (E)
{

}

Http://www.cnblogs.com/treasurelife/p/3734104.html

The online documentation is not comprehensive enough for ueditor, and some common methods and basic settings are collected for reference.
1. Create editor
Ue.geteditor (' editor ', {
Initialframewidth: "100%"//Initialization options
})
Lite version
Ue.geteditor (' editor ')
2. Delete Editor
Ue.geteditor (' editor '). Destroy ();
3. Set focus
Ue.geteditor (' editor '). focus ();
4. Get Editor Content
Ue.geteditor (' editor '). GetContent ()
5. Whether the editor has content
Ue.geteditor (' editor '). Hascontents ()
6. Get editor content in plain text format
Ue.geteditor (' editor '). Getcontenttxt ()
7. Get formatted plain text
Ue.geteditor (' editor '). Getplaintxt ()
8. Enable Editor
Ue.geteditor (' editor '). setenabled ();
9. Forbidden to edit
Ue.geteditor (' editor '). setdisabled (' fullscreen ');
10. Get the entire HTML content
Ue.geteditor (' editor '). getallhtml ()
11. Common Settings
Imageurl:ueditor_home_url + ". /yunserver/yunimageup.php ",//Picture upload interface
ImagePath: "/http",

Scrawlurl:ueditor_home_url + ". /yunserver/yunscrawlup.php ",//Graffiti interface
Scrawlpath: "/http",

Fileurl:ueditor_home_url + ". /yunserver/yunfileup.php ",//File Upload interface
FilePath: "/http",

Catcherurl:ueditor_home_url + "php/getremoteimage.php",//Get remote Picture interface
Catcherpath:ueditor_home_url + "php/",

Imagemanagerurl:ueditor_home_url + ". /yunserver/yunimgmanage.php ",//Picture management interface
Imagemanagerpath: "/http",

Snapscreenhost: ' ueditor.baidu.com ',
Snapscreenserverurl:ueditor_home_url + ". /yunserver/yunsnapimgup.php ",//interface
Snapscreenpath: "/http",

Wordimageurl:ueditor_home_url + ". /yunserver/yunimageup.php ",//word picture Dump interface
Wordimagepath: "/http",//

Getmovieurl:ueditor_home_url + ". /yunserver/getmovie.php ",//Get Video interface

Lang:/^zh/.test (navigator.language | | navigator.browserlanguage | | navigator.userlanguage)? ' ZH-CN ': ' en ',
Langpath:ueditor_home_url + "lang/",

Webappkey: "9hrmgf2ul4mlyk8kto2ziayd",
initialframewidth:860,//initialization width
initialframeheight:420,//initialization height
Focus:true//whether focus

Baidu Editor Ueditor initialize loading content failure resolution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.