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