From 0fd77808b9e82f04a5d1f675c91a1749c784d392 Mon Sep 17 00:00:00 2001 From: PaddiM8 Date: Sun, 11 Aug 2024 00:37:08 +0200 Subject: [PATCH] web: Trim description --- web/src/lib/components/editor/Editor.svelte | 12 +++++++++++- .../(main)/projects/[user]/[slug]/+page.svelte | 2 -- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/web/src/lib/components/editor/Editor.svelte b/web/src/lib/components/editor/Editor.svelte index b391664..0e6eef9 100644 --- a/web/src/lib/components/editor/Editor.svelte +++ b/web/src/lib/components/editor/Editor.svelte @@ -116,7 +116,17 @@ export function getHtml(): Promise { return new Promise((resolve, _) => { editor.update(() => { - resolve(generateHtmlFromNodes(editor)); + let html = generateHtmlFromNodes(editor); + const emptyLineMarkups = [ + '


', + '


', + '


', + ]; + let toTrim: string | undefined; + while (toTrim = emptyLineMarkups.find(x => html.endsWith(x))) { + html = html.slice(0, -toTrim.length); + } + resolve(html); }); }); } diff --git a/web/src/routes/(main)/projects/[user]/[slug]/+page.svelte b/web/src/routes/(main)/projects/[user]/[slug]/+page.svelte index 82efaee..33845a4 100644 --- a/web/src/routes/(main)/projects/[user]/[slug]/+page.svelte +++ b/web/src/routes/(main)/projects/[user]/[slug]/+page.svelte @@ -206,8 +206,6 @@ toast.info("Created ticket successfully."); if (data.project.allTicketsCount !== undefined && data.project.openTicketsCount !== undefined) { - //data.project.allTicketsCount++; - //data.project.openTicketsCount++; refreshFilterMap(); } }