N°7552 - Fix CKEditors table, hyperlinks, and other options inputs not working in iTop portal

This commit is contained in:
Stephen Abello
2024-07-12 10:49:20 +02:00
parent eb73b6b2f5
commit 21513f8df0

View File

@@ -24,19 +24,16 @@
*/ */
// N°2166: Fix a bootstrap/CKeditor incompatibility with their respective modals (source: https://stackoverflow.com/a/31679096) // N°2166: Fix a bootstrap/CKeditor incompatibility with their respective modals (source: https://stackoverflow.com/a/31679096)
$.fn.modal.Constructor.prototype.enforceFocus = function() { // N°7552 Update the ugly hacky hack to make it work with CKEditor 5. Only trigger the focus when the parent is not a CKEditor input (source: https://stackoverflow.com/questions/53556541/ckeditor-5-popup-controls-not-working-in-bootstrap-3-2018)
$( document ) $.fn.modal.Constructor.prototype.enforceFocus = function () {
.off( 'focusin.bs.modal' ) // guard against infinite focus loop var $modalElement = this.$element;
.on( 'focusin.bs.modal', $.proxy( function( e ) { $(document).on('focusin.modal', function (e) {
if ( var $parent = $(e.target.parentNode);
this.$element[ 0 ] !== e.target && !this.$element.has( e.target ).length if ($modalElement[0] !== e.target && !$modalElement.has(e.target).length &&
// CKEditor compatibility fix start. !$parent.hasClass('ck-input')) {
&& !$( e.target ).closest( '.cke_dialog, .cke' ).length e.target.focus()
// CKEditor compatibility fix end. }
) { })
this.$element.trigger( 'focus' );
}
}, this ) );
}; };
// 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 // 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