From dbddf12f25048028702dae045d7f33b42c5f3eee Mon Sep 17 00:00:00 2001
From: cdricms <36056008+cdricms@users.noreply.github.com>
Date: Thu, 20 Feb 2025 20:09:43 +0100
Subject: [PATCH] CSR
---
.../app/(auth)/dashboard/blogs/new/editor.tsx | 12 ++++--------
frontend/app/(auth)/dashboard/blogs/new/page.tsx | 15 ++++++++++-----
frontend/components/editor-menu.tsx | 4 ++--
3 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/frontend/app/(auth)/dashboard/blogs/new/editor.tsx b/frontend/app/(auth)/dashboard/blogs/new/editor.tsx
index d8149c3..1aed351 100644
--- a/frontend/app/(auth)/dashboard/blogs/new/editor.tsx
+++ b/frontend/app/(auth)/dashboard/blogs/new/editor.tsx
@@ -1,12 +1,8 @@
"use client";
+import { Editor } from "@/components/editor";
import { Button } from "@/components/ui/button";
import useApiMutation from "@/hooks/use-api";
-import dynamic from "next/dynamic";
-
-const Editor = dynamic(
- () => import("@/components/editor").then((mod) => mod.Editor),
- { ssr: false },
-);
+import { useState } from "react";
export default function BlogEditor() {
const {
@@ -29,7 +25,7 @@ export default function BlogEditor() {
className="text-black bg-white"
onClick={async () => {
try {
- const blogContent = localStorage.getItem("blog_draft");
+ // const blogContent = localStorage.getItem("blog_draft");
const res = await trigger({
label: "This is my label",
summary: "A summary",
@@ -37,7 +33,7 @@ export default function BlogEditor() {
href: "none",
blogID: "id",
slug: "myslug",
- content: blogContent,
+ // content: blogContent,
published: "",
});
if (!res)
diff --git a/frontend/app/(auth)/dashboard/blogs/new/page.tsx b/frontend/app/(auth)/dashboard/blogs/new/page.tsx
index 1ce082d..6ff5278 100644
--- a/frontend/app/(auth)/dashboard/blogs/new/page.tsx
+++ b/frontend/app/(auth)/dashboard/blogs/new/page.tsx
@@ -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 (
- <>
-
+ <>
+
>
- )
+ );
}
diff --git a/frontend/components/editor-menu.tsx b/frontend/components/editor-menu.tsx
index f2ff865..ca5dfd4 100644
--- a/frontend/components/editor-menu.tsx
+++ b/frontend/components/editor-menu.tsx
@@ -378,8 +378,8 @@ export function EditorMenu({ editor }: EditorMenuProps) {
+ aria-pressed={editor.isActive("codeBlock")}
+ onClick={() =>
editor
.chain()
.focus()