Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Keep the editor placeholder, and hide it when a table is present.

Cursor Agentffb2ab5ea8ca
diff --git a/apps/web/ui/partners/groups/design/lander/lander-rich-text-editor.tsx b/apps/web/ui/partners/groups/design/lander/lander-rich-text-editor.tsx
index a077665eaa..d64471652b 100644
--- a/apps/web/ui/partners/groups/design/lander/lander-rich-text-editor.tsx
+++ b/apps/web/ui/partners/groups/design/lander/lander-rich-text-editor.tsx
@@ -14,7 +14,7 @@ export function LanderRichTextEditor({
id,
value,
onChange,
- placeholder = "",
+ placeholder = "Start typing...",
error,
editorClassName,
maxLength,
diff --git a/apps/web/ui/partners/groups/design/lander/modals/accordion-block-modal.tsx b/apps/web/ui/partners/groups/design/lander/modals/accordion-block-modal.tsx
index 8be86df876..49f538f54a 100644
--- a/apps/web/ui/partners/groups/design/lander/modals/accordion-block-modal.tsx
+++ b/apps/web/ui/partners/groups/design/lander/modals/accordion-block-modal.tsx
@@ -227,6 +227,7 @@ function AccordionBlockModalInner({
id={`${id}-${field.id}-content`}
value={contentField.value}
onChange={contentField.onChange}
+ placeholder="Start typing"
error={Boolean(fieldErrors?.content)}
editorClassName="max-h-32 min-h-16"
maxLength={ACCORDION_ITEM_CONTENT_MAX_LENGTH}
diff --git a/packages/ui/src/rich-text-area/rich-text-provider.tsx b/packages/ui/src/rich-text-area/rich-text-provider.tsx
index 80bbd6d8eb..9307c9c1e8 100644
--- a/packages/ui/src/rich-text-area/rich-text-provider.tsx
+++ b/packages/ui/src/rich-text-area/rich-text-provider.tsx
@@ -259,24 +259,22 @@ export const RichTextProvider = forwardRef<
: []),
Placeholder.configure({
- placeholder: ({ editor, node, pos }) => {
+ placeholder: ({ editor }) => {
const text = placeholderRef.current;
if (!text) return "";
- // The placeholder decorates the top-level empty node. An empty
- // table is that node, so the text would show inside the first cell.
- const isTable = (name: string) =>
- name === "table" ||
- name === "tableCell" ||
- name === "tableHeader";
- if (isTable(node.type.name)) return "";
-
- const $pos = editor.state.doc.resolve(pos);
- for (let depth = $pos.depth; depth > 0; depth--) {
- if (isTable($pos.node(depth).type.name)) return "";
- }
+ // TipTap treats a table of empty cells as an empty doc, so the
+ // placeholder would show in the first cell. A table is content.
+ let hasTable = false;
+ editor.state.doc.descendants((node) => {
+ if (hasTable) return false;
+ if (node.type.name === "table") {
+ hasTable = true;
+ return false;
+ }
+ });
- return text;
+ return hasTable ? "" : text;
},
emptyEditorClass:
"before:content-[attr(data-placeholder)] before:float-left before:text-content-muted before:h-0 before:pointer-events-none",