Ckeditor 创建大小为>;的选择标记;1个编辑器插件
我的CKEDITOR插件需要创建Ckeditor 创建大小为>;的选择标记;1个编辑器插件,ckeditor,Ckeditor,我的CKEDITOR插件需要创建,但需要创建size属性。我尝试过在创建后添加size属性的各种方法,但到目前为止没有任何乐趣。这就是我所拥有的;创建了select,但它没有获得size属性 CKEDITOR.dialog.add('macrosDialog', function(editor) { return { // Basic properties of the dialog window: title, minimum size. title: 'Cadenza M
,但需要创建size
属性。我尝试过在创建后添加size
属性的各种方法,但到目前为止没有任何乐趣。这就是我所拥有的;创建了select
,但它没有获得size
属性
CKEDITOR.dialog.add('macrosDialog', function(editor) {
return {
// Basic properties of the dialog window: title, minimum size.
title: 'Cadenza Macros',
resizable: CKEDITOR.DIALOG_RESIZE_BOTH,
minWidth: 400,
minHeight: 200,
// Dialog window contents definition.
contents: [
{
// Definition of the Basic Settings dialog tab (page).
id: 'tab-basic',
label: 'Basic Settings',
// The tab contents.
elements: [
{
type: 'select',
id: 'groups',
name: 'groups',
label: 'Groups',
style: "height: 300",
items: [ [ 'Core Scala' ], [ 'Create Courses with Micronautics Cadenza' ], [ 'Java / Scala Interoperability' ], [ 'Play Framework' ] ],
'default': 'Play Framework'
},
{
// Text input field for the macro title (explanation).
type: 'text',
id: 'macroComment',
label: 'Comment',
validate: CKEDITOR.dialog.validate.notEmpty("Explanation field cannot be empty")
}
]
}
],
onLoad: function(e) {
var groups = editor.document.getElement("groups");
groups.setAttribute("size", 15);
//$("#groups").setAttr("size", 15);
},
onChange: function(e) {
alert('Group: ' + this.getValue());
},
// This method is invoked once a user clicks the OK button, confirming the dialog.
onOk: function() {
// The context of this function is the dialog object itself.
// http://docs.ckeditor.com/#!/api/CKEDITOR.dialog
var dialog = this;
// Creates a new <abbr> element.
var abbr = editor.document.createElement('abbr');
// Set element attribute and text, by getting the defined field values.
abbr.setAttribute('title', dialog.getValueOf('tab-basic', 'title'));
abbr.setText(dialog.getValueOf('tab-basic', 'abbr'));
// Finally, inserts the element at the editor caret position.
editor.insertElement(abbr);
}
};
});
CKEDITOR.dialog.add('macrosDialog',函数(编辑器){
返回{
//对话框窗口的基本属性:标题、最小大小。
标题:“华彩乐章宏”,
可调整大小:CKEDITOR.DIALOG\u RESIZE\u两者,
最小宽度:400,
身高:200,
//对话框窗口内容定义。
内容:[
{
//“基本设置”对话框选项卡(第页)的定义。
id:“基本选项卡”,
标签:“基本设置”,
//该选项卡包含以下内容。
要素:[
{
键入:“选择”,
id:'组',
名称:'组',
标签:“组”,
样式:“高度:300”,
项目:[“Core Scala”],[“使用Micronautics Cadenza创建课程”],[“Java/Scala互操作性”],[“Play Framework”],
“默认设置”:“播放框架”
},
{
//宏标题(说明)的文本输入字段。
键入:“文本”,
id:'宏注释',
标签:“评论”,
验证:CKEDITOR.dialog.validate.notEmpty(“解释字段不能为空”)
}
]
}
],
onLoad:函数(e){
var groups=editor.document.getElement(“组”);
组。设置属性(“大小”,15);
//$(“#组”).setAttr(“大小”,15);
},
onChange:函数(e){
警报('Group:'+this.getValue());
},
//一旦用户单击OK按钮并确认对话框,就会调用此方法。
onOk:function(){
//此函数的上下文是对话框对象本身。
// http://docs.ckeditor.com/#!/api/CKEDITOR.dialog
var dialog=这个;
//创建新元素。
var abbr=editor.document.createElement('abbr');
//通过获取定义的字段值来设置元素属性和文本。
abbr.setAttribute('title',dialog.getValueOf('tab-basic','title');
abbr.setText(dialog.getValueOf('tab-basic','abbr');
//最后,在编辑器插入符号位置插入元素。
编者:插入元素(缩写);
}
};
});
我使用html
元素插入我想要的任何内容:
contents: [
{
id: 'macrosDialog',
label: 'Basic Settings',
// The tab contents.
elements: [
{
type: 'hbox',
id: 'lists',
//style: "vertical-align: top",
widths: [ '25%', '25%', '25%', '25%' ],
children: [
{
type: 'html',
id: 'groups',
name: 'groups',
html: '<select size="15"></select>'
},{
type: 'html',
id: 'courses',
name: 'courses',
html: '<select size="15"></select>'
},{
type: 'html',
id: 'sections',
name: 'sections',
html: '<select size="15"></select>'
},{
type: 'html',
id: 'lectures',
name: 'lectures',
html: '<select size="15"></select>'
},
],
onLoad: function(data) {
var dialog = this.getDialog();
var groups = dialog.getContentElement('macrosDialog', 'lists', 'groups');
console.log(groups);
var courses = dialog.getContentElement('macrosDialog', 'lists', 'courses');
console.log(courses);
var sections = dialog.getContentElement('macrosDialog', 'lists', 'sections');
console.log(sections);
var lectures = dialog.getContentElement('macrosDialog', 'lists', 'lectures');
console.log(lectures);
}
}
]
}
]
内容:[
{
id:“宏对话框”,
标签:“基本设置”,
//该选项卡包含以下内容。
要素:[
{
类型:“hbox”,
id:'列表',
//样式:“垂直对齐:顶部”,
宽度:['25%,'25%,'25%,'25%,'25%,
儿童:[
{
键入:“html”,
id:'组',
名称:'组',
html:'
},{
键入:“html”,
id:'课程',
名称:'课程',
html:'
},{
键入:“html”,
id:'节',
名称:'节',
html:'
},{
键入:“html”,
id:“讲座”,
名称:"讲座",,
html:'
},
],
onLoad:函数(数据){
var dialog=this.getDialog();
var groups=dialog.getContentElement(“宏对话框”、“列表”、“组”);
控制台日志(组);
var courses=dialog.getContentElement('macrosDialog','lists','courses');
控制台日志(课程);
var sections=dialog.getContentElement('macrosDialog','lists','sections');
控制台日志(部分);
var touchts=dialog.getContentElement('macrosDialog','lists','touchts');
console.log(讲座);
}
}
]
}
]