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

前端之家收集整理的这篇文章主要介绍了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

原文链接:https://www.f2er.com/js/155623.html

猜你在找的JavaScript相关文章