
| Current Path : /var/www/html/strat/web/modules/contrib/webform/js/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/strat/web/modules/contrib/webform/js/webform.element.text_format.js |
/**
* @file
* JavaScript behaviors for Text format integration.
*/
(function ($, Drupal, once) {
'use strict';
/**
* Enhance text format element.
*
* @type {Drupal~behavior}
*/
Drupal.behaviors.webformTextFormat = {
attach: function (context) {
$(once('webform-text-format', '.js-text-format-wrapper textarea', context)).each(function () {
if (!window.CKEDITOR) {
return;
}
var $textarea = $(this);
// Update the CKEDITOR when the textarea's value has changed.
// @see webform.states.js
$textarea.on('change', function () {
if (CKEDITOR.instances[$textarea.attr('id')]) {
var editor = CKEDITOR.instances[$textarea.attr('id')];
editor.setData($textarea.val());
}
});
// Set CKEDITOR to be readonly when the textarea is disabled.
// @see webform.states.js
$textarea.on('webform:disabled', function () {
if (CKEDITOR.instances[$textarea.attr('id')]) {
var editor = CKEDITOR.instances[$textarea.attr('id')];
editor.setReadOnly($textarea.is(':disabled'));
}
});
});
}
};
})(jQuery, Drupal, once);