var ue = UE.getEditor('container', {
toolbars: [
['fullscreen', 'source', 'undo', 'redo', 'bold']
],
autoHeightEnabled: true,
autoFloatEnabled: true
});
从以上代码中可以看到,如果我们想在实例化的时候传入相应的定制参数,我们需要在UE.getEditor()方法中传入第二个参数,这个参数是一个数组
{toolbars: [[‘fullscreen’, ‘source’, ‘undo’, ‘redo’,’bold’]],autoHeightEnabled: true,autoFloatEnabled: true}
这个数组中的内容是可以自己定义的,具体定义内容可以参考http://fex.baidu.com/ueditor/#start-config
比如说根据官方给出的API我现在想使UEditor默认不显示,首先我要在API中找到那条负责这项功能,可以看到isShow {Boolean} [默认值:true] //默认显示编辑器,我们需要在实例化UEditor编辑器的时候向其传入这个参数,如下:
var ue = UE.getEditor('container', {
isShow: flase
});
以实现在初始化时完成对编辑器的设置
如何使用呢?
在代码中可以这样获取参数
var isShow = this.options.isShow;
这样就可以获取到传入的参数