I set the font-family in the jquery.jwysiwyg.js (line-# 497 where < body > is defined) and added a CSS …

$('#wysiwyg').wysiwyg({css : { fontFamily: 'Arial, Tahoma', fontSize : '12px', color : '#333333'}});

The textarea shows Arial as font-family but when I click the remove formatting button it turns to Times New Roman. Is there any way I can set a default font to prevent this? I don't want Times as a base font.

有帮助吗?

解决方案

Because jwysiwyg renders in an iframe, the styles of the containing page will not render (as it is actually a separate HTML file) and so jwysiwyg will default to the standard font for the browser, which is usually Times New Roman.

You can use an external stylesheet to counter this issue like so:

$('#wysiwyg').wysiwyg({
    css: 'editor.css'
});

And within editor.css you would put body { font-family: "Arial, Tahoma"; }.

其他提示

Use arial black or arial narrow, for example:

font_formats: "Andale Mono=andale mono,times;"+
        "Arial=arial narrow,avant garde;"+
        "Arial Black=arial black,avant garde;"+
        "Courier New=courier new,courier;"+
        "Georgia=georgia,palatino;"+
        "Impact=impact,chicago;"+
        "Symbol=symbol;"+
        "Tahoma=tahoma,arial,helvetica,sans-serif;"+
        "Times New Roman=times new roman,times;"+
        "Verdana=verdana,geneva;"+
        "Webdings=webdings;"+
        "Wingdings=wingdings,zapf dingbats",
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top