Javascript NicEditor字体大小mody from<;字体大小=';1'&燃气轮机;标记到<;跨度样式=';字体大小:8px'&燃气轮机;
嗨,我正在使用NicEditor,我想在不同的方式字体大小的工作。现在,编辑器使用:Javascript NicEditor字体大小mody from<;字体大小=';1'&燃气轮机;标记到<;跨度样式=';字体大小:8px'&燃气轮机;,javascript,textbox,text-editor,nicedit,rich-text-editor,Javascript,Textbox,Text Editor,Nicedit,Rich Text Editor,嗨,我正在使用NicEditor,我想在不同的方式字体大小的工作。现在,编辑器使用: 此处选择的文本 我不想把它变成一个span标签,即 此处选择的文本 以下是下拉列表的代码: var nicEditorFontSizeSelect = nicEditorSelect.extend({ sel : {1 : '1 (8pt)', 2 : '2 (10pt)', 3 : '3 (12pt)', 4 : '4 (14pt
此处选择的文本
我不想把它变成一个span标签,即
此处选择的文本
以下是下拉列表的代码:
var nicEditorFontSizeSelect = nicEditorSelect.extend({
sel : {1 : '1 (8pt)', 2 : '2 (10pt)', 3 : '3 (12pt)', 4 : '4 (14pt)', 5 : '5 (18pt)', 6 : '6 (24pt)', 7 : '7 (36pt)', 8 : '8 (48pt)', 9 : '9 (72pt)', 10 : '10 90pt)', 11 : '11 (100pt)'},
init : function() {
this.setDisplay('Font Size...');
for(itm in this.sel) {
this.add(itm,'<font size="'+itm+'">'+this.sel[itm]+'</font>');
}
}
});
var nicEditorFontSizeSelect=nicEditorSelect.extend({
选择:{1:'1(8pt)'2:'2(10pt)'3:'3(12pt)'4:'4(14pt)'5:'5(18pt)'6:'6(24pt)'7:'7(36pt)'8:'8(48pt)'9:'9(72pt)'10:'1090pt)'11:'11(100pt)},
init:function(){
此.setDisplay('Font Size…');
for(此.sel中的itm){
this.add(itm,“+this.sel[itm]+”);
}
}
});
但是我找不到要修改的代码,因此它将把font
替换为文本区域内的span
标记
欢迎提出任何建议
谢谢知道这是一个老问题,但如果其他人需要答案,就在这里 请注意,这是非常基本的,可能与改进有关,例如,它将创建嵌套的 无论如何,在初始化nicEditor之前添加此JS代码,创建自定义插件:
var nicSelectOptionsCustomFormat = {
buttons : {
'fontCustomSize' : {name : __('Font size'), type : 'nicEditorCustomFormatSelect'}
}
};
var nicEditorCustomFormatSelect = nicEditorSelect.extend({
sel : {'11px' : '11px', '13px' : '13px', '15px' : '15px', '19px' : '19px', '22px' : '22px'},
init : function() {
this.setDisplay('Font size');
for(itm in this.sel) {
this.add(itm,'<span style="size:'+itm+'">'+this.sel[itm]+'</span>');
}
}
,update : function(elm) {
var newNode = document.createElement('span');
newNode.style.fontSize = elm;
var rng = this.ne.selectedInstance.getRng().surroundContents(newNode);
this.close();
}
});
nicEditors.registerPlugin(nicPlugin,nicSelectOptionsCustomFormat);
知道这是一个老问题,但如果其他人需要答案,这里就是 请注意,这是非常基本的,可能与改进有关,例如,它将创建嵌套的 无论如何,在初始化nicEditor之前添加此JS代码,创建自定义插件:
var nicSelectOptionsCustomFormat = {
buttons : {
'fontCustomSize' : {name : __('Font size'), type : 'nicEditorCustomFormatSelect'}
}
};
var nicEditorCustomFormatSelect = nicEditorSelect.extend({
sel : {'11px' : '11px', '13px' : '13px', '15px' : '15px', '19px' : '19px', '22px' : '22px'},
init : function() {
this.setDisplay('Font size');
for(itm in this.sel) {
this.add(itm,'<span style="size:'+itm+'">'+this.sel[itm]+'</span>');
}
}
,update : function(elm) {
var newNode = document.createElement('span');
newNode.style.fontSize = elm;
var rng = this.ne.selectedInstance.getRng().surroundContents(newNode);
this.close();
}
});
nicEditors.registerPlugin(nicPlugin,nicSelectOptionsCustomFormat);