CKEditor嵌入了图像,视频,链接和许多其他在Modal中不起作用的东西 [英] CKEditor embed Image, Video, link and many others not working in Modal
问题描述
您好,我正在使用引导程序模式弹出窗口来打开ckeditor。它可以正常工作,但是当我单击该对话框中的图像,视频链接和其他任何图标时,该按钮会打开,但无法单击。我找到了此JS修复程序,但似乎不适用于Bootstrap4。
Hello I am using bootstrap modal popup to open ckeditor. It's working but when I to click the image, video link and any others icon in that dialog opens, but is not clickable. I found this JS fix but it doesn't seem to work with Bootstrap 4.
<script>
CKEDITOR.replace('help_ldesc');
//CKEDITOR.replace('help_ldesc1');
$.fn.modal.Constructor.prototype.enforceFocus = function() {
var $modalElement = this.$element;
$(document).on('focusin.modal',function(e) {
var $parent = $(e.target.parentNode);
if ($modalElement[0] !== e.target && !$modalElement.has(e.target).length && $(e.target).parentsUntil('*[role="dialog"]').length === 0) {
$modalElement.focus();
}
});
};
</script>
演示: https://jsfiddle.net/waraywarayako/swxr110h/
来自此主题:在模式对话框中时,CKEditor图像对话框窗体不可点击
推荐答案
因此,在发现此修复程序之后( https://gist.github.com/kaddopur/9996231 )在Bs 3.1.1中工作,我比较了3.1.1和新v4之间的功能。 enforceFocus
函数已更改为 _enforceFocus
。更改它似乎已解决了以下问题:
So after finding out that this fix (https://gist.github.com/kaddopur/9996231) worked in Bs 3.1.1 I compared the functions between 3.1.1 and the new v4. The enforceFocus
function was changed to _enforceFocus
. Changing it seems to have fixed the issue:
$.fn.modal.Constructor.prototype._enforceFocus = function() {
modal_this = this
$(document).on('focusin', 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()
}
})
};
https://jsfiddle.net/q3xbw8o7/7/
这篇关于CKEditor嵌入了图像,视频,链接和许多其他在Modal中不起作用的东西的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!