From 5e96922eba409d34a48a4978fc144c03d89ae53c Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Fri, 18 Oct 2024 22:56:04 -0700 Subject: [PATCH] refac: styling --- src/lib/components/common/Badge.svelte | 3 +- .../components/common/RichTextInput.svelte | 61 ++++++++++++++----- src/lib/components/workspace/Knowledge.svelte | 15 ++--- 3 files changed, 52 insertions(+), 27 deletions(-) diff --git a/src/lib/components/common/Badge.svelte b/src/lib/components/common/Badge.svelte index 92e0c3bdf..47b134b61 100644 --- a/src/lib/components/common/Badge.svelte +++ b/src/lib/components/common/Badge.svelte @@ -6,7 +6,8 @@ info: 'bg-blue-500/20 text-blue-700 dark:text-blue-200 ', success: 'bg-green-500/20 text-green-700 dark:text-green-200', warning: 'bg-yellow-500/20 text-yellow-700 dark:text-yellow-200', - error: 'bg-red-500/20 text-red-700 dark:text-red-200' + error: 'bg-red-500/20 text-red-700 dark:text-red-200', + mute: 'bg-gray-500/20 text-gray-700 dark:text-gray-200' }; diff --git a/src/lib/components/common/RichTextInput.svelte b/src/lib/components/common/RichTextInput.svelte index 586d67577..1ca4f2f97 100644 --- a/src/lib/components/common/RichTextInput.svelte +++ b/src/lib/components/common/RichTextInput.svelte @@ -186,21 +186,52 @@ 'Mod-z': undo, 'Mod-y': redo, Space: handleSpace, - Enter: chainCommands( - (state, dispatch, view) => { - if (isEmptyListItem(state)) { - return exitList(state, dispatch); - } - return false; - }, - (state, dispatch, view) => { - if (isInList(state)) { - return splitListItem(schema.nodes.list_item)(state, dispatch); - } - return false; - }, - baseKeymap.Enter - ), + + Enter: (state, dispatch, view) => { + if (shiftEnter) { + eventDispatch('submit'); + return true; + } + return chainCommands( + (state, dispatch, view) => { + if (isEmptyListItem(state)) { + return exitList(state, dispatch); + } + return false; + }, + (state, dispatch, view) => { + if (isInList(state)) { + return splitListItem(schema.nodes.list_item)(state, dispatch); + } + return false; + }, + baseKeymap.Enter + )(state, dispatch, view); + }, + + 'Shift-Enter': (state, dispatch, view) => { + if (shiftEnter) { + return chainCommands( + (state, dispatch, view) => { + if (isEmptyListItem(state)) { + return exitList(state, dispatch); + } + return false; + }, + (state, dispatch, view) => { + if (isInList(state)) { + return splitListItem(schema.nodes.list_item)(state, dispatch); + } + return false; + }, + baseKeymap.Enter + )(state, dispatch, view); + } else { + return baseKeymap.Enter(state, dispatch, view); + } + return false; + }, + // Prevent default tab navigation and provide indent/outdent behavior inside lists: Tab: (state, dispatch, view) => { const { $from } = state.selection; diff --git a/src/lib/components/workspace/Knowledge.svelte b/src/lib/components/workspace/Knowledge.svelte index 7053c845a..d0601ab24 100644 --- a/src/lib/components/workspace/Knowledge.svelte +++ b/src/lib/components/workspace/Knowledge.svelte @@ -21,6 +21,7 @@ import Pencil from '../icons/Pencil.svelte'; import DeleteConfirmDialog from '../common/ConfirmDialog.svelte'; import ItemMenu from './Knowledge/ItemMenu.svelte'; + import Badge from '../common/Badge.svelte'; let query = ''; let selectedItem = null; @@ -167,20 +168,12 @@
{#if item?.meta?.document} -
- {$i18n.t('Document')} -
+ {:else} -
- {$i18n.t('Collection')} -
+ {/if}
-
+
{$i18n.t('Updated')} {dayjs(item.updated_at * 1000).fromNow()}