Skip to content

Commit

Permalink
fix(textareafield): compatibility with GLPI 9.10
Browse files Browse the repository at this point in the history
backport of chande detection in textarea from Formcreator 2.13
  • Loading branch information
btry committed Nov 10, 2022
1 parent 7f2ff1a commit a325a94
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions js/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -1812,10 +1812,28 @@ function pluginFormcreatorInitializeTag(fieldName, rand) {
* Initialize a textarea field
*/
function pluginFormcreatorInitializeTextarea(fieldName, rand) {
var field = $('[name="' + fieldName + '"]');
field.on("change", function(e) {
plugin_formcreator.showFields($(field[0].form));
});
if (tinyMCE.majorVersion < 5) {
var field = $('[name="' + fieldName + '"]');
field.on("change", function(e) {
plugin_formcreator.showFields($(field[0].form));
});
} else {
var i = 0;
var e;
while (e = tinymce.get(i++)) {
var field = $('[name="' + fieldName + '"]');
var form = field[0].form;
if (e.formElement != form) {
continue;
}
// https://stackoverflow.com/a/63342064
e.on('input NodeChange', function(e) {
tinyMCE.triggerSave();
plugin_formcreator.showFields($(form));
});
return;
}
}
}

/**
Expand Down

0 comments on commit a325a94

Please sign in to comment.