Skip to content
Snippets Groups Projects

B15627: Added character count and maxLength feature for tinymce. refs #15627

Merged Enis Nuredini requested to merge F15627_character_count_tinymce into develop
2 files
+ 77
2
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -3436,9 +3436,29 @@ abstract class AbstractBuildForm {
} else {
$completeUrl = '?action=imageUpload';
}
// Prepare maxLength and characterCount for tinyMce
$maxLength = $formElement[FE_MAX_LENGTH];
$elementCharacterCount = '';
if (isset($formElement[FE_CHARACTER_COUNT_WRAP])) {
$attribute .= Support::doAttribute('data-character-count-id', $formElement[FE_HTML_ID] . HTML_ID_EXTENSION_CHARACTER_COUNT);
$attributeCC = Support::doAttribute('id', $formElement[FE_HTML_ID] . HTML_ID_EXTENSION_CHARACTER_COUNT);
$classCC = ($formElement[FE_CHARACTER_COUNT_WRAP] == '') ? Support::doAttribute('class', 'qfq-cc-style') : '';
$elementCharacterCount = "<span $attributeCC $classCC></span>";
if ($formElement[FE_CHARACTER_COUNT_WRAP] != '') {
$arr = explode('|', $formElement[FE_CHARACTER_COUNT_WRAP], 2);
$arr[] = '';
$arr[] = ''; //skip check that at least 2 elements exist
$elementCharacterCount = $arr[0] . $elementCharacterCount . $arr[1];
}
}
//TODO: static setup for TinyMCE ImagePlugin - needs to be activated / dynamically set by QFQ parameter.
$preSettings = [
# "plugins" => "image",
"plugins" => "charmap",
"maxLength" => $maxLength,
"file_picker_types" => "file image media",
"image_advtab" => true,
"automatic_uploads" => true,
@@ -3460,7 +3480,7 @@ abstract class AbstractBuildForm {
$html = Support::wrapTag("<textarea $attribute>", htmlentities($value), false);
$formElement = HelperFormElement::prepareExtraButton($formElement, false);
return $html . HelperFormElement::getHelpBlock() . $formElement[FE_TMP_EXTRA_BUTTON_HTML] . $formElement[FE_INPUT_EXTRA_BUTTON_INFO];
return $html . HelperFormElement::getHelpBlock() . $formElement[FE_TMP_EXTRA_BUTTON_HTML] . $elementCharacterCount . $formElement[FE_INPUT_EXTRA_BUTTON_INFO];
}
/**
Loading