This commit is contained in:
cdricms
2025-02-20 20:09:43 +01:00
parent 5bdfc9ce06
commit dbddf12f25
3 changed files with 16 additions and 15 deletions

View File

@@ -1,12 +1,8 @@
"use client"; "use client";
import { Editor } from "@/components/editor";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import useApiMutation from "@/hooks/use-api"; import useApiMutation from "@/hooks/use-api";
import dynamic from "next/dynamic"; import { useState } from "react";
const Editor = dynamic(
() => import("@/components/editor").then((mod) => mod.Editor),
{ ssr: false },
);
export default function BlogEditor() { export default function BlogEditor() {
const { const {
@@ -29,7 +25,7 @@ export default function BlogEditor() {
className="text-black bg-white" className="text-black bg-white"
onClick={async () => { onClick={async () => {
try { try {
const blogContent = localStorage.getItem("blog_draft"); // const blogContent = localStorage.getItem("blog_draft");
const res = await trigger({ const res = await trigger({
label: "This is my label", label: "This is my label",
summary: "A summary", summary: "A summary",
@@ -37,7 +33,7 @@ export default function BlogEditor() {
href: "none", href: "none",
blogID: "id", blogID: "id",
slug: "myslug", slug: "myslug",
content: blogContent, // content: blogContent,
published: "", published: "",
}); });
if (!res) if (!res)

View File

@@ -1,9 +1,14 @@
import Editor from "./editor" "use client";
import dynamic from "next/dynamic";
export default function NewBlog() { const Editor = dynamic(() => import("./editor").then((mod) => mod.default), {
ssr: false,
});
export default async function NewBlog() {
return ( return (
<> <>
<Editor /> <Editor />
</> </>
) );
} }

View File

@@ -378,8 +378,8 @@ export function EditorMenu({ editor }: EditorMenuProps) {
<ToggleGroupItem <ToggleGroupItem
value="codeBlock" value="codeBlock"
aria-label="Toggle code block" aria-label="Toggle code block"
pressed={editor.isActive("codeBlock")} aria-pressed={editor.isActive("codeBlock")}
onPressedChanged={() => onClick={() =>
editor editor
.chain() .chain()
.focus() .focus()