diff --git a/src/components/editor/hooks/useEditorEffects.ts b/src/components/editor/hooks/useEditorEffects.ts
index 4c8aea5..579f96a 100644
--- a/src/components/editor/hooks/useEditorEffects.ts
+++ b/src/components/editor/hooks/useEditorEffects.ts
@@ -63,7 +63,7 @@ export function useEditorEffects({
// Initialize word count when editor is ready
useEffect(() => {
- if (!editor || !editor.view) return;
+ if (!editor || !editor.view || !editor.view.dom) return;
// Calculate initial word count
const text = editor.state.doc.textContent;
@@ -72,11 +72,11 @@ export function useEditorEffects({
// Track scroll percentage
useEffect(() => {
- if (!editor || !editor.view) return;
+ if (!editor || !editor.view || !editor.view.dom) return;
const updateScrollPercentage = () => {
const editorView = editor.view;
- if (!editorView.dom) return;
+ if (!editorView || !editorView.dom) return;
const { scrollTop, scrollHeight, clientHeight } = editorView.dom;
const maxScroll = scrollHeight - clientHeight;
@@ -102,7 +102,7 @@ export function useEditorEffects({
// Store the original font size when editor is first created
useEffect(() => {
- if (!editor || !editor.view || baseFontSize) return;
+ if (!editor || !editor.view || !editor.view.dom || baseFontSize) return;
const editorElement = editor.view.dom as HTMLElement;
const computedStyle = window.getComputedStyle(editorElement);
@@ -112,7 +112,7 @@ export function useEditorEffects({
// Apply zoom level to editor
useEffect(() => {
- if (!editor || !editor.view || !baseFontSize) return;
+ if (!editor || !editor.view || !editor.view.dom || !baseFontSize) return;
const editorElement = editor.view.dom as HTMLElement;
diff --git a/src/components/editor/index.tsx b/src/components/editor/index.tsx
index c7ba6d9..fee4620 100644
--- a/src/components/editor/index.tsx
+++ b/src/components/editor/index.tsx
@@ -70,7 +70,9 @@ interface NoteEditorProps {
onDeleteNote: (noteId: string) => void;
onArchiveNote: (noteId: string) => void;
onToggleStar: (noteId: string) => void;
+ starringStar?: boolean;
onHideNote: (noteId: string) => void;
+ hidingNote?: boolean;
onUnhideNote: (noteId: string) => void;
onRefreshNote?: (noteId: string) => void;
userId?: string;
@@ -92,7 +94,9 @@ export default function Index({
onDeleteNote,
onArchiveNote,
onToggleStar,
+ starringStar = false,
onHideNote,
+ hidingNote = false,
onUnhideNote,
onRefreshNote,
userId = 'current-user',
@@ -671,10 +675,15 @@ export default function Index({
note.starred ? 'text-yellow-500' : 'text-muted-foreground'
}
title={note.starred ? 'Remove from starred' : 'Add to starred'}
+ disabled={starringStar}
>
-
+ {starringStar ? (
+
+ ) : (
+
+ )}