@carlonicora/nextjs-jsonapi 1.88.1 → 1.89.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/{BlockNoteEditor-ZK2FZKIT.mjs → BlockNoteEditor-7XTFKIVT.mjs} +33 -5
  2. package/dist/BlockNoteEditor-7XTFKIVT.mjs.map +1 -0
  3. package/dist/{BlockNoteEditor-WBQCVHRG.js → BlockNoteEditor-C2HEQ2GF.js} +39 -11
  4. package/dist/BlockNoteEditor-C2HEQ2GF.js.map +1 -0
  5. package/dist/billing/index.js +299 -299
  6. package/dist/billing/index.mjs +1 -1
  7. package/dist/{chunk-6PDFD446.js → chunk-IB5YCA74.js} +257 -182
  8. package/dist/chunk-IB5YCA74.js.map +1 -0
  9. package/dist/{chunk-JAVXCFGG.mjs → chunk-VFS7UECR.mjs} +1412 -1337
  10. package/dist/chunk-VFS7UECR.mjs.map +1 -0
  11. package/dist/client/index.js +2 -2
  12. package/dist/client/index.mjs +1 -1
  13. package/dist/components/index.d.mts +48 -29
  14. package/dist/components/index.d.ts +48 -29
  15. package/dist/components/index.js +6 -2
  16. package/dist/components/index.js.map +1 -1
  17. package/dist/components/index.mjs +5 -1
  18. package/dist/contexts/index.js +2 -2
  19. package/dist/contexts/index.mjs +1 -1
  20. package/package.json +1 -1
  21. package/src/components/editors/BlockNoteEditor.tsx +34 -5
  22. package/src/components/editors/BlockNoteEditorMentionHoverCard.tsx +99 -0
  23. package/src/components/editors/BlockNoteEditorMentionInlineContent.tsx +53 -31
  24. package/src/components/editors/index.ts +1 -0
  25. package/src/components/forms/FormBlockNote.tsx +2 -1
  26. package/src/features/assistant-message/components/parts/tabs/ContentsTab.tsx +3 -3
  27. package/src/features/assistant-message/components/parts/tabs/ReferencesTab.tsx +2 -2
  28. package/src/features/assistant-message/components/parts/tabs/UsersTab.tsx +3 -8
  29. package/src/features/how-to/components/details/HowToDetails.tsx +3 -3
  30. package/src/hooks/usePageUrlGenerator.ts +33 -29
  31. package/src/shadcnui/ui/sidebar.tsx +3 -3
  32. package/dist/BlockNoteEditor-WBQCVHRG.js.map +0 -1
  33. package/dist/BlockNoteEditor-ZK2FZKIT.mjs.map +0 -1
  34. package/dist/chunk-6PDFD446.js.map +0 -1
  35. package/dist/chunk-JAVXCFGG.mjs.map +0 -1
@@ -15,7 +15,8 @@ import { Button } from "../../shadcnui";
15
15
  import { BlockNoteDiffUtil, BlockNoteWordDiffRendererUtil, cn } from "../../utils";
16
16
  import { errorToast } from "../errors";
17
17
  import { BlockNoteEditorFormattingToolbar } from "./BlockNoteEditorFormattingToolbar";
18
- import { createMentionInlineContentSpec } from "./BlockNoteEditorMentionInlineContent";
18
+ import { BlockNoteEditorMentionHoverCard } from "./BlockNoteEditorMentionHoverCard";
19
+ import { createMentionInlineContentSpec, type MentionResolveFn } from "./BlockNoteEditorMentionInlineContent";
19
20
  import { BlockNoteEditorMentionSuggestionMenu } from "./BlockNoteEditorSuggestionMenuController";
20
21
 
21
22
  export type BlockNoteEditorProps = {
@@ -37,9 +38,35 @@ export type BlockNoteEditorProps = {
37
38
  params?: Record<string, string>,
38
39
  ) => Promise<import("./BlockNoteEditorSuggestionMenuController").MentionItem[]>;
39
40
  mentionSearchParams?: Record<string, string>;
40
- mentionResolveFn?: (id: string, entityType: string, alias: string) => { url: string; name: string } | null;
41
+ mentionResolveFn?: MentionResolveFn;
41
42
  };
42
43
 
