@collabchron/notiq 1.1.12 → 1.2.0
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.
- package/dist/AICommandBarPlugin-ZEC755KY.mjs +27 -0
- package/dist/{AIDialog-RHRYHSVN.mjs → AIDialog-HJW6PQPR.mjs} +11 -12
- package/dist/{AudioComponent-CKLMLB5T.mjs → AudioComponent-W5XMZPQB.mjs} +10 -6
- package/dist/{DynamicBlockComponent-2LOADZUX.mjs → DynamicBlockComponent-CHRL2GAQ.mjs} +7 -6
- package/dist/{EquationComponent-4NFG55NQ.mjs → EquationComponent-GNQHG53L.mjs} +26 -7
- package/dist/{ExcalidrawComponent-BMSYIPP6.mjs → ExcalidrawComponent-POMYXDSG.mjs} +33 -6
- package/dist/{FileComponent-Y56MX5QD.mjs → FileComponent-EOVCH4V5.mjs} +9 -5
- package/dist/{HintComponet-ET7M2Q7S.mjs → HintComponet-QXL5ESND.mjs} +32 -8
- package/dist/{InlineImageComponent-FVTA4LXZ.mjs → InlineImageComponent-KDN3VGZC.mjs} +8 -3
- package/dist/{StoryBuilderComponent-JN4ZPZOW.mjs → StoryBuilderComponent-CBRFPFTR.mjs} +8 -9
- package/dist/{chunk-6UVNHT3T.mjs → chunk-4SYRK2NH.mjs} +23 -1
- package/dist/chunk-5CJZC5IB.mjs +9086 -0
- package/dist/{chunk-FO7M3X2B.mjs → chunk-6NK5DONB.mjs} +1 -1
- package/dist/{chunk-N6ILV6NF.mjs → chunk-ACW4DLVO.mjs} +21 -7
- package/dist/chunk-BCGD2YXP.mjs +574 -0
- package/dist/{chunk-TC3IISJZ.mjs → chunk-BTR3TPIN.mjs} +18 -5
- package/dist/{chunk-ZYJ7KABY.mjs → chunk-CQCS5YPS.mjs} +3 -5
- package/dist/{chunk-T2UBAZ66.mjs → chunk-D4UBNSUW.mjs} +1 -1
- package/dist/{chunk-KNW2CGIP.mjs → chunk-DBRZIA43.mjs} +4 -1
- package/dist/{chunk-CDAMHK63.mjs → chunk-GJK2L7ZM.mjs} +23 -2
- package/dist/{chunk-ELBTVBTS.mjs → chunk-IKYVBTCJ.mjs} +43 -20
- package/dist/chunk-IXRA5D53.mjs +10447 -0
- package/dist/{chunk-W6VQSFE5.mjs → chunk-J2CEQXG4.mjs} +1 -1
- package/dist/{chunk-43Z4Z2KD.mjs → chunk-JTNLN4JI.mjs} +1 -1
- package/dist/{chunk-OE5JRLCN.mjs → chunk-ONOHG5NB.mjs} +6 -4
- package/dist/{chunk-QNIY45SF.mjs → chunk-OO42URWA.mjs} +27 -6
- package/dist/chunk-PBVRSNGU.mjs +129 -0
- package/dist/chunk-QCS57TIF.mjs +1794 -0
- package/dist/chunk-RNEIJRUS.mjs +60 -0
- package/dist/chunk-TJPTGECP.mjs +1556 -0
- package/dist/{chunk-XYMXGU4T.mjs → chunk-TMYRA2W4.mjs} +1 -1
- package/dist/{chunk-ZFV2HGD3.mjs → chunk-UNEFOZTS.mjs} +1 -1
- package/dist/chunk-X4NI7EQS.mjs +282 -0
- package/dist/{chunk-5D4JF3ZZ.mjs → chunk-XAJ4GACN.mjs} +171 -49
- package/dist/{chunk-7QRJVZQY.mjs → chunk-YVUQRJVV.mjs} +63 -18
- package/dist/components/editor/index.d.ts +1 -1
- package/dist/components/editor/nodes/EquationNode/EquationNode.d.ts +1 -0
- package/dist/components/editor/nodes/Hint/index.d.ts +2 -1
- package/dist/components/editor/plugins/AICommandBarPlugin/index.d.ts +73 -1
- package/dist/components/editor/plugins/DraggableBlockPlugin/index.d.ts +25 -3
- package/dist/components/editor/plugins/InlineCopilotPlugin/index.d.ts +16 -3
- package/dist/components/editor/plugins/LinkWithMetaData/index.d.ts +20 -25
- package/dist/components/editor/plugins/MarkdownPastePlugin/index.d.ts +5 -0
- package/dist/components/editor/plugins/MarkdownTransformers/index.d.ts +2 -0
- package/dist/components/editor/plugins/SlashCommand/index.d.ts +18 -1
- package/dist/components/editor/plugins/SmartTypographyPlugin/index.d.ts +26 -0
- package/dist/components/editor/utils/aiStream.d.ts +27 -0
- package/dist/components/editor/utils/excalidrawDiagramBuilder.d.ts +29 -0
- package/dist/components/editor/utils/markdownTransformers.d.ts +4 -1
- package/dist/components/editor/utils/url.d.ts +16 -4
- package/dist/components/providers/AIContext.d.ts +8 -0
- package/dist/components/ui/equation/equationTypography.d.ts +23 -0
- package/dist/core/extension.d.ts +3 -1
- package/dist/core/extensions/blocks-kit.d.ts +22 -1
- package/dist/core/extensions/copilot-and-collab.d.ts +15 -1
- package/dist/core/react/NotiqContent.d.ts +4 -1
- package/dist/core/react/index.d.ts +1 -0
- package/dist/core/react/node-renderers.d.ts +73 -0
- package/dist/core.js +15429 -13116
- package/dist/core.mjs +47 -39
- package/dist/hooks/instructions-messages.d.ts +13 -4
- package/dist/{image-QPB2CVXP.mjs → image-AL6PHM2A.mjs} +17 -12
- package/dist/index.js +15526 -13194
- package/dist/index.mjs +64 -60
- package/dist/{insert-audio-I3PD6JFS.mjs → insert-audio-CRWR7EO5.mjs} +4 -6
- package/dist/{insert-file-PHR7XL4V.mjs → insert-file-I73AZW3L.mjs} +4 -6
- package/dist/{insert-gif-R5ZO4JHC.mjs → insert-gif-KWRC3ACT.mjs} +1 -1
- package/dist/{insert-image-PLBZELHK.mjs → insert-image-XIY6BGW5.mjs} +4 -3
- package/dist/{insert-poll-6BCIFY5G.mjs → insert-poll-J5YVZNZ4.mjs} +4 -3
- package/dist/{insert-table-ZRJP6X52.mjs → insert-table-OIMJRFFK.mjs} +1 -1
- package/dist/{poll-component-VHMM5KKZ.mjs → poll-component-TVHXIKGQ.mjs} +3 -2
- package/dist/react.js +14747 -12554
- package/dist/react.mjs +40 -38
- package/dist/{stepper-KNITDVLG.mjs → stepper-ILF7YXTO.mjs} +63 -73
- package/dist/styles/notiq.css +1 -1
- package/package.json +2 -2
- package/src/styles/notiq.css +20 -0
- package/dist/AICommandBarPlugin-TADJ3X2Y.mjs +0 -12
- package/dist/CodeActionMenuPlugin-FGH6HZLL.mjs +0 -14
- package/dist/CollaborationPlugin-TIZOQBUT.mjs +0 -405
- package/dist/CollaboratorsBar-AMPIAUOY.mjs +0 -20
- package/dist/CommentsPlugin-SDJJTUGK.mjs +0 -19
- package/dist/ExcalidrawPlugin-QLPGJPSX.mjs +0 -14
- package/dist/ExportPlugin-MJHYKQZJ.mjs +0 -43
- package/dist/FloatingLinkEditorPlugin-MABB34L7.mjs +0 -12
- package/dist/FloatingTextFormatToolbarPlugin-BXCPN3KD.mjs +0 -45
- package/dist/InlineCopilotPlugin-PNS5Y6OO.mjs +0 -360
- package/dist/MobileToolbar-KV5DX4ED.mjs +0 -982
- package/dist/SlashCommand-SPR7G5EI.mjs +0 -39
- package/dist/TableCellActionMenuPlugin-YWBA64J7.mjs +0 -838
- package/dist/TableHoverActionsPlugin-2EIXHEXN.mjs +0 -265
- package/dist/TemplatePlugin-HNTPEXBB.mjs +0 -9
- package/dist/ToolbarPlugin-F52PVNXU.mjs +0 -823
- package/dist/VersionHistoryPlugin-YWGCREKA.mjs +0 -371
- package/dist/background-color-RW5JYLMG.mjs +0 -425
- package/dist/block-format-TODFREE2.mjs +0 -14
- package/dist/chunk-22ZIL6NH.mjs +0 -88
- package/dist/chunk-2LNT36RL.mjs +0 -555
- package/dist/chunk-37LC44W3.mjs +0 -2677
- package/dist/chunk-3IILA3IP.mjs +0 -28
- package/dist/chunk-4DVIYZVB.mjs +0 -193
- package/dist/chunk-4FFTOZGJ.mjs +0 -103
- package/dist/chunk-4UMUPCDK.mjs +0 -68
- package/dist/chunk-6D6QLRYR.mjs +0 -238
- package/dist/chunk-6FQFPPLG.mjs +0 -785
- package/dist/chunk-ACV47ZKE.mjs +0 -201
- package/dist/chunk-BGV62GC2.mjs +0 -26
- package/dist/chunk-C4JWLBYN.mjs +0 -132
- package/dist/chunk-CLRSETYQ.mjs +0 -431
- package/dist/chunk-D3IOUQFR.mjs +0 -441
- package/dist/chunk-EEBA6OAH.mjs +0 -59
- package/dist/chunk-EIZMKFHF.mjs +0 -32
- package/dist/chunk-ENH2IOHI.mjs +0 -1828
- package/dist/chunk-EVPWKNE4.mjs +0 -27
- package/dist/chunk-HOZ4QRFV.mjs +0 -536
- package/dist/chunk-IAFCQV3Z.mjs +0 -349
- package/dist/chunk-J6ZUY5BY.mjs +0 -202
- package/dist/chunk-K5OAFEVY.mjs +0 -191
- package/dist/chunk-KXRLARGI.mjs +0 -26
- package/dist/chunk-LBGM4VVZ.mjs +0 -409
- package/dist/chunk-LLGVCM7M.mjs +0 -809
- package/dist/chunk-LU2XWLOE.mjs +0 -219
- package/dist/chunk-LVRJM45C.mjs +0 -171
- package/dist/chunk-MSAO3YFB.mjs +0 -144
- package/dist/chunk-N3KDPSRI.mjs +0 -496
- package/dist/chunk-OXWTZV3U.mjs +0 -174
- package/dist/chunk-PD5K4AGP.mjs +0 -64
- package/dist/chunk-PFH63ZU4.mjs +0 -33
- package/dist/chunk-R7WFRENU.mjs +0 -262
- package/dist/chunk-RAVYEEIC.mjs +0 -36
- package/dist/chunk-RJQTA6HG.mjs +0 -358
- package/dist/chunk-SAOJHVPE.mjs +0 -153
- package/dist/chunk-SYUCM5G5.mjs +0 -111
- package/dist/chunk-VGAX6YEY.mjs +0 -399
- package/dist/chunk-VNDDDXGH.mjs +0 -682
- package/dist/chunk-WUVIQCX7.mjs +0 -944
- package/dist/chunk-XNJNT6PC.mjs +0 -1701
- package/dist/chunk-XYLTLGY5.mjs +0 -775
- package/dist/chunk-ZKZ7MLSS.mjs +0 -165
- package/dist/color-S55XFDYQ.mjs +0 -13
- package/dist/font-IJKFR4BM.mjs +0 -12
- package/dist/font-size-3HMJHKO2.mjs +0 -15
- package/dist/insert-node-DGCZBGKG.mjs +0 -243
- package/dist/table-dropdown-4VCRSQB6.mjs +0 -391
- package/dist/text-align-TEB4S52S.mjs +0 -121
- package/dist/text-format-T3IY7FBI.mjs +0 -15
package/dist/chunk-PD5K4AGP.mjs
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Tooltip,
|
|
3
|
-
TooltipContent,
|
|
4
|
-
TooltipProvider,
|
|
5
|
-
TooltipTrigger
|
|
6
|
-
} from "./chunk-OE5JRLCN.mjs";
|
|
7
|
-
import {
|
|
8
|
-
cn
|
|
9
|
-
} from "./chunk-JHXDLYEV.mjs";
|
|
10
|
-
import {
|
|
11
|
-
__objRest,
|
|
12
|
-
__spreadValues,
|
|
13
|
-
init_react_shim
|
|
14
|
-
} from "./chunk-WYCFGRFJ.mjs";
|
|
15
|
-
|
|
16
|
-
// src/components/ui/toggle.tsx
|
|
17
|
-
init_react_shim();
|
|
18
|
-
import * as React from "react";
|
|
19
|
-
import * as TogglePrimitive from "@radix-ui/react-toggle";
|
|
20
|
-
import { cva } from "class-variance-authority";
|
|
21
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
22
|
-
var toggleVariants = cva(
|
|
23
|
-
"inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors hover:bg-zinc-100 hover:text-zinc-500 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-zinc-950 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-zinc-100 data-[state=on]:text-zinc-900 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 dark:hover:bg-zinc-800 dark:hover:text-zinc-400 dark:focus-visible:ring-zinc-300 dark:data-[state=on]:bg-zinc-800 dark:data-[state=on]:text-zinc-50",
|
|
24
|
-
{
|
|
25
|
-
variants: {
|
|
26
|
-
variant: {
|
|
27
|
-
default: "bg-transparent",
|
|
28
|
-
outline: "border-none cursor-pointer bg-transparent shadow-sm"
|
|
29
|
-
},
|
|
30
|
-
size: {
|
|
31
|
-
default: "h-9 px-2 min-w-9",
|
|
32
|
-
sm: "h-7 rounded-md px-[6px] ",
|
|
33
|
-
lg: "h-10 px-2.5 min-w-10",
|
|
34
|
-
Toolbar: "h-7 w-7 p-1.5",
|
|
35
|
-
floting: "h-7 w-7 p-1.5",
|
|
36
|
-
floating: "h-7 w-7 p-1.5"
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
defaultVariants: {
|
|
40
|
-
variant: "default",
|
|
41
|
-
size: "default"
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
);
|
|
45
|
-
var Toggle = React.forwardRef((_a, ref) => {
|
|
46
|
-
var _b = _a, { className, variant, tip, size } = _b, props = __objRest(_b, ["className", "variant", "tip", "size"]);
|
|
47
|
-
const toggleButton = /* @__PURE__ */ jsx(
|
|
48
|
-
TogglePrimitive.Root,
|
|
49
|
-
__spreadValues({
|
|
50
|
-
ref,
|
|
51
|
-
className: cn(toggleVariants({ variant, size, className }))
|
|
52
|
-
}, props)
|
|
53
|
-
);
|
|
54
|
-
if (!tip) return toggleButton;
|
|
55
|
-
return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 200, children: [
|
|
56
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: toggleButton }),
|
|
57
|
-
/* @__PURE__ */ jsx(TooltipContent, { side: "top", children: /* @__PURE__ */ jsx("span", { children: tip }) })
|
|
58
|
-
] }) });
|
|
59
|
-
});
|
|
60
|
-
Toggle.displayName = TogglePrimitive.Root.displayName;
|
|
61
|
-
|
|
62
|
-
export {
|
|
63
|
-
Toggle
|
|
64
|
-
};
|
package/dist/chunk-PFH63ZU4.mjs
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
cn
|
|
3
|
-
} from "./chunk-JHXDLYEV.mjs";
|
|
4
|
-
import {
|
|
5
|
-
__objRest,
|
|
6
|
-
__spreadValues,
|
|
7
|
-
init_react_shim
|
|
8
|
-
} from "./chunk-WYCFGRFJ.mjs";
|
|
9
|
-
|
|
10
|
-
// src/components/ui/label.tsx
|
|
11
|
-
init_react_shim();
|
|
12
|
-
import * as React from "react";
|
|
13
|
-
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
14
|
-
import { cva } from "class-variance-authority";
|
|
15
|
-
import { jsx } from "react/jsx-runtime";
|
|
16
|
-
var labelVariants = cva(
|
|
17
|
-
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
18
|
-
);
|
|
19
|
-
var Label = React.forwardRef((_a, ref) => {
|
|
20
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
21
|
-
return /* @__PURE__ */ jsx(
|
|
22
|
-
LabelPrimitive.Root,
|
|
23
|
-
__spreadValues({
|
|
24
|
-
ref,
|
|
25
|
-
className: cn(labelVariants(), className)
|
|
26
|
-
}, props)
|
|
27
|
-
);
|
|
28
|
-
});
|
|
29
|
-
Label.displayName = LabelPrimitive.Root.displayName;
|
|
30
|
-
|
|
31
|
-
export {
|
|
32
|
-
Label
|
|
33
|
-
};
|
package/dist/chunk-R7WFRENU.mjs
DELETED
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useCollab
|
|
3
|
-
} from "./chunk-RJQTA6HG.mjs";
|
|
4
|
-
import {
|
|
5
|
-
__spreadProps,
|
|
6
|
-
__spreadValues,
|
|
7
|
-
init_react_shim
|
|
8
|
-
} from "./chunk-WYCFGRFJ.mjs";
|
|
9
|
-
|
|
10
|
-
// src/components/providers/CommentsContext.tsx
|
|
11
|
-
init_react_shim();
|
|
12
|
-
import {
|
|
13
|
-
createContext,
|
|
14
|
-
useContext,
|
|
15
|
-
useState,
|
|
16
|
-
useEffect,
|
|
17
|
-
useCallback,
|
|
18
|
-
useMemo
|
|
19
|
-
} from "react";
|
|
20
|
-
import { toast } from "sonner";
|
|
21
|
-
import { Fragment, jsx } from "react/jsx-runtime";
|
|
22
|
-
var CommentsContext = createContext(null);
|
|
23
|
-
var useComments = () => {
|
|
24
|
-
const context = useContext(CommentsContext);
|
|
25
|
-
if (!context) {
|
|
26
|
-
throw new Error("useComments must be used within a CommentsProvider");
|
|
27
|
-
}
|
|
28
|
-
return context;
|
|
29
|
-
};
|
|
30
|
-
var CommentsProviderInternal = ({ children }) => {
|
|
31
|
-
const { provider, username, cursorColor, avatar } = useCollab();
|
|
32
|
-
const [threads, setThreads] = useState([]);
|
|
33
|
-
const [activeThreadId, setActiveThreadId] = useState(null);
|
|
34
|
-
const [isSidebarOpen, setIsSidebarOpen] = useState(false);
|
|
35
|
-
const [draftComment, setDraftComment] = useState(null);
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
const doc = provider == null ? void 0 : provider.doc;
|
|
38
|
-
if (!doc) return;
|
|
39
|
-
const yComments = doc.getArray("notiq-comments");
|
|
40
|
-
const syncThreadsFromYjs = () => {
|
|
41
|
-
try {
|
|
42
|
-
const rawList = yComments.toArray();
|
|
43
|
-
const parsed = rawList.map((item) => {
|
|
44
|
-
if (typeof item === "string") {
|
|
45
|
-
try {
|
|
46
|
-
return JSON.parse(item);
|
|
47
|
-
} catch (e) {
|
|
48
|
-
return item;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return item;
|
|
52
|
-
});
|
|
53
|
-
setThreads(parsed);
|
|
54
|
-
} catch (err) {
|
|
55
|
-
console.warn("[Notiq Comments] Failed to parse Yjs comments array:", err);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
syncThreadsFromYjs();
|
|
59
|
-
yComments.observeDeep(syncThreadsFromYjs);
|
|
60
|
-
return () => {
|
|
61
|
-
yComments.unobserveDeep(syncThreadsFromYjs);
|
|
62
|
-
};
|
|
63
|
-
}, [provider == null ? void 0 : provider.doc]);
|
|
64
|
-
const author = useMemo(
|
|
65
|
-
() => ({
|
|
66
|
-
name: username,
|
|
67
|
-
color: cursorColor,
|
|
68
|
-
avatar
|
|
69
|
-
}),
|
|
70
|
-
[username, cursorColor, avatar]
|
|
71
|
-
);
|
|
72
|
-
const addThread = useCallback(
|
|
73
|
-
(quote, messageText) => {
|
|
74
|
-
const threadId = `comment-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`;
|
|
75
|
-
const newThread = {
|
|
76
|
-
id: threadId,
|
|
77
|
-
quote: quote.trim(),
|
|
78
|
-
author,
|
|
79
|
-
createdAt: Date.now(),
|
|
80
|
-
resolved: false,
|
|
81
|
-
messages: [
|
|
82
|
-
{
|
|
83
|
-
id: `msg-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
|
|
84
|
-
author,
|
|
85
|
-
content: messageText.trim(),
|
|
86
|
-
createdAt: Date.now()
|
|
87
|
-
}
|
|
88
|
-
]
|
|
89
|
-
};
|
|
90
|
-
const doc = provider == null ? void 0 : provider.doc;
|
|
91
|
-
if (doc) {
|
|
92
|
-
const yComments = doc.getArray("notiq-comments");
|
|
93
|
-
doc.transact(() => {
|
|
94
|
-
yComments.push([JSON.stringify(newThread)]);
|
|
95
|
-
});
|
|
96
|
-
} else {
|
|
97
|
-
setThreads((prev) => [...prev, newThread]);
|
|
98
|
-
}
|
|
99
|
-
setActiveThreadId(threadId);
|
|
100
|
-
setIsSidebarOpen(true);
|
|
101
|
-
setDraftComment(null);
|
|
102
|
-
toast.success("Comment added", {
|
|
103
|
-
description: `Thread started on "${quote.slice(0, 30)}${quote.length > 30 ? "..." : ""}"`
|
|
104
|
-
});
|
|
105
|
-
return threadId;
|
|
106
|
-
},
|
|
107
|
-
[author, provider == null ? void 0 : provider.doc]
|
|
108
|
-
);
|
|
109
|
-
const addReply = useCallback(
|
|
110
|
-
(threadId, messageText) => {
|
|
111
|
-
if (!messageText.trim()) return;
|
|
112
|
-
const reply = {
|
|
113
|
-
id: `msg-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
|
|
114
|
-
author,
|
|
115
|
-
content: messageText.trim(),
|
|
116
|
-
createdAt: Date.now()
|
|
117
|
-
};
|
|
118
|
-
const doc = provider == null ? void 0 : provider.doc;
|
|
119
|
-
if (doc) {
|
|
120
|
-
const yComments = doc.getArray("notiq-comments");
|
|
121
|
-
doc.transact(() => {
|
|
122
|
-
const rawList = yComments.toArray();
|
|
123
|
-
const targetIndex = rawList.findIndex((item) => {
|
|
124
|
-
const thread = typeof item === "string" ? JSON.parse(item) : item;
|
|
125
|
-
return thread.id === threadId;
|
|
126
|
-
});
|
|
127
|
-
if (targetIndex !== -1) {
|
|
128
|
-
const currentThread = typeof rawList[targetIndex] === "string" ? JSON.parse(rawList[targetIndex]) : rawList[targetIndex];
|
|
129
|
-
const updatedThread = __spreadProps(__spreadValues({}, currentThread), {
|
|
130
|
-
messages: [...currentThread.messages || [], reply]
|
|
131
|
-
});
|
|
132
|
-
yComments.delete(targetIndex, 1);
|
|
133
|
-
yComments.insert(targetIndex, [JSON.stringify(updatedThread)]);
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
} else {
|
|
137
|
-
setThreads(
|
|
138
|
-
(prev) => prev.map(
|
|
139
|
-
(thread) => thread.id === threadId ? __spreadProps(__spreadValues({}, thread), { messages: [...thread.messages, reply] }) : thread
|
|
140
|
-
)
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
[author, provider == null ? void 0 : provider.doc]
|
|
145
|
-
);
|
|
146
|
-
const toggleResolveThread = useCallback(
|
|
147
|
-
(threadId) => {
|
|
148
|
-
const doc = provider == null ? void 0 : provider.doc;
|
|
149
|
-
if (doc) {
|
|
150
|
-
const yComments = doc.getArray("notiq-comments");
|
|
151
|
-
doc.transact(() => {
|
|
152
|
-
const rawList = yComments.toArray();
|
|
153
|
-
const targetIndex = rawList.findIndex((item) => {
|
|
154
|
-
const thread = typeof item === "string" ? JSON.parse(item) : item;
|
|
155
|
-
return thread.id === threadId;
|
|
156
|
-
});
|
|
157
|
-
if (targetIndex !== -1) {
|
|
158
|
-
const currentThread = typeof rawList[targetIndex] === "string" ? JSON.parse(rawList[targetIndex]) : rawList[targetIndex];
|
|
159
|
-
const updatedThread = __spreadProps(__spreadValues({}, currentThread), {
|
|
160
|
-
resolved: !currentThread.resolved
|
|
161
|
-
});
|
|
162
|
-
yComments.delete(targetIndex, 1);
|
|
163
|
-
yComments.insert(targetIndex, [JSON.stringify(updatedThread)]);
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
} else {
|
|
167
|
-
setThreads(
|
|
168
|
-
(prev) => prev.map(
|
|
169
|
-
(thread) => thread.id === threadId ? __spreadProps(__spreadValues({}, thread), { resolved: !thread.resolved }) : thread
|
|
170
|
-
)
|
|
171
|
-
);
|
|
172
|
-
}
|
|
173
|
-
},
|
|
174
|
-
[provider == null ? void 0 : provider.doc]
|
|
175
|
-
);
|
|
176
|
-
const deleteThread = useCallback(
|
|
177
|
-
(threadId) => {
|
|
178
|
-
const doc = provider == null ? void 0 : provider.doc;
|
|
179
|
-
if (doc) {
|
|
180
|
-
const yComments = doc.getArray("notiq-comments");
|
|
181
|
-
doc.transact(() => {
|
|
182
|
-
const rawList = yComments.toArray();
|
|
183
|
-
const targetIndex = rawList.findIndex((item) => {
|
|
184
|
-
const thread = typeof item === "string" ? JSON.parse(item) : item;
|
|
185
|
-
return thread.id === threadId;
|
|
186
|
-
});
|
|
187
|
-
if (targetIndex !== -1) {
|
|
188
|
-
yComments.delete(targetIndex, 1);
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
} else {
|
|
192
|
-
setThreads((prev) => prev.filter((t) => t.id !== threadId));
|
|
193
|
-
}
|
|
194
|
-
if (activeThreadId === threadId) {
|
|
195
|
-
setActiveThreadId(null);
|
|
196
|
-
}
|
|
197
|
-
toast.info("Comment thread deleted");
|
|
198
|
-
},
|
|
199
|
-
[activeThreadId, provider == null ? void 0 : provider.doc]
|
|
200
|
-
);
|
|
201
|
-
const toggleSidebar = useCallback(() => {
|
|
202
|
-
setIsSidebarOpen((prev) => !prev);
|
|
203
|
-
}, []);
|
|
204
|
-
const jumpToQuote = useCallback((quote, threadId) => {
|
|
205
|
-
setActiveThreadId(threadId);
|
|
206
|
-
if (typeof window !== "undefined") {
|
|
207
|
-
window.dispatchEvent(
|
|
208
|
-
new CustomEvent("notiq:jump-to-quote", {
|
|
209
|
-
detail: { quote, threadId }
|
|
210
|
-
})
|
|
211
|
-
);
|
|
212
|
-
}
|
|
213
|
-
}, []);
|
|
214
|
-
const unresolvedCount = useMemo(
|
|
215
|
-
() => threads.filter((t) => !t.resolved).length,
|
|
216
|
-
[threads]
|
|
217
|
-
);
|
|
218
|
-
const value = useMemo(
|
|
219
|
-
() => ({
|
|
220
|
-
threads,
|
|
221
|
-
activeThreadId,
|
|
222
|
-
setActiveThreadId,
|
|
223
|
-
isSidebarOpen,
|
|
224
|
-
setIsSidebarOpen,
|
|
225
|
-
toggleSidebar,
|
|
226
|
-
unresolvedCount,
|
|
227
|
-
draftComment,
|
|
228
|
-
setDraftComment,
|
|
229
|
-
addThread,
|
|
230
|
-
addReply,
|
|
231
|
-
toggleResolveThread,
|
|
232
|
-
deleteThread,
|
|
233
|
-
jumpToQuote
|
|
234
|
-
}),
|
|
235
|
-
[
|
|
236
|
-
threads,
|
|
237
|
-
activeThreadId,
|
|
238
|
-
isSidebarOpen,
|
|
239
|
-
toggleSidebar,
|
|
240
|
-
unresolvedCount,
|
|
241
|
-
draftComment,
|
|
242
|
-
addThread,
|
|
243
|
-
addReply,
|
|
244
|
-
toggleResolveThread,
|
|
245
|
-
deleteThread,
|
|
246
|
-
jumpToQuote
|
|
247
|
-
]
|
|
248
|
-
);
|
|
249
|
-
return /* @__PURE__ */ jsx(CommentsContext.Provider, { value, children });
|
|
250
|
-
};
|
|
251
|
-
var CommentsProvider = ({ children }) => {
|
|
252
|
-
const existing = useContext(CommentsContext);
|
|
253
|
-
if (existing) {
|
|
254
|
-
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
255
|
-
}
|
|
256
|
-
return /* @__PURE__ */ jsx(CommentsProviderInternal, { children });
|
|
257
|
-
};
|
|
258
|
-
|
|
259
|
-
export {
|
|
260
|
-
useComments,
|
|
261
|
-
CommentsProvider
|
|
262
|
-
};
|
package/dist/chunk-RAVYEEIC.mjs
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
init_react_shim
|
|
3
|
-
} from "./chunk-WYCFGRFJ.mjs";
|
|
4
|
-
|
|
5
|
-
// src/components/editor/utils/url.ts
|
|
6
|
-
init_react_shim();
|
|
7
|
-
var SUPPORTED_URL_PROTOCOLS = /* @__PURE__ */ new Set([
|
|
8
|
-
"http:",
|
|
9
|
-
"https:",
|
|
10
|
-
"mailto:",
|
|
11
|
-
"sms:",
|
|
12
|
-
"tel:",
|
|
13
|
-
"ftp:"
|
|
14
|
-
]);
|
|
15
|
-
function sanitizeUrl(url) {
|
|
16
|
-
try {
|
|
17
|
-
const parsedUrl = new URL(url);
|
|
18
|
-
if (!SUPPORTED_URL_PROTOCOLS.has(parsedUrl.protocol)) {
|
|
19
|
-
return "about:blank";
|
|
20
|
-
}
|
|
21
|
-
} catch (e) {
|
|
22
|
-
return url;
|
|
23
|
-
}
|
|
24
|
-
return url;
|
|
25
|
-
}
|
|
26
|
-
var urlRegExp = new RegExp(
|
|
27
|
-
/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=+$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z0-9.-]+)((?:\/[+~%/.\w-_]*)?\??(?:[-+=&;%@.\w_]*)#?(?:[\w]*))?)/
|
|
28
|
-
);
|
|
29
|
-
function validateUrl(url) {
|
|
30
|
-
return url === "https://" || urlRegExp.test(url);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export {
|
|
34
|
-
sanitizeUrl,
|
|
35
|
-
validateUrl
|
|
36
|
-
};
|