mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
Merge remote-tracking branch 'origin/support/3.2' into develop
This commit is contained in:
@@ -115,6 +115,19 @@ class CKEditorHelper
|
||||
return $aMentionConfiguration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode value when using CKEditor with a TextArea.
|
||||
* @see https://ckeditor.com/docs/ckeditor5/latest/installation/getting-started/getting-and-setting-data.html#automatic-integration-with-html-forms
|
||||
*
|
||||
* @param string $sValue
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function PrepareCKEditorValueTextEncodingForTextarea(string $sValue) : string
|
||||
{
|
||||
return str_replace( '&', '&', $sValue );
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure CKEditor element (WebPage).
|
||||
*
|
||||
|
||||
@@ -161,7 +161,7 @@ EOF
|
||||
// First the edition area
|
||||
$oOutput->AddHtml('<div>');
|
||||
$sEditorClasses = $bRichEditor ? 'htmlEditor' : '';
|
||||
$oOutput->AddHtml('<textarea id="'.$this->oField->GetGlobalId().'" name="'.$this->oField->GetId().'" class="' . $sEditorClasses . ' form-control" rows="8" '.$sInputTags.'>'.$this->oField->GetCurrentValue().'</textarea>');
|
||||
$oOutput->AddHtml('<textarea id="'.$this->oField->GetGlobalId().'" name="'.$this->oField->GetId().'" class="' . $sEditorClasses . ' form-control" rows="8" '.$sInputTags.'>'. CKEditorHelper::PrepareCKEditorValueTextEncodingForTextarea($this->oField->GetCurrentValue()) .'</textarea>');
|
||||
$oOutput->AddHtml('</div>');
|
||||
// Then the previous entries if necessary
|
||||
if ($sFieldClass === 'Combodo\\iTop\\Form\\Field\\CaseLogField') {
|
||||
|
||||
@@ -156,7 +156,7 @@ class ConsoleSimpleFieldRenderer extends FieldRenderer
|
||||
}
|
||||
else
|
||||
{
|
||||
$oText = new TextArea("",$this->oField->GetCurrentValue(),$this->oField->GetGlobalId(),40,8);
|
||||
$oText = new TextArea("", CKEditorHelper::PrepareCKEditorValueTextEncodingForTextarea($this->oField->GetCurrentValue()),$this->oField->GetGlobalId(),40,8);
|
||||
$oText->AddCSSClasses(['ibo-input-field-wrapper', 'ibo-input']);
|
||||
$oValue->AddSubBlock($oText);
|
||||
// Some additional stuff if we are displaying it with a rich editor
|
||||
|
||||
Reference in New Issue
Block a user