N°2166: Portal: fields in CKEditor modals are inactive

This commit is contained in:
Stephen Abello
2019-05-15 15:41:38 +02:00
parent 70d2bb163c
commit b157fad0b6
2 changed files with 27 additions and 7 deletions

View File

@@ -94,6 +94,7 @@
<script type="text/javascript" src="{{ app['combodo.absolute_url'] ~ 'js/d3.min.js'|add_itop_version }}"></script>
<script type="text/javascript" src="{{ app['combodo.absolute_url'] ~ 'js/c3.min.js'|add_itop_version }}"></script>
<script type="text/javascript" src="{{ app['combodo.portal.base.absolute_url'] ~ 'lib/bootstrap/js/bootstrap.min.js'|add_itop_version }}"></script>
<script type="text/javascript" src="{{ app['combodo.portal.base.absolute_url'] ~ 'js/bootstrap-patches.js'|add_itop_version }}"></script>
<script type="text/javascript" src="{{ app['combodo.absolute_url'] ~ 'js/latinise/latinise.min.js'|add_itop_version }}"></script>
{# Visible.js to check if an element is visible on screen #}
<script type="text/javascript" src="{{ app['combodo.portal.base.absolute_url'] ~ 'lib/jquery-visible/js/jquery.visible.min.js'|add_itop_version }}"></script>
@@ -458,13 +459,6 @@
$(this).removeData('bs.modal');
$(this).find('.modal-content').html(GetContentLoaderTemplate());
});
// Hack to enable multiple modals by making sure the .modal-open class is set to the <body> when there is at least one modal open left
$('body').on('hidden.bs.modal', function () {
if($('.modal.in').length > 0)
{
$('body').addClass('modal-open');
}
});
// Hide tooltips when a modal is opening, otherwise it might be overlapping it
$('body').on('show.bs.modal', function () {
$(this).find('.tooltip.in').tooltip('hide');

View File

@@ -0,0 +1,26 @@
/*
* Patches for bootstrap 3 as it is no longer maintained by its editor
*/
//N°2166: Fix a boostrap/CKeditor incompatibility with their respective modals (source: https://stackoverflow.com/a/23667151)
$.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
// add whatever conditions you need here:
&&
!$parent.hasClass('cke_dialog_ui_input_select') && !$parent.hasClass('cke_dialog_ui_input_text')) {
$modalElement.focus()
}
})
};
// Hack to enable multiple modals by making sure the .modal-open class is set to the <body> when there is at least one modal open left
$(document).ready(function() {
$('body').on('hidden.bs.modal', function () {
if ($('.modal.in').length > 0) {
$('body').addClass('modal-open');
}
});
});