@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
|
@@ -1,982 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
INSERT_EXCALIDRAW_COMMAND
|
|
4
|
-
} from "./chunk-22ZIL6NH.mjs";
|
|
5
|
-
import {
|
|
6
|
-
INSERT_COMMENT_COMMAND
|
|
7
|
-
} from "./chunk-WUVIQCX7.mjs";
|
|
8
|
-
import "./chunk-3JN6QEJR.mjs";
|
|
9
|
-
import "./chunk-6UVNHT3T.mjs";
|
|
10
|
-
import {
|
|
11
|
-
SPEECH_TO_TEXT_COMMAND,
|
|
12
|
-
SUPPORT_SPEECH_RECOGNITION
|
|
13
|
-
} from "./chunk-ZKZ7MLSS.mjs";
|
|
14
|
-
import {
|
|
15
|
-
AutoEmbedDialog,
|
|
16
|
-
INSERT_LAYOUT_COMMAND,
|
|
17
|
-
Youtube,
|
|
18
|
-
YoutubeEmbedConfig
|
|
19
|
-
} from "./chunk-XYLTLGY5.mjs";
|
|
20
|
-
import {
|
|
21
|
-
useModal
|
|
22
|
-
} from "./chunk-IAFCQV3Z.mjs";
|
|
23
|
-
import "./chunk-VGAX6YEY.mjs";
|
|
24
|
-
import "./chunk-OXWTZV3U.mjs";
|
|
25
|
-
import "./chunk-R7WFRENU.mjs";
|
|
26
|
-
import "./chunk-RJQTA6HG.mjs";
|
|
27
|
-
import {
|
|
28
|
-
Skeleton
|
|
29
|
-
} from "./chunk-NBE6FF6L.mjs";
|
|
30
|
-
import "./chunk-5NRAXWYA.mjs";
|
|
31
|
-
import {
|
|
32
|
-
sanitizeUrl
|
|
33
|
-
} from "./chunk-RAVYEEIC.mjs";
|
|
34
|
-
import "./chunk-TC3IISJZ.mjs";
|
|
35
|
-
import "./chunk-H3P47YXJ.mjs";
|
|
36
|
-
import "./chunk-QNIY45SF.mjs";
|
|
37
|
-
import "./chunk-OE5JRLCN.mjs";
|
|
38
|
-
import {
|
|
39
|
-
INSERT_HINT_COMMAND
|
|
40
|
-
} from "./chunk-7QRJVZQY.mjs";
|
|
41
|
-
import {
|
|
42
|
-
cn
|
|
43
|
-
} from "./chunk-JHXDLYEV.mjs";
|
|
44
|
-
import {
|
|
45
|
-
init_react_shim
|
|
46
|
-
} from "./chunk-WYCFGRFJ.mjs";
|
|
47
|
-
|
|
48
|
-
// src/components/editor/plugins/ToolbarPlugin/MobileToolbar.tsx
|
|
49
|
-
init_react_shim();
|
|
50
|
-
import { useEffect, useState, useMemo, lazy, Suspense, useCallback, useRef } from "react";
|
|
51
|
-
import {
|
|
52
|
-
$getSelection,
|
|
53
|
-
$isRangeSelection,
|
|
54
|
-
FORMAT_TEXT_COMMAND,
|
|
55
|
-
FORMAT_ELEMENT_COMMAND,
|
|
56
|
-
REDO_COMMAND,
|
|
57
|
-
UNDO_COMMAND
|
|
58
|
-
} from "lexical";
|
|
59
|
-
import {
|
|
60
|
-
Bold,
|
|
61
|
-
Italic,
|
|
62
|
-
Underline,
|
|
63
|
-
Strikethrough,
|
|
64
|
-
Undo2,
|
|
65
|
-
Redo2,
|
|
66
|
-
Heading1,
|
|
67
|
-
Heading2,
|
|
68
|
-
Heading3,
|
|
69
|
-
Type,
|
|
70
|
-
List,
|
|
71
|
-
ListOrdered,
|
|
72
|
-
Link as LinkIcon,
|
|
73
|
-
Code,
|
|
74
|
-
Quote,
|
|
75
|
-
CheckSquare,
|
|
76
|
-
AlignLeft,
|
|
77
|
-
AlignCenter,
|
|
78
|
-
AlignRight,
|
|
79
|
-
Mic,
|
|
80
|
-
Plus,
|
|
81
|
-
Image,
|
|
82
|
-
FileAudio,
|
|
83
|
-
FileText,
|
|
84
|
-
Table,
|
|
85
|
-
SquarePenIcon,
|
|
86
|
-
DraftingCompassIcon,
|
|
87
|
-
AlertCircle,
|
|
88
|
-
FlipHorizontal2,
|
|
89
|
-
Columns2,
|
|
90
|
-
ChevronDown,
|
|
91
|
-
Palette,
|
|
92
|
-
Sparkles,
|
|
93
|
-
Eraser,
|
|
94
|
-
MessageSquarePlus,
|
|
95
|
-
ArrowDownUp
|
|
96
|
-
} from "lucide-react";
|
|
97
|
-
import { TOGGLE_LINK_COMMAND } from "@lexical/link";
|
|
98
|
-
import {
|
|
99
|
-
INSERT_ORDERED_LIST_COMMAND,
|
|
100
|
-
INSERT_UNORDERED_LIST_COMMAND,
|
|
101
|
-
INSERT_CHECK_LIST_COMMAND
|
|
102
|
-
} from "@lexical/list";
|
|
103
|
-
import { $createHeadingNode, $createQuoteNode } from "@lexical/rich-text";
|
|
104
|
-
import { $setBlocksType, $patchStyleText } from "@lexical/selection";
|
|
105
|
-
import { INSERT_HORIZONTAL_RULE_COMMAND } from "@lexical/react/LexicalHorizontalRuleNode";
|
|
106
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
107
|
-
var InsertImageDialog = lazy(
|
|
108
|
-
() => import("./insert-image-PLBZELHK.mjs").then((m) => ({ default: m.InsertImageDialog }))
|
|
109
|
-
);
|
|
110
|
-
var InsertAudioDialog = lazy(
|
|
111
|
-
() => import("./insert-audio-I3PD6JFS.mjs").then((m) => ({ default: m.InsertAudioDialog }))
|
|
112
|
-
);
|
|
113
|
-
var InsertFileDialog = lazy(
|
|
114
|
-
() => import("./insert-file-PHR7XL4V.mjs").then((m) => ({ default: m.InsertFileDialog }))
|
|
115
|
-
);
|
|
116
|
-
var InsertTableBody = lazy(
|
|
117
|
-
() => import("./insert-table-ZRJP6X52.mjs").then((m) => ({ default: m.InsertTable }))
|
|
118
|
-
);
|
|
119
|
-
var InsertPoll = lazy(
|
|
120
|
-
() => import("./insert-poll-6BCIFY5G.mjs").then((m) => ({ default: m.InsertPoll }))
|
|
121
|
-
);
|
|
122
|
-
var TEXT_COLORS = [
|
|
123
|
-
{ label: "Default", color: "inherit", bg: "bg-foreground" },
|
|
124
|
-
{ label: "Blue", color: "#2563eb", bg: "bg-blue-600" },
|
|
125
|
-
{ label: "Purple", color: "#7c3aed", bg: "bg-purple-600" },
|
|
126
|
-
{ label: "Emerald", color: "#059669", bg: "bg-emerald-600" },
|
|
127
|
-
{ label: "Amber", color: "#d97706", bg: "bg-amber-600" },
|
|
128
|
-
{ label: "Rose", color: "#e11d48", bg: "bg-rose-600" }
|
|
129
|
-
];
|
|
130
|
-
var HIGHLIGHT_COLORS = [
|
|
131
|
-
{ label: "None", color: "transparent", border: "border-border" },
|
|
132
|
-
{ label: "Yellow", color: "#fef08a", bg: "bg-yellow-200" },
|
|
133
|
-
{ label: "Green", color: "#bbf7d0", bg: "bg-green-200" },
|
|
134
|
-
{ label: "Blue", color: "#bfdbfe", bg: "bg-blue-200" },
|
|
135
|
-
{ label: "Pink", color: "#fbcfe8", bg: "bg-pink-200" },
|
|
136
|
-
{ label: "Orange", color: "#fed7aa", bg: "bg-orange-200" }
|
|
137
|
-
];
|
|
138
|
-
function MobileToolbar({
|
|
139
|
-
editor,
|
|
140
|
-
activeEditor,
|
|
141
|
-
toolbarState,
|
|
142
|
-
setIsLinkEditMode,
|
|
143
|
-
isVisible,
|
|
144
|
-
toolbarConfig
|
|
145
|
-
}) {
|
|
146
|
-
const [activeTab, setActiveTab] = useState("format");
|
|
147
|
-
const [isKeyboardOpen, setIsKeyboardOpen] = useState(false);
|
|
148
|
-
const [bottomOffset, setBottomOffset] = useState(0);
|
|
149
|
-
const [isSpeechActive, setIsSpeechActive] = useState(false);
|
|
150
|
-
const [isExpanded, setIsExpanded] = useState(false);
|
|
151
|
-
const [insertCategory, setInsertCategory] = useState("all");
|
|
152
|
-
const [modal, showModal] = useModal();
|
|
153
|
-
const targetEditor = activeEditor || editor;
|
|
154
|
-
useEffect(() => {
|
|
155
|
-
if (isVisible || isKeyboardOpen) {
|
|
156
|
-
setIsExpanded(true);
|
|
157
|
-
}
|
|
158
|
-
}, [isVisible, isKeyboardOpen]);
|
|
159
|
-
const scrollContainerRef = useRef(null);
|
|
160
|
-
const [canScrollLeft, setCanScrollLeft] = useState(false);
|
|
161
|
-
const [canScrollRight, setCanScrollRight] = useState(true);
|
|
162
|
-
const checkScrollAffordance = useCallback(() => {
|
|
163
|
-
const el = scrollContainerRef.current;
|
|
164
|
-
if (!el) return;
|
|
165
|
-
setCanScrollLeft(el.scrollLeft > 4);
|
|
166
|
-
setCanScrollRight(el.scrollLeft < el.scrollWidth - el.clientWidth - 4);
|
|
167
|
-
}, []);
|
|
168
|
-
useEffect(() => {
|
|
169
|
-
checkScrollAffordance();
|
|
170
|
-
}, [activeTab, checkScrollAffordance]);
|
|
171
|
-
useEffect(() => {
|
|
172
|
-
const visualViewport = window.visualViewport;
|
|
173
|
-
if (!visualViewport) return;
|
|
174
|
-
const handleResize = () => {
|
|
175
|
-
const windowHeight = window.innerHeight;
|
|
176
|
-
const viewportHeight = visualViewport.height;
|
|
177
|
-
const offsetTop = visualViewport.offsetTop;
|
|
178
|
-
const viewportBottom = offsetTop + viewportHeight;
|
|
179
|
-
const diff = windowHeight - viewportBottom;
|
|
180
|
-
setBottomOffset(Math.max(0, Math.min(diff, windowHeight * 0.55)));
|
|
181
|
-
const keyboardIsOpen = viewportHeight < windowHeight * 0.82;
|
|
182
|
-
setIsKeyboardOpen(keyboardIsOpen);
|
|
183
|
-
if (keyboardIsOpen) {
|
|
184
|
-
setIsExpanded(true);
|
|
185
|
-
}
|
|
186
|
-
};
|
|
187
|
-
visualViewport.addEventListener("resize", handleResize);
|
|
188
|
-
visualViewport.addEventListener("scroll", handleResize);
|
|
189
|
-
handleResize();
|
|
190
|
-
return () => {
|
|
191
|
-
visualViewport.removeEventListener("resize", handleResize);
|
|
192
|
-
visualViewport.removeEventListener("scroll", handleResize);
|
|
193
|
-
};
|
|
194
|
-
}, []);
|
|
195
|
-
const handleOpenDock = useCallback(
|
|
196
|
-
(e) => {
|
|
197
|
-
if (e) {
|
|
198
|
-
e.preventDefault();
|
|
199
|
-
e.stopPropagation();
|
|
200
|
-
}
|
|
201
|
-
setIsExpanded(true);
|
|
202
|
-
try {
|
|
203
|
-
targetEditor.focus();
|
|
204
|
-
} catch (e2) {
|
|
205
|
-
}
|
|
206
|
-
},
|
|
207
|
-
[targetEditor]
|
|
208
|
-
);
|
|
209
|
-
const handleCloseDock = useCallback((e) => {
|
|
210
|
-
if (e) {
|
|
211
|
-
e.preventDefault();
|
|
212
|
-
e.stopPropagation();
|
|
213
|
-
}
|
|
214
|
-
setIsExpanded(false);
|
|
215
|
-
}, []);
|
|
216
|
-
const shouldShow = isExpanded;
|
|
217
|
-
const formatHeading = (level) => {
|
|
218
|
-
targetEditor.update(() => {
|
|
219
|
-
const selection = $getSelection();
|
|
220
|
-
if ($isRangeSelection(selection)) {
|
|
221
|
-
$setBlocksType(selection, () => $createHeadingNode(level));
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
};
|
|
225
|
-
const formatQuote = () => {
|
|
226
|
-
targetEditor.update(() => {
|
|
227
|
-
const selection = $getSelection();
|
|
228
|
-
if ($isRangeSelection(selection)) {
|
|
229
|
-
$setBlocksType(selection, () => $createQuoteNode());
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
};
|
|
233
|
-
const applyColor = (color) => {
|
|
234
|
-
targetEditor.update(() => {
|
|
235
|
-
const selection = $getSelection();
|
|
236
|
-
if ($isRangeSelection(selection)) {
|
|
237
|
-
$patchStyleText(selection, { color: color === "inherit" ? "" : color });
|
|
238
|
-
}
|
|
239
|
-
});
|
|
240
|
-
};
|
|
241
|
-
const applyHighlight = (bgColor) => {
|
|
242
|
-
targetEditor.update(() => {
|
|
243
|
-
const selection = $getSelection();
|
|
244
|
-
if ($isRangeSelection(selection)) {
|
|
245
|
-
$patchStyleText(selection, {
|
|
246
|
-
"background-color": bgColor === "transparent" ? "" : bgColor
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
});
|
|
250
|
-
};
|
|
251
|
-
const toggleSpeech = () => {
|
|
252
|
-
if (!SUPPORT_SPEECH_RECOGNITION) return;
|
|
253
|
-
const next = !isSpeechActive;
|
|
254
|
-
setIsSpeechActive(next);
|
|
255
|
-
targetEditor.dispatchCommand(SPEECH_TO_TEXT_COMMAND, next);
|
|
256
|
-
};
|
|
257
|
-
const handleInsertLink = () => {
|
|
258
|
-
if (!toolbarState.isLink) {
|
|
259
|
-
setIsLinkEditMode(true);
|
|
260
|
-
targetEditor.dispatchCommand(TOGGLE_LINK_COMMAND, sanitizeUrl("https://"));
|
|
261
|
-
} else {
|
|
262
|
-
setIsLinkEditMode(false);
|
|
263
|
-
targetEditor.dispatchCommand(TOGGLE_LINK_COMMAND, null);
|
|
264
|
-
}
|
|
265
|
-
};
|
|
266
|
-
const INSERT_BLOCKS = useMemo(
|
|
267
|
-
() => [
|
|
268
|
-
{
|
|
269
|
-
id: "image",
|
|
270
|
-
category: "media",
|
|
271
|
-
label: "Image",
|
|
272
|
-
desc: "Upload photo or web URL",
|
|
273
|
-
icon: Image,
|
|
274
|
-
color: "text-blue-500 bg-blue-500/10 dark:bg-blue-500/20",
|
|
275
|
-
action: () => {
|
|
276
|
-
showModal(
|
|
277
|
-
"Insert Image",
|
|
278
|
-
"Upload an image from your device or paste a URL.",
|
|
279
|
-
(onClose) => /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Skeleton, { className: "w-full h-48 rounded-xl" }), children: /* @__PURE__ */ jsx(InsertImageDialog, { activeEditor: targetEditor, onClose }) }),
|
|
280
|
-
true
|
|
281
|
-
);
|
|
282
|
-
}
|
|
283
|
-
},
|
|
284
|
-
{
|
|
285
|
-
id: "audio",
|
|
286
|
-
category: "media",
|
|
287
|
-
label: "Audio Track",
|
|
288
|
-
desc: "Interactive player with speed controls",
|
|
289
|
-
icon: FileAudio,
|
|
290
|
-
color: "text-emerald-500 bg-emerald-500/10 dark:bg-emerald-500/20",
|
|
291
|
-
action: () => {
|
|
292
|
-
showModal(
|
|
293
|
-
"Insert Audio Player",
|
|
294
|
-
"Attach an audio clip, voice memo, or music track.",
|
|
295
|
-
(onClose) => /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Skeleton, { className: "w-full h-48 rounded-xl" }), children: /* @__PURE__ */ jsx(InsertAudioDialog, { activeEditor: targetEditor, onClose }) }),
|
|
296
|
-
true
|
|
297
|
-
);
|
|
298
|
-
}
|
|
299
|
-
},
|
|
300
|
-
{
|
|
301
|
-
id: "file",
|
|
302
|
-
category: "media",
|
|
303
|
-
label: "Document File",
|
|
304
|
-
desc: "PDF, Word, Excel, ZIP or code file",
|
|
305
|
-
icon: FileText,
|
|
306
|
-
color: "text-amber-500 bg-amber-500/10 dark:bg-amber-500/20",
|
|
307
|
-
action: () => {
|
|
308
|
-
showModal(
|
|
309
|
-
"Attach Document",
|
|
310
|
-
"Upload a document or document archive to download.",
|
|
311
|
-
(onClose) => /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Skeleton, { className: "w-full h-48 rounded-xl" }), children: /* @__PURE__ */ jsx(InsertFileDialog, { activeEditor: targetEditor, onClose }) }),
|
|
312
|
-
true
|
|
313
|
-
);
|
|
314
|
-
}
|
|
315
|
-
},
|
|
316
|
-
{
|
|
317
|
-
id: "youtube",
|
|
318
|
-
category: "media",
|
|
319
|
-
label: "YouTube Video",
|
|
320
|
-
desc: "Embed streaming video player",
|
|
321
|
-
icon: Youtube,
|
|
322
|
-
color: "text-red-500 bg-red-500/10 dark:bg-red-500/20",
|
|
323
|
-
action: () => {
|
|
324
|
-
showModal(
|
|
325
|
-
"Embed YouTube Video",
|
|
326
|
-
"Paste a YouTube video URL to embed it in the page.",
|
|
327
|
-
(onClose) => /* @__PURE__ */ jsx(AutoEmbedDialog, { embedConfig: YoutubeEmbedConfig, onClose }),
|
|
328
|
-
true
|
|
329
|
-
);
|
|
330
|
-
}
|
|
331
|
-
},
|
|
332
|
-
{
|
|
333
|
-
id: "table",
|
|
334
|
-
category: "blocks",
|
|
335
|
-
label: "Data Table",
|
|
336
|
-
desc: "Configurable rows and columns",
|
|
337
|
-
icon: Table,
|
|
338
|
-
color: "text-purple-500 bg-purple-500/10 dark:bg-purple-500/20",
|
|
339
|
-
action: () => {
|
|
340
|
-
showModal(
|
|
341
|
-
"Insert Table",
|
|
342
|
-
"Choose rows and columns for your data table.",
|
|
343
|
-
(onClose) => /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Skeleton, { className: "w-full h-32 rounded-xl" }), children: /* @__PURE__ */ jsx(InsertTableBody, { activeEditor: targetEditor, onClose }) }),
|
|
344
|
-
true
|
|
345
|
-
);
|
|
346
|
-
}
|
|
347
|
-
},
|
|
348
|
-
{
|
|
349
|
-
id: "poll",
|
|
350
|
-
category: "blocks",
|
|
351
|
-
label: "Voting Poll",
|
|
352
|
-
desc: "Interactive multi-choice question",
|
|
353
|
-
icon: SquarePenIcon,
|
|
354
|
-
color: "text-rose-500 bg-rose-500/10 dark:bg-rose-500/20",
|
|
355
|
-
action: () => {
|
|
356
|
-
showModal(
|
|
357
|
-
"Create Poll",
|
|
358
|
-
"Add a voting poll with customizable choices.",
|
|
359
|
-
(onClose) => /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Skeleton, { className: "w-full h-32 rounded-xl" }), children: /* @__PURE__ */ jsx(InsertPoll, { activeEditor: targetEditor, onClose }) }),
|
|
360
|
-
true
|
|
361
|
-
);
|
|
362
|
-
}
|
|
363
|
-
},
|
|
364
|
-
{
|
|
365
|
-
id: "excalidraw",
|
|
366
|
-
category: "blocks",
|
|
367
|
-
label: "Sketch Canvas",
|
|
368
|
-
desc: "Hand-drawn diagram and whiteboard",
|
|
369
|
-
icon: DraftingCompassIcon,
|
|
370
|
-
color: "text-orange-500 bg-orange-500/10 dark:bg-orange-500/20",
|
|
371
|
-
action: () => {
|
|
372
|
-
targetEditor.dispatchCommand(INSERT_EXCALIDRAW_COMMAND, void 0);
|
|
373
|
-
}
|
|
374
|
-
},
|
|
375
|
-
{
|
|
376
|
-
id: "hint",
|
|
377
|
-
category: "blocks",
|
|
378
|
-
label: "Callout Card",
|
|
379
|
-
desc: "Colored highlight note or tip",
|
|
380
|
-
icon: AlertCircle,
|
|
381
|
-
color: "text-indigo-500 bg-indigo-500/10 dark:bg-indigo-500/20",
|
|
382
|
-
action: () => {
|
|
383
|
-
targetEditor.dispatchCommand(INSERT_HINT_COMMAND, "info");
|
|
384
|
-
}
|
|
385
|
-
},
|
|
386
|
-
{
|
|
387
|
-
id: "columns",
|
|
388
|
-
category: "blocks",
|
|
389
|
-
label: "2 Columns",
|
|
390
|
-
desc: "Side-by-side content container",
|
|
391
|
-
icon: Columns2,
|
|
392
|
-
color: "text-teal-500 bg-teal-500/10 dark:bg-teal-500/20",
|
|
393
|
-
action: () => {
|
|
394
|
-
targetEditor.dispatchCommand(INSERT_LAYOUT_COMMAND, "1fr 1fr");
|
|
395
|
-
}
|
|
396
|
-
},
|
|
397
|
-
{
|
|
398
|
-
id: "hr",
|
|
399
|
-
category: "blocks",
|
|
400
|
-
label: "Divider",
|
|
401
|
-
desc: "Clean horizontal separator line",
|
|
402
|
-
icon: FlipHorizontal2,
|
|
403
|
-
color: "text-slate-500 bg-slate-500/10 dark:bg-slate-500/20",
|
|
404
|
-
action: () => {
|
|
405
|
-
targetEditor.dispatchCommand(INSERT_HORIZONTAL_RULE_COMMAND, void 0);
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
],
|
|
409
|
-
[targetEditor, showModal]
|
|
410
|
-
);
|
|
411
|
-
const filteredBlocks = useMemo(() => {
|
|
412
|
-
if (insertCategory === "all") return INSERT_BLOCKS;
|
|
413
|
-
return INSERT_BLOCKS.filter((b) => b.category === insertCategory);
|
|
414
|
-
}, [INSERT_BLOCKS, insertCategory]);
|
|
415
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
416
|
-
modal,
|
|
417
|
-
!shouldShow && /* @__PURE__ */ jsx("div", { className: "fixed bottom-5 right-4 z-40 md:hidden animate-in fade-in zoom-in-95 duration-200", children: /* @__PURE__ */ jsxs(
|
|
418
|
-
"button",
|
|
419
|
-
{
|
|
420
|
-
type: "button",
|
|
421
|
-
onClick: handleOpenDock,
|
|
422
|
-
className: "flex items-center gap-2 px-4 py-2.5 rounded-full bg-primary text-primary-foreground shadow-2xl shadow-primary/40 text-xs font-semibold active:scale-95 transition-all touch-manipulation border border-primary/20 backdrop-blur-md cursor-pointer",
|
|
423
|
-
"aria-label": "Open formatting dock",
|
|
424
|
-
children: [
|
|
425
|
-
/* @__PURE__ */ jsx(Sparkles, { className: "w-3.5 h-3.5 text-amber-300 animate-pulse" }),
|
|
426
|
-
/* @__PURE__ */ jsx("span", { children: "Format & Insert" })
|
|
427
|
-
]
|
|
428
|
-
}
|
|
429
|
-
) }),
|
|
430
|
-
/* @__PURE__ */ jsx(
|
|
431
|
-
"div",
|
|
432
|
-
{
|
|
433
|
-
className: cn(
|
|
434
|
-
"fixed left-0 right-0 w-full z-50 md:hidden transition-transform duration-300 ease-out",
|
|
435
|
-
shouldShow ? "translate-y-0" : "translate-y-[120%] pointer-events-none"
|
|
436
|
-
),
|
|
437
|
-
style: {
|
|
438
|
-
bottom: `${bottomOffset}px`
|
|
439
|
-
},
|
|
440
|
-
children: /* @__PURE__ */ jsxs(
|
|
441
|
-
"div",
|
|
442
|
-
{
|
|
443
|
-
className: cn(
|
|
444
|
-
"w-full bg-background/95 dark:bg-zinc-950/95 backdrop-blur-2xl border-t border-border/80 shadow-2xl pointer-events-auto rounded-t-2xl",
|
|
445
|
-
"pb-[max(0.5rem,env(safe-area-inset-bottom))]",
|
|
446
|
-
toolbarConfig == null ? void 0 : toolbarConfig.mobileClassName
|
|
447
|
-
),
|
|
448
|
-
onMouseDown: (e) => {
|
|
449
|
-
if (e.target instanceof Element && e.target.tagName !== "INPUT") {
|
|
450
|
-
e.preventDefault();
|
|
451
|
-
}
|
|
452
|
-
},
|
|
453
|
-
children: [
|
|
454
|
-
/* @__PURE__ */ jsx("div", { className: "flex justify-center pt-2 pb-1", children: /* @__PURE__ */ jsx("div", { className: "w-10 h-1 rounded-full bg-muted-foreground/25" }) }),
|
|
455
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-3 pb-1.5 border-b border-border/50 text-xs", children: [
|
|
456
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 bg-muted/50 p-0.5 rounded-xl border border-border/40", children: [
|
|
457
|
-
/* @__PURE__ */ jsxs(
|
|
458
|
-
"button",
|
|
459
|
-
{
|
|
460
|
-
type: "button",
|
|
461
|
-
onClick: () => setActiveTab("format"),
|
|
462
|
-
className: cn(
|
|
463
|
-
"flex items-center gap-1 px-2.5 py-1 rounded-lg font-medium transition-all text-xs touch-manipulation",
|
|
464
|
-
activeTab === "format" ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"
|
|
465
|
-
),
|
|
466
|
-
children: [
|
|
467
|
-
/* @__PURE__ */ jsx(Type, { className: "w-3.5 h-3.5" }),
|
|
468
|
-
/* @__PURE__ */ jsx("span", { children: "Format" })
|
|
469
|
-
]
|
|
470
|
-
}
|
|
471
|
-
),
|
|
472
|
-
/* @__PURE__ */ jsxs(
|
|
473
|
-
"button",
|
|
474
|
-
{
|
|
475
|
-
type: "button",
|
|
476
|
-
onClick: () => setActiveTab("insert"),
|
|
477
|
-
className: cn(
|
|
478
|
-
"flex items-center gap-1 px-2.5 py-1 rounded-lg font-medium transition-all text-xs touch-manipulation",
|
|
479
|
-
activeTab === "insert" ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"
|
|
480
|
-
),
|
|
481
|
-
children: [
|
|
482
|
-
/* @__PURE__ */ jsx(Plus, { className: "w-3.5 h-3.5" }),
|
|
483
|
-
/* @__PURE__ */ jsx("span", { children: "Insert" })
|
|
484
|
-
]
|
|
485
|
-
}
|
|
486
|
-
),
|
|
487
|
-
/* @__PURE__ */ jsxs(
|
|
488
|
-
"button",
|
|
489
|
-
{
|
|
490
|
-
type: "button",
|
|
491
|
-
onClick: () => setActiveTab("style"),
|
|
492
|
-
className: cn(
|
|
493
|
-
"flex items-center gap-1 px-2.5 py-1 rounded-lg font-medium transition-all text-xs touch-manipulation",
|
|
494
|
-
activeTab === "style" ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"
|
|
495
|
-
),
|
|
496
|
-
children: [
|
|
497
|
-
/* @__PURE__ */ jsx(Palette, { className: "w-3.5 h-3.5" }),
|
|
498
|
-
/* @__PURE__ */ jsx("span", { children: "Style" })
|
|
499
|
-
]
|
|
500
|
-
}
|
|
501
|
-
)
|
|
502
|
-
] }),
|
|
503
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
504
|
-
SUPPORT_SPEECH_RECOGNITION && /* @__PURE__ */ jsxs(
|
|
505
|
-
"button",
|
|
506
|
-
{
|
|
507
|
-
type: "button",
|
|
508
|
-
onClick: toggleSpeech,
|
|
509
|
-
className: cn(
|
|
510
|
-
"flex items-center gap-1 px-2 py-1 rounded-lg text-[11px] font-medium transition-all touch-manipulation",
|
|
511
|
-
isSpeechActive ? "bg-rose-500 text-white animate-pulse" : "text-muted-foreground hover:bg-muted"
|
|
512
|
-
),
|
|
513
|
-
title: "Speech to Text",
|
|
514
|
-
"aria-label": "Toggle voice typing",
|
|
515
|
-
children: [
|
|
516
|
-
/* @__PURE__ */ jsx(Mic, { className: "w-3.5 h-3.5" }),
|
|
517
|
-
/* @__PURE__ */ jsx("span", { className: "hidden sm:inline", children: isSpeechActive ? "Listening..." : "Dictate" })
|
|
518
|
-
]
|
|
519
|
-
}
|
|
520
|
-
),
|
|
521
|
-
/* @__PURE__ */ jsx(
|
|
522
|
-
"button",
|
|
523
|
-
{
|
|
524
|
-
type: "button",
|
|
525
|
-
onClick: handleCloseDock,
|
|
526
|
-
className: "p-1.5 rounded-lg text-muted-foreground hover:bg-muted active:scale-95 transition-colors touch-manipulation cursor-pointer",
|
|
527
|
-
"aria-label": "Dismiss mobile toolbar",
|
|
528
|
-
children: /* @__PURE__ */ jsx(ChevronDown, { className: "w-4 h-4" })
|
|
529
|
-
}
|
|
530
|
-
)
|
|
531
|
-
] })
|
|
532
|
-
] }),
|
|
533
|
-
activeTab === "format" && /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
|
|
534
|
-
/* @__PURE__ */ jsx(
|
|
535
|
-
"div",
|
|
536
|
-
{
|
|
537
|
-
className: cn(
|
|
538
|
-
"pointer-events-none absolute left-0 top-0 bottom-0 w-5 bg-gradient-to-r from-background to-transparent z-10 transition-opacity duration-200",
|
|
539
|
-
canScrollLeft ? "opacity-100" : "opacity-0"
|
|
540
|
-
)
|
|
541
|
-
}
|
|
542
|
-
),
|
|
543
|
-
/* @__PURE__ */ jsx(
|
|
544
|
-
"div",
|
|
545
|
-
{
|
|
546
|
-
className: cn(
|
|
547
|
-
"pointer-events-none absolute right-0 top-0 bottom-0 w-5 bg-gradient-to-l from-background to-transparent z-10 transition-opacity duration-200",
|
|
548
|
-
canScrollRight ? "opacity-100" : "opacity-0"
|
|
549
|
-
)
|
|
550
|
-
}
|
|
551
|
-
),
|
|
552
|
-
/* @__PURE__ */ jsxs(
|
|
553
|
-
"div",
|
|
554
|
-
{
|
|
555
|
-
ref: scrollContainerRef,
|
|
556
|
-
onScroll: checkScrollAffordance,
|
|
557
|
-
className: "flex items-center gap-1.5 px-3 py-2 overflow-x-auto no-scrollbar scroll-smooth w-full",
|
|
558
|
-
children: [
|
|
559
|
-
/* @__PURE__ */ jsx(
|
|
560
|
-
"button",
|
|
561
|
-
{
|
|
562
|
-
type: "button",
|
|
563
|
-
disabled: !toolbarState.canUndo,
|
|
564
|
-
onClick: (e) => {
|
|
565
|
-
e.preventDefault();
|
|
566
|
-
targetEditor.dispatchCommand(UNDO_COMMAND, void 0);
|
|
567
|
-
},
|
|
568
|
-
className: cn(
|
|
569
|
-
"flex items-center justify-center min-w-[36px] h-9 rounded-xl transition-all touch-manipulation",
|
|
570
|
-
toolbarState.canUndo ? "text-foreground hover:bg-muted active:scale-95" : "text-muted-foreground/30 cursor-not-allowed"
|
|
571
|
-
),
|
|
572
|
-
"aria-label": "Undo",
|
|
573
|
-
children: /* @__PURE__ */ jsx(Undo2, { className: "w-4 h-4" })
|
|
574
|
-
}
|
|
575
|
-
),
|
|
576
|
-
/* @__PURE__ */ jsx(
|
|
577
|
-
"button",
|
|
578
|
-
{
|
|
579
|
-
type: "button",
|
|
580
|
-
disabled: !toolbarState.canRedo,
|
|
581
|
-
onClick: (e) => {
|
|
582
|
-
e.preventDefault();
|
|
583
|
-
targetEditor.dispatchCommand(REDO_COMMAND, void 0);
|
|
584
|
-
},
|
|
585
|
-
className: cn(
|
|
586
|
-
"flex items-center justify-center min-w-[36px] h-9 rounded-xl transition-all touch-manipulation",
|
|
587
|
-
toolbarState.canRedo ? "text-foreground hover:bg-muted active:scale-95" : "text-muted-foreground/30 cursor-not-allowed"
|
|
588
|
-
),
|
|
589
|
-
"aria-label": "Redo",
|
|
590
|
-
children: /* @__PURE__ */ jsx(Redo2, { className: "w-4 h-4" })
|
|
591
|
-
}
|
|
592
|
-
),
|
|
593
|
-
/* @__PURE__ */ jsx("div", { className: "w-px h-5 bg-border/60 mx-0.5 flex-shrink-0" }),
|
|
594
|
-
/* @__PURE__ */ jsx(
|
|
595
|
-
"button",
|
|
596
|
-
{
|
|
597
|
-
type: "button",
|
|
598
|
-
onClick: (e) => {
|
|
599
|
-
e.preventDefault();
|
|
600
|
-
targetEditor.dispatchCommand(FORMAT_TEXT_COMMAND, "bold");
|
|
601
|
-
},
|
|
602
|
-
className: cn(
|
|
603
|
-
"flex items-center justify-center min-w-[36px] h-9 rounded-xl transition-all active:scale-95 touch-manipulation",
|
|
604
|
-
toolbarState.isBold ? "bg-primary text-primary-foreground font-bold shadow-md shadow-primary/20" : "text-muted-foreground hover:bg-muted"
|
|
605
|
-
),
|
|
606
|
-
"aria-label": "Bold",
|
|
607
|
-
children: /* @__PURE__ */ jsx(Bold, { className: "w-4 h-4 stroke-[2.5]" })
|
|
608
|
-
}
|
|
609
|
-
),
|
|
610
|
-
/* @__PURE__ */ jsx(
|
|
611
|
-
"button",
|
|
612
|
-
{
|
|
613
|
-
type: "button",
|
|
614
|
-
onClick: (e) => {
|
|
615
|
-
e.preventDefault();
|
|
616
|
-
targetEditor.dispatchCommand(FORMAT_TEXT_COMMAND, "italic");
|
|
617
|
-
},
|
|
618
|
-
className: cn(
|
|
619
|
-
"flex items-center justify-center min-w-[36px] h-9 rounded-xl transition-all active:scale-95 touch-manipulation",
|
|
620
|
-
toolbarState.isItalic ? "bg-primary text-primary-foreground shadow-md shadow-primary/20" : "text-muted-foreground hover:bg-muted"
|
|
621
|
-
),
|
|
622
|
-
"aria-label": "Italic",
|
|
623
|
-
children: /* @__PURE__ */ jsx(Italic, { className: "w-4 h-4 stroke-[2.5]" })
|
|
624
|
-
}
|
|
625
|
-
),
|
|
626
|
-
/* @__PURE__ */ jsx(
|
|
627
|
-
"button",
|
|
628
|
-
{
|
|
629
|
-
type: "button",
|
|
630
|
-
onClick: (e) => {
|
|
631
|
-
e.preventDefault();
|
|
632
|
-
targetEditor.dispatchCommand(FORMAT_TEXT_COMMAND, "underline");
|
|
633
|
-
},
|
|
634
|
-
className: cn(
|
|
635
|
-
"flex items-center justify-center min-w-[36px] h-9 rounded-xl transition-all active:scale-95 touch-manipulation",
|
|
636
|
-
toolbarState.isUnderline ? "bg-primary text-primary-foreground shadow-md shadow-primary/20" : "text-muted-foreground hover:bg-muted"
|
|
637
|
-
),
|
|
638
|
-
"aria-label": "Underline",
|
|
639
|
-
children: /* @__PURE__ */ jsx(Underline, { className: "w-4 h-4 stroke-[2.5]" })
|
|
640
|
-
}
|
|
641
|
-
),
|
|
642
|
-
/* @__PURE__ */ jsx(
|
|
643
|
-
"button",
|
|
644
|
-
{
|
|
645
|
-
type: "button",
|
|
646
|
-
onClick: (e) => {
|
|
647
|
-
e.preventDefault();
|
|
648
|
-
targetEditor.dispatchCommand(FORMAT_TEXT_COMMAND, "strikethrough");
|
|
649
|
-
},
|
|
650
|
-
className: cn(
|
|
651
|
-
"flex items-center justify-center min-w-[36px] h-9 rounded-xl transition-all active:scale-95 touch-manipulation",
|
|
652
|
-
toolbarState.isStrikethrough ? "bg-primary text-primary-foreground shadow-md shadow-primary/20" : "text-muted-foreground hover:bg-muted"
|
|
653
|
-
),
|
|
654
|
-
"aria-label": "Strikethrough",
|
|
655
|
-
children: /* @__PURE__ */ jsx(Strikethrough, { className: "w-4 h-4 stroke-[2.5]" })
|
|
656
|
-
}
|
|
657
|
-
),
|
|
658
|
-
/* @__PURE__ */ jsx(
|
|
659
|
-
"button",
|
|
660
|
-
{
|
|
661
|
-
type: "button",
|
|
662
|
-
onClick: (e) => {
|
|
663
|
-
e.preventDefault();
|
|
664
|
-
targetEditor.dispatchCommand(FORMAT_TEXT_COMMAND, "code");
|
|
665
|
-
},
|
|
666
|
-
className: cn(
|
|
667
|
-
"flex items-center justify-center min-w-[36px] h-9 rounded-xl transition-all active:scale-95 touch-manipulation font-mono",
|
|
668
|
-
toolbarState.isCode ? "bg-primary text-primary-foreground shadow-md shadow-primary/20" : "text-muted-foreground hover:bg-muted"
|
|
669
|
-
),
|
|
670
|
-
"aria-label": "Inline Code",
|
|
671
|
-
children: /* @__PURE__ */ jsx(Code, { className: "w-4 h-4 stroke-[2.5]" })
|
|
672
|
-
}
|
|
673
|
-
),
|
|
674
|
-
/* @__PURE__ */ jsx(
|
|
675
|
-
"button",
|
|
676
|
-
{
|
|
677
|
-
type: "button",
|
|
678
|
-
onClick: (e) => {
|
|
679
|
-
e.preventDefault();
|
|
680
|
-
handleInsertLink();
|
|
681
|
-
},
|
|
682
|
-
className: cn(
|
|
683
|
-
"flex items-center justify-center min-w-[36px] h-9 rounded-xl transition-all active:scale-95 touch-manipulation",
|
|
684
|
-
toolbarState.isLink ? "bg-primary text-primary-foreground shadow-md shadow-primary/20" : "text-muted-foreground hover:bg-muted"
|
|
685
|
-
),
|
|
686
|
-
"aria-label": "Link",
|
|
687
|
-
children: /* @__PURE__ */ jsx(LinkIcon, { className: "w-4 h-4 stroke-[2.5]" })
|
|
688
|
-
}
|
|
689
|
-
),
|
|
690
|
-
/* @__PURE__ */ jsx("div", { className: "w-px h-5 bg-border/60 mx-0.5 flex-shrink-0" }),
|
|
691
|
-
/* @__PURE__ */ jsx(
|
|
692
|
-
"button",
|
|
693
|
-
{
|
|
694
|
-
type: "button",
|
|
695
|
-
onClick: (e) => {
|
|
696
|
-
e.preventDefault();
|
|
697
|
-
formatHeading("h1");
|
|
698
|
-
},
|
|
699
|
-
className: cn(
|
|
700
|
-
"flex items-center justify-center min-w-[36px] h-9 rounded-xl transition-all active:scale-95 touch-manipulation",
|
|
701
|
-
toolbarState.blockType === "h1" ? "bg-primary text-primary-foreground shadow-md shadow-primary/20 font-bold" : "text-muted-foreground hover:bg-muted"
|
|
702
|
-
),
|
|
703
|
-
"aria-label": "Heading 1",
|
|
704
|
-
children: /* @__PURE__ */ jsx(Heading1, { className: "w-4 h-4 stroke-[2.5]" })
|
|
705
|
-
}
|
|
706
|
-
),
|
|
707
|
-
/* @__PURE__ */ jsx(
|
|
708
|
-
"button",
|
|
709
|
-
{
|
|
710
|
-
type: "button",
|
|
711
|
-
onClick: (e) => {
|
|
712
|
-
e.preventDefault();
|
|
713
|
-
formatHeading("h2");
|
|
714
|
-
},
|
|
715
|
-
className: cn(
|
|
716
|
-
"flex items-center justify-center min-w-[36px] h-9 rounded-xl transition-all active:scale-95 touch-manipulation",
|
|
717
|
-
toolbarState.blockType === "h2" ? "bg-primary text-primary-foreground shadow-md shadow-primary/20 font-bold" : "text-muted-foreground hover:bg-muted"
|
|
718
|
-
),
|
|
719
|
-
"aria-label": "Heading 2",
|
|
720
|
-
children: /* @__PURE__ */ jsx(Heading2, { className: "w-4 h-4 stroke-[2.5]" })
|
|
721
|
-
}
|
|
722
|
-
),
|
|
723
|
-
/* @__PURE__ */ jsx(
|
|
724
|
-
"button",
|
|
725
|
-
{
|
|
726
|
-
type: "button",
|
|
727
|
-
onClick: (e) => {
|
|
728
|
-
e.preventDefault();
|
|
729
|
-
formatHeading("h3");
|
|
730
|
-
},
|
|
731
|
-
className: cn(
|
|
732
|
-
"flex items-center justify-center min-w-[36px] h-9 rounded-xl transition-all active:scale-95 touch-manipulation",
|
|
733
|
-
toolbarState.blockType === "h3" ? "bg-primary text-primary-foreground shadow-md shadow-primary/20 font-bold" : "text-muted-foreground hover:bg-muted"
|
|
734
|
-
),
|
|
735
|
-
"aria-label": "Heading 3",
|
|
736
|
-
children: /* @__PURE__ */ jsx(Heading3, { className: "w-4 h-4 stroke-[2.5]" })
|
|
737
|
-
}
|
|
738
|
-
),
|
|
739
|
-
/* @__PURE__ */ jsx("div", { className: "w-px h-5 bg-border/60 mx-0.5 flex-shrink-0" }),
|
|
740
|
-
/* @__PURE__ */ jsx(
|
|
741
|
-
"button",
|
|
742
|
-
{
|
|
743
|
-
type: "button",
|
|
744
|
-
onClick: (e) => {
|
|
745
|
-
e.preventDefault();
|
|
746
|
-
targetEditor.dispatchCommand(INSERT_UNORDERED_LIST_COMMAND, void 0);
|
|
747
|
-
},
|
|
748
|
-
className: cn(
|
|
749
|
-
"flex items-center justify-center min-w-[36px] h-9 rounded-xl transition-all active:scale-95 touch-manipulation",
|
|
750
|
-
toolbarState.blockType === "bullet" ? "bg-primary text-primary-foreground shadow-md shadow-primary/20" : "text-muted-foreground hover:bg-muted"
|
|
751
|
-
),
|
|
752
|
-
"aria-label": "Bullet list",
|
|
753
|
-
children: /* @__PURE__ */ jsx(List, { className: "w-4 h-4 stroke-[2.5]" })
|
|
754
|
-
}
|
|
755
|
-
),
|
|
756
|
-
/* @__PURE__ */ jsx(
|
|
757
|
-
"button",
|
|
758
|
-
{
|
|
759
|
-
type: "button",
|
|
760
|
-
onClick: (e) => {
|
|
761
|
-
e.preventDefault();
|
|
762
|
-
targetEditor.dispatchCommand(INSERT_ORDERED_LIST_COMMAND, void 0);
|
|
763
|
-
},
|
|
764
|
-
className: cn(
|
|
765
|
-
"flex items-center justify-center min-w-[36px] h-9 rounded-xl transition-all active:scale-95 touch-manipulation",
|
|
766
|
-
toolbarState.blockType === "number" ? "bg-primary text-primary-foreground shadow-md shadow-primary/20" : "text-muted-foreground hover:bg-muted"
|
|
767
|
-
),
|
|
768
|
-
"aria-label": "Numbered list",
|
|
769
|
-
children: /* @__PURE__ */ jsx(ListOrdered, { className: "w-4 h-4 stroke-[2.5]" })
|
|
770
|
-
}
|
|
771
|
-
),
|
|
772
|
-
/* @__PURE__ */ jsx(
|
|
773
|
-
"button",
|
|
774
|
-
{
|
|
775
|
-
type: "button",
|
|
776
|
-
onClick: (e) => {
|
|
777
|
-
e.preventDefault();
|
|
778
|
-
targetEditor.dispatchCommand(INSERT_CHECK_LIST_COMMAND, void 0);
|
|
779
|
-
},
|
|
780
|
-
className: cn(
|
|
781
|
-
"flex items-center justify-center min-w-[36px] h-9 rounded-xl transition-all active:scale-95 touch-manipulation",
|
|
782
|
-
toolbarState.blockType === "check" ? "bg-primary text-primary-foreground shadow-md shadow-primary/20" : "text-muted-foreground hover:bg-muted"
|
|
783
|
-
),
|
|
784
|
-
"aria-label": "Checklist",
|
|
785
|
-
children: /* @__PURE__ */ jsx(CheckSquare, { className: "w-4 h-4 stroke-[2.5]" })
|
|
786
|
-
}
|
|
787
|
-
),
|
|
788
|
-
/* @__PURE__ */ jsx(
|
|
789
|
-
"button",
|
|
790
|
-
{
|
|
791
|
-
type: "button",
|
|
792
|
-
onClick: (e) => {
|
|
793
|
-
e.preventDefault();
|
|
794
|
-
formatQuote();
|
|
795
|
-
},
|
|
796
|
-
className: cn(
|
|
797
|
-
"flex items-center justify-center min-w-[36px] h-9 rounded-xl transition-all active:scale-95 touch-manipulation",
|
|
798
|
-
toolbarState.blockType === "quote" ? "bg-primary text-primary-foreground shadow-md shadow-primary/20" : "text-muted-foreground hover:bg-muted"
|
|
799
|
-
),
|
|
800
|
-
"aria-label": "Quote",
|
|
801
|
-
children: /* @__PURE__ */ jsx(Quote, { className: "w-4 h-4 stroke-[2.5]" })
|
|
802
|
-
}
|
|
803
|
-
),
|
|
804
|
-
/* @__PURE__ */ jsx("div", { className: "w-px h-5 bg-border/60 mx-0.5 flex-shrink-0" }),
|
|
805
|
-
/* @__PURE__ */ jsx(
|
|
806
|
-
"button",
|
|
807
|
-
{
|
|
808
|
-
type: "button",
|
|
809
|
-
onClick: (e) => {
|
|
810
|
-
e.preventDefault();
|
|
811
|
-
targetEditor.dispatchCommand(FORMAT_ELEMENT_COMMAND, "left");
|
|
812
|
-
},
|
|
813
|
-
className: cn(
|
|
814
|
-
"flex items-center justify-center min-w-[36px] h-9 rounded-xl transition-all active:scale-95 touch-manipulation",
|
|
815
|
-
toolbarState.elementFormat === "left" ? "bg-primary text-primary-foreground shadow-md shadow-primary/20" : "text-muted-foreground hover:bg-muted"
|
|
816
|
-
),
|
|
817
|
-
"aria-label": "Align left",
|
|
818
|
-
children: /* @__PURE__ */ jsx(AlignLeft, { className: "w-4 h-4 stroke-[2.5]" })
|
|
819
|
-
}
|
|
820
|
-
),
|
|
821
|
-
/* @__PURE__ */ jsx(
|
|
822
|
-
"button",
|
|
823
|
-
{
|
|
824
|
-
type: "button",
|
|
825
|
-
onClick: (e) => {
|
|
826
|
-
e.preventDefault();
|
|
827
|
-
targetEditor.dispatchCommand(FORMAT_ELEMENT_COMMAND, "center");
|
|
828
|
-
},
|
|
829
|
-
className: cn(
|
|
830
|
-
"flex items-center justify-center min-w-[36px] h-9 rounded-xl transition-all active:scale-95 touch-manipulation",
|
|
831
|
-
toolbarState.elementFormat === "center" ? "bg-primary text-primary-foreground shadow-md shadow-primary/20" : "text-muted-foreground hover:bg-muted"
|
|
832
|
-
),
|
|
833
|
-
"aria-label": "Align center",
|
|
834
|
-
children: /* @__PURE__ */ jsx(AlignCenter, { className: "w-4 h-4 stroke-[2.5]" })
|
|
835
|
-
}
|
|
836
|
-
),
|
|
837
|
-
/* @__PURE__ */ jsx(
|
|
838
|
-
"button",
|
|
839
|
-
{
|
|
840
|
-
type: "button",
|
|
841
|
-
onClick: (e) => {
|
|
842
|
-
e.preventDefault();
|
|
843
|
-
targetEditor.dispatchCommand(FORMAT_ELEMENT_COMMAND, "right");
|
|
844
|
-
},
|
|
845
|
-
className: cn(
|
|
846
|
-
"flex items-center justify-center min-w-[36px] h-9 rounded-xl transition-all active:scale-95 touch-manipulation",
|
|
847
|
-
toolbarState.elementFormat === "right" ? "bg-primary text-primary-foreground shadow-md shadow-primary/20" : "text-muted-foreground hover:bg-muted"
|
|
848
|
-
),
|
|
849
|
-
"aria-label": "Align right",
|
|
850
|
-
children: /* @__PURE__ */ jsx(AlignRight, { className: "w-4 h-4 stroke-[2.5]" })
|
|
851
|
-
}
|
|
852
|
-
),
|
|
853
|
-
/* @__PURE__ */ jsx("div", { className: "w-px h-5 bg-border/60 mx-0.5 flex-shrink-0" }),
|
|
854
|
-
/* @__PURE__ */ jsx(
|
|
855
|
-
"button",
|
|
856
|
-
{
|
|
857
|
-
type: "button",
|
|
858
|
-
onClick: (e) => {
|
|
859
|
-
e.preventDefault();
|
|
860
|
-
targetEditor.dispatchCommand(INSERT_COMMENT_COMMAND, void 0);
|
|
861
|
-
},
|
|
862
|
-
className: "flex items-center justify-center min-w-[36px] h-9 rounded-xl text-muted-foreground hover:bg-muted active:scale-95 transition-all touch-manipulation",
|
|
863
|
-
"aria-label": "Add inline comment",
|
|
864
|
-
children: /* @__PURE__ */ jsx(MessageSquarePlus, { className: "w-4 h-4" })
|
|
865
|
-
}
|
|
866
|
-
),
|
|
867
|
-
/* @__PURE__ */ jsx(
|
|
868
|
-
"button",
|
|
869
|
-
{
|
|
870
|
-
type: "button",
|
|
871
|
-
onClick: (e) => {
|
|
872
|
-
e.preventDefault();
|
|
873
|
-
if (typeof window !== "undefined") {
|
|
874
|
-
window.dispatchEvent(
|
|
875
|
-
new CustomEvent("notiq:open-import-export", {
|
|
876
|
-
detail: { defaultTab: "export" }
|
|
877
|
-
})
|
|
878
|
-
);
|
|
879
|
-
}
|
|
880
|
-
},
|
|
881
|
-
className: "flex items-center justify-center min-w-[36px] h-9 rounded-xl text-muted-foreground hover:bg-muted active:scale-95 transition-all touch-manipulation",
|
|
882
|
-
"aria-label": "Import & Export document",
|
|
883
|
-
title: "Import / Export",
|
|
884
|
-
children: /* @__PURE__ */ jsx(ArrowDownUp, { className: "w-4 h-4" })
|
|
885
|
-
}
|
|
886
|
-
)
|
|
887
|
-
]
|
|
888
|
-
}
|
|
889
|
-
)
|
|
890
|
-
] }),
|
|
891
|
-
activeTab === "insert" && /* @__PURE__ */ jsxs("div", { className: "px-3 py-2 space-y-2.5", children: [
|
|
892
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-1.5 pb-1 overflow-x-auto no-scrollbar", children: ["all", "media", "blocks"].map((cat) => /* @__PURE__ */ jsx(
|
|
893
|
-
"button",
|
|
894
|
-
{
|
|
895
|
-
type: "button",
|
|
896
|
-
onClick: () => setInsertCategory(cat),
|
|
897
|
-
className: cn(
|
|
898
|
-
"px-3 py-1 rounded-full text-xs font-medium capitalize transition-all touch-manipulation",
|
|
899
|
-
insertCategory === cat ? "bg-primary text-primary-foreground shadow-sm" : "bg-muted/60 text-muted-foreground hover:bg-muted"
|
|
900
|
-
),
|
|
901
|
-
children: cat === "all" ? "All Blocks" : cat === "media" ? "Media & Files" : "Rich Blocks"
|
|
902
|
-
},
|
|
903
|
-
cat
|
|
904
|
-
)) }),
|
|
905
|
-
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-2 max-h-[42dvh] overflow-y-auto pr-0.5", children: filteredBlocks.map((block) => {
|
|
906
|
-
const Icon = block.icon;
|
|
907
|
-
return /* @__PURE__ */ jsxs(
|
|
908
|
-
"button",
|
|
909
|
-
{
|
|
910
|
-
type: "button",
|
|
911
|
-
onClick: (e) => {
|
|
912
|
-
e.preventDefault();
|
|
913
|
-
block.action();
|
|
914
|
-
},
|
|
915
|
-
className: "flex items-center gap-2.5 p-2.5 rounded-xl bg-card hover:bg-muted/70 active:scale-97 transition-all touch-manipulation border border-border/50 text-left shadow-sm",
|
|
916
|
-
children: [
|
|
917
|
-
/* @__PURE__ */ jsx("div", { className: cn("flex items-center justify-center w-9 h-9 rounded-xl flex-shrink-0", block.color), children: /* @__PURE__ */ jsx(Icon, { className: "w-4 h-4" }) }),
|
|
918
|
-
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
919
|
-
/* @__PURE__ */ jsx("div", { className: "text-xs font-semibold text-foreground truncate", children: block.label }),
|
|
920
|
-
/* @__PURE__ */ jsx("div", { className: "text-[10px] text-muted-foreground truncate leading-tight mt-0.5", children: block.desc })
|
|
921
|
-
] })
|
|
922
|
-
]
|
|
923
|
-
},
|
|
924
|
-
block.id
|
|
925
|
-
);
|
|
926
|
-
}) })
|
|
927
|
-
] }),
|
|
928
|
-
activeTab === "style" && /* @__PURE__ */ jsxs("div", { className: "px-3 py-2.5 space-y-3", children: [
|
|
929
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
930
|
-
/* @__PURE__ */ jsx("div", { className: "text-[11px] font-semibold text-muted-foreground uppercase tracking-wider mb-1.5", children: "Text Color" }),
|
|
931
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 overflow-x-auto no-scrollbar", children: TEXT_COLORS.map((tc) => /* @__PURE__ */ jsxs(
|
|
932
|
-
"button",
|
|
933
|
-
{
|
|
934
|
-
type: "button",
|
|
935
|
-
onClick: () => applyColor(tc.color),
|
|
936
|
-
className: "flex flex-col items-center gap-1 min-w-[44px] py-1 rounded-lg hover:bg-muted active:scale-95 transition-all touch-manipulation",
|
|
937
|
-
children: [
|
|
938
|
-
/* @__PURE__ */ jsx(
|
|
939
|
-
"span",
|
|
940
|
-
{
|
|
941
|
-
className: cn("w-6 h-6 rounded-full border border-border/60 shadow-sm flex items-center justify-center", tc.bg)
|
|
942
|
-
}
|
|
943
|
-
),
|
|
944
|
-
/* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground font-medium", children: tc.label })
|
|
945
|
-
]
|
|
946
|
-
},
|
|
947
|
-
tc.label
|
|
948
|
-
)) })
|
|
949
|
-
] }),
|
|
950
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
951
|
-
/* @__PURE__ */ jsx("div", { className: "text-[11px] font-semibold text-muted-foreground uppercase tracking-wider mb-1.5", children: "Highlight Background" }),
|
|
952
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 overflow-x-auto no-scrollbar", children: HIGHLIGHT_COLORS.map((hc) => /* @__PURE__ */ jsxs(
|
|
953
|
-
"button",
|
|
954
|
-
{
|
|
955
|
-
type: "button",
|
|
956
|
-
onClick: () => applyHighlight(hc.color),
|
|
957
|
-
className: "flex flex-col items-center gap-1 min-w-[44px] py-1 rounded-lg hover:bg-muted active:scale-95 transition-all touch-manipulation",
|
|
958
|
-
children: [
|
|
959
|
-
/* @__PURE__ */ jsx(
|
|
960
|
-
"span",
|
|
961
|
-
{
|
|
962
|
-
className: cn("w-6 h-6 rounded-lg border shadow-sm flex items-center justify-center", hc.bg || "bg-transparent", hc.border),
|
|
963
|
-
children: hc.color === "transparent" && /* @__PURE__ */ jsx(Eraser, { className: "w-3 h-3 text-muted-foreground" })
|
|
964
|
-
}
|
|
965
|
-
),
|
|
966
|
-
/* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground font-medium", children: hc.label })
|
|
967
|
-
]
|
|
968
|
-
},
|
|
969
|
-
hc.label
|
|
970
|
-
)) })
|
|
971
|
-
] })
|
|
972
|
-
] })
|
|
973
|
-
]
|
|
974
|
-
}
|
|
975
|
-
)
|
|
976
|
-
}
|
|
977
|
-
)
|
|
978
|
-
] });
|
|
979
|
-
}
|
|
980
|
-
export {
|
|
981
|
-
MobileToolbar as default
|
|
982
|
-
};
|