Ueditor Set default font, size, and color; carriage return event capture

Source: Internet
Author: User

Simple record, the recent work to use a rich text box, using the former colleague Ueditor, Baidu's open source software. http://ueditor.baidu.com/doc/

Their API bad look, good hard, Baidu search for a long time there is not much information, and finally to see the source, found a better way to modify: Ueditor with the IFRAME to implement the edit box, set body style,

Default font and color
UE.dom.domUtils.setStyles (Self.ue.body, {
' Color ': ' #868686 ', ' font-family ': ' ' Microsoft yahei ', ' Helvetica Neue ', Helvetica, Stheiti, Arial, Sans-serif ', ' Font-size ': ' 14px '
});

See someone on the net directly to change Ueditor.all.js file I feel too rough (http://blog.csdn.net/yxstars/article/details/44655857), use my this way of configuration will be better, And you can set different styles in different instances, which is better.

By the way: Modify the configuration file ueditor.config.js just modify the optional, can not modify the default value, so when the instance to the options, or editor.setopt (Object) These are useless.

################ Below is my code snippet, I also realized the function of return to send, I hope to help other friends

# # # # code begin ############

Instantiation Editor
var = this;
Self.ue = ue.geteditor (' editor ', {toolbars: []});
Self.ue.ready (function () {
Self.isloadedue = true;
Set Global.ueditor
Global.ueditor = Self.ue;

Self.ue.setDisabled ();
Default font and color
UE.dom.domUtils.setStyles (Self.ue.body, {
' Color ': ' #868686 ', ' font-family ': ' ' Microsoft yahei ', ' Helvetica Neue ', Helvetica, Stheiti, Arial, Sans-serif ', ' Font-size ': ' 14px '
});
Enter send
UE.dom.domUtils.on (self.ue.body, ' KeyUp ', function (event) {
if (Event.keycode = = 13) {
Console.log (' enter OK ');
Event.preventdefault ();
Event.stoppropagation ();
Self.sendmsg ();
}
});
});

################ Code End ############

Ueditor Set default font, size, and color; carriage return event capture

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.