From f51758f8c9adc663379503cbe9c472f12880c850 Mon Sep 17 00:00:00 2001 From: Jordan Wright Date: Tue, 25 Aug 2015 22:07:57 -0500 Subject: [PATCH] Fixed issue where links and other attributes could not be edited in CKEditor --- static/js/app/landing_pages.js | 14 ++++++++++++++ static/js/app/templates.js | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/static/js/app/landing_pages.js b/static/js/app/landing_pages.js index d14a0188..1486d835 100644 --- a/static/js/app/landing_pages.js +++ b/static/js/app/landing_pages.js @@ -141,5 +141,19 @@ $(document).ready(function(){ $( '.modal-backdrop' ).not( '.fv-modal-stack' ).css( 'z-index', 1039 + (10 * $('body').data( 'fv_open_modals' ))); $( '.modal-backdrop' ).not( 'fv-modal-stack' ).addClass( 'fv-modal-stack' ); }); + $.fn.modal.Constructor.prototype.enforceFocus = function() { + $( document ) + .off( 'focusin.bs.modal' ) // guard against infinite focus loop + .on( 'focusin.bs.modal', $.proxy( function( e ) { + if ( + this.$element[ 0 ] !== e.target && !this.$element.has( e.target ).length + // CKEditor compatibility fix start. + && !$( e.target ).closest( '.cke_dialog, .cke' ).length + // CKEditor compatibility fix end. + ) { + this.$element.trigger( 'focus' ); + } + }, this ) ); + }; load() }) diff --git a/static/js/app/templates.js b/static/js/app/templates.js index f8cbd94e..e36291d3 100644 --- a/static/js/app/templates.js +++ b/static/js/app/templates.js @@ -170,5 +170,19 @@ function load(){ } $(document).ready(function(){ + $.fn.modal.Constructor.prototype.enforceFocus = function() { + $( document ) + .off( 'focusin.bs.modal' ) // guard against infinite focus loop + .on( 'focusin.bs.modal', $.proxy( function( e ) { + if ( + this.$element[ 0 ] !== e.target && !this.$element.has( e.target ).length + // CKEditor compatibility fix start. + && !$( e.target ).closest( '.cke_dialog, .cke' ).length + // CKEditor compatibility fix end. + ) { + this.$element.trigger( 'focus' ); + } + }, this ) ); + }; load() })