Baidu Editor (baidu. editor), Editor baidu. editor

Source: Internet
Author: User

Baidu Editor (baidu. editor), Editor baidu. editor

The editor is usually used in some forums or blog websites. Now I will explain how to generate the editor using Jquery on the page.

1. Page code:

   Introduce relevant JS files:

   <Script type = "text/javascript" charset = "UTF-8" src = "~ /Content/ueditor. config. js "> </script>
<Script type = "text/javascript" charset = "UTF-8" src = "~ /Content/ueditor. all. min. js "> </script>
<Script type = "text/javascript" charset = "UTF-8" src = "~ /Content/ueditor/lang/zh-cn/zh-cn.js "> </script>
<Script type = "text/javascript" charset = "UTF-8" src = "~ /Content/ueditor/kityformula-plugin/addKityFormulaDialog. js "> </script>
<Script type = "text/javascript" charset = "UTF-8" src = "~ /Content/ueditor/kityformula-plugin/getKfContent. js "> </script>
<Script type = "text/javascript" charset = "UTF-8" src = "~ /Content/ueditor/kityformula-plugin/defaultFilterFix. js "> </script>
<Script type = "text/javascript" charset = "UTF-8" src = "~ /Content/ueditor/kityformula-plugin/kityformula/js/kity-formula-parser.all.min.js "> </script>
<Script type = "text/javascript" charset = "UTF-8" src = "~ /Content/ueditor/kityformula-plugin/kityformula/js/kityformula-editor.all.min.js "> </script>
<Script type = "text/javascript" charset = "UTF-8" src = "~ /Content/ueditor/kityformula-plugin/kityformula/js/kitygraph. all. js "> </script>

 

// Generate the editor

<Script type = "text/javascript">
$ (Document). ready (function (){
// Initialize Baidu Editor
Var editorOption = {
InitialFrameWidth: 784,
InitialFrameHeight: 300,
ElementPathEnabled: false,
WordCount: false, // disable word count statistics
// Customize the toolbar
Toolbars :[[
'Fullscreen', 'source', '|', 'undo ', 'redo', '| ',
'Bold ', 'italic', 'underline', 'fontborder', 'strikethangout', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset ', 'blockquote', 'pasteplain ',' | ', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '| ',
'Rowspacingtop', 'rowspacingbottom ', 'lineheight',' | ',
'Customstyle', 'paragraph', 'fontfamily ', 'fontsize',' | ',
'Ctionityalityltr', 'ctionctionalityrtl ', 'indent', '| ',
'Justifyleft', 'justifycenter', 'justifyright', 'justifyjustify ',' | ', 'touppercase', 'tolowercase',' | ',
'Link', 'unlink', 'anchor', '|', 'imagenone', 'imageleft ', 'imageright', 'imagecenter', '| ',
'Simpleupload', 'insertimage', 'expression', 'scrawl ', 'insertvideo', 'music', 'attachment', 'map', 'gmap', 'insertframework ', 'insertcode', 'webapp', 'pagebreak', 'template', 'background', '| ',
'Horizontal ', 'date', 'time', 'spechars', 'snapscreen', 'wordimage',' | ',
'Inserttable', 'deleteable', 'delete', 'insertrow', 'deleteterow ', 'insertcol', 'deletecol', 'mergecells ', 'mergeright', 'mergelow ', 'splittocell', 'splittorows ', 'splittocols', 'charts',' | ',
'Print ', 'preview', 'searchreplace', 'help', 'drafs', 'kityformula', 'preview'
]

}
Var editor = new baidu. editor. ui. Editor (editorOption );
Editor. render ('description ');

// When submitting a form, assign the content entered in the editor to the corresponding form field.
$('Form1 '). submit (function (){
$ ('# Description'). val (editor. getContent ());
});
})

</Script>

 

<Div class = "form-group">
<Label class = "control-label col-sm-2"> question content: </label>
<Div class = "col-sm-2">
@ Html. TextAreaFor (model => model. description)
</Div>
@ Html. ValidationMessageFor (model => model. description)
</Div>

2. Baidu editor effect after generation

 

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.