From 1847634f499918c529734c73e85d611e2166a310 Mon Sep 17 00:00:00 2001 From: Fady Mondy Date: Wed, 8 May 2024 13:20:53 +0300 Subject: [PATCH] add darkmode support for Markdown Editor --- .../views/auth/confirm-password.blade.php | 2 +- .../views/auth/forgot-password.blade.php | 2 +- resources/views/auth/login.blade.php | 6 +- resources/views/auth/register.blade.php | 2 +- resources/views/auth/reset-password.blade.php | 2 +- .../views/auth/two-factor-challenge.blade.php | 2 +- resources/views/auth/verify-email.blade.php | 2 +- .../components/markdown-editor.blade.php | 62 +++++++++++++++++-- .../components/markdown-viewer.blade.php | 16 ++++- resources/views/layouts/app.blade.php | 10 ++- resources/views/layouts/guest.blade.php | 33 ++++++++++ .../views/layouts/includes/nav.blade.php | 3 + src/Views/Layout.php | 6 ++ src/Views/Navbar.php | 6 ++ 14 files changed, 133 insertions(+), 21 deletions(-) diff --git a/resources/views/auth/confirm-password.blade.php b/resources/views/auth/confirm-password.blade.php index b2bd759..bcf8c36 100644 --- a/resources/views/auth/confirm-password.blade.php +++ b/resources/views/auth/confirm-password.blade.php @@ -8,7 +8,7 @@
- +
diff --git a/resources/views/auth/forgot-password.blade.php b/resources/views/auth/forgot-password.blade.php index 5b8a17f..f934c92 100644 --- a/resources/views/auth/forgot-password.blade.php +++ b/resources/views/auth/forgot-password.blade.php @@ -11,7 +11,7 @@
- +
diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index 5cf4c9b..a554acd 100644 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -1,7 +1,7 @@ - + {{ __('Login') }} - +
@@ -19,7 +19,7 @@ @endif - +
diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php index 2f8c96c..a11304c 100644 --- a/resources/views/auth/register.blade.php +++ b/resources/views/auth/register.blade.php @@ -23,7 +23,7 @@ {{ trans('tomato-admin::global.auth.already-registered') }} - +
diff --git a/resources/views/auth/reset-password.blade.php b/resources/views/auth/reset-password.blade.php index debb0cf..b8f85d5 100644 --- a/resources/views/auth/reset-password.blade.php +++ b/resources/views/auth/reset-password.blade.php @@ -6,7 +6,7 @@
- +
diff --git a/resources/views/auth/two-factor-challenge.blade.php b/resources/views/auth/two-factor-challenge.blade.php index 201821f..e40c1f3 100644 --- a/resources/views/auth/two-factor-challenge.blade.php +++ b/resources/views/auth/two-factor-challenge.blade.php @@ -36,7 +36,7 @@ - + diff --git a/resources/views/auth/verify-email.blade.php b/resources/views/auth/verify-email.blade.php index 16c41ac..41b68d0 100644 --- a/resources/views/auth/verify-email.blade.php +++ b/resources/views/auth/verify-email.blade.php @@ -17,7 +17,7 @@
- +
diff --git a/resources/views/components/markdown-editor.blade.php b/resources/views/components/markdown-editor.blade.php index 2b0e726..15d0bc6 100644 --- a/resources/views/components/markdown-editor.blade.php +++ b/resources/views/components/markdown-editor.blade.php @@ -1,8 +1,56 @@ - -only(['v-if', 'v-show', 'class'])->class(['hidden' => $isHidden()]) }} -v-model="{{ $vueModel() }}" language="en-US" :preview="@js($preview)" :toolbars="[ + +
+ + only(['v-if', 'v-show', 'class'])->class(['hidden' => $isHidden()]) }} + v-model="{{ $vueModel() }}" :language="data.lang.id === 'ar' ? 'ar-EG' : 'en-US'" :preview="@js($preview)" :toolbars="[ + 'bold', + 'underline', + 'italic', + '-', + 'strikeThrough', + 'title', + 'sub', + 'sup', + 'quote', + 'unorderedList', + 'orderedList', + 'task', + '-', + 'codeRow', + 'code', + 'link', + 'image', + 'table', + 'htmlPreview', + 'preview', + 'fullscreen', + 'prettier', + 'katex', + 'mermaid', + + ]"> + + +
+
+ + only(['v-if', 'v-show', 'class'])->class(['hidden' => $isHidden()]) }} + v-model="{{ $vueModel() }}" language="en-US" :preview="@js($preview)" :toolbars="[ 'bold', 'underline', 'italic', @@ -23,4 +71,6 @@ 'table', ]"> - + +
+
diff --git a/resources/views/components/markdown-viewer.blade.php b/resources/views/components/markdown-viewer.blade.php index 80adec3..84d7575 100644 --- a/resources/views/components/markdown-viewer.blade.php +++ b/resources/views/components/markdown-viewer.blade.php @@ -1,3 +1,13 @@ -
- -
+ +
+ + +
+
diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index 1973bd5..fd9009c 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -18,12 +18,16 @@
- + @if($sidebar) + + @endif
- +
@foreach(\TomatoPHP\TomatoAdmin\Facade\TomatoSlot::getLayoutTop() as $item) diff --git a/resources/views/layouts/guest.blade.php b/resources/views/layouts/guest.blade.php index a706e02..8e5b3d1 100644 --- a/resources/views/layouts/guest.blade.php +++ b/resources/views/layouts/guest.blade.php @@ -1,3 +1,19 @@ + + + if(localStorage.getItem("splade") && typeof document !== undefined){ + let spladeStorage = JSON.parse(localStorage.getItem("splade")); + let dark = spladeStorage?.admin?.dark; + document.body.classList[dark ? "add" : "remove"]("dark-scrollbars"); + document.documentElement.classList[dark ? "add" : "remove"]("dark"); + let htmlEl = document.querySelector("html"); + + if ("{{app()->getLocale()}}" === "ar") { + htmlEl.setAttribute("dir", "rtl"); + } else { + htmlEl.setAttribute("dir", "ltr"); + } + } + + + diff --git a/resources/views/layouts/includes/nav.blade.php b/resources/views/layouts/includes/nav.blade.php index 5bc8941..1988426 100644 --- a/resources/views/layouts/includes/nav.blade.php +++ b/resources/views/layouts/includes/nav.blade.php @@ -16,6 +16,7 @@ ">
+ @if($sidebar) + @endif