Skip to content
Snippets Groups Projects
Commit 78548b5c authored by Yassine Doghri's avatar Yassine Doghri
Browse files

fix: update form_textarea to prevent escaping value

replace form_markdown_textarea with form_textarea
parent 73ad94c1
No related branches found
No related tags found
No related merge requests found
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
declare(strict_types=1); 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 $data
* @param mixed $extra * @param mixed $extra
*/ */
function form_markdown_textarea($data = '', string $value = '', $extra = ''): string function form_textarea($data = '', string $value = '', $extra = ''): string
{ {
$defaults = [ $defaults = [
'name' => is_array($data) ? '' : $data, 'name' => is_array($data) ? '' : $data,
...@@ -38,9 +38,9 @@ if (! function_exists('form_markdown_textarea')) { ...@@ -38,9 +38,9 @@ if (! function_exists('form_markdown_textarea')) {
unset($defaults['cols']); unset($defaults['cols']);
} }
return '<textarea ' . rtrim(parse_form_attributes($data, $defaults)) . stringify_attributes($extra) . '>' return '<textarea ' . rtrim(parse_form_attributes($data, $defaults)) . stringify_attributes(
. $val $extra
. "</textarea>\n"; ) . '>' . $val . "</textarea>\n";
} }
} }
......
...@@ -23,7 +23,7 @@ class MarkdownEditor extends FormComponent ...@@ -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['class'] = 'bg-elevated border-none focus:border-none focus:outline-none focus:ring-0 w-full h-full';
$this->attributes['rows'] = 6; $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( $markdownIcon = icon(
'markdown', 'markdown',
'mr-1 text-lg opacity-40' 'mr-1 text-lg opacity-40'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment