Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

add note modal

daniel31x13cf16344aef60
diff --git a/components/Editor/MenuBar.tsx b/components/Editor/MenuBar.tsx
index ed86a407..60520144 100644
--- a/components/Editor/MenuBar.tsx
+++ b/components/Editor/MenuBar.tsx
@@ -26,12 +26,6 @@ const MenuBar = ({ editor }: { editor: Editor | null }) => {
icon="bi bi-type-h3"
title="Heading 3"
/>
- <IconButton
- onClick={() => editor.chain().focus().setParagraph().run()}
- isActive={editor.isActive("paragraph")}
- icon="bi bi-paragraph"
- title="Paragraph"
- />
<IconButton
onClick={() => editor.chain().focus().toggleBold().run()}
isActive={editor.isActive("bold")}
@@ -82,7 +76,7 @@ const MenuBar = ({ editor }: { editor: Editor | null }) => {
/>
<IconButton
onClick={() => editor.chain().focus().toggleBulletList().run()}
- isActive={editor.isActive({ textAlign: "justify" })}
+ isActive={editor.isActive("bulletList")}
icon="bi bi-list-ul"
title="Bullet List"
/>
diff --git a/components/LinkViews/LinkComponents/LinkIcon.tsx b/components/LinkViews/LinkComponents/LinkIcon.tsx
index 6d00c258..25a41ef9 100644
--- a/components/LinkViews/LinkComponents/LinkIcon.tsx
+++ b/components/LinkViews/LinkComponents/LinkIcon.tsx
@@ -74,6 +74,11 @@ export default function LinkIcon({
iconClasses={iconClasses}
icon="bi-file-earmark-image"
/>
+ ) : link.type === "readable" ? (
+ <LinkPlaceholderIcon
+ iconClasses={iconClasses}
+ icon="bi-file-earmark-text"
+ />
) : // : link.type === "monolith" ? (
// <LinkPlaceholderIcon
// iconClasses={iconClasses + dimension}
diff --git a/components/LinkViews/LinkComponents/LinkTypeBadge.tsx b/components/LinkViews/LinkComponents/LinkTypeBadge.tsx
index c985ec17..0bfd0b28 100644
--- a/components/LinkViews/LinkComponents/LinkTypeBadge.tsx
+++ b/components/LinkViews/LinkComponents/LinkTypeBadge.tsx
@@ -22,6 +22,8 @@ export default function LinkTypeBadge({
return "bi-file-earmark-pdf";
case "image":
return "bi-file-earmark-image";
+ case "readable":
+ return "bi-file-earmark-text";
default:
return "bi-link-45deg";
}
@@ -43,7 +45,9 @@ export default function LinkTypeBadge({
) : (
<div className="flex gap-1 item-center select-none text-neutral duration-100 max-w-full w-fit">
<i className={typeIcon() + ` text-md leading-none`}></i>
- <p className="text-xs truncate">{link.type}</p>
+ <p className="text-xs truncate">
+ {link.type === "readable" ? "note" : link.type}
+ </p>
</div>
);
}
diff --git a/components/ModalContent/NewNoteModal.tsx b/components/ModalContent/NewNoteModal.tsx
index 3bc6822a..110a838b 100644
--- a/components/ModalContent/NewNoteModal.tsx
+++ b/components/ModalContent/NewNoteModal.tsx
@@ -1,27 +1,28 @@
-import React, { useEffect, useState } from "react";
+// NewNoteModal.tsx
+import React, { useEffect, useState, useRef } from "react";
import CollectionSelection from "@/components/InputSelect/CollectionSelection";
import TagSelection from "@/components/InputSelect/TagSelection";
-import TextInput from "@/components/TextInput";
import unescapeString from "@/lib/client/unescapeString";
import { useRouter } from "next/router";
import Modal from "../Modal";
import { useTranslation } from "next-i18next";
import { useCollections } from "@/hooks/store/collections";
-import { useAddLink } from "@/hooks/store/links";
+import { useUploadFile } from "@/hooks/store/links";
import toast from "react-hot-toast";
import { PostLinkSchemaType } from "@/lib/shared/schemaValidation";
+import TextEditor, { TextEditorRef } from "../TextEditor";
+import DOMPurify from "dompurify";
type Props = {
- onClose: Function;
+ onClose: () => void;
};
export default function NewNoteModal({ onClose }: Props) {
const { t } = useTranslation();
const initial = {
name: "",
- url: "",
description: "",
- type: "url",
+ type: "readable",
tags: [],
collection: {
id: undefined,
@@ -30,14 +31,13 @@ export default function NewNoteModal({ onClose }: Props) {
} as PostLinkSchemaType;
const [link, setLink] = useState<PostLinkSchemaType>(initial);
-
- const addLink = useAddLink();
-
const [submitLoader, setSubmitLoader] = useState(false);
const [optionsExpanded, setOptionsExpanded] = useState(false);
const router = useRouter();
const { data: collections = [] } = useCollections();
+ const editorRef = useRef<TextEditorRef>(null);
+
const setCollection = (e: any) => {
if (e?.__isNew__) e.value = undefined;
setLink({
@@ -54,7 +54,7 @@ export default function NewNoteModal({ onClose }: Props) {
useEffect(() => {
if (router.pathname.startsWith("/collections/") && router.query.id) {
const currentCollection = collections.find(
- (e) => e.id == Number(router.query.id)
+ (e) => e.id === Number(router.query.id)
);
if (currentCollection && currentCollection.ownerId)
@@ -70,70 +70,76 @@ export default function NewNoteModal({ onClose }: Props) {
...initial,
collection: { name: "Unorganized" },
});
- }, []);
+ }, [router.pathname, router.query.id, collections]);
+
+ const uploadFile = useUploadFile();
const submit = async () => {
- if (!submitLoader) {
- setSubmitLoader(true);
-
- const load = toast.loading(t("creating_link"));
-
- await addLink.mutateAsync(link, {
- onSettled: (data, error) => {
- setSubmitLoader(false);
- toast.dismiss(load);
-
- if (error) {
- toast.error(t(error.message));
- } else {
- onClose();
- toast.success(t("link_created"));
- }
- },
+ if (submitLoader) return;
+ setSubmitLoader(true);
+
+ const load = toast.loading(t("creating_link"));
+
+ try {
+ const editor = editorRef.current?.getEditor();
+ if (!editor) throw new Error("Editor not initialized");
+
+ // Get the sanitized HTML content from the editor
+ const sanitizedHTML = DOMPurify.sanitize(editor.getHTML());
+
+ // Create a DOM parser to parse the sanitized HTML string
+ const parser = new DOMParser();
+ const doc = parser.parseFromString(sanitizedHTML, "text/html");
+
+ // Extract the first <h1> element as the title
+ const h1 = doc.querySelector("h1");
+ const title = h1 ? h1.textContent?.trim() : link.name;
+
+ // Remove the first <h1> from the content to isolate the main content
+ if (h1) {
+ h1.remove();
+ }
+ const contentWithoutTitle = doc.body.innerHTML.trim();
+
+ // Prepare the file content, optionally including the title
+ const file = new File([contentWithoutTitle], title || "Untitled Note", {
+ type: "text/plain",
});
+
+ // Perform the file upload mutation
+ await uploadFile.mutateAsync(
+ { link, file },
+ {
+ onSettled: (data, error) => {
+ setSubmitLoader(false);
+ toast.dismiss(load);
+
+ if (error) {
+ toast.error(error.message);
+ } else {
+ onClose();
+ toast.success(t("created_success"));
+ }
+ },
+ }
+ );
+ } catch (error: any) {
+ setSubmitLoader(false);
+ toast.dismiss(load);
+ toast.error(error.message || "An error occurred");
}
};
return (
<Modal toggleModal={onClose}>
- <p className="text-xl font-thin">{t("create_new_link")}</p>
- <div className="divider mb-3 mt-1"></div>
- <div className="grid grid-flow-row-dense sm:grid-cols-5 gap-3">
- <div className="sm:col-span-3 col-span-5">
- <p className="mb-2">{t("link")}</p>
- <TextInput
- value={link.url || ""}
- onChange={(e) => setLink({ ...link, url: e.target.value })}
- placeholder={t("link_url_placeholder")}
- className="bg-base-200"
- />
- </div>
- <div className="sm:col-span-2 col-span-5">
- <p className="mb-2">{t("collection")}</p>
- {link.collection?.name && (
- <CollectionSelection
- onChange={setCollection}
- defaultValue={{
- value: link.collection?.id,
- label: link.collection?.name || "Unorganized",
- }}
- />
- )}
- </div>
- </div>
+ <p className="text-xl font-thin">{t("write_new_note")}</p>
+ <div className="divider mb-2 mt-1"></div>
+ {/* Pass the ref to TextEditor */}
+ <TextEditor ref={editorRef} editable />
<div className={"mt-2"}>
{optionsExpanded && (
<div className="mt-5">
- <div className="grid sm:grid-cols-2 gap-3">
- <div>
- <p className="mb-2">{t("name")}</p>
- <TextInput
- value={link.name}
- onChange={(e) => setLink({ ...link, name: e.target.value })}
- placeholder={t("link_name_placeholder")}
- className="bg-base-200"
- />
- </div>
+ <div className="grid gap-3">
<div>
<p className="mb-2">{t("tags")}</p>
<TagSelection
@@ -144,6 +150,18 @@ export default function NewNoteModal({ onClose }: Props) {
}))}
/>
</div>
+ <div>
+ <p className="mb-2">{t("collection")}</p>
+ {link.collection?.name && (
+ <CollectionSelection
+ onChange={setCollection}
+ defaultValue={{
+ value: link.collection?.id,
+ label: link.collection?.name || "Unorganized",
+ }}
+ />
+ )}
+ </div>
<div className="sm:col-span-2">
<p className="mb-2">{t("description")}</p>
<textarea
@@ -170,8 +188,9 @@ export default function NewNoteModal({ onClose }: Props) {
<button
className="btn btn-accent dark:border-violet-400 text-white"
onClick={submit}
+ disabled={submitLoader}
>
- {t("create_link")}
+ {submitLoader ? t("creating...") : t("create_link")}
</button>
</div>
</Modal>
diff --git a/components/ModalContent/UploadFileModal.tsx b/components/ModalContent/UploadFileModal.tsx
index 0abf961c..d5d83b91 100644
--- a/components/ModalContent/UploadFileModal.tsx
+++ b/components/ModalContent/UploadFileModal.tsx
@@ -3,11 +3,6 @@ import CollectionSelection from "@/components/InputSelect/CollectionSelection";
import TagSelection from "@/components/InputSelect/TagSelection";
import TextInput from "@/components/TextInput";
import unescapeString from "@/lib/client/unescapeString";
-import {
- LinkIncludingShortenedCollectionAndTags,
- ArchivedFormat,
-} from "@/types/global";
-import { useSession } from "next-auth/react";
import { useRouter } from "next/router";
import toast from "react-hot-toast";
import Modal from "../Modal";
@@ -90,24 +85,6 @@ export default function UploadFileModal({ onClose }: Props) {
const submit = async () => {
if (!submitLoader && file) {
- let fileType: ArchivedFormat | null = null;
- let linkType: "url" | "image" | "monolith" | "pdf" | null = null;
-
- if (file?.type === "image/jpg" || file.type === "image/jpeg") {
- fileType = ArchivedFormat.jpeg;
- linkType = "image";
- } else if (file.type === "image/png") {
- fileType = ArchivedFormat.png;
- linkType = "image";
- } else if (file.type === "application/pdf") {
- fileType = ArchivedFormat.pdf;
- linkType = "pdf";
- }
- // else if (file.type === "text/html") {
- // fileType = ArchivedFormat.monolith;
- // linkType = "monolith";
- // }
-
setSubmitLoader(true);
const load = toast.loading(t("creating"));
diff --git a/components/Navbar.tsx b/components/Navbar.tsx
index 083ace96..9a9856bf 100644
--- a/components/Navbar.tsx
+++ b/components/Navbar.tsx
@@ -12,6 +12,7 @@ import { dropdownTriggerer } from "@/lib/client/utils";
import MobileNavigation from "./MobileNavigation";
import ProfileDropdown from "./ProfileDropdown";
import { useTranslation } from "next-i18next";
+import NewNoteModal from "./ModalContent/NewNoteModal";
export default function Navbar() {
const { t } = useTranslation();
@@ -37,6 +38,7 @@ export default function Navbar() {
const [newLinkModal, setNewLinkModal] = useState(false);
const [newCollectionModal, setNewCollectionModal] = useState(false);
const [uploadFileModal, setUploadFileModal] = useState(false);
+ const [newNoteModal, setNewNoteModal] = useState(false);
return (
<div className="flex justify-between gap-2 items-center pl-3 pr-4 py-2 border-solid border-b-neutral-content border-b">
@@ -78,11 +80,24 @@ export default function Navbar() {
}}
tabIndex={0}
role="button"
- className="whitespace-nowrap"
+ className="whitespace-nowrap flex gap-2"
>
{t("new_link")}
</div>
</li>
+ <li>
+ <div
+ onClick={() => {
+ (document?.activeElement as HTMLElement)?.blur();
+ setNewNoteModal(true);
+ }}
+ tabIndex={0}
+ role="button"
+ className="whitespace-nowrap flex gap-2"
+ >
+ {t("new_note")}
+ </div>
+ </li>
<li>
<div
onClick={() => {
@@ -91,7 +106,7 @@ export default function Navbar() {
}}
tabIndex={0}
role="button"
- className="whitespace-nowrap"
+ className="whitespace-nowrap flex gap-2"
>
{t("upload_file")}
</div>
@@ -104,7 +119,7 @@ export default function Navbar() {
}}
tabIndex={0}
role="button"
- className="whitespace-nowrap"
+ className="whitespace-nowrap flex gap-2"
>
{t("new_collection")}
</div>
@@ -133,6 +148,7 @@ export default function Navbar() {
{uploadFileModal && (
<UploadFileModal onClose={() => setUploadFileModal(false)} />
)}
+ {newNoteModal && <NewNoteModal onClose={() => setNewNoteModal(false)} />}
</div>
);
}
diff --git a/components/Preservation/ReadableView.tsx b/components/Preservation/ReadableView.tsx
index 74b94aa8..1752f438 100644
--- a/components/Preservation/ReadableView.tsx
+++ b/components/Preservation/ReadableView.tsx
@@ -46,7 +46,9 @@ export default function ReadableView({ link, isExpanded, standalone }: Props) {
Image,
ListItem,
Highlight,
- TextAlign,
+ TextAlign.configure({
+ types: ["heading", "paragraph"],
+ }),
TipTapLink.configure({
openOnClick: false,
}),
diff --git a/components/TextEditor.tsx b/components/TextEditor.tsx
new file mode 100644
index 00000000..75533a8a
--- /dev/null
+++ b/components/TextEditor.tsx
@@ -0,0 +1,138 @@
+// TextEditor.tsx
+import React, {
+ useEffect,
+ useState,
+ forwardRef,
+ useImperativeHandle,
+} from "react";
+import { formatAvailable } from "@/lib/shared/formatStats";
+import {
+ ArchivedFormat,
+ LinkIncludingShortenedCollectionAndTags,
+} from "@/types/global";
+import { useRouter } from "next/router";
+import { useTranslation } from "next-i18next";
+import clsx from "clsx";
+import usePermissions from "@/hooks/usePermissions";
+import { useUpdateFile } from "@/hooks/store/links";
+import { EditorContent, useEditor } from "@tiptap/react";
+import StarterKit from "@tiptap/starter-kit";
+import Image from "@tiptap/extension-image";
+import TipTapLink from "@tiptap/extension-link";
+import Highlight from "@tiptap/extension-highlight";
+import TextAlign from "@tiptap/extension-text-align";
+import MenuBar from "@/components/Editor/MenuBar";
+import TaskItem from "@tiptap/extension-task-item";
+import TaskList from "@tiptap/extension-task-list";
+import ListItem from "@tiptap/extension-list-item";
+import Placeholder from "@tiptap/extension-placeholder";
+import Document from "@tiptap/extension-document";
+
+type Props = {
+ onSave?: () => void; // Make onSave optional
+ link?: LinkIncludingShortenedCollectionAndTags;
+ className?: string;
+ editable?: boolean;
+};
+
+// Define the type for the exposed methods via ref
+export type TextEditorRef = {
+ getEditor: () => any; // Replace `any` with the actual editor type if available
+};
+
+const TextEditor = forwardRef<TextEditorRef, Props>(
+ ({ onSave, link, className, editable }, ref) => {
+ const { t } = useTranslation();
+ const [linkContent, setLinkContent] = useState("");
+
+ const editor = useEditor({
+ extensions: [
+ Document.extend({
+ content: "heading block*",
+ }),
+ TaskList,
+ TaskItem.configure({
+ nested: true,
+ }),
+ StarterKit.configure({
+ document: false,
+ }),
+ Image,
+ ListItem,
+ Highlight,
+ TextAlign.configure({
+ types: ["heading", "paragraph"],
+ }),
+ TipTapLink.configure({
+ openOnClick: false,
+ }),
+ Placeholder.configure({
+ placeholder: ({ node }: any) => {
+ if (node.type.name === "heading") {
+ return t("add_a_title_placeholder");
+ }
+
+ return t("write_notes_here_placeholder");
+ },
+ }),
+ ],
+ immediatelyRender: false,
+ content: linkContent || `<h1>${link?.name || ""}</h1>\n<p></p>`,
+ editable: editable || false,
+ editorProps: {
+ attributes: {
+ class: clsx(
+ "w-full h-[calc(80vh-10.75rem)] reader-view rounded-md bg-base-200 focus:outline-none border-neutral-content focus:border-primary border-solid border p-3 overflow-auto duration-100"
+ ),
+ },
+ },
+ });
+
+ // Expose the editor instance to the parent via ref
+ useImperativeHandle(ref, () => ({
+ getEditor: () => editor,
+ }));
+
+ const router = useRouter();
+ const isPublicRoute = router.pathname.startsWith("/public");
+ const permissions = link
+ ? usePermissions(link.collection?.id as number)
+ : true;
+
+ useEffect(() => {
+ const fetchLinkContent = async (
+ l: LinkIncludingShortenedCollectionAndTags
+ ) => {
+ if (formatAvailable(l, "readable")) {
+ const response = await fetch(
+ `/api/v1/archives/${l?.id}?format=${ArchivedFormat.readability}&_=${l.updatedAt}`
+ );
+ const data = await response?.json();
+ const content = data?.content || "";
+ const combinedContent = `<h1>${l.name}</h1>\n${content}`;
+ setLinkContent(combinedContent);
+ }
+ };
+
+ if (link) {
+ fetchLinkContent(link);
+ }
+ }, [link]);
+
+ useEffect(() => {
+ const a = editor?.getText();
+ console.log(a);
+ }, [editable, editor]);
+
+ return (
+ editor && (
+ <div className={clsx(className)}>
+ <MenuBar editor={editor} />
+ <EditorContent editor={editor} />
+ </div>
+ )
+ );
+ }
+);
+
+export default TextEditor;
diff --git a/lib/api/archiveHandler.ts b/lib/api/archiveHandler.ts
index cff6006c..16416747 100644
--- a/lib/api/archiveHandler.ts
+++ b/lib/api/archiveHandler.ts
@@ -6,7 +6,7 @@ import fetchHeaders from "./fetchHeaders";
import createFolder from "./storage/createFolder";
import { removeFiles } from "./manageLinkFiles";
import handleMonolith from "./preservationScheme/handleMonolith";
-import handleReadablility from "./preservationScheme/handleReadablility";
+import handleReadability from "./preservationScheme/handleReadability";
import handleArchivePreview from "./preservationScheme/handleArchivePreview";
import handleScreenshotAndPdf from "./preservationScheme/handleScreenshotAndPdf";
import imageHandler from "./preservationScheme/imageHandler";
@@ -92,7 +92,7 @@ export default async function archiveHandler(link: LinksAndCollectionAndOwner) {
if (!link.preview) await handleArchivePreview(link, page);
// Readability
- if (!link.readable) await handleReadablility(content, link);
+ if (!link.readable) await handleReadability(content, link);
// Auto-tagging
if (
diff --git a/lib/api/controllers/links/postLink.ts b/lib/api/controllers/links/postLink.ts
index 76e0eb85..e649faff 100644
--- a/lib/api/controllers/links/postLink.ts
+++ b/lib/api/controllers/links/postLink.ts
@@ -96,6 +96,7 @@ export default async function postLink(
data: {
url: link.url?.trim() || null,
name,
+ preview: link.type === "readable" ? "unavailable" : undefined,
description: link.description,
type: linkType,
createdBy: {
diff --git a/lib/api/preservationScheme/handleReadablility.ts b/lib/api/preservationScheme/handleReadability.ts
similarity index 93%
rename from lib/api/preservationScheme/handleReadablility.ts
rename to lib/api/preservationScheme/handleReadability.ts
index 3a44a592..a64e98f0 100644
--- a/lib/api/preservationScheme/handleReadablility.ts
+++ b/lib/api/preservationScheme/handleReadability.ts
@@ -13,7 +13,11 @@ const handleReadablility = async (
const window = new JSDOM("").window;
const purify = DOMPurify(window);
const cleanedUpContent = purify.sanitize(content);
- const dom = new JSDOM(cleanedUpContent, { url: link.url || "" });
+ const dom = new JSDOM(
+ cleanedUpContent,
+ link?.url ? { url: link.url || "" } : undefined
+ );
+
const article = new Readability(dom.window.document).parse();
const articleText = article?.textContent
.replace(/ +(?= )/g, "") // strip out multiple spaces
diff --git a/lib/shared/schemaValidation.ts b/lib/shared/schemaValidation.ts
index d549c9f5..5d85087d 100644
--- a/lib/shared/schemaValidation.ts
+++ b/lib/shared/schemaValidation.ts
@@ -96,7 +96,7 @@ export const PostSessionSchema = z.object({
});
export const PostLinkSchema = z.object({
- type: z.enum(["url", "pdf", "image"]).nullish(),
+ type: z.enum(["url", "pdf", "image", "readable"]).nullish(),
url: z.string().trim().max(2048).url().optional(),
name: z.string().trim().max(2048).optional(),
description: z.string().trim().max(2048).optional(),
diff --git a/package.json b/package.json
index dbdbb843..ef423991 100644
--- a/package.json
+++ b/package.json
@@ -34,6 +34,7 @@
"@tiptap/extension-highlight": "^2.11.2",
"@tiptap/extension-image": "^2.11.2",
"@tiptap/extension-link": "^2.11.2",
+ "@tiptap/extension-placeholder": "^2.11.5",
"@tiptap/extension-task-item": "^2.11.2",
"@tiptap/extension-task-list": "^2.11.2",
"@tiptap/extension-text-align": "^2.11.2",
diff --git a/pages/api/v1/archives/[linkId].ts b/pages/api/v1/archives/[linkId].ts
index 344c6914..34b1e9e7 100644
--- a/pages/api/v1/archives/[linkId].ts
+++ b/pages/api/v1/archives/[linkId].ts
@@ -17,7 +17,7 @@ import DOMPurify from "dompurify";
import { formatAvailable } from "@/lib/shared/formatStats";
import { ArchivedFormat } from "@/types/global";
import getLinkTypeFromFormat from "@/lib/shared/getLinkTypeFromFormat";
-import handleReadablility from "@/lib/api/preservationScheme/handleReadablility";
+import handleReadability from "@/lib/api/preservationScheme/handleReadability";
export const config = {
api: {
@@ -256,13 +256,15 @@ async function handlePost(req: NextApiRequest, res: NextApiResponse) {
const isReadable = mimetype?.includes("text");
if (isReadable) {
- await handleReadablility(fileBuffer.toString(), link, true);
+ await handleReadability(fileBuffer.toString(), link, true);
fs.unlinkSync(files.file[0].filepath);
return res.status(200).json({ response: files });
}
+ console.log("isPDF", isPDF);
+
if (isImage) {
const collectionId = collectionPermissions.id;
createFolder({ filePath: `archives/preview/${collectionId}` });
diff --git a/public/locales/en/common.json b/public/locales/en/common.json
index 70ace3c2..79c5ee74 100644
--- a/public/locales/en/common.json
+++ b/public/locales/en/common.json
@@ -460,5 +460,9 @@
"search_for_links": "Search for Links",
"search_query_invalid_symbol": "The search query should not contain '%'.",
"open_modal_new_tab": "Open this modal in a new tab",
- "file": "File"
+ "file": "File",
+ "write_new_note": "Write a New Note",
+ "new_note": "New Note",
+ "add_a_title_placeholder": "Add a title...",
+ "write_notes_here_placeholder": "Write some notes here..."
}
\ No newline at end of file
diff --git a/styles/globals.css b/styles/globals.css
index d30e3bde..2009ce98 100644
--- a/styles/globals.css
+++ b/styles/globals.css
@@ -297,6 +297,22 @@
cursor: pointer;
}
+.reader-view h1.is-editor-empty:first-child::before {
+ color: oklch(var(--n));
+ content: attr(data-placeholder);
+ float: left;
+ height: 0;
+ pointer-events: none;
+}
+
+.reader-view h1 + p.is-empty::before {
+ color: oklch(var(--n));
+ content: attr(data-placeholder);
+ float: left;
+ height: 0;
+ pointer-events: none;
+}
+
.read-only ul[data-type="taskList"] {
pointer-events: none;
}
diff --git a/yarn.lock b/yarn.lock
index c254a4e5..46cdcf84 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2059,6 +2059,11 @@
resolved "https://registry.yarnpkg.com/@tiptap/extension-paragraph/-/extension-paragraph-2.11.2.tgz#b4e99129b1c5959e2926b9563ced89755e0d4d81"
integrity sha512-iydTjeZbPJuqctOaAx7QebLPvz9J/hBxPptuhe4GZmqInknAk7+SFJagYeGNb14wfXKOvDZ9DMqv6mBiqSA90Q==
+"@tiptap/extension-placeholder@^2.11.5":
+ version "2.11.5"
+ resolved "https://registry.yarnpkg.com/@tiptap/extension-placeholder/-/extension-placeholder-2.11.5.tgz#de8412b486865b379f121a502ae3de8be7fa2d27"
+ integrity sha512-Pr+0Ju/l2ZvXMd9VQxtaoSZbs0BBp1jbBDqwms88ctpyvQFRfLSfSkqudQcSHyw2ROOz2E31p/7I7fpI8Y0CLA==
+
"@tiptap/extension-strike@^2.11.2":
version "2.11.2"
resolved "https://registry.yarnpkg.com/@tiptap/extension-strike/-/extension-strike-2.11.2.tgz#9b5b698da5a024219e2ecf438c3b503d9b812fbe"