1// TinyMCE 4 dialogs (link, source codeâ¦) opened inside a Bootstrap modal lose 2// focus because Bootstrap's enforceFocus() registers a focusin.bs.modal handler 3// on document that redirects focus to the modal for any element outside it. 4// TinyMCE appends its dialogs (.mce-window) directly to <body>, so Bootstrap 5// treats them as external and immediately steals focus back. 6// 7// Fix: patch Bootstrap's enforceFocus prototype to skip focus-redirection when 8// the focused element is inside a TinyMCE dialog. This script is loaded from 9// layout.html (line 971) AFTER bootstrap.min.js (line 908). 10// 11// NB: layout.html does `var jQuery = jQ = $.noConflict(true)` then loads 12// jquery-1.7.1.min.js which overwrites window.jQuery with jQuery 1.7.1. 13// Bootstrap was initialised with the NEWER jQuery stored in `jQ`, so we must 14// use `jQ` here â not `jQuery` (which is jQuery 1.7.1 at this point and has 15// no .fn.modal). 16(function () { 17 if (typeof jQ === 'undefined' || 18 !jQ.fn.modal || 19 !jQ.fn.modal.Constructor) { return; } 20 21 var proto = jQ.fn.modal.Constructor.prototype; 22 proto.enforceFocus = function () { 23 var self = this; 24 jQ(document) 25 .off('focusin.bs.modal') 26 .on('focusin.bs.modal', function (e) { 27 if (self.$element[0] === e.target || 28 self.$element.has(e.target).length) { return; } 29 // Allow focus inside any TinyMCE dialog/panel 30 var node = e.target; 31 while (node) { 32 var cn = node.className; 33 if (cn && typeof cn === 'string' && 34 (cn.indexOf('mce-window') !== -1 || 35 cn.indexOf('mce-floatpanel') !== -1 || 36 cn.indexOf('mce-container') !== -1)) { return; } 37 node = node.parentElement; 38 } 39 self.$element.trigger('focus'); 40 }); 41 }; 42}()); 43 44$(function() { 45 // !!! si changement fait ici le faire aussi dans netassoc.js dans initTinyMCE !!! 46 na.tinymce.init_all(); 47 na.tinymce.init_all_specific(); 48 if( typeof tinymce != "undefined") { 49 tinymce.init(na.tinymce.all); 50 tinymce.init(na.tinymce.all_reduced); 51 tinymce.init(na.tinymce.standard); 52 tinymce.init(na.tinymce.simple); 53 tinymce.init(na.tinymce.newsletter); 54 tinymce.init(na.tinymce.mail); 55 tinymce.init(na.tinymce.mail_fullpage); 56 tinymce.init(na.tinymce.histo); 57 tinymce.init(na.tinymce.emploi); 58 tinymce.init(na.tinymce.model_doc); 59 tinymce.init(na.tinymce.gls); 60 tinymce.init(na.tinymce.mobile); 61 } 62});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.