From 14ebb21049f4fa6329a9c7c10ac75a0bee208207 Mon Sep 17 00:00:00 2001 From: Timothy Cardoza Date: Sat, 28 Feb 2026 14:57:43 -0600 Subject: [PATCH] newline at top funtun added --- src/components/TaskEditor.tsx | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/src/components/TaskEditor.tsx b/src/components/TaskEditor.tsx index 0797d10..15169dc 100644 --- a/src/components/TaskEditor.tsx +++ b/src/components/TaskEditor.tsx @@ -93,7 +93,10 @@ export const TaskEditor: Component = (props) => { "[&_li[data-type='taskItem']]:flex [&_li[data-type='taskItem']]:items-start", "[&_li[data-type='taskItem']>label]:mr-3 [&_li[data-type='taskItem']>label]:mt-1 [&_li[data-type='taskItem']>label]:select-none", "[&_li[data-type='taskItem']>label>input]:w-5 [&_li[data-type='taskItem']>label>input]:h-5 [&_li[data-type='taskItem']>label>input]:cursor-pointer", - "[&_li[data-type='taskItem']>div]:flex-1 [&_li[data-type='taskItem']>div]:min-h-[1.5rem]", + "[&_li[data-type='taskItem']>div]:flex-1 [&_li[data-type='taskItem']>div]:min-w-0 [&_li[data-type='taskItem']>div]:min-h-[1.5rem]", + "[&_li[data-type='taskItem']>div>p]:min-h-[1.5rem] [&_li[data-type='taskItem']>div>p]:m-0 [&_li[data-type='taskItem']>div>p]:w-full", + "[&_li[data-type='taskItem']>div>p:empty]:after:content-['\\200B'] [&_li[data-type='taskItem']>div>p:empty]:after:inline-block", + "[&_li[data-type='taskItem']>div>p>br]:after:content-['\\200B'] [&_li[data-type='taskItem']>div>p>br]:after:inline-block", // if tiptap adds br props.class ), }, @@ -118,15 +121,29 @@ export const TaskEditor: Component = (props) => { }); return ( - <> +
+
{ + const e = editor(); + if (!e) return; + e.chain().insertContentAt(0, '

').focus('start').run(); + }} + title="Add empty line at the top" + > + + Click to insert newline above + +
{ const target = e.target as HTMLElement; if (target.tagName.toLowerCase() === 'img') { setFullscreenImage((target as HTMLImageElement).src); - } else { + } else if (e.target === editorRef) { + // Focus end if clicking on padding below content editor()?.chain().focus().run(); } }} @@ -205,6 +222,6 @@ export const TaskEditor: Component = (props) => {
- + ); };