Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

fix: update

Marc Seitz1a305ee432cb
diff --git a/components/documents/annotations/annotation-form.tsx b/components/documents/annotations/annotation-form.tsx
index 7473498b..c61a0b6a 100644
--- a/components/documents/annotations/annotation-form.tsx
+++ b/components/documents/annotations/annotation-form.tsx
@@ -32,7 +32,7 @@ const formSchema = z.object({
.max(100, "Title must be less than 100 characters"),
content: z.any().optional(),
pages: z.array(z.number()).min(1, "At least one page must be selected"),
- isVisible: z.boolean().default(true),
+ isVisible: z.boolean(),
});
type FormValues = z.infer<typeof formSchema>;
@@ -63,7 +63,8 @@ export function AnnotationForm({
title: annotation?.title || "",
content: annotation?.content || null,
pages: annotation?.pages || [],
- isVisible: annotation?.isVisible ?? true,
+ isVisible:
+ annotation?.isVisible !== undefined ? annotation.isVisible : true,
},
});
diff --git a/components/ui/rich-text-editor.tsx b/components/ui/rich-text-editor.tsx
index 8bc19ce5..c2aaae7b 100644
--- a/components/ui/rich-text-editor.tsx
+++ b/components/ui/rich-text-editor.tsx
@@ -70,9 +70,9 @@ export function RichTextEditor({
.then((url) => {
const { state } = view;
const { selection } = state;
- const position = selection.$cursor
- ? selection.$cursor.pos
- : selection.$to.pos;
+ const position = selection.empty
+ ? selection.from
+ : selection.to;
const node = state.schema.nodes.image.create({ src: url });
const transaction = state.tr.insert(position, node);
@@ -101,9 +101,9 @@ export function RichTextEditor({
.then((url) => {
const { state } = view;
const { selection } = state;
- const position = selection.$cursor
- ? selection.$cursor.pos
- : selection.$to.pos;
+ const position = selection.empty
+ ? selection.from
+ : selection.to;
const node = state.schema.nodes.image.create({ src: url });
const transaction = state.tr.insert(position, node);
diff --git a/pages/api/teams/[teamId]/documents/[id]/annotations/index.ts b/pages/api/teams/[teamId]/documents/[id]/annotations/index.ts
index 28776823..6d7f34d5 100644
--- a/pages/api/teams/[teamId]/documents/[id]/annotations/index.ts
+++ b/pages/api/teams/[teamId]/documents/[id]/annotations/index.ts
@@ -64,6 +64,7 @@ export default async function handle(
},
});
+ // @ts-ignore
return res.status(200).json(document?.annotations || []);
} catch (error) {
log({