Skip to content

Commit 5f4ae3d

Browse files
feat(blog-editor): improve Google Docs import and placeholder UI (#3384)
1 parent afa7c70 commit 5f4ae3d

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

packages/tiptap/src/blog-editor/google-docs-import.tsx

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import clsx from "clsx";
2-
import { SendIcon } from "lucide-react";
2+
import { FileTextIcon, SendIcon } from "lucide-react";
33
import { useState } from "react";
44

55
interface GoogleDocsImportProps {
@@ -30,34 +30,27 @@ export function GoogleDocsImport({
3030
};
3131

3232
return (
33-
<div
34-
className={clsx([
35-
"absolute inset-0 flex items-start justify-center pt-0",
36-
"pointer-events-none",
37-
])}
38-
>
33+
<div className="border border-dashed border-neutral-200 rounded-lg p-4 bg-neutral-50/50">
3934
<form
4035
onSubmit={handleSubmit}
41-
className={clsx([
42-
"flex flex-col gap-3 w-full max-w-md",
43-
"pointer-events-auto",
44-
])}
36+
className="flex flex-col gap-2"
4537
onClick={(e) => e.stopPropagation()}
4638
>
47-
<p className="text-sm text-neutral-400">
48-
Paste a Google Docs link to import, or start typing...
49-
</p>
39+
<div className="flex items-center gap-2 text-neutral-400">
40+
<FileTextIcon className="size-4" />
41+
<span className="text-sm">Or import from Google Docs</span>
42+
</div>
5043
<div className="flex gap-2">
5144
<input
5245
type="url"
5346
value={url}
5447
onChange={(e) => setUrl(e.target.value)}
5548
onKeyDown={handleKeyDown}
56-
placeholder="https://docs.google.com/document/d/..."
49+
placeholder="Paste Google Docs link..."
5750
disabled={isLoading}
5851
className={clsx([
5952
"flex-1 px-3 py-2 text-sm",
60-
"border border-neutral-200 rounded-lg",
53+
"border border-neutral-200 rounded-lg bg-white",
6154
"focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",
6255
"placeholder:text-neutral-300",
6356
"disabled:opacity-50 disabled:cursor-not-allowed",
@@ -68,8 +61,8 @@ export function GoogleDocsImport({
6861
disabled={!url.trim() || isLoading}
6962
className={clsx([
7063
"px-3 py-2 rounded-lg",
71-
"bg-blue-600 text-white",
72-
"hover:bg-blue-700",
64+
"bg-neutral-900 text-white",
65+
"hover:bg-neutral-800",
7366
"disabled:opacity-50 disabled:cursor-not-allowed",
7467
"transition-colors",
7568
"flex items-center gap-2",

packages/tiptap/src/blog-editor/index.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,12 @@ const BlogEditor = forwardRef<{ editor: TiptapEditor | null }, BlogEditorProps>(
5959
const extensions = useMemo(
6060
() => [
6161
...shared.getExtensions(
62-
undefined,
62+
({ node }) => {
63+
if (node.type.name === "paragraph") {
64+
return "Start typing...";
65+
}
66+
return "";
67+
},
6368
onImageUpload
6469
? {
6570
onImageUpload,
@@ -178,10 +183,12 @@ const BlogEditor = forwardRef<{ editor: TiptapEditor | null }, BlogEditorProps>(
178183
role="textbox"
179184
/>
180185
{showImportOverlay && (
181-
<GoogleDocsImport
182-
onImport={onGoogleDocsImport}
183-
isLoading={isImporting}
184-
/>
186+
<div className="mt-6">
187+
<GoogleDocsImport
188+
onImport={onGoogleDocsImport}
189+
isLoading={isImporting}
190+
/>
191+
</div>
185192
)}
186193
</div>
187194
</div>

0 commit comments

Comments
 (0)