[英]content css ignored after setData in CKEditor
I get the text and add some classes to spans. 我得到了文本,并在span中添加了一些类。 setData updates the content but the content css is not applied.
setData更新内容,但不应用内容CSS。
I can inspect(in Chrome) and see the new classes. 我可以检查(在Chrome中)并查看新类。 I toggle on a Drupal page between flat text and WYSIWYG(disable-enable rich text) and it looks fine.
我在纯文本和所见即所得(禁用启用富文本)之间的Drupal页面上切换,看起来还不错。
it is as if the editor forgets or stops applying the content css on setData 就像编辑器忘记或停止在setData上应用内容CSS一样
I tried: 我试过了:
function submitaftersetdata() { this.updateElement(); this.checkdirty; CKEDITOR.config.contentsCss = 'http://www.mooyai.com/sites/all/modules/custom/languagetool/atd-ckeditor/atd.css'; alert('done'); } editor.setData(editorContents, submitaftersetdata);
editor.insertHtml(editorContents);
works fine to add the new text and looks correct(the content css is applied) 可以正常工作以添加新文本并看起来正确(已应用内容CSS)
setData to empty '' then insert works but again breaks the css setData为空''然后插入工作,但再次破坏CSS
I found a weak work around: 我发现周围的工作很弱:
editor.execCommand( 'selectAll' ); editor.insertHtml(editorContents);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.