@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-D3IOUQFR.mjs
DELETED
|
@@ -1,441 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getSelectedNode
|
|
3
|
-
} from "./chunk-KXRLARGI.mjs";
|
|
4
|
-
import {
|
|
5
|
-
Input
|
|
6
|
-
} from "./chunk-5NRAXWYA.mjs";
|
|
7
|
-
import {
|
|
8
|
-
sanitizeUrl
|
|
9
|
-
} from "./chunk-RAVYEEIC.mjs";
|
|
10
|
-
import {
|
|
11
|
-
Button
|
|
12
|
-
} from "./chunk-OE5JRLCN.mjs";
|
|
13
|
-
import {
|
|
14
|
-
cn
|
|
15
|
-
} from "./chunk-JHXDLYEV.mjs";
|
|
16
|
-
import {
|
|
17
|
-
init_react_shim
|
|
18
|
-
} from "./chunk-WYCFGRFJ.mjs";
|
|
19
|
-
|
|
20
|
-
// src/components/editor/plugins/FloatingLinkEditorPlugin/index.tsx
|
|
21
|
-
init_react_shim();
|
|
22
|
-
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
23
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
24
|
-
import { createPortal } from "react-dom";
|
|
25
|
-
import {
|
|
26
|
-
$createLinkNode,
|
|
27
|
-
$isAutoLinkNode,
|
|
28
|
-
$isLinkNode,
|
|
29
|
-
TOGGLE_LINK_COMMAND
|
|
30
|
-
} from "@lexical/link";
|
|
31
|
-
import { $findMatchingParent, mergeRegister } from "@lexical/utils";
|
|
32
|
-
import {
|
|
33
|
-
$getSelection,
|
|
34
|
-
$isLineBreakNode,
|
|
35
|
-
$isRangeSelection,
|
|
36
|
-
CLICK_COMMAND,
|
|
37
|
-
COMMAND_PRIORITY_CRITICAL,
|
|
38
|
-
COMMAND_PRIORITY_HIGH,
|
|
39
|
-
COMMAND_PRIORITY_LOW,
|
|
40
|
-
getDOMSelection,
|
|
41
|
-
KEY_ESCAPE_COMMAND,
|
|
42
|
-
SELECTION_CHANGE_COMMAND
|
|
43
|
-
} from "lexical";
|
|
44
|
-
|
|
45
|
-
// src/components/editor/utils/setFloatingElemPositionForLinkEditor.ts
|
|
46
|
-
init_react_shim();
|
|
47
|
-
var VERTICAL_GAP = 10;
|
|
48
|
-
var HORIZONTAL_OFFSET = 5;
|
|
49
|
-
function setFloatingElemPositionForLinkEditor(targetRect, floatingElem, anchorElem, verticalGap = VERTICAL_GAP, horizontalOffset = HORIZONTAL_OFFSET) {
|
|
50
|
-
const scrollerElem = anchorElem.parentElement;
|
|
51
|
-
if (targetRect === null || !scrollerElem) {
|
|
52
|
-
floatingElem.style.opacity = "0";
|
|
53
|
-
floatingElem.style.transform = "translate(-10000px, -10000px)";
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
const floatingElemRect = floatingElem.getBoundingClientRect();
|
|
57
|
-
const anchorElementRect = anchorElem.getBoundingClientRect();
|
|
58
|
-
const editorScrollerRect = scrollerElem.getBoundingClientRect();
|
|
59
|
-
let top = targetRect.top - verticalGap;
|
|
60
|
-
let left = targetRect.left - horizontalOffset;
|
|
61
|
-
if (top < editorScrollerRect.top) {
|
|
62
|
-
top += floatingElemRect.height + targetRect.height + verticalGap * 2;
|
|
63
|
-
}
|
|
64
|
-
if (left + floatingElemRect.width > editorScrollerRect.right) {
|
|
65
|
-
left = editorScrollerRect.right - floatingElemRect.width - horizontalOffset;
|
|
66
|
-
}
|
|
67
|
-
top -= anchorElementRect.top;
|
|
68
|
-
left -= anchorElementRect.left;
|
|
69
|
-
floatingElem.style.opacity = "1";
|
|
70
|
-
floatingElem.style.transform = `translate(${left}px, ${top}px)`;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// src/components/editor/plugins/FloatingLinkEditorPlugin/index.tsx
|
|
74
|
-
import { Check, Edit2Icon, Link, X } from "lucide-react";
|
|
75
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
76
|
-
function preventDefault(event) {
|
|
77
|
-
event.preventDefault();
|
|
78
|
-
}
|
|
79
|
-
function FloatingLinkEditor({
|
|
80
|
-
editor,
|
|
81
|
-
isLink,
|
|
82
|
-
setIsLink,
|
|
83
|
-
anchorElem,
|
|
84
|
-
isLinkEditMode,
|
|
85
|
-
setIsLinkEditMode
|
|
86
|
-
}) {
|
|
87
|
-
const editorRef = useRef(null);
|
|
88
|
-
const inputRef = useRef(null);
|
|
89
|
-
const [linkUrl, setLinkUrl] = useState("");
|
|
90
|
-
const [editedLinkUrl, setEditedLinkUrl] = useState("https://");
|
|
91
|
-
const [lastSelection, setLastSelection] = useState(
|
|
92
|
-
null
|
|
93
|
-
);
|
|
94
|
-
const [urlLogo, setUrlLogo] = useState(null);
|
|
95
|
-
const $updateLinkEditor = useCallback(() => {
|
|
96
|
-
var _a, _b;
|
|
97
|
-
const selection = $getSelection();
|
|
98
|
-
if ($isRangeSelection(selection)) {
|
|
99
|
-
const node = getSelectedNode(selection);
|
|
100
|
-
const linkParent = $findMatchingParent(node, $isLinkNode);
|
|
101
|
-
if (linkParent) {
|
|
102
|
-
setLinkUrl(linkParent.getURL());
|
|
103
|
-
} else if ($isLinkNode(node)) {
|
|
104
|
-
setLinkUrl(node.getURL());
|
|
105
|
-
} else {
|
|
106
|
-
setLinkUrl("");
|
|
107
|
-
}
|
|
108
|
-
if (isLinkEditMode) {
|
|
109
|
-
setEditedLinkUrl(linkUrl);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
const editorElem = editorRef.current;
|
|
113
|
-
const nativeSelection = getDOMSelection(editor._window);
|
|
114
|
-
const activeElement = document.activeElement;
|
|
115
|
-
if (editorElem === null) {
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
const rootElement = editor.getRootElement();
|
|
119
|
-
if (selection !== null && nativeSelection !== null && rootElement !== null && rootElement.contains(nativeSelection.anchorNode) && editor.isEditable()) {
|
|
120
|
-
const domRect = (_b = (_a = nativeSelection.focusNode) == null ? void 0 : _a.parentElement) == null ? void 0 : _b.getBoundingClientRect();
|
|
121
|
-
if (domRect) {
|
|
122
|
-
domRect.y += 40;
|
|
123
|
-
setFloatingElemPositionForLinkEditor(domRect, editorElem, anchorElem);
|
|
124
|
-
}
|
|
125
|
-
setLastSelection(selection);
|
|
126
|
-
} else if (!activeElement || activeElement.className !== "link-input") {
|
|
127
|
-
if (rootElement !== null) {
|
|
128
|
-
setFloatingElemPositionForLinkEditor(null, editorElem, anchorElem);
|
|
129
|
-
}
|
|
130
|
-
setLastSelection(null);
|
|
131
|
-
setIsLinkEditMode(false);
|
|
132
|
-
setLinkUrl("");
|
|
133
|
-
}
|
|
134
|
-
return true;
|
|
135
|
-
}, [anchorElem, editor, setIsLinkEditMode, isLinkEditMode, linkUrl]);
|
|
136
|
-
useEffect(() => {
|
|
137
|
-
const scrollerElem = anchorElem.parentElement;
|
|
138
|
-
const update = () => {
|
|
139
|
-
editor.getEditorState().read(() => {
|
|
140
|
-
$updateLinkEditor();
|
|
141
|
-
});
|
|
142
|
-
};
|
|
143
|
-
window.addEventListener("resize", update);
|
|
144
|
-
if (scrollerElem) {
|
|
145
|
-
scrollerElem.addEventListener("scroll", update);
|
|
146
|
-
}
|
|
147
|
-
return () => {
|
|
148
|
-
window.removeEventListener("resize", update);
|
|
149
|
-
if (scrollerElem) {
|
|
150
|
-
scrollerElem.removeEventListener("scroll", update);
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
}, [anchorElem.parentElement, editor, $updateLinkEditor]);
|
|
154
|
-
useEffect(() => {
|
|
155
|
-
return mergeRegister(
|
|
156
|
-
editor.registerUpdateListener(({ editorState }) => {
|
|
157
|
-
editorState.read(() => {
|
|
158
|
-
$updateLinkEditor();
|
|
159
|
-
});
|
|
160
|
-
}),
|
|
161
|
-
editor.registerCommand(
|
|
162
|
-
SELECTION_CHANGE_COMMAND,
|
|
163
|
-
() => {
|
|
164
|
-
$updateLinkEditor();
|
|
165
|
-
return true;
|
|
166
|
-
},
|
|
167
|
-
COMMAND_PRIORITY_LOW
|
|
168
|
-
),
|
|
169
|
-
editor.registerCommand(
|
|
170
|
-
KEY_ESCAPE_COMMAND,
|
|
171
|
-
() => {
|
|
172
|
-
if (isLink) {
|
|
173
|
-
setIsLink(false);
|
|
174
|
-
return true;
|
|
175
|
-
}
|
|
176
|
-
return false;
|
|
177
|
-
},
|
|
178
|
-
COMMAND_PRIORITY_HIGH
|
|
179
|
-
)
|
|
180
|
-
);
|
|
181
|
-
}, [editor, $updateLinkEditor, setIsLink, isLink]);
|
|
182
|
-
useEffect(() => {
|
|
183
|
-
editor.getEditorState().read(() => {
|
|
184
|
-
$updateLinkEditor();
|
|
185
|
-
});
|
|
186
|
-
}, [editor, $updateLinkEditor]);
|
|
187
|
-
useEffect(() => {
|
|
188
|
-
if (isLinkEditMode && inputRef.current) {
|
|
189
|
-
inputRef.current.focus();
|
|
190
|
-
}
|
|
191
|
-
}, [isLinkEditMode, isLink]);
|
|
192
|
-
const monitorInputInteraction = (event) => {
|
|
193
|
-
if (event.key === "Enter") {
|
|
194
|
-
handleLinkSubmission(event);
|
|
195
|
-
} else if (event.key === "Escape") {
|
|
196
|
-
event.preventDefault();
|
|
197
|
-
setIsLinkEditMode(false);
|
|
198
|
-
}
|
|
199
|
-
};
|
|
200
|
-
const handleLinkSubmission = (event) => {
|
|
201
|
-
event.preventDefault();
|
|
202
|
-
if (lastSelection !== null) {
|
|
203
|
-
if (linkUrl !== "") {
|
|
204
|
-
editor.update(() => {
|
|
205
|
-
editor.dispatchCommand(
|
|
206
|
-
TOGGLE_LINK_COMMAND,
|
|
207
|
-
sanitizeUrl(editedLinkUrl)
|
|
208
|
-
);
|
|
209
|
-
const selection = $getSelection();
|
|
210
|
-
if ($isRangeSelection(selection)) {
|
|
211
|
-
const parent = getSelectedNode(selection).getParent();
|
|
212
|
-
if ($isAutoLinkNode(parent)) {
|
|
213
|
-
const linkNode = $createLinkNode(parent.getURL(), {
|
|
214
|
-
rel: parent.__rel,
|
|
215
|
-
target: parent.__target,
|
|
216
|
-
title: parent.__title
|
|
217
|
-
});
|
|
218
|
-
parent.replace(linkNode, true);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
setEditedLinkUrl("https://");
|
|
224
|
-
setIsLinkEditMode(false);
|
|
225
|
-
}
|
|
226
|
-
};
|
|
227
|
-
return /* @__PURE__ */ jsx(
|
|
228
|
-
"div",
|
|
229
|
-
{
|
|
230
|
-
ref: editorRef,
|
|
231
|
-
className: " absolute max-w-96 bg-background max-sm:mx-1 w-full border-0 top-0 left-0",
|
|
232
|
-
children: isLinkEditMode ? /* @__PURE__ */ jsxs("div", { className: " relative w-full", children: [
|
|
233
|
-
/* @__PURE__ */ jsx(
|
|
234
|
-
Link,
|
|
235
|
-
{
|
|
236
|
-
className: cn(
|
|
237
|
-
"size-[14px] text-muted-foreground absolute transition-colors duration-500 transform -translate-x-1/2 -translate-y-1/2 left-4 top-1/2",
|
|
238
|
-
!!editedLinkUrl && "text-black dark:text-white"
|
|
239
|
-
)
|
|
240
|
-
}
|
|
241
|
-
),
|
|
242
|
-
/* @__PURE__ */ jsx(
|
|
243
|
-
Input,
|
|
244
|
-
{
|
|
245
|
-
placeholder: "https://",
|
|
246
|
-
value: editedLinkUrl,
|
|
247
|
-
onChange: (event) => {
|
|
248
|
-
setEditedLinkUrl(event.target.value);
|
|
249
|
-
},
|
|
250
|
-
onKeyDown: (event) => {
|
|
251
|
-
monitorInputInteraction(event);
|
|
252
|
-
},
|
|
253
|
-
ref: inputRef,
|
|
254
|
-
className: "text-gray-900 pl-7 dark:text-gray-100 rounded-xl placeholder-gray-400 dark:placeholder-gray-500"
|
|
255
|
-
}
|
|
256
|
-
),
|
|
257
|
-
/* @__PURE__ */ jsxs("div", { className: " absolute bg-background rounded-xl flex flex-row gap-x-1 items-center transition-colors duration-500 transform -translate-y-1/2 right-2 top-1/2", children: [
|
|
258
|
-
/* @__PURE__ */ jsx(
|
|
259
|
-
Button,
|
|
260
|
-
{
|
|
261
|
-
className: " rounded-xl h-6 w-6 flex items-center",
|
|
262
|
-
role: "button",
|
|
263
|
-
variant: "destructive",
|
|
264
|
-
size: "Toolbar",
|
|
265
|
-
tip: "delete link",
|
|
266
|
-
tabIndex: 0,
|
|
267
|
-
onMouseDown: preventDefault,
|
|
268
|
-
onClick: () => {
|
|
269
|
-
setIsLinkEditMode(false);
|
|
270
|
-
},
|
|
271
|
-
children: /* @__PURE__ */ jsx(X, {})
|
|
272
|
-
}
|
|
273
|
-
),
|
|
274
|
-
/* @__PURE__ */ jsx(
|
|
275
|
-
Button,
|
|
276
|
-
{
|
|
277
|
-
className: " rounded-xl h-6 w-6 flex items-center",
|
|
278
|
-
role: "button",
|
|
279
|
-
tabIndex: 0,
|
|
280
|
-
tip: "confirm link",
|
|
281
|
-
onMouseDown: preventDefault,
|
|
282
|
-
onClick: handleLinkSubmission,
|
|
283
|
-
size: "Toolbar",
|
|
284
|
-
children: /* @__PURE__ */ jsx(Check, {})
|
|
285
|
-
}
|
|
286
|
-
)
|
|
287
|
-
] })
|
|
288
|
-
] }) : /* @__PURE__ */ jsxs("div", { className: "w-full border-input border rounded-xl h-9 flex items-center justify-between px-3 py-1 text-base shadow-sm ", children: [
|
|
289
|
-
/* @__PURE__ */ jsx(
|
|
290
|
-
Link,
|
|
291
|
-
{
|
|
292
|
-
className: cn(
|
|
293
|
-
"size-[14px] text-muted-foreground absolute transition-colors duration-500 transform -translate-x-1/2 -translate-y-1/2 left-4 top-1/2",
|
|
294
|
-
!!editedLinkUrl && "text-black dark:text-white"
|
|
295
|
-
)
|
|
296
|
-
}
|
|
297
|
-
),
|
|
298
|
-
/* @__PURE__ */ jsx(
|
|
299
|
-
"a",
|
|
300
|
-
{
|
|
301
|
-
href: sanitizeUrl(linkUrl),
|
|
302
|
-
target: "_blank",
|
|
303
|
-
rel: "noopener noreferrer",
|
|
304
|
-
className: "pl-4 mb-[1px]",
|
|
305
|
-
children: linkUrl
|
|
306
|
-
}
|
|
307
|
-
),
|
|
308
|
-
/* @__PURE__ */ jsxs("div", { className: " absolute bg-background rounded-xl flex flex-row gap-x-1 items-center transition-colors duration-500 transform -translate-y-1/2 right-2 top-1/2", children: [
|
|
309
|
-
/* @__PURE__ */ jsx(
|
|
310
|
-
Button,
|
|
311
|
-
{
|
|
312
|
-
className: " rounded-xl z-50 h-6 w-6 flex items-center",
|
|
313
|
-
role: "button",
|
|
314
|
-
size: "Toolbar",
|
|
315
|
-
tip: "edit link",
|
|
316
|
-
tabIndex: 0,
|
|
317
|
-
onMouseDown: preventDefault,
|
|
318
|
-
onClick: (event) => {
|
|
319
|
-
event.preventDefault();
|
|
320
|
-
setEditedLinkUrl(linkUrl);
|
|
321
|
-
setIsLinkEditMode(true);
|
|
322
|
-
},
|
|
323
|
-
children: /* @__PURE__ */ jsx(Edit2Icon, { className: "size-4" })
|
|
324
|
-
}
|
|
325
|
-
),
|
|
326
|
-
/* @__PURE__ */ jsx(
|
|
327
|
-
Button,
|
|
328
|
-
{
|
|
329
|
-
className: " rounded-xl h-6 w-6 flex items-center",
|
|
330
|
-
role: "button",
|
|
331
|
-
tabIndex: 0,
|
|
332
|
-
variant: "secondary",
|
|
333
|
-
tip: "delet link",
|
|
334
|
-
size: "Toolbar",
|
|
335
|
-
onMouseDown: preventDefault,
|
|
336
|
-
onClick: () => {
|
|
337
|
-
editor.dispatchCommand(TOGGLE_LINK_COMMAND, null);
|
|
338
|
-
},
|
|
339
|
-
children: /* @__PURE__ */ jsx(X, {})
|
|
340
|
-
}
|
|
341
|
-
)
|
|
342
|
-
] })
|
|
343
|
-
] })
|
|
344
|
-
}
|
|
345
|
-
);
|
|
346
|
-
}
|
|
347
|
-
function useFloatingLinkEditorToolbar(editor, anchorElem, isLinkEditMode, setIsLinkEditMode) {
|
|
348
|
-
const [activeEditor, setActiveEditor] = useState(editor);
|
|
349
|
-
const [isLink, setIsLink] = useState(false);
|
|
350
|
-
useEffect(() => {
|
|
351
|
-
function $updateToolbar() {
|
|
352
|
-
const selection = $getSelection();
|
|
353
|
-
if ($isRangeSelection(selection)) {
|
|
354
|
-
const focusNode = getSelectedNode(selection);
|
|
355
|
-
const focusLinkNode = $findMatchingParent(focusNode, $isLinkNode);
|
|
356
|
-
const focusAutoLinkNode = $findMatchingParent(
|
|
357
|
-
focusNode,
|
|
358
|
-
$isAutoLinkNode
|
|
359
|
-
);
|
|
360
|
-
if (!(focusLinkNode || focusAutoLinkNode)) {
|
|
361
|
-
setIsLink(false);
|
|
362
|
-
return;
|
|
363
|
-
}
|
|
364
|
-
const badNode = selection.getNodes().filter((node) => !$isLineBreakNode(node)).find((node) => {
|
|
365
|
-
const linkNode = $findMatchingParent(node, $isLinkNode);
|
|
366
|
-
const autoLinkNode = $findMatchingParent(node, $isAutoLinkNode);
|
|
367
|
-
return focusLinkNode && !focusLinkNode.is(linkNode) || linkNode && !linkNode.is(focusLinkNode) || focusAutoLinkNode && !focusAutoLinkNode.is(autoLinkNode) || autoLinkNode && (!autoLinkNode.is(focusAutoLinkNode) || autoLinkNode.getIsUnlinked());
|
|
368
|
-
});
|
|
369
|
-
if (!badNode) {
|
|
370
|
-
setIsLink(true);
|
|
371
|
-
} else {
|
|
372
|
-
setIsLink(false);
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
return mergeRegister(
|
|
377
|
-
editor.registerUpdateListener(({ editorState }) => {
|
|
378
|
-
editorState.read(() => {
|
|
379
|
-
$updateToolbar();
|
|
380
|
-
});
|
|
381
|
-
}),
|
|
382
|
-
editor.registerCommand(
|
|
383
|
-
SELECTION_CHANGE_COMMAND,
|
|
384
|
-
(_payload, newEditor) => {
|
|
385
|
-
$updateToolbar();
|
|
386
|
-
setActiveEditor(newEditor);
|
|
387
|
-
return false;
|
|
388
|
-
},
|
|
389
|
-
COMMAND_PRIORITY_CRITICAL
|
|
390
|
-
),
|
|
391
|
-
editor.registerCommand(
|
|
392
|
-
CLICK_COMMAND,
|
|
393
|
-
(payload) => {
|
|
394
|
-
const selection = $getSelection();
|
|
395
|
-
if ($isRangeSelection(selection)) {
|
|
396
|
-
const node = getSelectedNode(selection);
|
|
397
|
-
const linkNode = $findMatchingParent(node, $isLinkNode);
|
|
398
|
-
if ($isLinkNode(linkNode) && (payload.metaKey || payload.ctrlKey)) {
|
|
399
|
-
window.open(linkNode.getURL(), "_blank");
|
|
400
|
-
return true;
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
return false;
|
|
404
|
-
},
|
|
405
|
-
COMMAND_PRIORITY_LOW
|
|
406
|
-
)
|
|
407
|
-
);
|
|
408
|
-
}, [editor]);
|
|
409
|
-
if (!isLink) return null;
|
|
410
|
-
return createPortal(
|
|
411
|
-
/* @__PURE__ */ jsx(
|
|
412
|
-
FloatingLinkEditor,
|
|
413
|
-
{
|
|
414
|
-
editor: activeEditor,
|
|
415
|
-
isLink,
|
|
416
|
-
anchorElem,
|
|
417
|
-
setIsLink,
|
|
418
|
-
isLinkEditMode,
|
|
419
|
-
setIsLinkEditMode
|
|
420
|
-
}
|
|
421
|
-
),
|
|
422
|
-
anchorElem
|
|
423
|
-
);
|
|
424
|
-
}
|
|
425
|
-
function FloatingLinkEditorPlugin({
|
|
426
|
-
anchorElem = document.body,
|
|
427
|
-
isLinkEditMode,
|
|
428
|
-
setIsLinkEditMode
|
|
429
|
-
}) {
|
|
430
|
-
const [editor] = useLexicalComposerContext();
|
|
431
|
-
return useFloatingLinkEditorToolbar(
|
|
432
|
-
editor,
|
|
433
|
-
anchorElem,
|
|
434
|
-
isLinkEditMode,
|
|
435
|
-
setIsLinkEditMode
|
|
436
|
-
);
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
export {
|
|
440
|
-
FloatingLinkEditorPlugin
|
|
441
|
-
};
|
package/dist/chunk-EEBA6OAH.mjs
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DropDown
|
|
3
|
-
} from "./chunk-LU2XWLOE.mjs";
|
|
4
|
-
import {
|
|
5
|
-
init_react_shim
|
|
6
|
-
} from "./chunk-WYCFGRFJ.mjs";
|
|
7
|
-
|
|
8
|
-
// src/components/editor/utils/codeLanguages.ts
|
|
9
|
-
init_react_shim();
|
|
10
|
-
import {
|
|
11
|
-
getCodeLanguageOptions as getShikiOptions,
|
|
12
|
-
normalizeCodeLanguage
|
|
13
|
-
} from "@lexical/code-shiki";
|
|
14
|
-
var options = getShikiOptions();
|
|
15
|
-
var friendlyNameMap = new Map(options);
|
|
16
|
-
function getCodeLanguageOptions() {
|
|
17
|
-
return options;
|
|
18
|
-
}
|
|
19
|
-
function getLanguageFriendlyName(lang) {
|
|
20
|
-
if (!lang) return "Plain Text";
|
|
21
|
-
const normalized = normalizeCodeLanguage(lang) || lang;
|
|
22
|
-
return friendlyNameMap.get(normalized) || friendlyNameMap.get(lang) || lang;
|
|
23
|
-
}
|
|
24
|
-
function normalizeCodeLang(lang) {
|
|
25
|
-
if (!lang) return "";
|
|
26
|
-
return normalizeCodeLanguage(lang) || lang;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// src/components/ui/drop-downs/code.tsx
|
|
30
|
-
init_react_shim();
|
|
31
|
-
import { jsx } from "react/jsx-runtime";
|
|
32
|
-
function CodeList({
|
|
33
|
-
onCodeLanguageSelect,
|
|
34
|
-
disabled = false,
|
|
35
|
-
codeLanguage
|
|
36
|
-
}) {
|
|
37
|
-
const CODE_LANGUAGE_OPTIONS = getCodeLanguageOptions();
|
|
38
|
-
const languageButtons = CODE_LANGUAGE_OPTIONS.map(([lang, friendlyName]) => ({
|
|
39
|
-
label: friendlyName || lang,
|
|
40
|
-
func: () => onCodeLanguageSelect(lang)
|
|
41
|
-
}));
|
|
42
|
-
return /* @__PURE__ */ jsx(
|
|
43
|
-
DropDown,
|
|
44
|
-
{
|
|
45
|
-
values: languageButtons,
|
|
46
|
-
disabled,
|
|
47
|
-
triggerVariants: "ghost",
|
|
48
|
-
className: "h-7 text-xs px-2 py-0 font-mono text-zinc-700 dark:text-zinc-300 hover:text-zinc-900 dark:hover:text-white",
|
|
49
|
-
TriggerClassName: { maxWidth: "140px", minWidth: "60px" },
|
|
50
|
-
TriggerLabel: getLanguageFriendlyName(codeLanguage) || "Plain Text"
|
|
51
|
-
}
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export {
|
|
56
|
-
getLanguageFriendlyName,
|
|
57
|
-
normalizeCodeLang,
|
|
58
|
-
CodeList
|
|
59
|
-
};
|
package/dist/chunk-EIZMKFHF.mjs
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
init_react_shim
|
|
3
|
-
} from "./chunk-WYCFGRFJ.mjs";
|
|
4
|
-
|
|
5
|
-
// src/components/editor/plugins/TemplatePlugin/index.tsx
|
|
6
|
-
init_react_shim();
|
|
7
|
-
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
8
|
-
import { $convertFromMarkdownString, TRANSFORMERS } from "@lexical/markdown";
|
|
9
|
-
import { COMMAND_PRIORITY_EDITOR, createCommand } from "lexical";
|
|
10
|
-
import { useEffect } from "react";
|
|
11
|
-
var INSERT_TEMPLATE_COMMAND = createCommand("INSERT_TEMPLATE_COMMAND");
|
|
12
|
-
function TemplatePlugin() {
|
|
13
|
-
const [editor] = useLexicalComposerContext();
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
return editor.registerCommand(
|
|
16
|
-
INSERT_TEMPLATE_COMMAND,
|
|
17
|
-
(markdownContent) => {
|
|
18
|
-
editor.update(() => {
|
|
19
|
-
$convertFromMarkdownString(markdownContent, TRANSFORMERS);
|
|
20
|
-
});
|
|
21
|
-
return true;
|
|
22
|
-
},
|
|
23
|
-
COMMAND_PRIORITY_EDITOR
|
|
24
|
-
);
|
|
25
|
-
}, [editor]);
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export {
|
|
30
|
-
INSERT_TEMPLATE_COMMAND,
|
|
31
|
-
TemplatePlugin
|
|
32
|
-
};
|