From cfac0f4c90947d181bd9dd3d8400a94fc2e72eb2 Mon Sep 17 00:00:00 2001 From: Atmanand Gauns <83651531+tu2-atmanand@users.noreply.github.com> Date: Thu, 12 Dec 2024 10:11:35 +0530 Subject: [PATCH 1/4] Feat : Add setting for show delete button --- src/settings.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/settings.ts b/src/settings.ts index 631d9da..d6a9d6a 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -10,6 +10,7 @@ export enum TitleDisplayMode { export interface CardsViewSettings { minCardWidth: number; launchOnStart: boolean; + showDeleteButton: boolean; displayTitle: TitleDisplayMode; pinnedFiles: string[]; } @@ -17,6 +18,7 @@ export interface CardsViewSettings { export const DEFAULT_SETTINGS: CardsViewSettings = { minCardWidth: 200, launchOnStart: false, + showDeleteButton: true, displayTitle: TitleDisplayMode.Both, pinnedFiles: [], }; @@ -68,6 +70,20 @@ export class CardsViewSettingsTab extends PluginSettingTab { }), ); + new Setting(containerEl) + .setName("Show delete button") + .setDesc( + "Disable this option to remove the delete button, so you dont delete any note accidentally." + ) + .addToggle((toggle) => + toggle + .setValue(this.plugin.settings.showDeleteButton) + .onChange(async (value) => { + this.plugin.settings.showDeleteButton = value; + await this.plugin.saveSettings(); + }), + ); + new Setting(containerEl) .setName("Launch on start") .setDesc("Open the cards view when Obsidian starts") From 5377f0bc42a9b2143f1a086bc249c92d59d484e9 Mon Sep 17 00:00:00 2001 From: Atmanand Gauns <83651531+tu2-atmanand@users.noreply.github.com> Date: Thu, 12 Dec 2024 10:32:26 +0530 Subject: [PATCH 2/4] feat : implementation of show delete button --- src/components/Card.svelte | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/components/Card.svelte b/src/components/Card.svelte index 37a1864..d985081 100644 --- a/src/components/Card.svelte +++ b/src/components/Card.svelte @@ -17,6 +17,11 @@ let pinned: boolean; $: pinned = $settings.pinnedFiles.includes(file.path); + // Compute style based on settings + $: cardStyle = $settings.maxCardHeight + ? `max-height: ${$settings.maxCardHeight}px; overflow: hidden; text-overflow: ellipsis;` + : ""; + function postProcessor( element: HTMLElement, context: MarkdownPostProcessorContext, @@ -128,6 +133,7 @@