1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-14 10:45:54 +02:00

Update InputfieldTinyMCE to add an 'InputfieldTinyMCEFocused' class to .Inputfield element when the TinyMCE input is focused

This commit is contained in:
Ryan Cramer
2025-05-30 15:01:28 -04:00
parent 6566c5795c
commit c1259148d2

View File

@@ -120,6 +120,7 @@ var InputfieldTinyMCE = {
inline: 'InputfieldTinyMCEInline',
normal: 'InputfieldTinyMCENormal',
loaded: 'InputfieldTinyMCELoaded',
focused: 'InputfieldTinyMCEFocused',
editor: 'InputfieldTinyMCEEditor',
placeholder: 'InputfieldTinyMCEPlaceholder'
},
@@ -839,6 +840,7 @@ var InputfieldTinyMCE = {
*
*/
documentReady: function() {
var t = this;
this.debug = ProcessWire.config.InputfieldTinyMCE.debug;
this.isDocumentReady = true;
this.log('documentReady', this.editorIds);
@@ -849,6 +851,16 @@ var InputfieldTinyMCE = {
this.initDocumentEvents();
var $placeholders = jQuery('.' + this.cls.placeholder + ':visible');
if($placeholders.length) this.initPlaceholders($placeholders);
this.onSetup(function(editor) {
editor.on('focus', function(e) {
$(editor.container).closest('.' + t.cls.main).addClass(t.cls.focused);
});
editor.on('blur', function(e) {
$(editor.container).closest('.' + t.cls.main).removeClass(t.cls.focused);
});
});
if(this.debug) {
this.log('qty',
'normal=' + jQuery('.' + this.cls.normal).length + ', ' +