fix: update form_textarea to prevent escaping value

replace form_markdown_textarea with form_textarea
This commit is contained in:
Yassine Doghri 2022-04-05 12:08:56 +00:00
parent 73ad94c1d5
commit 78548b5cd7
2 changed files with 7 additions and 7 deletions

View File

@ -2,14 +2,14 @@
declare(strict_types=1);
if (! function_exists('form_markdown_textarea')) {
if (! function_exists('form_textarea')) {
/**
* Textarea field
* Adapted textarea field from CI4 core: without value escaping.
*
* @param mixed $data
* @param mixed $extra
*/
function form_markdown_textarea($data = '', string $value = '', $extra = ''): string
function form_textarea($data = '', string $value = '', $extra = ''): string
{
$defaults = [
'name' => is_array($data) ? '' : $data,
@ -38,9 +38,9 @@ if (! function_exists('form_markdown_textarea')) {
unset($defaults['cols']);
}
return '<textarea ' . rtrim(parse_form_attributes($data, $defaults)) . stringify_attributes($extra) . '>'
. $val
. "</textarea>\n";
return '<textarea ' . rtrim(parse_form_attributes($data, $defaults)) . stringify_attributes(
$extra
) . '>' . $val . "</textarea>\n";
}
}

View File

@ -23,7 +23,7 @@ class MarkdownEditor extends FormComponent
$this->attributes['class'] = 'bg-elevated border-none focus:border-none focus:outline-none focus:ring-0 w-full h-full';
$this->attributes['rows'] = 6;
$textarea = form_markdown_textarea($this->attributes, old($this->name, $this->value));
$textarea = form_textarea($this->attributes, old($this->name, $this->value));
$markdownIcon = icon(
'markdown',
'mr-1 text-lg opacity-40'