From 214992650db16bceca439a60d45fb78035d38af1 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Wed, 20 Apr 2022 14:03:47 +0100 Subject: [PATCH] Standardised dropdown list item styles, Extracted page editor toolbar - Updated all dropdown list item actions into three specific styles: icon-item, text-item & label-item. Allows a stronger structure while prevents mixing of styles as we were getting for header dropdown in dark mode. - Extracted out page editor top toolbar to its own view file & split editor switch options to different markdown options. --- resources/js/components/auto-suggest.js | 2 +- resources/js/components/code-editor.js | 2 +- resources/lang/en/entities.php | 6 +- resources/sass/_lists.scss | 46 +++++++--- resources/sass/_text.scss | 1 - .../views/attachments/manager-list.blade.php | 2 +- resources/views/comments/comment.blade.php | 7 +- resources/views/common/header.blade.php | 22 +++-- .../views/entities/export-menu.blade.php | 8 +- resources/views/entities/sort.blade.php | 2 +- .../mfa/parts/setup-method-row.blade.php | 2 +- .../pages/parts/editor-toolbar.blade.php | 86 +++++++++++++++++++ resources/views/pages/parts/form.blade.php | 60 +------------ resources/views/pages/revisions.blade.php | 10 ++- resources/views/settings/audit.blade.php | 4 +- .../settings/recycle-bin/index.blade.php | 6 +- 16 files changed, 171 insertions(+), 95 deletions(-) create mode 100644 resources/views/pages/parts/editor-toolbar.blade.php diff --git a/resources/js/components/auto-suggest.js b/resources/js/components/auto-suggest.js index 68de49b4a..d1c15c00a 100644 --- a/resources/js/components/auto-suggest.js +++ b/resources/js/components/auto-suggest.js @@ -131,7 +131,7 @@ class AutoSuggest { return this.hideSuggestions(); } - this.list.innerHTML = suggestions.map(value => `
  • `).join(''); + this.list.innerHTML = suggestions.map(value => `
  • `).join(''); this.list.style.display = 'block'; for (const button of this.list.querySelectorAll('button')) { button.addEventListener('blur', this.hideSuggestionsIfFocusedLost.bind(this)); diff --git a/resources/js/components/code-editor.js b/resources/js/components/code-editor.js index f44de813d..4ee3531c5 100644 --- a/resources/js/components/code-editor.js +++ b/resources/js/components/code-editor.js @@ -96,7 +96,7 @@ class CodeEditor { this.historyDropDown.classList.toggle('hidden', historyKeys.length === 0); this.historyList.innerHTML = historyKeys.map(key => { const localTime = (new Date(parseInt(key))).toLocaleTimeString(); - return `
  • `; + return `
  • `; }).join(''); } diff --git a/resources/lang/en/entities.php b/resources/lang/en/entities.php index 8de379bbb..3921828d8 100644 --- a/resources/lang/en/entities.php +++ b/resources/lang/en/entities.php @@ -196,8 +196,10 @@ return [ 'pages_edit_draft_save_at' => 'Draft saved at ', 'pages_edit_delete_draft' => 'Delete Draft', 'pages_edit_discard_draft' => 'Discard Draft', - 'pages_edit_switch_to_markdown' => 'Switch to Markdown editor', - 'pages_edit_switch_to_wysiwyg' => 'Switch to WYSIWYG editor', + 'pages_edit_switch_to_markdown' => 'Switch to Markdown Editor', + 'pages_edit_switch_to_markdown_clean' => '(Clean Markdown Content)', + 'pages_edit_switch_to_markdown_stable' => '(Stable Markdown Content)', + 'pages_edit_switch_to_wysiwyg' => 'Switch to WYSIWYG Editor', 'pages_edit_set_changelog' => 'Set Changelog', 'pages_edit_enter_changelog_desc' => 'Enter a brief description of the changes you\'ve made', 'pages_edit_enter_changelog' => 'Enter Changelog', diff --git a/resources/sass/_lists.scss b/resources/sass/_lists.scss index 9cff52972..26d12a25d 100644 --- a/resources/sass/_lists.scss +++ b/resources/sass/_lists.scss @@ -593,13 +593,22 @@ ul.pagination { li.active a { font-weight: 600; } - a, button { - display: block; - padding: $-xs $-m; + button { + width: 100%; + text-align: start; + } + li.border-bottom { + border-bottom: 1px solid #DDD; + } + li hr { + margin: $-xs 0; + } + .icon-item, .text-item, .label-item { + padding: 8px $-m; @include lightDark(color, #555, #eee); fill: currentColor; white-space: nowrap; - line-height: 1.6; + line-height: 1.4; cursor: pointer; &:hover, &:focus { text-decoration: none; @@ -616,15 +625,30 @@ ul.pagination { width: 16px; } } - button { - width: 100%; - text-align: start; + .text-item { + display: block; } - li.border-bottom { - border-bottom: 1px solid #DDD; + .label-item { + display: grid; + align-items: center; + grid-template-columns: auto min-content; + gap: $-m; } - li hr { - margin: $-xs 0; + .label-item > *:nth-child(2) { + opacity: 0.7; + &:hover { + opacity: 1; + } + } + .icon-item { + display: grid; + align-items: start; + grid-template-columns: 16px auto; + gap: $-m; + svg { + margin-inline-end: 0; + margin-block-start: 1px; + } } } diff --git a/resources/sass/_text.scss b/resources/sass/_text.scss index 884808bb4..51f315614 100644 --- a/resources/sass/_text.scss +++ b/resources/sass/_text.scss @@ -163,7 +163,6 @@ em, i, .italic { small, p.small, span.small, .text-small { font-size: 0.75rem; - @include lightDark(color, #5e5e5e, #999); } sup, .superscript { diff --git a/resources/views/attachments/manager-list.blade.php b/resources/views/attachments/manager-list.blade.php index b48fde9c0..ebb1c24aa 100644 --- a/resources/views/attachments/manager-list.blade.php +++ b/resources/views/attachments/manager-list.blade.php @@ -28,7 +28,7 @@ class="drag-card-action text-center text-neg">@icon('close') diff --git a/resources/views/comments/comment.blade.php b/resources/views/comments/comment.blade.php index 9f4a12357..6189c65d4 100644 --- a/resources/views/comments/comment.blade.php +++ b/resources/views/comments/comment.blade.php @@ -31,7 +31,12 @@ @endif diff --git a/resources/views/common/header.blade.php b/resources/views/common/header.blade.php index d55f3ae2d..b5ac520c1 100644 --- a/resources/views/common/header.blade.php +++ b/resources/views/common/header.blade.php @@ -62,26 +62,36 @@ diff --git a/resources/views/entities/export-menu.blade.php b/resources/views/entities/export-menu.blade.php index 2b0f5c19d..dd7231095 100644 --- a/resources/views/entities/export-menu.blade.php +++ b/resources/views/entities/export-menu.blade.php @@ -5,9 +5,9 @@ {{ trans('entities.export') }} diff --git a/resources/views/entities/sort.blade.php b/resources/views/entities/sort.blade.php index bf9087397..f81ed797f 100644 --- a/resources/views/entities/sort.blade.php +++ b/resources/views/entities/sort.blade.php @@ -16,7 +16,7 @@ diff --git a/resources/views/mfa/parts/setup-method-row.blade.php b/resources/views/mfa/parts/setup-method-row.blade.php index e195174c1..271ec1bf4 100644 --- a/resources/views/mfa/parts/setup-method-row.blade.php +++ b/resources/views/mfa/parts/setup-method-row.blade.php @@ -19,7 +19,7 @@
    {{ csrf_field() }} {{ method_field('delete') }} - +
    diff --git a/resources/views/pages/parts/editor-toolbar.blade.php b/resources/views/pages/parts/editor-toolbar.blade.php new file mode 100644 index 000000000..d7fb76c29 --- /dev/null +++ b/resources/views/pages/parts/editor-toolbar.blade.php @@ -0,0 +1,86 @@ +
    +
    + + + +
    + +
    + +
    + + + +
    +
    +
    \ No newline at end of file diff --git a/resources/views/pages/parts/form.blade.php b/resources/views/pages/parts/form.blade.php index ebad2bd72..2c2ab9b92 100644 --- a/resources/views/pages/parts/form.blade.php +++ b/resources/views/pages/parts/form.blade.php @@ -15,64 +15,8 @@ option:page-editor:draft-discarded-text="{{ trans('entities.pages_draft_discarded') }}" option:page-editor:set-changelog-text="{{ trans('entities.pages_edit_set_changelog') }}"> - {{--Header Bar--}} -
    -
    - - - -
    - -
    - -
    - - - -
    -
    -
    + {{--Header Toolbar--}} + @include('pages.parts.editor-toolbar', ['model' => $model, 'editor' => $editor, 'isDraft' => $isDraft, 'draftsEnabled' => $draftsEnabled]) {{--Title input--}}
    diff --git a/resources/views/pages/revisions.blade.php b/resources/views/pages/revisions.blade.php index 5508f362d..87949837b 100644 --- a/resources/views/pages/revisions.blade.php +++ b/resources/views/pages/revisions.blade.php @@ -58,7 +58,10 @@
    {!! csrf_field() !!} - +
    @@ -72,7 +75,10 @@
    {!! csrf_field() !!} - +
    diff --git a/resources/views/settings/audit.blade.php b/resources/views/settings/audit.blade.php index ca5dba527..506a735a2 100644 --- a/resources/views/settings/audit.blade.php +++ b/resources/views/settings/audit.blade.php @@ -14,9 +14,9 @@
    diff --git a/resources/views/settings/recycle-bin/index.blade.php b/resources/views/settings/recycle-bin/index.blade.php index 5f2ec333f..56e2437fe 100644 --- a/resources/views/settings/recycle-bin/index.blade.php +++ b/resources/views/settings/recycle-bin/index.blade.php @@ -22,7 +22,7 @@
    {!! csrf_field() !!} - +
    @@ -93,8 +93,8 @@