Skip to content

πŸ“¨ The ultimate agentic social media scheduling tool πŸ€–

fix(frontend): keep blank lines when pasting plain text and make media tile names readable

Gilad Resisi774323e1c24f
diff --git a/apps/frontend/src/components/media/media.component.tsx b/apps/frontend/src/components/media/media.component.tsx
index dbd5bf9b8..fe23b821a 100644
--- a/apps/frontend/src/components/media/media.component.tsx
+++ b/apps/frontend/src/components/media/media.component.tsx
@@ -644,7 +644,7 @@ export const MediaBox: FC<{
)}
<div
className={clsx(
- 'absolute bottom-[10px] start-[10px] end-[10px] z-[100] truncate text-end mobile:text-[12px]',
+ 'absolute bottom-[10px] start-[10px] end-[10px] z-[100] truncate text-end mobile:text-[12px] rounded-[4px] px-[6px] bg-black/60 text-white',
!standalone && 'mobile:hidden'
)}
>
diff --git a/apps/frontend/src/components/new-launch/editor.tsx b/apps/frontend/src/components/new-launch/editor.tsx
index 25385f1f4..3f8062ce4 100644
--- a/apps/frontend/src/components/new-launch/editor.tsx
+++ b/apps/frontend/src/components/new-launch/editor.tsx
@@ -51,7 +51,7 @@ import { History } from '@tiptap/extension-history';
import { BulletList, ListItem } from '@tiptap/extension-list';
import { Bullets } from '@gitroom/frontend/components/new-launch/bullets.component';
import Heading from '@tiptap/extension-heading';
-import { Slice } from '@tiptap/pm/model';
+import { Fragment, Slice } from '@tiptap/pm/model';
import { HeadingComponent } from '@gitroom/frontend/components/new-launch/heading.component';
import Mention from '@tiptap/extension-mention';
import { suggestion } from '@gitroom/frontend/components/new-launch/mention.component';
@@ -1350,6 +1350,24 @@ export const OnlyEditor = forwardRef<
immediatelyRender: false,
editorProps: {
handlePaste: (view, event, slice) => !!paste?.(event as any, slice),
+ // the default parser merges consecutive newlines, which drops the
+ // blank lines of pasted plain text; keep each one as an empty paragraph
+ clipboardTextParser: (text, $context, _plain, view) => {
+ const { schema } = view.state;
+ const marks = $context.marks();
+ return Slice.maxOpen(
+ Fragment.from(
+ text
+ .split(/\r\n?|\n/)
+ .map((line) =>
+ schema.nodes.paragraph.create(
+ null,
+ line ? schema.text(line, marks) : undefined
+ )
+ )
+ )
+ );
+ },
},
onUpdate: (innerProps) => {
onChange?.(innerProps.editor.getHTML());