如何更改ckeditor iframe CSS样式
发布时间:2020-12-14 18:32:19 所属栏目:资源 来源:网络整理
导读:我无法弄清楚如何修改CKeditor iframe的body CSS样式.我已经尝试了一系列基于网络上各种潜在解决方案的选项,但我对CKeditor的API并不是很熟悉,这使得事情变得相当困难.这是(具体)CKeditor 4.4.3. 您可以在以下JSfiddle中看到各种尝试(已评论): http://jsfid
我无法弄清楚如何修改CKeditor iframe的body CSS样式.我已经尝试了一系列基于网络上各种潜在解决方案的选项,但我对CKeditor的API并不是很熟悉,这使得事情变得相当困难.这是(具体)CKeditor 4.4.3.
您可以在以下JSfiddle中看到各种尝试(已评论): http://jsfiddle.net/KS3p4/1/ CKEDITOR.stylesSet.add( 'style_updates',[ // ATTEMPT 1 // Block-level styles...this is for the dropdown menu (not shown in current config) { name: 'Body Margin Fix',element: 'body',styles: { margin: '10px' } } ]); editor = $('textarea').ckeditor( function(editor){ // ATTEMPT 2 //callback `this` refers to CKEDITOR.editor this.ckeditorGet().addCss('body { margin:10px; }') },{ // ATTEMTP 3 addCss: 'body { margin:10px; }',stylesSet: 'styles_updates',uiColor: '#FFFFFF',scayt_autoStartup: true,autoGrow_onStartup: true,enterMode: CKEDITOR.ENTER_BR,removePlugins: 'elementspath,resize',toolbar: [ { name: 'basicstyles',groups: [ 'basicstyles','cleanup' ],items: [ 'Bold','Italic','Underline' ] },{ name: 'clipboard',groups: [ 'clipboard','undo' ],items: [ 'PasteFromWord','Undo','Redo' ] },{ name: 'links',items: [ 'Link','Unlink' ] },{ name: 'editing',groups: [ 'spellchecker' ],items: [ 'Scayt' ] },{ name: 'tools',items: [ 'Maximize' ] } ] // ATTEMPT 4 }).ckeditorGet().addCss('body { margin:10px; }'); 解决方法
编辑位于主CKEditor目录中的contents.css文件,或使用
config.contentsCss 设置加载其他文件.
我看到你将样式系统设置与内容样式混淆了.这是两个完全不同的东西 – 样式系统负责应用和删除所选内容的“样式” – 例如它使用按样式和格式下拉以及粗体或斜体按钮 – 所有这些都是“样式”. 至于 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容