javascript - How to resize CKEditor to fit its parent div - Stack Overflow

I have a CKeditor which is placed in a parent div. What is the best way to have the CKEditor exactly fi

I have a CKeditor which is placed in a parent div. What is the best way to have the CKEditor exactly fit the div and resize when the div resizes? If possible I would prefer solutions which don't involve jQuery. If this is not possible solutions using jQuery would be fine to.

I have a CKeditor which is placed in a parent div. What is the best way to have the CKEditor exactly fit the div and resize when the div resizes? If possible I would prefer solutions which don't involve jQuery. If this is not possible solutions using jQuery would be fine to.

Share Improve this question edited Mar 23, 2021 at 0:28 Jason Aller 3,65228 gold badges41 silver badges39 bronze badges asked Jan 4, 2013 at 10:28 user1257239user1257239
Add a ment  | 

3 Answers 3

Reset to default 6
var editor = CKEDITOR.replace( 'editor' );

...

And then, in event of your choice, do this:

editor.resize($("#elem").width(),$("#elem").height());

Hope this helped.

Use the width attribute when you call ckeditor.

<script type="text/javascript">
//<![CDATA[

CKEDITOR.replace( 'page_content',
{
    toolbar : 'MyToolbar',
    width : '100%'


});

//]]>
</script>

Since the call to initialize the editor is done with jquery, this is the best way.

edit: This will cause ckeditor to auto-resize when the div width changes as well.

If someone needs this now, I added this to my css file:

#cke_id_text {
  width: fit-content!important;
}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1743782004a4505974.html

相关推荐

  • javascript - How to resize CKEditor to fit its parent div - Stack Overflow

    I have a CKeditor which is placed in a parent div. What is the best way to have the CKEditor exactly fi

    7天前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信