From 2682642e283dc9723668d1b47c3000491e0229a7 Mon Sep 17 00:00:00 2001 From: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com> Date: Fri, 22 Sep 2023 10:38:48 +0100 Subject: [PATCH] Fix UI issue with markdown editor Signed-off-by: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com> --- app/admin/formwidgets/MediaFinder.php | 9 ++++++++- .../assets/css/markdowneditor.css | 19 +++++++++++++------ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/app/admin/formwidgets/MediaFinder.php b/app/admin/formwidgets/MediaFinder.php index 6505b8ea83..829fd42fcb 100644 --- a/app/admin/formwidgets/MediaFinder.php +++ b/app/admin/formwidgets/MediaFinder.php @@ -238,7 +238,12 @@ public function onAddAttachment() )); } - $items = post('items'); + $items = $this->validate(request()->input(), [ + 'items' => ['required', 'array'], + 'items.*.name' => ['required', 'string'], + 'items.*.path' => ['required', 'string'], + ]); + if (!is_array($items)) throw new ApplicationException(lang('main::lang.media_manager.alert_select_item_to_attach')); @@ -248,6 +253,8 @@ public function onAddAttachment() $manager = MediaLibrary::instance(); foreach ($items as &$item) { + $item['path'] = strip_tags($item['path']); + $media = $model->newMediaInstance(); $media->addFromRaw( $manager->get(array_get($item, 'path'), true), diff --git a/app/admin/formwidgets/markdowneditor/assets/css/markdowneditor.css b/app/admin/formwidgets/markdowneditor/assets/css/markdowneditor.css index 30ecbc48bd..8f3b58c73a 100644 --- a/app/admin/formwidgets/markdowneditor/assets/css/markdowneditor.css +++ b/app/admin/formwidgets/markdowneditor/assets/css/markdowneditor.css @@ -1,17 +1,24 @@ .editor-toolbar { - border-color: var(--bs-gray-300); - border-top-left-radius: 3px; - border-top-right-radius: 3px; + border-color: var(--bs-gray-300); + border-top-left-radius: 3px; + border-top-right-radius: 3px; } + +.editor-toolbar button.table { + width: 30px; +} + .editor-toolbar button.active, .editor-toolbar button:hover { - border-color: var(--bs-gray-300); + border-color: var(--bs-gray-300); } + .field-markdowneditor .CodeMirror { - border: 1px solid var(--bs-gray-300); + border: 1px solid var(--bs-gray-300); } + .editor-toolbar.fullscreen, .field-markdowneditor .CodeMirror-fullscreen, .editor-preview-side { - z-index: 1040; + z-index: 1040; }