44
+ function isBlockEmpty(block: any): boolean {
45
+ if (!block || typeof block !== "object") return true;
46
+ if (block.type !== "paragraph") return false;
47
+ if (Array.isArray(block.children) && block.children.length > 0 && !isDocumentEmpty(block.children)) {
48
+ return false;
49
+ }
50
+ if (Array.isArray(block.content)) {
51
+ for (const inline of block.content) {
52
+ if (typeof inline === "string") {
53
+ if (inline.trim()) return false;
54
+ } else if (inline && typeof inline === "object") {
55
+ if (inline.type !== "text") return false;
56
+ if (typeof inline.text === "string" && inline.text.trim()) return false;
57
+ }
58
+ }
59
+ } else if (typeof block.content === "string" && block.content.trim()) {
60
+ return false;
61
+ }
62
+ return true;
63
+ }
64
+
65
+ function isDocumentEmpty(blocks: any[]): boolean {
66
+ if (!Array.isArray(blocks) || blocks.length === 0) return true;
67
+ return blocks.every(isBlockEmpty);
68
+ }
69
+
43
70
  const createDiffActionsInlineContentSpec = (
44
71
  handleAcceptChange: (diffId: string) => void,
45
72
  handleRejectChange: (diffId: string) => void,
@@ -305,8 +332,7 @@ export default function BlockNoteEditor({
305
332
  const handleChange = useCallback(async () => {
306
333
  if (!onChange) return;
307
334
  const newBlocks = editor.document;
308
-
309
- const markdownFromBlocks = (await editor.blocksToMarkdownLossy(editor.document)).trim();
335
+ const isEmpty = isDocumentEmpty(newBlocks);
310
336
 
311
337
  function hasUnresolvedDiffsRecursive(block: any): boolean {
312
338
  if (!block || typeof block !== "object") return false;
@@ -358,7 +384,7 @@ export default function BlockNoteEditor({
358
384
  hasUnresolvedDiff = newBlocks.some((block: any) => hasUnresolvedDiffsRecursive(block));
359
385
  }
360
386
 
361
- onChange(newBlocks, !markdownFromBlocks.length, hasUnresolvedDiff);
387
+ onChange(newBlocks, isEmpty, hasUnresolvedDiff);
362
388
  }, [editor, onChange, id, acceptedChanges, rejectedChanges]);
363
389
 
364
390
  // Utility: deep equality for arrays of blocks
@@ -454,6 +480,9 @@ export default function BlockNoteEditor({
454
480
  />
455
481
  )}
456
482
  {renderOverlays?.(editor)}
483
+ {enableMentions && mentionResolveFn && (
484
+ <BlockNoteEditorMentionHoverCard containerRef={editorRef} mentionResolveFn={mentionResolveFn} />
485
+ )}
457
486
  </BlockNoteView>
458
487
  </div>
459
488
  );
@@ -0,0 +1,99 @@
1
+ "use client";
2
+
3
+ import type { MentionResolveFn } from "./BlockNoteEditorMentionInlineContent";
4
+ import React, { useCallback, useEffect, useRef, useState } from "react";
5
+ import { createPortal } from "react-dom";
6
+
7
+ type HoveredMention = {
8
+ id: string;
9
+ entityType: string;
10
+ alias: string;
11
+ element: HTMLElement;
12
+ };
13
+
14
+ export function BlockNoteEditorMentionHoverCard({
15
+ containerRef,
16
+ mentionResolveFn,
17
+ }: {
18
+ containerRef: React.RefObject<HTMLDivElement | null>;
19
+ mentionResolveFn?: MentionResolveFn;
20
+ }) {
21
+ const [hovered, setHovered] = useState<HoveredMention | null>(null);
22
+ const closeTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
23
+
24
+ const scheduleClose = useCallback(() => {
25
+ closeTimeoutRef.current = setTimeout(() => setHovered(null), 200);
26
+ }, []);
27
+
28
+ const cancelClose = useCallback(() => {
29
+ if (closeTimeoutRef.current) {
30
+ clearTimeout(closeTimeoutRef.current);
31
+ closeTimeoutRef.current = null;
32
+ }
33
+ }, []);
34
+
35
+ useEffect(() => {
36
+ const container = containerRef.current;
37
+ if (!container || !mentionResolveFn) return;
38
+
39
+ const handleMouseOver = (e: MouseEvent) => {
40
+ const target = (e.target as HTMLElement).closest("[data-mention-id]") as HTMLElement | null;
41
+ if (!target) return;
42
+
43
+ cancelClose();
44
+
45
+ const id = target.dataset.mentionId!;
46
+ const entityType = target.dataset.mentionType!;
47
+ const alias = target.dataset.mentionAlias!;
48
+
49
+ setHovered((prev) => {
50
+ if (prev?.id === id && prev?.element === target) return prev;
51
+ return { id, entityType, alias, element: target };
52
+ });
53
+ };
54
+
55
+ const handleMouseOut = (e: MouseEvent) => {
56
+ const target = (e.target as HTMLElement).closest("[data-mention-id]");
57
+ if (!target) return;
58
+
59
+ const related = (e.relatedTarget as HTMLElement)?.closest("[data-mention-id]");
60
+ if (related) return;
61
+
62
+ scheduleClose();
63
+ };
64
+
65
+ container.addEventListener("mouseover", handleMouseOver);
66
+ container.addEventListener("mouseout", handleMouseOut);
67
+
68
+ return () => {
69
+ container.removeEventListener("mouseover", handleMouseOver);
70
+ container.removeEventListener("mouseout", handleMouseOut);
71
+ if (closeTimeoutRef.current) clearTimeout(closeTimeoutRef.current);
72
+ };
73
+ }, [containerRef, mentionResolveFn, cancelClose, scheduleClose]);
74
+
75
+ if (!hovered || !mentionResolveFn) return null;
76
+
77
+ const resolved = mentionResolveFn(hovered.id, hovered.entityType, hovered.alias);
78
+ if (!resolved?.HoverContent) return null;
79
+
80
+ const ContentComponent = resolved.HoverContent;
81
+ const rect = hovered.element.getBoundingClientRect();
82
+
83
+ return createPortal(
84
+ <div
85
+ onMouseEnter={cancelClose}
86
+ onMouseLeave={scheduleClose}
87
+ style={{
88
+ position: "fixed",
89
+ top: rect.bottom + 4,
90
+ left: rect.left,
91
+ zIndex: 50,
92
+ }}
93
+ className="bg-popover text-popover-foreground rounded-lg border p-2.5 text-xs shadow-md animate-in fade-in-0 zoom-in-95 duration-100"
94
+ >
95
+ <ContentComponent id={hovered.id} entityType={hovered.entityType} alias={hovered.alias} />
96
+ </div>,
97
+ document.body,
98
+ );
99
+ }
@@ -1,18 +1,59 @@
1
1
  "use client";
2
2
 
3
- import { Link } from "@/shadcnui";
4
3
  import { createReactInlineContentSpec } from "@blocknote/react";
4
+ import Link from "next/link";
5
5
  import React from "react";
6
6
 
7
+ export interface MentionRenderProps {
8
+ id: string;
9
+ entityType: string;
10
+ alias: string;
11
+ }
12
+
13
+ /** @deprecated Use MentionRenderProps. */
14
+ export type MentionHoverCardProps = MentionRenderProps;
15
+
7
16
  export interface MentionResolveResult {
8
- url: string;
17
+ /** Navigation target. Optional — without it, default Link goes to "#" and only renders text. */
18
+ url?: string;
9
19
  name: string;
20
+ /** Replace the entire inline element. Receives the same props as the default. Must keep the data-mention-* attributes if hovercard support is desired. */
21
+ Inline?: React.ComponentType<MentionRenderProps>;
22
+ /** Rendered inside the hovercard popup that opens on mouseover. */
23
+ HoverContent?: React.ComponentType<MentionRenderProps>;
24
+ /** Override the default Link's click behavior (e.g., open a modal/sidebar instead of navigating). */
25
+ onActivate?: (e: React.MouseEvent, props: MentionRenderProps) => void;
10
26
  }
11
27
 
12
28
  export type MentionResolveFn = (id: string, entityType: string, alias: string) => MentionResolveResult | null;
13
29
 
14
- export const createMentionInlineContentSpec = (resolveFn?: MentionResolveFn) =>
15
- createReactInlineContentSpec(
30
+ /** Spread on the root element of a custom Inline so the hovercard can detect hover. */
31
+ export const mentionDataAttrs = (p: MentionRenderProps) => ({
32
+ "data-mention-id": p.id,
33
+ "data-mention-type": p.entityType,
34
+ "data-mention-alias": p.alias,
35
+ });
36
+
37
+ export const createMentionInlineContentSpec = (resolveFn?: MentionResolveFn) => {
38
+ const Mention = React.memo(function Mention(props: MentionRenderProps) {
39
+ const resolved = resolveFn?.(props.id, props.entityType, props.alias);
40
+
41
+ if (resolved?.Inline) {
42
+ const Custom = resolved.Inline;
43
+ return <Custom {...props} />;
44
+ }
45
+
46
+ const href = resolved?.url ?? "#";
47
+ const handleClick = resolved?.onActivate ? (e: React.MouseEvent) => resolved.onActivate!(e, props) : undefined;
48
+
49
+ return (
50
+ <Link href={href} className="text-primary" onClick={handleClick} {...mentionDataAttrs(props)}>
51
+ @{props.alias}
52
+ </Link>
53
+ );
54
+ });
55
+
56
+ return createReactInlineContentSpec(
16
57
  {
17
58
  type: "mention",
18
59
  propSchema: {
@@ -23,32 +64,13 @@ export const createMentionInlineContentSpec = (resolveFn?: MentionResolveFn) =>
23
64
  content: "none",
24
65
  },
25
66
  {
26
- render: (props) => {
27
- const alias = props.inlineContent.props.alias;
28
- const id = props.inlineContent.props.id;
29
- const entityType = props.inlineContent.props.entityType;
30
-
31
- if (resolveFn) {
32
- const resolved = resolveFn(id, entityType, alias);
33
- if (resolved) {
34
- return (
35
- <Link
36
- href={resolved.url}
37
- className="text-primary"
38
- style={{ textDecoration: "none" }}
39
- onClick={(e: React.MouseEvent) => e.stopPropagation()}
40
- >
41
- @{resolved.name || alias}
42
- </Link>
43
- );
44
- }
45
- }
46
-
47
- return (
48
- <span className="text-primary" style={{ textDecoration: "none" }}>
49
- @{alias}
50
- </span>
51
- );
52
- },
67
+ render: (props) => (
68
+ <Mention
69
+ id={props.inlineContent.props.id}
70
+ entityType={props.inlineContent.props.entityType}
71
+ alias={props.inlineContent.props.alias}
72
+ />
73
+ ),
53
74
  },
54
75
  );
76
+ };
@@ -1,3 +1,4 @@
1
1
  export * from "./BlockNoteEditorContainer";
2
+ export * from "./BlockNoteEditorMentionHoverCard";
2
3
  export * from "./BlockNoteEditorMentionInlineContent";
3
4
  export * from "./BlockNoteEditorSuggestionMenuController";
@@ -3,6 +3,7 @@
3
3
  import React from "react";
4
4
  import { cn } from "../../utils/cn";
5
5
  import { BlockNoteEditorContainer } from "../editors/BlockNoteEditorContainer";
6
+ import type { MentionResolveFn } from "../editors/BlockNoteEditorMentionInlineContent";
6
7
  import { FormFieldWrapper } from "./FormFieldWrapper";
7
8
 
8
9
  export function FormBlockNote({
@@ -47,7 +48,7 @@ export function FormBlockNote({
47
48
  params?: Record<string, string>,
48
49
  ) => Promise<import("../editors/BlockNoteEditorSuggestionMenuController").MentionItem[]>;
49
50
  mentionSearchParams?: Record<string, string>;
50
- mentionResolveFn?: (id: string, entityType: string, alias: string) => { url: string; name: string } | null;
51
+ mentionResolveFn?: MentionResolveFn;
51
52
  }) {
52
53
  return (
53
54
  <div
@@ -1,12 +1,12 @@
1
1
  "use client";
2
2
 
3
- import Link from "next/link";
4
3
  import { useTranslations } from "next-intl";
4
+ import Link from "next/link";
5
5
  import type { ApiDataInterface } from "../../../../../core";
6
6
  import { ModuleRegistry } from "../../../../../core/registry/ModuleRegistry";
7
7
  import { usePageUrlGenerator } from "../../../../../hooks";
8
- import type { ChunkInterface, ChunkRelationshipMeta } from "../../../../chunk/data/ChunkInterface";
9
8
  import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "../../../../../shadcnui/ui/table";
9
+ import type { ChunkInterface, ChunkRelationshipMeta } from "../../../../chunk/data/ChunkInterface";
10
10
 
11
11
  interface Props {
12
12
  citations: (ChunkInterface & ChunkRelationshipMeta)[];
@@ -69,7 +69,7 @@ export function ContentsTab({ citations, sources }: Props) {
69
69
  return (
70
70
  <TableRow key={`${source.type}/${source.id}`}>
71
71
  <TableCell>
72
- <Link href={href} target="_blank" rel="noopener noreferrer" className="hover:underline">
72
+ <Link href={href} target="_blank" rel="noopener noreferrer">
73
73
  <span className="font-medium">{name}</span>{" "}
74
74
  <span className="text-muted-foreground text-xs">
75
75
  {t("features.assistant.message.sources.citations_count", {
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
- import Link from "next/link";
4
3
  import { useTranslations } from "next-intl";
4
+ import Link from "next/link";
5
5
  import type { ApiDataInterface } from "../../../../../core";
6
6
  import { ModuleRegistry } from "../../../../../core/registry/ModuleRegistry";
7
7
  import { usePageUrlGenerator } from "../../../../../hooks";
@@ -37,7 +37,7 @@ export function ReferencesTab({ references }: Props) {
37
37
  return (
38
38
  <TableRow key={`${ref.type}/${ref.id}`}>
39
39
  <TableCell>
40
- <Link href={href} target="_blank" rel="noopener noreferrer" className="font-medium hover:underline">
40
+ <Link href={href} target="_blank" rel="noopener noreferrer" className="font-medium">
41
41
  {ref.identifier}
42
42
  </Link>
43
43
  </TableCell>
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
 
3
- import Link from "next/link";
4
3
  import { useTranslations } from "next-intl";
4
+ import Link from "next/link";
5
5
  import type { ApiDataInterface } from "../../../../../core";
6
6
  import { ModuleRegistry } from "../../../../../core/registry/ModuleRegistry";
7
7
  import { usePageUrlGenerator } from "../../../../../hooks";
8
- import type { ChunkInterface, ChunkRelationshipMeta } from "../../../../chunk/data/ChunkInterface";
9
8
  import { Avatar, AvatarFallback, AvatarImage } from "../../../../../shadcnui/ui/avatar";
10
9
  import { Table, TableBody, TableCell, TableRow } from "../../../../../shadcnui/ui/table";
10
+ import type { ChunkInterface, ChunkRelationshipMeta } from "../../../../chunk/data/ChunkInterface";
11
11
 
12
12
  interface Props {
13
13
  /** Pre-deduplicated list of authors derived from the resolved sources. */
@@ -107,12 +107,7 @@ export function UsersTab({ users, citations, sources }: Props) {
107
107
  return (
108
108
  <TableRow key={user.id}>
109
109
  <TableCell>
110
- <Link
111
- href={href}
112
- target="_blank"
113
- rel="noopener noreferrer"
114
- className="flex items-center gap-3 hover:underline"
115
- >
110
+ <Link href={href} target="_blank" rel="noopener noreferrer" className="flex items-center gap-3">
116
111
  <Avatar className="h-7 w-7">
117
112
  <AvatarImage src={avatarUrl} aria-label={name} />
118
113
  <AvatarFallback aria-label={name}>{getInitials(name)}</AvatarFallback>
@@ -2,12 +2,12 @@
2
2
 
3
3
  import { useTranslations } from "next-intl";
4
4
  import { AttributeElement, ContentTitle } from "../../../../components";
5
- import { Modules } from "../../../../core";
6
5
  import { useSharedContext } from "../../../../contexts/SharedContext";
6
+ import { Modules } from "../../../../core";
7
7
  import { Link } from "../../../../shadcnui";
8
+ import { useHowToContext } from "../../contexts/HowToContext";
8
9
  import { HowTo } from "../../data/HowTo";
9
10
  import { HowToInterface } from "../../data/HowToInterface";
10
- import { useHowToContext } from "../../contexts/HowToContext";
11
11
 
12
12
  type HowToDetailsProps = {
13
13
  howTo: HowToInterface;
@@ -30,7 +30,7 @@ function HowToDetailsInternal({ howTo }: HowToDetailsProps) {
30
30
  <ul className="flex flex-col gap-y-1">
31
31
  {pagesList.map((page, index) => (
32
32
  <li key={index}>
33
- <Link href={page} className="text-primary hover:underline">
33
+ <Link href={page} className="text-primary">
34
34
  {page}
35
35
  </Link>
36
36
  </li>
@@ -1,3 +1,4 @@
1
+ import { useCallback } from "react";
1
2
  import { PageUrl } from "../permissions/types";
2
3
 
3
4
  export function usePageUrlGenerator(): (params: {
@@ -8,43 +9,46 @@ export function usePageUrlGenerator(): (params: {
8
9
  additionalParameters?: { [key: string]: string | string[] | undefined };
9
10
  language?: string;
10
11
  }) => string {
11
- const generateUrl = (params: {
12
- page?: PageUrl | string;
13
- id?: string;
14
- childPage?: PageUrl | string;
15
- childId?: string;
16
- additionalParameters?: { [key: string]: string | string[] | undefined };
17
- language?: string;
18
- }): string => {
19
- if (!params.page) return "/";
12
+ const generateUrl = useCallback(
13
+ (params: {
14
+ page?: PageUrl | string;
15
+ id?: string;
16
+ childPage?: PageUrl | string;
17
+ childId?: string;
18
+ additionalParameters?: { [key: string]: string | string[] | undefined };
19
+ language?: string;
20
+ }): string => {
21
+ if (!params.page) return "/";
20
22
 
21
- const pathParams: string[] = [
22
- `${params.language ? `/${params.language}` : ""}${typeof params.page === "string" ? params.page : params.page.pageUrl}`,
23
- ];
23
+ const pathParams: string[] = [
24
+ `${params.language ? `/${params.language}` : ""}${typeof params.page === "string" ? params.page : params.page.pageUrl}`,
25
+ ];
24
26
 
25
- if (params.id) {
26
- pathParams.push(params.id);
27
- if (params.childPage) {
28
- pathParams.push(typeof params.childPage === "string" ? params.childPage : (params.childPage.pageUrl ?? ""));
29
- if (params.childId) {
30
- pathParams.push(params.childId);
27
+ if (params.id) {
28
+ pathParams.push(params.id);
29
+ if (params.childPage) {
30
+ pathParams.push(typeof params.childPage === "string" ? params.childPage : (params.childPage.pageUrl ?? ""));
31
+ if (params.childId) {
32
+ pathParams.push(params.childId);
33
+ }
31
34
  }
32
35
  }
33
- }
34
- const response = pathParams.join(`/`);
36
+ const response = pathParams.join(`/`);
35
37
 
36
- if (params.additionalParameters) {
37
- const searchParams = new URLSearchParams();
38
- for (const key in params.additionalParameters) {
39
- if (params.additionalParameters[key]) {
40
- searchParams.append(key, params.additionalParameters[key] as string);
38
+ if (params.additionalParameters) {
39
+ const searchParams = new URLSearchParams();
40
+ for (const key in params.additionalParameters) {
41
+ if (params.additionalParameters[key]) {
42
+ searchParams.append(key, params.additionalParameters[key] as string);
43
+ }
41
44
  }
45
+ return `${response}?${searchParams.toString()}`;
42
46
  }
43
- return `${response}?${searchParams.toString()}`;
44
- }
45
47
 
46
- return response;
47
- };
48
+ return response;
49
+ },
50
+ [],
51
+ );
48
52
 
49
53
  return generateUrl;
50
54
  }
@@ -1,11 +1,10 @@
1
1
  "use client";
2
2
 
3
- import * as React from "react";
4
3
  import { mergeProps } from "@base-ui/react/merge-props";
5
4
  import { useRender } from "@base-ui/react/use-render";
6
5
  import { cva, type VariantProps } from "class-variance-authority";
6
+ import * as React from "react";
7
7
 
8
- import { cn } from "@/lib/utils";
9
8
  import { Button } from "@/components/ui/button";
10
9
  import { Input } from "@/components/ui/input";
11
10
  import { Separator } from "@/components/ui/separator";
@@ -13,6 +12,7 @@ import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "
13
12
  import { Skeleton } from "@/components/ui/skeleton";
14
13
  import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
15
14
  import { useIsMobile } from "@/hooks/use-mobile";
15
+ import { cn } from "@/lib/utils";
16
16
  import { PanelLeftIcon } from "lucide-react";
17
17
 
18
18
  const SIDEBAR_COOKIE_NAME = "sidebar_state";
@@ -20,7 +20,7 @@ const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
20
20
  const SIDEBAR_WIDTH = "16rem";
21
21
  const SIDEBAR_WIDTH_MOBILE = "18rem";
22
22
  const SIDEBAR_WIDTH_ICON = "3rem";
23
- const SIDEBAR_KEYBOARD_SHORTCUT = "b";
23
+ const SIDEBAR_KEYBOARD_SHORTCUT = "";
24
24
 
25
25
  type SidebarContextProps = {
26
26
  state: "expanded" | "collapsed";
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/BlockNoteEditor-WBQCVHRG.js","../src/components/editors/BlockNoteEditor.tsx","../src/components/editors/BlockNoteEditorFormattingToolbar.tsx"],"names":["jsxs","jsx"],"mappings":"AAAA,ylBAAY;AACZ;AACE;AACA;AACA;AACA;AACA;AACF,sDAA4B;AAC5B,+BAA4B;AAC5B;AACE;AACA;AACA;AACA;AACF,sDAA4B;AAC5B,+BAA4B;AAC5B,+BAA4B;AAC5B,+BAA4B;AAC5B,+BAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACrBA,uCAAyE;AACzE,yCAAiE;AACjE,2CAA8B;AAC9B,uCAAO;AACP,2CAAiC;AACjC,qCAAgC;AAChC,+BAAy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C1B,UAAA;AACtB,QAAA;AAGkC,QAAA;AACpB,MAAA;AAC0C,QAAA;AAEpD,QAAA;AACoB,UAAA;AACC,UAAA;AACqB,YAAA;AACM,YAAA;AACd,YAAA;AACpC,UAAA;AACsB,QAAA;AAC2B,UAAA;AACnD,QAAA;AACF,MAAA;AACF,IAAA;AACO,IAAA;AACT,EAAA;AAGEA,EAAAA;AAAC,IAAA;AAAA,IAAA;AACM,MAAA;AACM,MAAA;AACE,QAAA;AACX,QAAA;AACA,QAAA;AACF,MAAA;AAEAD,MAAAA;AAAC,QAAA;AAAA,QAAA;AACC,UAAA;AACU,UAAA;AACa,UAAA;AACJ,UAAA;AACb,UAAA;AACqD,UAAA;AAE3D,UAAA;AAAkC,4BAAA;AAEhCC,YAAAA;AAAC,cAAA;AAAA,cAAA;AACC,gBAAA;AACA,gBAAA;AACA,gBAAA;AAAA,cAAA;AACF,YAAA;AAEsB,4BAAA;AAAA,UAAA;AAAA,QAAA;AAC1B,MAAA;AAAA,IAAA;AACF,EAAA;AAEJ;AAjXwB;ADmV6C;AACA;AACA","file":"/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/BlockNoteEditor-WBQCVHRG.js","sourcesContent":[null,"\"use client\";\n\nimport { BlockNoteSchema, defaultInlineContentSpecs, PartialBlock } from \"@blocknote/core\";\nimport { createReactInlineContentSpec, useCreateBlockNote } from \"@blocknote/react\";\nimport { BlockNoteView } from \"@blocknote/shadcn\";\nimport \"@blocknote/shadcn/style.css\";\nimport { CheckIcon, XIcon } from \"lucide-react\";\nimport { useTranslations } from \"next-intl\";\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { useCurrentUserContext } from \"../../contexts\";\nimport { S3Interface } from \"../../features/s3/data\";\nimport { S3Service } from \"../../features/s3/data/s3.service\";\nimport { UserInterface } from \"../../features/user/data\";\nimport { Button } from \"../../shadcnui\";\nimport { BlockNoteDiffUtil, BlockNoteWordDiffRendererUtil, cn } from \"../../utils\";\nimport { errorToast } from \"../errors\";\nimport { BlockNoteEditorFormattingToolbar } from \"./BlockNoteEditorFormattingToolbar\";\nimport { createMentionInlineContentSpec } from \"./BlockNoteEditorMentionInlineContent\";\nimport { BlockNoteEditorMentionSuggestionMenu } from \"./BlockNoteEditorSuggestionMenuController\";\n\nexport type BlockNoteEditorProps = {\n id: string;\n type: string;\n initialContent?: PartialBlock[];\n onChange?: (content: any, isEmpty: boolean, hasUnresolvedDiff: boolean) => void;\n size?: \"sm\" | \"md\";\n className?: string;\n markdownContent?: string;\n diffContent?: PartialBlock[];\n placeholder?: string;\n bordered?: boolean;\n inlineContentSpecs?: Record<string, any>;\n renderOverlays?: (editor: any) => React.ReactNode;\n enableMentions?: boolean;\n mentionSearchFn?: (\n query: string,\n params?: Record<string, string>,\n ) => Promise<import(\"./BlockNoteEditorSuggestionMenuController\").MentionItem[]>;\n mentionSearchParams?: Record<string, string>;\n mentionResolveFn?: (id: string, entityType: string, alias: string) => { url: string; name: string } | null;\n};\n\nconst createDiffActionsInlineContentSpec = (\n handleAcceptChange: (diffId: string) => void,\n handleRejectChange: (diffId: string) => void,\n) => {\n return createReactInlineContentSpec(\n {\n type: \"diffActions\",\n propSchema: {\n diffIds: {\n default: \"\",\n },\n },\n content: \"none\",\n },\n {\n render: (props) => {\n const diffIds = props.inlineContent.props.diffIds;\n\n return (\n <span className=\"diff-actions-container mx-2 inline-flex items-center gap-1 align-middle\">\n <Button\n title=\"Accept change\"\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n diffIds.split(\",\").forEach((id: string) => handleAcceptChange(id.trim()));\n }}\n >\n <CheckIcon className=\"h-3 w-3 text-green-600\" />\n </Button>\n <Button\n title=\"Reject change\"\n className=\"mx-2 p-0\"\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n diffIds.split(\",\").forEach((id: string) => handleRejectChange(id.trim()));\n }}\n >\n <XIcon className=\"h-3 w-3 text-red-600\" />\n </Button>\n </span>\n );\n },\n },\n );\n};\n\nexport default function BlockNoteEditor({\n id,\n type,\n initialContent,\n onChange,\n size,\n className,\n markdownContent,\n diffContent,\n placeholder,\n bordered,\n inlineContentSpecs,\n renderOverlays,\n enableMentions,\n mentionSearchFn,\n mentionSearchParams,\n mentionResolveFn,\n}: BlockNoteEditorProps): React.JSX.Element {\n const t = useTranslations();\n const { company } = useCurrentUserContext<UserInterface>();\n\n const [acceptedChanges, setAcceptedChanges] = useState<Set<string>>(new Set());\n const [rejectedChanges, setRejectedChanges] = useState<Set<string>>(new Set());\n\n const editorRef = useRef<HTMLDivElement>(null);\n\n // Ensure side menu buttons don't trigger form submission\n useEffect(() => {\n if (!editorRef.current) return;\n const setButtonTypes = () => {\n editorRef.current?.querySelectorAll(\".bn-side-menu button\").forEach((btn) => {\n if (!btn.getAttribute(\"type\")) {\n btn.setAttribute(\"type\", \"button\");\n }\n });\n };\n const observer = new MutationObserver(setButtonTypes);\n observer.observe(editorRef.current, { childList: true, subtree: true });\n return () => observer.disconnect();\n }, []);\n\n const handleAcceptChange = useCallback((diffId: string) => {\n setAcceptedChanges((prev) => new Set([...prev, diffId]));\n setRejectedChanges((prev) => {\n const newSet = new Set(prev);\n newSet.delete(diffId);\n return newSet;\n });\n }, []);\n\n const handleRejectChange = useCallback((diffId: string) => {\n setRejectedChanges((prev) => new Set([...prev, diffId]));\n setAcceptedChanges((prev) => {\n const newSet = new Set(prev);\n newSet.delete(diffId);\n return newSet;\n });\n }, []);\n\n const DiffActionsInlineContent = useMemo(\n () => createDiffActionsInlineContentSpec(handleAcceptChange, handleRejectChange),\n [handleAcceptChange, handleRejectChange],\n );\n\n const mentionSpec = useMemo(\n () => (enableMentions ? createMentionInlineContentSpec(mentionResolveFn) : null),\n [enableMentions, mentionResolveFn],\n );\n\n const schema = useMemo(\n () =>\n BlockNoteSchema.create({\n inlineContentSpecs: {\n ...defaultInlineContentSpecs,\n diffActions: DiffActionsInlineContent,\n ...(mentionSpec ? { mention: mentionSpec } : {}),\n ...inlineContentSpecs,\n },\n } as any),\n [DiffActionsInlineContent, mentionSpec, inlineContentSpecs],\n );\n\n const uploadImage = useCallback(\n async (file: File): Promise<string> => {\n if (!company) {\n errorToast({\n title: t(`common.errors.upload`),\n error: t(`common.errors.upload_description`),\n });\n throw new Error(t(`common.errors.upload`));\n }\n\n const fileType = file.type;\n const key = `companies/${company.id}/${type}/${id}/${file.name}`;\n\n const s3: S3Interface = await S3Service.getPreSignedUrl({\n key: key,\n contentType: fileType,\n isPublic: true,\n });\n\n await fetch(s3.url, {\n method: \"PUT\",\n headers: s3.headers,\n body: file,\n });\n\n const signedImage: S3Interface = await S3Service.getSignedUrl({\n key: key,\n isPublic: true,\n });\n\n return signedImage.url;\n },\n [company, id, t],\n );\n\n // Utility: Remove trailing empty blocks for read-only display\n const removeTrailingEmptyBlocks = useCallback(\n (blocks: PartialBlock[]): PartialBlock[] => {\n if (!blocks || blocks.length === 0) return blocks;\n\n // Only remove trailing empty blocks in read-only mode\n if (onChange !== undefined) return blocks;\n\n const result = [...blocks];\n\n // Remove trailing empty paragraph blocks, but keep at least one block\n while (result.length > 1) {\n const lastBlock = result[result.length - 1];\n\n // Check if it's an empty paragraph\n const isEmptyParagraph =\n lastBlock.type === \"paragraph\" &&\n (!lastBlock.content ||\n lastBlock.content.length === 0 ||\n (Array.isArray(lastBlock.content) && lastBlock.content.every((c: any) => !c.text || c.text.trim() === \"\")));\n\n if (isEmptyParagraph) {\n result.pop();\n } else {\n break;\n }\n }\n\n return result;\n },\n [onChange],\n );\n\n const processedContent = useMemo(() => {\n if (diffContent && initialContent) {\n try {\n const diffResult = BlockNoteDiffUtil.diff(initialContent, diffContent);\n const renderedDiff = BlockNoteWordDiffRendererUtil.renderWordDiffs(\n diffResult.blocks,\n handleAcceptChange,\n handleRejectChange,\n acceptedChanges,\n rejectedChanges,\n );\n return removeTrailingEmptyBlocks(renderedDiff);\n } catch (_error) {\n return initialContent && Array.isArray(initialContent) && initialContent.length > 0\n ? removeTrailingEmptyBlocks(initialContent)\n : [];\n }\n }\n\n if (!initialContent) {\n return [];\n }\n\n if (!Array.isArray(initialContent)) {\n return [];\n }\n\n return initialContent.length > 0 ? removeTrailingEmptyBlocks(initialContent) : [];\n }, [\n initialContent,\n diffContent,\n handleAcceptChange,\n handleRejectChange,\n acceptedChanges,\n rejectedChanges,\n removeTrailingEmptyBlocks,\n ]);\n\n const validatedInitialContent = useMemo(() => {\n if (processedContent && Array.isArray(processedContent) && processedContent.length > 0) {\n const validatedContent = processedContent.filter((block) => {\n if (!block || typeof block !== \"object\") return false;\n if (!(block as any).type) return false;\n return true;\n });\n return validatedContent.length > 0 ? (validatedContent as PartialBlock[]) : undefined;\n }\n return undefined;\n }, [processedContent]);\n\n const editor = useCreateBlockNote(\n useMemo(\n () => ({\n placeholders: {\n emptyDocument: placeholder || t(`common.blocknote.placeholder`),\n },\n schema,\n initialContent: validatedInitialContent,\n uploadFile: uploadImage,\n }),\n [placeholder, t, schema, validatedInitialContent, uploadImage],\n ),\n );\n\n const handleChange = useCallback(async () => {\n if (!onChange) return;\n const newBlocks = editor.document;\n\n const markdownFromBlocks = (await editor.blocksToMarkdownLossy(editor.document)).trim();\n\n function hasUnresolvedDiffsRecursive(block: any): boolean {\n if (!block || typeof block !== \"object\") return false;\n let diffId = undefined;\n if (block.props && block.props.diffId) diffId = block.props.diffId;\n if (!diffId && block.attrs && block.attrs.diffId) diffId = block.attrs.diffId;\n if (diffId && !acceptedChanges.has(diffId) && !rejectedChanges.has(diffId)) {\n return true;\n }\n\n if (block.content) {\n const contentArr = Array.isArray(block.content) ? block.content : [block.content];\n for (const inline of contentArr) {\n if (inline && typeof inline === \"object\") {\n if (inline.type === \"diffActions\" && inline.props && inline.props.diffIds) {\n const ids =\n typeof inline.props.diffIds === \"string\" ? inline.props.diffIds.split(\",\") : inline.props.diffIds;\n for (const id of ids) {\n const trimmed = (id || \"\").toString().trim();\n if (trimmed && !acceptedChanges.has(trimmed) && !rejectedChanges.has(trimmed)) {\n return true;\n }\n }\n }\n if (inline.props && inline.props.diffId) {\n const diffIdInline = inline.props.diffId;\n if (diffIdInline && !acceptedChanges.has(diffIdInline) && !rejectedChanges.has(diffIdInline)) {\n return true;\n }\n }\n if (inline.children && Array.isArray(inline.children)) {\n for (const child of inline.children) {\n if (hasUnresolvedDiffsRecursive(child)) return true;\n }\n }\n }\n }\n }\n if (Array.isArray(block.children)) {\n for (const child of block.children) {\n if (hasUnresolvedDiffsRecursive(child)) return true;\n }\n }\n return false;\n }\n\n let hasUnresolvedDiff = false;\n if (Array.isArray(newBlocks)) {\n hasUnresolvedDiff = newBlocks.some((block: any) => hasUnresolvedDiffsRecursive(block));\n }\n\n onChange(newBlocks, !markdownFromBlocks.length, hasUnresolvedDiff);\n }, [editor, onChange, id, acceptedChanges, rejectedChanges]);\n\n // Utility: deep equality for arrays of blocks\n const areBlocksEqual = (a: any[], b: any[]): boolean => {\n return JSON.stringify(a) === JSON.stringify(b);\n };\n\n // Only initialize from markdownContent once per value, and only if different\n const hasInitializedFromMarkdown = useRef<string | null>(null);\n useEffect(() => {\n const updateContent = async (markdown: string) => {\n const blocks = await editor.tryParseMarkdownToBlocks(markdown);\n if (!areBlocksEqual(blocks, editor.document)) {\n editor.replaceBlocks(editor.document, blocks);\n }\n };\n\n if (markdownContent && hasInitializedFromMarkdown.current !== markdownContent) {\n hasInitializedFromMarkdown.current = markdownContent;\n updateContent(markdownContent).then(() => handleChange());\n }\n }, [markdownContent, editor]);\n\n // Update editor content when diff content changes, but only if different\n // Prevent unnecessary replaceBlocks calls that reset scroll/cursor.\n const previousContentHashRef = useRef<string | null>(null);\n useEffect(() => {\n if (!processedContent || !editor) return;\n const hash = JSON.stringify(processedContent);\n if (previousContentHashRef.current === hash) return; // no changes\n const currentHash = JSON.stringify(editor.document);\n if (currentHash === hash) {\n previousContentHashRef.current = hash;\n return; // already in sync\n }\n editor.replaceBlocks(editor.document, processedContent as PartialBlock[]);\n previousContentHashRef.current = hash;\n }, [processedContent, editor]);\n\n // Handle audio received from whisper transcription\n const _handleAudioReceived = useCallback(\n (message: string) => {\n try {\n // Ensure the editor has focus\n const editorElement = editorRef.current?.querySelector('[contenteditable=\"true\"]') as HTMLElement;\n if (editorElement && document.activeElement !== editorElement) {\n editorElement.focus();\n }\n\n // Insert the transcribed text at the current cursor position\n editor.insertInlineContent(message);\n } catch (error) {\n console.error(\"Error inserting transcribed text:\", error);\n // Fallback: try to insert at the end of the document\n try {\n const blocks = editor.document;\n if (blocks.length > 0) {\n const lastBlock = blocks[blocks.length - 1];\n editor.setTextCursorPosition(lastBlock.id, \"end\");\n editor.insertInlineContent(message);\n }\n } catch (fallbackError) {\n console.error(\"Fallback insertion also failed:\", fallbackError);\n }\n }\n },\n [editor],\n );\n\n return (\n <div\n ref={editorRef}\n className={cn(\n bordered ? \"rounded-md border border-input bg-input/20 dark:bg-input/30\" : \"\",\n \"flex flex-col w-full\",\n className,\n )}\n >\n <BlockNoteView\n editor={editor}\n onChange={handleChange}\n editable={onChange !== undefined}\n formattingToolbar={false}\n theme=\"light\"\n className={cn(`BlockNoteView flex-1 ${onChange ? \"p-4\" : \"\"}`, size === \"sm\" && \"small\")}\n >\n <BlockNoteEditorFormattingToolbar />\n {enableMentions && mentionSearchFn && (\n <BlockNoteEditorMentionSuggestionMenu\n editor={editor}\n mentionSearchFn={mentionSearchFn}\n mentionSearchParams={mentionSearchParams}\n />\n )}\n {renderOverlays?.(editor)}\n </BlockNoteView>\n </div>\n );\n}\n","\"use client\";\n\nimport {\n BasicTextStyleButton,\n BlockTypeSelect,\n CreateLinkButton,\n FileCaptionButton,\n FileReplaceButton,\n FormattingToolbar,\n FormattingToolbarController,\n TextAlignButton,\n} from \"@blocknote/react\";\n\nexport function BlockNoteEditorFormattingToolbar() {\n return (\n <FormattingToolbarController\n formattingToolbar={() => (\n <FormattingToolbar>\n <BlockTypeSelect key={\"blockTypeSelect\"} />\n\n <FileCaptionButton key={\"fileCaptionButton\"} />\n <FileReplaceButton key={\"replaceFileButton\"} />\n\n <BasicTextStyleButton basicTextStyle={\"bold\"} key={\"boldStyleButton\"} />\n <BasicTextStyleButton basicTextStyle={\"italic\"} key={\"italicStyleButton\"} />\n <BasicTextStyleButton basicTextStyle={\"underline\"} key={\"underlineStyleButton\"} />\n <BasicTextStyleButton basicTextStyle={\"strike\"} key={\"strikeStyleButton\"} />\n\n <TextAlignButton textAlignment={\"left\"} key={\"textAlignLeftButton\"} />\n <TextAlignButton textAlignment={\"center\"} key={\"textAlignCenterButton\"} />\n <TextAlignButton textAlignment={\"right\"} key={\"textAlignRightButton\"} />\n\n <CreateLinkButton key={\"createLinkButton\"} />\n </FormattingToolbar>\n )}\n />\n );\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/editors/BlockNoteEditor.tsx","../src/components/editors/BlockNoteEditorFormattingToolbar.tsx"],"sourcesContent":["\"use client\";\n\nimport { BlockNoteSchema, defaultInlineContentSpecs, PartialBlock } from \"@blocknote/core\";\nimport { createReactInlineContentSpec, useCreateBlockNote } from \"@blocknote/react\";\nimport { BlockNoteView } from \"@blocknote/shadcn\";\nimport \"@blocknote/shadcn/style.css\";\nimport { CheckIcon, XIcon } from \"lucide-react\";\nimport { useTranslations } from \"next-intl\";\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { useCurrentUserContext } from \"../../contexts\";\nimport { S3Interface } from \"../../features/s3/data\";\nimport { S3Service } from \"../../features/s3/data/s3.service\";\nimport { UserInterface } from \"../../features/user/data\";\nimport { Button } from \"../../shadcnui\";\nimport { BlockNoteDiffUtil, BlockNoteWordDiffRendererUtil, cn } from \"../../utils\";\nimport { errorToast } from \"../errors\";\nimport { BlockNoteEditorFormattingToolbar } from \"./BlockNoteEditorFormattingToolbar\";\nimport { createMentionInlineContentSpec } from \"./BlockNoteEditorMentionInlineContent\";\nimport { BlockNoteEditorMentionSuggestionMenu } from \"./BlockNoteEditorSuggestionMenuController\";\n\nexport type BlockNoteEditorProps = {\n id: string;\n type: string;\n initialContent?: PartialBlock[];\n onChange?: (content: any, isEmpty: boolean, hasUnresolvedDiff: boolean) => void;\n size?: \"sm\" | \"md\";\n className?: string;\n markdownContent?: string;\n diffContent?: PartialBlock[];\n placeholder?: string;\n bordered?: boolean;\n inlineContentSpecs?: Record<string, any>;\n renderOverlays?: (editor: any) => React.ReactNode;\n enableMentions?: boolean;\n mentionSearchFn?: (\n query: string,\n params?: Record<string, string>,\n ) => Promise<import(\"./BlockNoteEditorSuggestionMenuController\").MentionItem[]>;\n mentionSearchParams?: Record<string, string>;\n mentionResolveFn?: (id: string, entityType: string, alias: string) => { url: string; name: string } | null;\n};\n\nconst createDiffActionsInlineContentSpec = (\n handleAcceptChange: (diffId: string) => void,\n handleRejectChange: (diffId: string) => void,\n) => {\n return createReactInlineContentSpec(\n {\n type: \"diffActions\",\n propSchema: {\n diffIds: {\n default: \"\",\n },\n },\n content: \"none\",\n },\n {\n render: (props) => {\n const diffIds = props.inlineContent.props.diffIds;\n\n return (\n <span className=\"diff-actions-container mx-2 inline-flex items-center gap-1 align-middle\">\n <Button\n title=\"Accept change\"\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n diffIds.split(\",\").forEach((id: string) => handleAcceptChange(id.trim()));\n }}\n >\n <CheckIcon className=\"h-3 w-3 text-green-600\" />\n </Button>\n <Button\n title=\"Reject change\"\n className=\"mx-2 p-0\"\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n diffIds.split(\",\").forEach((id: string) => handleRejectChange(id.trim()));\n }}\n >\n <XIcon className=\"h-3 w-3 text-red-600\" />\n </Button>\n </span>\n );\n },\n },\n );\n};\n\nexport default function BlockNoteEditor({\n id,\n type,\n initialContent,\n onChange,\n size,\n className,\n markdownContent,\n diffContent,\n placeholder,\n bordered,\n inlineContentSpecs,\n renderOverlays,\n enableMentions,\n mentionSearchFn,\n mentionSearchParams,\n mentionResolveFn,\n}: BlockNoteEditorProps): React.JSX.Element {\n const t = useTranslations();\n const { company } = useCurrentUserContext<UserInterface>();\n\n const [acceptedChanges, setAcceptedChanges] = useState<Set<string>>(new Set());\n const [rejectedChanges, setRejectedChanges] = useState<Set<string>>(new Set());\n\n const editorRef = useRef<HTMLDivElement>(null);\n\n // Ensure side menu buttons don't trigger form submission\n useEffect(() => {\n if (!editorRef.current) return;\n const setButtonTypes = () => {\n editorRef.current?.querySelectorAll(\".bn-side-menu button\").forEach((btn) => {\n if (!btn.getAttribute(\"type\")) {\n btn.setAttribute(\"type\", \"button\");\n }\n });\n };\n const observer = new MutationObserver(setButtonTypes);\n observer.observe(editorRef.current, { childList: true, subtree: true });\n return () => observer.disconnect();\n }, []);\n\n const handleAcceptChange = useCallback((diffId: string) => {\n setAcceptedChanges((prev) => new Set([...prev, diffId]));\n setRejectedChanges((prev) => {\n const newSet = new Set(prev);\n newSet.delete(diffId);\n return newSet;\n });\n }, []);\n\n const handleRejectChange = useCallback((diffId: string) => {\n setRejectedChanges((prev) => new Set([...prev, diffId]));\n setAcceptedChanges((prev) => {\n const newSet = new Set(prev);\n newSet.delete(diffId);\n return newSet;\n });\n }, []);\n\n const DiffActionsInlineContent = useMemo(\n () => createDiffActionsInlineContentSpec(handleAcceptChange, handleRejectChange),\n [handleAcceptChange, handleRejectChange],\n );\n\n const mentionSpec = useMemo(\n () => (enableMentions ? createMentionInlineContentSpec(mentionResolveFn) : null),\n [enableMentions, mentionResolveFn],\n );\n\n const schema = useMemo(\n () =>\n BlockNoteSchema.create({\n inlineContentSpecs: {\n ...defaultInlineContentSpecs,\n diffActions: DiffActionsInlineContent,\n ...(mentionSpec ? { mention: mentionSpec } : {}),\n ...inlineContentSpecs,\n },\n } as any),\n [DiffActionsInlineContent, mentionSpec, inlineContentSpecs],\n );\n\n const uploadImage = useCallback(\n async (file: File): Promise<string> => {\n if (!company) {\n errorToast({\n title: t(`common.errors.upload`),\n error: t(`common.errors.upload_description`),\n });\n throw new Error(t(`common.errors.upload`));\n }\n\n const fileType = file.type;\n const key = `companies/${company.id}/${type}/${id}/${file.name}`;\n\n const s3: S3Interface = await S3Service.getPreSignedUrl({\n key: key,\n contentType: fileType,\n isPublic: true,\n });\n\n await fetch(s3.url, {\n method: \"PUT\",\n headers: s3.headers,\n body: file,\n });\n\n const signedImage: S3Interface = await S3Service.getSignedUrl({\n key: key,\n isPublic: true,\n });\n\n return signedImage.url;\n },\n [company, id, t],\n );\n\n // Utility: Remove trailing empty blocks for read-only display\n const removeTrailingEmptyBlocks = useCallback(\n (blocks: PartialBlock[]): PartialBlock[] => {\n if (!blocks || blocks.length === 0) return blocks;\n\n // Only remove trailing empty blocks in read-only mode\n if (onChange !== undefined) return blocks;\n\n const result = [...blocks];\n\n // Remove trailing empty paragraph blocks, but keep at least one block\n while (result.length > 1) {\n const lastBlock = result[result.length - 1];\n\n // Check if it's an empty paragraph\n const isEmptyParagraph =\n lastBlock.type === \"paragraph\" &&\n (!lastBlock.content ||\n lastBlock.content.length === 0 ||\n (Array.isArray(lastBlock.content) && lastBlock.content.every((c: any) => !c.text || c.text.trim() === \"\")));\n\n if (isEmptyParagraph) {\n result.pop();\n } else {\n break;\n }\n }\n\n return result;\n },\n [onChange],\n );\n\n const processedContent = useMemo(() => {\n if (diffContent && initialContent) {\n try {\n const diffResult = BlockNoteDiffUtil.diff(initialContent, diffContent);\n const renderedDiff = BlockNoteWordDiffRendererUtil.renderWordDiffs(\n diffResult.blocks,\n handleAcceptChange,\n handleRejectChange,\n acceptedChanges,\n rejectedChanges,\n );\n return removeTrailingEmptyBlocks(renderedDiff);\n } catch (_error) {\n return initialContent && Array.isArray(initialContent) && initialContent.length > 0\n ? removeTrailingEmptyBlocks(initialContent)\n : [];\n }\n }\n\n if (!initialContent) {\n return [];\n }\n\n if (!Array.isArray(initialContent)) {\n return [];\n }\n\n return initialContent.length > 0 ? removeTrailingEmptyBlocks(initialContent) : [];\n }, [\n initialContent,\n diffContent,\n handleAcceptChange,\n handleRejectChange,\n acceptedChanges,\n rejectedChanges,\n removeTrailingEmptyBlocks,\n ]);\n\n const validatedInitialContent = useMemo(() => {\n if (processedContent && Array.isArray(processedContent) && processedContent.length > 0) {\n const validatedContent = processedContent.filter((block) => {\n if (!block || typeof block !== \"object\") return false;\n if (!(block as any).type) return false;\n return true;\n });\n return validatedContent.length > 0 ? (validatedContent as PartialBlock[]) : undefined;\n }\n return undefined;\n }, [processedContent]);\n\n const editor = useCreateBlockNote(\n useMemo(\n () => ({\n placeholders: {\n emptyDocument: placeholder || t(`common.blocknote.placeholder`),\n },\n schema,\n initialContent: validatedInitialContent,\n uploadFile: uploadImage,\n }),\n [placeholder, t, schema, validatedInitialContent, uploadImage],\n ),\n );\n\n const handleChange = useCallback(async () => {\n if (!onChange) return;\n const newBlocks = editor.document;\n\n const markdownFromBlocks = (await editor.blocksToMarkdownLossy(editor.document)).trim();\n\n function hasUnresolvedDiffsRecursive(block: any): boolean {\n if (!block || typeof block !== \"object\") return false;\n let diffId = undefined;\n if (block.props && block.props.diffId) diffId = block.props.diffId;\n if (!diffId && block.attrs && block.attrs.diffId) diffId = block.attrs.diffId;\n if (diffId && !acceptedChanges.has(diffId) && !rejectedChanges.has(diffId)) {\n return true;\n }\n\n if (block.content) {\n const contentArr = Array.isArray(block.content) ? block.content : [block.content];\n for (const inline of contentArr) {\n if (inline && typeof inline === \"object\") {\n if (inline.type === \"diffActions\" && inline.props && inline.props.diffIds) {\n const ids =\n typeof inline.props.diffIds === \"string\" ? inline.props.diffIds.split(\",\") : inline.props.diffIds;\n for (const id of ids) {\n const trimmed = (id || \"\").toString().trim();\n if (trimmed && !acceptedChanges.has(trimmed) && !rejectedChanges.has(trimmed)) {\n return true;\n }\n }\n }\n if (inline.props && inline.props.diffId) {\n const diffIdInline = inline.props.diffId;\n if (diffIdInline && !acceptedChanges.has(diffIdInline) && !rejectedChanges.has(diffIdInline)) {\n return true;\n }\n }\n if (inline.children && Array.isArray(inline.children)) {\n for (const child of inline.children) {\n if (hasUnresolvedDiffsRecursive(child)) return true;\n }\n }\n }\n }\n }\n if (Array.isArray(block.children)) {\n for (const child of block.children) {\n if (hasUnresolvedDiffsRecursive(child)) return true;\n }\n }\n return false;\n }\n\n let hasUnresolvedDiff = false;\n if (Array.isArray(newBlocks)) {\n hasUnresolvedDiff = newBlocks.some((block: any) => hasUnresolvedDiffsRecursive(block));\n }\n\n onChange(newBlocks, !markdownFromBlocks.length, hasUnresolvedDiff);\n }, [editor, onChange, id, acceptedChanges, rejectedChanges]);\n\n // Utility: deep equality for arrays of blocks\n const areBlocksEqual = (a: any[], b: any[]): boolean => {\n return JSON.stringify(a) === JSON.stringify(b);\n };\n\n // Only initialize from markdownContent once per value, and only if different\n const hasInitializedFromMarkdown = useRef<string | null>(null);\n useEffect(() => {\n const updateContent = async (markdown: string) => {\n const blocks = await editor.tryParseMarkdownToBlocks(markdown);\n if (!areBlocksEqual(blocks, editor.document)) {\n editor.replaceBlocks(editor.document, blocks);\n }\n };\n\n if (markdownContent && hasInitializedFromMarkdown.current !== markdownContent) {\n hasInitializedFromMarkdown.current = markdownContent;\n updateContent(markdownContent).then(() => handleChange());\n }\n }, [markdownContent, editor]);\n\n // Update editor content when diff content changes, but only if different\n // Prevent unnecessary replaceBlocks calls that reset scroll/cursor.\n const previousContentHashRef = useRef<string | null>(null);\n useEffect(() => {\n if (!processedContent || !editor) return;\n const hash = JSON.stringify(processedContent);\n if (previousContentHashRef.current === hash) return; // no changes\n const currentHash = JSON.stringify(editor.document);\n if (currentHash === hash) {\n previousContentHashRef.current = hash;\n return; // already in sync\n }\n editor.replaceBlocks(editor.document, processedContent as PartialBlock[]);\n previousContentHashRef.current = hash;\n }, [processedContent, editor]);\n\n // Handle audio received from whisper transcription\n const _handleAudioReceived = useCallback(\n (message: string) => {\n try {\n // Ensure the editor has focus\n const editorElement = editorRef.current?.querySelector('[contenteditable=\"true\"]') as HTMLElement;\n if (editorElement && document.activeElement !== editorElement) {\n editorElement.focus();\n }\n\n // Insert the transcribed text at the current cursor position\n editor.insertInlineContent(message);\n } catch (error) {\n console.error(\"Error inserting transcribed text:\", error);\n // Fallback: try to insert at the end of the document\n try {\n const blocks = editor.document;\n if (blocks.length > 0) {\n const lastBlock = blocks[blocks.length - 1];\n editor.setTextCursorPosition(lastBlock.id, \"end\");\n editor.insertInlineContent(message);\n }\n } catch (fallbackError) {\n console.error(\"Fallback insertion also failed:\", fallbackError);\n }\n }\n },\n [editor],\n );\n\n return (\n <div\n ref={editorRef}\n className={cn(\n bordered ? \"rounded-md border border-input bg-input/20 dark:bg-input/30\" : \"\",\n \"flex flex-col w-full\",\n className,\n )}\n >\n <BlockNoteView\n editor={editor}\n onChange={handleChange}\n editable={onChange !== undefined}\n formattingToolbar={false}\n theme=\"light\"\n className={cn(`BlockNoteView flex-1 ${onChange ? \"p-4\" : \"\"}`, size === \"sm\" && \"small\")}\n >\n <BlockNoteEditorFormattingToolbar />\n {enableMentions && mentionSearchFn && (\n <BlockNoteEditorMentionSuggestionMenu\n editor={editor}\n mentionSearchFn={mentionSearchFn}\n mentionSearchParams={mentionSearchParams}\n />\n )}\n {renderOverlays?.(editor)}\n </BlockNoteView>\n </div>\n );\n}\n","\"use client\";\n\nimport {\n BasicTextStyleButton,\n BlockTypeSelect,\n CreateLinkButton,\n FileCaptionButton,\n FileReplaceButton,\n FormattingToolbar,\n FormattingToolbarController,\n TextAlignButton,\n} from \"@blocknote/react\";\n\nexport function BlockNoteEditorFormattingToolbar() {\n return (\n <FormattingToolbarController\n formattingToolbar={() => (\n <FormattingToolbar>\n <BlockTypeSelect key={\"blockTypeSelect\"} />\n\n <FileCaptionButton key={\"fileCaptionButton\"} />\n <FileReplaceButton key={\"replaceFileButton\"} />\n\n <BasicTextStyleButton basicTextStyle={\"bold\"} key={\"boldStyleButton\"} />\n <BasicTextStyleButton basicTextStyle={\"italic\"} key={\"italicStyleButton\"} />\n <BasicTextStyleButton basicTextStyle={\"underline\"} key={\"underlineStyleButton\"} />\n <BasicTextStyleButton basicTextStyle={\"strike\"} key={\"strikeStyleButton\"} />\n\n <TextAlignButton textAlignment={\"left\"} key={\"textAlignLeftButton\"} />\n <TextAlignButton textAlignment={\"center\"} key={\"textAlignCenterButton\"} />\n <TextAlignButton textAlignment={\"right\"} key={\"textAlignRightButton\"} />\n\n <CreateLinkButton key={\"createLinkButton\"} />\n </FormattingToolbar>\n )}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAEA,SAAS,iBAAiB,iCAA+C;AACzE,SAAS,8BAA8B,0BAA0B;AACjE,SAAS,qBAAqB;AAC9B,OAAO;AACP,SAAS,WAAW,aAAa;AACjC,SAAS,uBAAuB;AAChC,SAAgB,aAAa,WAAW,SAAS,QAAQ,gBAAgB;;;ACNzE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAMC,SACE,KADF;AAJD,SAAS,mCAAmC;AACjD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,mBAAmB,MACjB,qBAAC,qBACC;AAAA,4BAAC,qBAAqB,iBAAmB;AAAA,QAEzC,oBAAC,uBAAuB,mBAAqB;AAAA,QAC7C,oBAAC,uBAAuB,mBAAqB;AAAA,QAE7C,oBAAC,wBAAqB,gBAAgB,UAAa,iBAAmB;AAAA,QACtE,oBAAC,wBAAqB,gBAAgB,YAAe,mBAAqB;AAAA,QAC1E,oBAAC,wBAAqB,gBAAgB,eAAkB,sBAAwB;AAAA,QAChF,oBAAC,wBAAqB,gBAAgB,YAAe,mBAAqB;AAAA,QAE1E,oBAAC,mBAAgB,eAAe,UAAa,qBAAuB;AAAA,QACpE,oBAAC,mBAAgB,eAAe,YAAe,uBAAyB;AAAA,QACxE,oBAAC,mBAAgB,eAAe,WAAc,sBAAwB;AAAA,QAEtE,oBAAC,sBAAsB,kBAAoB;AAAA,SAC7C;AAAA;AAAA,EAEJ;AAEJ;AAxBgB;;;ADgDN,SASI,OAAAA,MATJ,QAAAC,aAAA;AAnBV,IAAM,qCAAqC,wBACzC,oBACA,uBACG;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