How to use CKEditor in a Bootstrap Modal?

后端 未结 14 1172
名媛妹妹
名媛妹妹 2020-11-30 04:14

If I use the CKEditor plugin in an HTML page based on a Bootstrap template, it works great, however if I insert the editor on a Bootstrap Modal like this

<         


        
相关标签:
14条回答
  • 2020-11-30 04:53

    This worked for me with bootstrap 4.4 and ckeditor 4.14. All you need to do is to initialize the ckeditor in your modal's shown.bs.modal event.

    $('#yourModal')
        .on('shown.bs.modal', (e) => {
            CKEDITOR.replace('editor')
    });
    

    worked like a charm.

    0 讨论(0)
  • 2020-11-30 04:55

    Don't know, maybe in my version it's already fixed, but my solution is:

        $("#messageModal").on('shown.bs.modal', function() {
         CKEDITOR.replace('message', {
           height: '400px',
           width: '100%'
         });
       })
    
    0 讨论(0)
提交回复
热议问题