From 86dec91a777f649b80f1f3acfdf8c6d7a05fa538 Mon Sep 17 00:00:00 2001 From: "PITCHAYAKIT-LEG\\Pitchayakit" Date: Tue, 10 Jan 2023 10:37:46 +0700 Subject: [PATCH 1/2] Fixd old value doesn't load when using attachments --- src/Pipes/Input.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Pipes/Input.php b/src/Pipes/Input.php index cf380d9..33e98c7 100644 --- a/src/Pipes/Input.php +++ b/src/Pipes/Input.php @@ -8,7 +8,10 @@ class Input { public function handle(LaravelTrix $trix, \Closure $next) { - $html = is_object($trix->model) && $trix->model->exists ? htmlspecialchars(optional($trix->model->trixRichText()->where('field', $trix->config['field'])->first())->content, ENT_QUOTES) : old($trix->loweredModelName.'-trixFields.'.$trix->config['field'], ''); + $html = is_object($trix->model) && $trix->model->exists ? optional($trix->model->trixRichText()->where('field', $trix->config['field'])->first())->content : old($trix->loweredModelName.'-trixFields.'.$trix->config['field'], ''); + + //Convert both double and single quotes. + $html = htmlspecialchars($html, ENT_QUOTES); $trix->html .= ""; From b9557c227aae8c70b071f397a5310db795717750 Mon Sep 17 00:00:00 2001 From: "PITCHAYAKIT-LEG\\Pitchayakit" Date: Tue, 10 Jan 2023 10:44:55 +0700 Subject: [PATCH 2/2] Apply code to support styleCI --- src/Pipes/Input.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Pipes/Input.php b/src/Pipes/Input.php index 33e98c7..1eae8b8 100644 --- a/src/Pipes/Input.php +++ b/src/Pipes/Input.php @@ -9,7 +9,7 @@ class Input public function handle(LaravelTrix $trix, \Closure $next) { $html = is_object($trix->model) && $trix->model->exists ? optional($trix->model->trixRichText()->where('field', $trix->config['field'])->first())->content : old($trix->loweredModelName.'-trixFields.'.$trix->config['field'], ''); - + //Convert both double and single quotes. $html = htmlspecialchars($html, ENT_QUOTES);