Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/399.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript NicEditor字体大小mody from<;字体大小=';1'&燃气轮机;标记到<;跨度样式=';字体大小:8px'&燃气轮机;_Javascript_Textbox_Text Editor_Nicedit_Rich Text Editor - Fatal编程技术网

Javascript NicEditor字体大小mody from<;字体大小=';1'&燃气轮机;标记到<;跨度样式=';字体大小:8px'&燃气轮机;

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&nbsp;(8pt)', 2 : '2&nbsp;(10pt)', 3 : '3&nbsp;(12pt)', 4 : '4&nbsp;(14pt

嗨,我正在使用NicEditor,我想在不同的方式字体大小的工作。现在,编辑器使用:

此处选择的文本

我不想把它变成一个span标签,即

此处选择的文本

以下是下拉列表的代码:

var nicEditorFontSizeSelect = nicEditorSelect.extend({
    sel : {1 : '1&nbsp;(8pt)', 2 : '2&nbsp;(10pt)', 3 : '3&nbsp;(12pt)', 4 : '4&nbsp;(14pt)', 5 : '5&nbsp;(18pt)', 6 : '6&nbsp;(24pt)', 7 : '7&nbsp;(36pt)', 8 : '8&nbsp;(48pt)', 9 : '9&nbsp;(72pt)', 10 : '10&nbsp;90pt)', 11 : '11&nbsp;(100pt)'},
    init : function() {
        this.setDisplay('Font&nbsp;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);