更改所见即所得编辑器上的字体大小选项? [英] Changing font size options on WYSIWYG editor?

查看:136
本文介绍了更改所见即所得编辑器上的字体大小选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个

So I have a bootstrap wysiwyg editor from a jqueryscript.net plugin and I'm trying to give more font options in the font size dropdown. So I went into the JS and found the var for it and changed it from like small, medium, large, huge into more precise sizes like 10px, 11px, 12px, etc. But when I got into the editor to test it out, it's still using the old font sizes, so when I go from like 5px-10px it's the small medium size.. etc. I've looked and looked and looked in the JS which isn't too in depth and cannot find how it's pulling those in for the life of me! Does anyone have any clue how to adjust the font sizes correctly on this dropdown?? Thank you!!

我将代码放入jsfiddle中,因为它在这里太长了,尽管无法在其中工作.我必须删除js中用于打印功能的document.write才能保存它.

I put the code into a jsfiddle because it's too long for here, couldn't get it working in it though. I had to remove a document.write for the print function in the js to get it to save.

http://jsfiddle.net/wfaLa3h0/3/

code here

推荐答案

此问题的解决方案之后,我我们创建了一个自定义函数,用于将<font size="7">替换为所选字体大小的CSS.

Following the solution to this question, I've created a custom function for replacing <font size="7"> with CSS of the selected font size.

'font_size': { "select":true,
    "default": "Font size",
    "tooltip": "Font Size",
    "commandname":"fontSize", 
    "custom":function(button){
        document.execCommand("fontSize", false, "7");
        $("#contentarea font[size]").removeAttr("size")
            .css("font-size", $(button).data('value'));
    }
}

JSFiddle: http://jsfiddle.net/wfaLa3h0/6/

JSFiddle: http://jsfiddle.net/wfaLa3h0/6/

这篇关于更改所见即所得编辑器上的字体大小选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