From 3f049f0672c2d8b32ee23b9cf6026e7bbf9bc1e5 Mon Sep 17 00:00:00 2001 From: Chiyu Liang <532117255@qq.com> Date: Tue, 14 Nov 2023 22:12:32 +0800 Subject: [PATCH] Allow rich-text formatting on board column header (#732) --- src/ui/views/Board/BoardView.svelte | 1 + .../views/Board/components/Board/Board.svelte | 2 + .../Board/components/Board/BoardColumn.svelte | 6 +- .../components/Board/ColumnHeader.svelte | 60 +++++++++++++++++++ 4 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 src/ui/views/Board/components/Board/ColumnHeader.svelte diff --git a/src/ui/views/Board/BoardView.svelte b/src/ui/views/Board/BoardView.svelte index 86a72153..171fcd52 100644 --- a/src/ui/views/Board/BoardView.svelte +++ b/src/ui/views/Board/BoardView.svelte @@ -113,5 +113,6 @@ onRecordUpdate={handleRecordUpdate(groupByField)} onSortColumns={handleSortColumns} {readonly} + richText={groupByField?.typeConfig?.richText ?? false} /> diff --git a/src/ui/views/Board/components/Board/Board.svelte b/src/ui/views/Board/components/Board/Board.svelte index e944a1eb..5dadccc4 100644 --- a/src/ui/views/Board/components/Board/Board.svelte +++ b/src/ui/views/Board/components/Board/Board.svelte @@ -12,6 +12,7 @@ export let columns: Column[]; export let readonly: boolean; + export let richText: boolean; export let onRecordClick: (record: DataRecord) => void; export let onRecordUpdate: (column: string, record: DataRecord) => void; export let onRecordAdd: (column: string) => void; @@ -48,6 +49,7 @@ {#each columns as column (column.id)} - import { Button, Typography, Icon } from "obsidian-svelte"; + import { Button, Icon } from "obsidian-svelte"; import { i18n } from "src/lib/stores/i18n"; + import ColumnHeader from "./ColumnHeader.svelte"; import type { DataRecord, DataField } from "src/lib/dataframe/dataframe"; import CardGroup from "./CardList.svelte"; @@ -8,6 +9,7 @@ export let name: string; export let records: DataRecord[]; export let readonly: boolean; + export let richText: boolean; export let onDrop: (records: DataRecord[]) => void; export let includeFields: DataField[]; @@ -16,7 +18,7 @@
- {name} + {#if !readonly} diff --git a/src/ui/views/Board/components/Board/ColumnHeader.svelte b/src/ui/views/Board/components/Board/ColumnHeader.svelte new file mode 100644 index 00000000..528e80af --- /dev/null +++ b/src/ui/views/Board/components/Board/ColumnHeader.svelte @@ -0,0 +1,60 @@ + + +{#if richText} +
+{:else} +
+ {value} +
+{/if} + +