javascript – 如何将(编程)google字体添加到ckeditor

我刚下载CKEditor,它很棒.虽然我注意到它松弛了字体.
所以我认为能够将Google Web Fonts添加到CKEditor以添加功能是个好主意.

我在线搜索但我只能找到如何手动进入并在config.js文件添加每个字体.

有人可以帮助我以编程方式将所有Google Web字体添加到CKEditor并显示如何.

解决方法

好的,我找到了答案.我在这里发帖,所以对于那些正在寻找相同内容的人来说,这可能会有所帮助.所以这里是:
myFonts = ['Aclonica','Allan','Allerta','Allerta Stencil','Amaranth','Angkor','Annie Use Your Telescope','Anonymous Pro','Anton','Architects Daughter','Arimo','Artifika','Arvo','Astloch','Bangers','Battambang','Bayon','Bentham','Bevan','Bigshot One','Bokor','Brawler','Buda','Cabin','Cabin Sketch','Calligraffitti','Candal','Cantarell','Cardo','Carter One','Caudex','Chenla','Cherry Cream Soda','Chewy','Coda','Coda Caption','Coming Soon','Content','copse','Corben','Cousine','Covered By Your Grace','Crafty Girls','Crimson Text','Crushed','Cuprum','damion','Dancing Script','Dangrek','Dawning of a New Day','Didact Gothic','Droid Sans','Droid Sans Mono','Droid Serif','EB Garamond','Expletus Sans','Fontdiner Swanky','Francois One','Freehand','GFS Didot','GFS Neohellenic','Geo','Goudy Bookletter 1911','Gruppo','Handlee','Hanuman','Holtwood One SC','Homemade Apple','IM Fell DW Pica','IM Fell DW Pica SC','IM Fell Double Pica','IM Fell Double Pica SC','IM Fell English','IM Fell English SC','IM Fell french Canon','IM Fell french Canon SC','IM Fell Great Primer','IM Fell Great Primer SC','Inconsolata','Indie Flower','Irish grover','Josefin Sans','Josefin Slab','Judson','Jura','Just Another Hand','Just Me Again Down Here','Kenia','Khmer','Koulen','Kranky','Kreon','Kristi','Lato','League Script','Lekton','Limelight','Lobster','Lora','Luckiest Guy','Maiden Orange','Mako','Maven Pro','Meddon','MedievalSharp','Megrim','Merriweather','Metal','Metrophobic','Michroma','Miltonian','Miltonian Tattoo','Molengo','Monofett','Moul','Moulpali','Mountains of Christmas','Muli','Neucha','Neuton','News Cycle','Nobile','Nova Cut','Nova Flat','Nova Mono','Nova oval','Nova Round','Nova Script','Nova Slim','Nova Square','Nunito','OFL Sorts Mill Goudy TT','odor Mean Chey','Old Standard TT','Open Sans','Open Sans Condensed','Orbitron','Oswald','Over the Rainbow','PT Sans','PT Sans Caption','PT Sans Narrow','PT Serif','PT Serif Caption','Pacifico','Paytone One','Permanent Marker','Philosopher','Play','Playfair display','Podkova','Preahvihear','Puritan','Quattrocento','Quattrocento Sans','Radley','Raleway','Reenie Beanie','Rock Salt','Rokkitt','Ruslan display','Schoolbell','Shanti','Siemreap','Sigmar One','Six Caps','Slackey','Smythe','Sniglet','Special Elite','Sue Ellen Francisco','Sunshiney','Suwannaphum','Swanky and Moo Moo','Syncopate','Tangerine','Taprom','Tenor Sans','Terminal Dosis Light','The Girl Next Door','Tinos','Ubuntu','Ultra','UnifrakturCook','UnifrakturMaguntia','Unkempt','VT323','Vibur','Vollkorn','Waiting for the Sunrise','Wallpoet','Walter Turncoat','Wire One','Yanone Kaffeesatz'];

config.font_names = 'serif;sans serif;monospace;cursive;fantasy';

for(var i = 0; i<myFonts.length; i++){
            config.font_names = config.font_names+';'+myFonts[i];
            myFonts[i] = 'http://fonts.googleapis.com/css?family='+myFonts[i].replace(' ','+');
}

config.contentsCss = ['/ckeditor/contents.css'].concat(myFonts);

干杯,

Praney

相关文章

前言 做过web项目开发的人对layer弹层组件肯定不陌生,作为l...
前言 前端表单校验是过滤无效数据、假数据、有毒数据的第一步...
前言 图片上传是web项目常见的需求,我基于之前的博客的代码...
前言 导出Excel文件这个功能,通常都是在后端实现返回前端一...
前言 众所周知,js是单线程的,从上往下,从左往右依次执行,...
前言 项目开发中,我们可能会碰到这样的需求:select标签,禁...