2amigos / yii2-ckeditor-widget

CKEditor WYSIWYG widget for Yii2.
https://2amigos.us/open-source/ckeditor-widget
Other
172 stars 112 forks source link

Toolbar items Image , Link not working in Modal #75

Closed shahzadthathal closed 7 years ago

shahzadthathal commented 8 years ago

I have integrate my form in modal and then use this widget in modal form but when I click on Image or Link button in toolbar , it show a new popup but input fields are not getting any value, even I'm unable to click on those fields.

<?php Modal::begin([ "id"=>"ajaxCrudModal", "footer"=>"",// always need it for jquery plugin ])?> <?php Modal::end(); ?>

How should I solve this issue?

tonydspaniard commented 7 years ago

@shahzadthathal is it content ajaxed? ~if so, the problem is that the plugin needs to be re-initialized~. If not, then make sure you have no CSS conflicts with the overlay.

Resmedia commented 7 years ago

@shahzadthathal add this after your code in modal or in config.js if this not in vendor and will be OK. I had same problem.


<script>
    $.fn.modal.Constructor.prototype.enforceFocus = function () {
        modal_this = this
        $(document).on('focusin.modal', function (e) {
            if (modal_this.$element[0] !== e.target && !modal_this.$element.has(e.target).length
                && !$(e.target.parentNode).hasClass('cke_dialog_ui_input_select')
                && !$(e.target.parentNode).hasClass('cke_dialog_ui_input_text')) {
                modal_this.$element.focus()
            }
        })
    };
</script>
shahzadthathal commented 7 years ago

Thanks I will try.

tonydspaniard commented 7 years ago

Thank you @Resmedia for the sample. Very kind of you.