@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-XYLTLGY5.mjs
DELETED
|
@@ -1,775 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useModal
|
|
3
|
-
} from "./chunk-IAFCQV3Z.mjs";
|
|
4
|
-
import {
|
|
5
|
-
$createFigmaNode,
|
|
6
|
-
$createTweetNode,
|
|
7
|
-
$createYouTubeNode,
|
|
8
|
-
FigmaNode,
|
|
9
|
-
TweetNode,
|
|
10
|
-
YouTubeNode
|
|
11
|
-
} from "./chunk-VGAX6YEY.mjs";
|
|
12
|
-
import {
|
|
13
|
-
Input
|
|
14
|
-
} from "./chunk-5NRAXWYA.mjs";
|
|
15
|
-
import {
|
|
16
|
-
Button
|
|
17
|
-
} from "./chunk-OE5JRLCN.mjs";
|
|
18
|
-
import {
|
|
19
|
-
__objRest,
|
|
20
|
-
__spreadProps,
|
|
21
|
-
__spreadValues,
|
|
22
|
-
init_react_shim
|
|
23
|
-
} from "./chunk-WYCFGRFJ.mjs";
|
|
24
|
-
|
|
25
|
-
// src/components/ui/icons/brand-icons.tsx
|
|
26
|
-
init_react_shim();
|
|
27
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
28
|
-
function Youtube(_a) {
|
|
29
|
-
var _b = _a, { className = "w-4 h-4" } = _b, props = __objRest(_b, ["className"]);
|
|
30
|
-
return /* @__PURE__ */ jsxs(
|
|
31
|
-
"svg",
|
|
32
|
-
__spreadProps(__spreadValues({
|
|
33
|
-
viewBox: "0 0 24 24",
|
|
34
|
-
width: "24",
|
|
35
|
-
height: "24",
|
|
36
|
-
stroke: "currentColor",
|
|
37
|
-
strokeWidth: "2",
|
|
38
|
-
fill: "none",
|
|
39
|
-
strokeLinecap: "round",
|
|
40
|
-
strokeLinejoin: "round",
|
|
41
|
-
className
|
|
42
|
-
}, props), {
|
|
43
|
-
children: [
|
|
44
|
-
/* @__PURE__ */ jsx("path", { d: "M2.5 17a24.12 24.12 0 0 1 0-10 2 2 0 0 1 1.4-1.4 49.56 49.56 0 0 1 16.2 0A2 2 0 0 1 21.5 7a24.12 24.12 0 0 1 0 10 2 2 0 0 1-1.4 1.4 49.55 49.55 0 0 1-16.2 0A2 2 0 0 1 2.5 17" }),
|
|
45
|
-
/* @__PURE__ */ jsx("polygon", { points: "10 15 15 12 10 9 10 15", fill: "currentColor" })
|
|
46
|
-
]
|
|
47
|
-
})
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
function Twitter(_a) {
|
|
51
|
-
var _b = _a, { className = "w-4 h-4" } = _b, props = __objRest(_b, ["className"]);
|
|
52
|
-
return /* @__PURE__ */ jsx(
|
|
53
|
-
"svg",
|
|
54
|
-
__spreadProps(__spreadValues({
|
|
55
|
-
viewBox: "0 0 24 24",
|
|
56
|
-
width: "24",
|
|
57
|
-
height: "24",
|
|
58
|
-
stroke: "currentColor",
|
|
59
|
-
strokeWidth: "2",
|
|
60
|
-
fill: "none",
|
|
61
|
-
strokeLinecap: "round",
|
|
62
|
-
strokeLinejoin: "round",
|
|
63
|
-
className
|
|
64
|
-
}, props), {
|
|
65
|
-
children: /* @__PURE__ */ jsx("path", { d: "M22 4s-.7 2.1-2 3.4c1.6 10-9.4 17.3-18 11.6 2.2.1 4.4-.6 6-2C3 15.5.5 9.6 3 5c2.2 2.6 5.6 4.1 9 4-.9-4.2 4-6.6 7-3.8 1.1 0 3-1.2 3-1.2z" })
|
|
66
|
-
})
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
function Figma(_a) {
|
|
70
|
-
var _b = _a, { className = "w-4 h-4" } = _b, props = __objRest(_b, ["className"]);
|
|
71
|
-
return /* @__PURE__ */ jsxs(
|
|
72
|
-
"svg",
|
|
73
|
-
__spreadProps(__spreadValues({
|
|
74
|
-
viewBox: "0 0 24 24",
|
|
75
|
-
width: "24",
|
|
76
|
-
height: "24",
|
|
77
|
-
stroke: "currentColor",
|
|
78
|
-
strokeWidth: "2",
|
|
79
|
-
fill: "none",
|
|
80
|
-
strokeLinecap: "round",
|
|
81
|
-
strokeLinejoin: "round",
|
|
82
|
-
className
|
|
83
|
-
}, props), {
|
|
84
|
-
children: [
|
|
85
|
-
/* @__PURE__ */ jsx("path", { d: "M5 5.5A3.5 3.5 0 0 1 8.5 2H12v7H8.5A3.5 3.5 0 0 1 5 5.5z" }),
|
|
86
|
-
/* @__PURE__ */ jsx("path", { d: "M12 2h3.5a3.5 3.5 0 1 1 0 7H12V2z" }),
|
|
87
|
-
/* @__PURE__ */ jsx("path", { d: "M12 12.5a3.5 3.5 0 1 1 7 0 3.5 3.5 0 1 1-7 0z" }),
|
|
88
|
-
/* @__PURE__ */ jsx("path", { d: "M5 19.5A3.5 3.5 0 0 1 8.5 16H12v3.5a3.5 3.5 0 1 1-7 0z" }),
|
|
89
|
-
/* @__PURE__ */ jsx("path", { d: "M5 12.5A3.5 3.5 0 0 1 8.5 9H12v7H8.5A3.5 3.5 0 0 1 5 12.5z" })
|
|
90
|
-
]
|
|
91
|
-
})
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// src/components/editor/plugins/LayoutPlugin/index.tsx
|
|
96
|
-
init_react_shim();
|
|
97
|
-
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
98
|
-
import {
|
|
99
|
-
$findMatchingParent,
|
|
100
|
-
$insertNodeToNearestRoot,
|
|
101
|
-
mergeRegister
|
|
102
|
-
} from "@lexical/utils";
|
|
103
|
-
import {
|
|
104
|
-
$createParagraphNode,
|
|
105
|
-
$getNodeByKey,
|
|
106
|
-
$getSelection,
|
|
107
|
-
$isRangeSelection,
|
|
108
|
-
COMMAND_PRIORITY_EDITOR,
|
|
109
|
-
COMMAND_PRIORITY_LOW,
|
|
110
|
-
createCommand,
|
|
111
|
-
KEY_ARROW_DOWN_COMMAND,
|
|
112
|
-
KEY_ARROW_LEFT_COMMAND,
|
|
113
|
-
KEY_ARROW_RIGHT_COMMAND,
|
|
114
|
-
KEY_ARROW_UP_COMMAND
|
|
115
|
-
} from "lexical";
|
|
116
|
-
import { useEffect } from "react";
|
|
117
|
-
|
|
118
|
-
// src/components/editor/nodes/LayoutNode/LayoutContainerNode.ts
|
|
119
|
-
init_react_shim();
|
|
120
|
-
import { addClassNamesToElement } from "@lexical/utils";
|
|
121
|
-
import { ElementNode } from "lexical";
|
|
122
|
-
function $convertLayoutContainerElement(domNode) {
|
|
123
|
-
const styleAttributes = window.getComputedStyle(domNode);
|
|
124
|
-
const templateColumns = styleAttributes.getPropertyValue(
|
|
125
|
-
"grid-template-columns"
|
|
126
|
-
);
|
|
127
|
-
if (templateColumns) {
|
|
128
|
-
const node = $createLayoutContainerNode(templateColumns);
|
|
129
|
-
return { node };
|
|
130
|
-
}
|
|
131
|
-
return null;
|
|
132
|
-
}
|
|
133
|
-
var LayoutContainerNode = class _LayoutContainerNode extends ElementNode {
|
|
134
|
-
constructor(templateColumns, key) {
|
|
135
|
-
super(key);
|
|
136
|
-
this.__templateColumns = templateColumns;
|
|
137
|
-
}
|
|
138
|
-
static getType() {
|
|
139
|
-
return "layout-container";
|
|
140
|
-
}
|
|
141
|
-
static clone(node) {
|
|
142
|
-
return new _LayoutContainerNode(node.__templateColumns, node.__key);
|
|
143
|
-
}
|
|
144
|
-
createDOM(config) {
|
|
145
|
-
const dom = document.createElement("div");
|
|
146
|
-
dom.style.gridTemplateColumns = this.__templateColumns;
|
|
147
|
-
if (typeof config.theme.layoutContainer === "string") {
|
|
148
|
-
addClassNamesToElement(dom, config.theme.layoutContainer);
|
|
149
|
-
}
|
|
150
|
-
return dom;
|
|
151
|
-
}
|
|
152
|
-
exportDOM() {
|
|
153
|
-
const element = document.createElement("div");
|
|
154
|
-
element.style.gridTemplateColumns = this.__templateColumns;
|
|
155
|
-
element.setAttribute("data-lexical-layout-container", "true");
|
|
156
|
-
return { element };
|
|
157
|
-
}
|
|
158
|
-
updateDOM(prevNode, dom) {
|
|
159
|
-
if (prevNode.__templateColumns !== this.__templateColumns) {
|
|
160
|
-
dom.style.gridTemplateColumns = this.__templateColumns;
|
|
161
|
-
}
|
|
162
|
-
return false;
|
|
163
|
-
}
|
|
164
|
-
static importDOM() {
|
|
165
|
-
return {
|
|
166
|
-
div: (domNode) => {
|
|
167
|
-
if (!domNode.hasAttribute("data-lexical-layout-container")) {
|
|
168
|
-
return null;
|
|
169
|
-
}
|
|
170
|
-
return {
|
|
171
|
-
conversion: $convertLayoutContainerElement,
|
|
172
|
-
priority: 2
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
static importJSON(json) {
|
|
178
|
-
return $createLayoutContainerNode().updateFromJSON(json);
|
|
179
|
-
}
|
|
180
|
-
updateFromJSON(serializedNode) {
|
|
181
|
-
return super.updateFromJSON(serializedNode).setTemplateColumns(serializedNode.templateColumns);
|
|
182
|
-
}
|
|
183
|
-
isShadowRoot() {
|
|
184
|
-
return true;
|
|
185
|
-
}
|
|
186
|
-
canBeEmpty() {
|
|
187
|
-
return false;
|
|
188
|
-
}
|
|
189
|
-
exportJSON() {
|
|
190
|
-
return __spreadProps(__spreadValues({}, super.exportJSON()), {
|
|
191
|
-
templateColumns: this.__templateColumns
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
getTemplateColumns() {
|
|
195
|
-
return this.getLatest().__templateColumns;
|
|
196
|
-
}
|
|
197
|
-
setTemplateColumns(templateColumns) {
|
|
198
|
-
const self = this.getWritable();
|
|
199
|
-
self.__templateColumns = templateColumns;
|
|
200
|
-
return self;
|
|
201
|
-
}
|
|
202
|
-
};
|
|
203
|
-
function $createLayoutContainerNode(templateColumns = "") {
|
|
204
|
-
return new LayoutContainerNode(templateColumns);
|
|
205
|
-
}
|
|
206
|
-
function $isLayoutContainerNode(node) {
|
|
207
|
-
return node instanceof LayoutContainerNode;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// src/components/editor/nodes/LayoutNode/LayoutItemNode.ts
|
|
211
|
-
init_react_shim();
|
|
212
|
-
import { addClassNamesToElement as addClassNamesToElement2 } from "@lexical/utils";
|
|
213
|
-
import { ElementNode as ElementNode2 } from "lexical";
|
|
214
|
-
function $convertLayoutItemElement() {
|
|
215
|
-
return { node: $createLayoutItemNode() };
|
|
216
|
-
}
|
|
217
|
-
var LayoutItemNode = class _LayoutItemNode extends ElementNode2 {
|
|
218
|
-
static getType() {
|
|
219
|
-
return "layout-item";
|
|
220
|
-
}
|
|
221
|
-
static clone(node) {
|
|
222
|
-
return new _LayoutItemNode(node.__key);
|
|
223
|
-
}
|
|
224
|
-
createDOM(config) {
|
|
225
|
-
const dom = document.createElement("div");
|
|
226
|
-
dom.setAttribute("data-lexical-layout-item", "true");
|
|
227
|
-
if (typeof config.theme.layoutItem === "string") {
|
|
228
|
-
addClassNamesToElement2(dom, config.theme.layoutItem);
|
|
229
|
-
}
|
|
230
|
-
return dom;
|
|
231
|
-
}
|
|
232
|
-
updateDOM() {
|
|
233
|
-
return false;
|
|
234
|
-
}
|
|
235
|
-
static importDOM() {
|
|
236
|
-
return {
|
|
237
|
-
div: (domNode) => {
|
|
238
|
-
if (!domNode.hasAttribute("data-lexical-layout-item")) {
|
|
239
|
-
return null;
|
|
240
|
-
}
|
|
241
|
-
return {
|
|
242
|
-
conversion: $convertLayoutItemElement,
|
|
243
|
-
priority: 2
|
|
244
|
-
};
|
|
245
|
-
}
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
static importJSON(serializedNode) {
|
|
249
|
-
return $createLayoutItemNode().updateFromJSON(serializedNode);
|
|
250
|
-
}
|
|
251
|
-
isShadowRoot() {
|
|
252
|
-
return true;
|
|
253
|
-
}
|
|
254
|
-
};
|
|
255
|
-
function $createLayoutItemNode() {
|
|
256
|
-
return new LayoutItemNode();
|
|
257
|
-
}
|
|
258
|
-
function $isLayoutItemNode(node) {
|
|
259
|
-
return node instanceof LayoutItemNode;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
// src/components/editor/plugins/LayoutPlugin/index.tsx
|
|
263
|
-
var INSERT_LAYOUT_COMMAND = createCommand();
|
|
264
|
-
var UPDATE_LAYOUT_COMMAND = createCommand();
|
|
265
|
-
function LayoutPlugin() {
|
|
266
|
-
const [editor] = useLexicalComposerContext();
|
|
267
|
-
useEffect(() => {
|
|
268
|
-
if (!editor.hasNodes([LayoutContainerNode, LayoutItemNode])) {
|
|
269
|
-
throw new Error(
|
|
270
|
-
"LayoutPlugin: LayoutContainerNode, or LayoutItemNode not registered on editor"
|
|
271
|
-
);
|
|
272
|
-
}
|
|
273
|
-
const $onEscape = (before) => {
|
|
274
|
-
var _a, _b;
|
|
275
|
-
const selection = $getSelection();
|
|
276
|
-
if ($isRangeSelection(selection) && selection.isCollapsed() && selection.anchor.offset === 0) {
|
|
277
|
-
const container = $findMatchingParent(
|
|
278
|
-
selection.anchor.getNode(),
|
|
279
|
-
$isLayoutContainerNode
|
|
280
|
-
);
|
|
281
|
-
if ($isLayoutContainerNode(container)) {
|
|
282
|
-
const parent = container.getParent();
|
|
283
|
-
const child = parent && (before ? parent.getFirstChild() : parent == null ? void 0 : parent.getLastChild());
|
|
284
|
-
const descendant = before ? (_a = container.getFirstDescendant()) == null ? void 0 : _a.getKey() : (_b = container.getLastDescendant()) == null ? void 0 : _b.getKey();
|
|
285
|
-
if (parent !== null && child === container && selection.anchor.key === descendant) {
|
|
286
|
-
if (before) {
|
|
287
|
-
container.insertBefore($createParagraphNode());
|
|
288
|
-
} else {
|
|
289
|
-
container.insertAfter($createParagraphNode());
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
return false;
|
|
295
|
-
};
|
|
296
|
-
const $fillLayoutItemIfEmpty = (node) => {
|
|
297
|
-
if (node.isEmpty()) {
|
|
298
|
-
node.append($createParagraphNode());
|
|
299
|
-
}
|
|
300
|
-
};
|
|
301
|
-
const $removeIsolatedLayoutItem = (node) => {
|
|
302
|
-
const parent = node.getParent();
|
|
303
|
-
if (!$isLayoutContainerNode(parent)) {
|
|
304
|
-
const children = node.getChildren();
|
|
305
|
-
for (const child of children) {
|
|
306
|
-
node.insertBefore(child);
|
|
307
|
-
}
|
|
308
|
-
node.remove();
|
|
309
|
-
return true;
|
|
310
|
-
}
|
|
311
|
-
return false;
|
|
312
|
-
};
|
|
313
|
-
return mergeRegister(
|
|
314
|
-
// When layout is the last child pressing down/right arrow will insert paragraph
|
|
315
|
-
// below it to allow adding more content. It's similar what $insertBlockNode
|
|
316
|
-
// (mainly for decorators), except it'll always be possible to continue adding
|
|
317
|
-
// new content even if trailing paragraph is accidentally deleted
|
|
318
|
-
editor.registerCommand(
|
|
319
|
-
KEY_ARROW_DOWN_COMMAND,
|
|
320
|
-
() => $onEscape(false),
|
|
321
|
-
COMMAND_PRIORITY_LOW
|
|
322
|
-
),
|
|
323
|
-
editor.registerCommand(
|
|
324
|
-
KEY_ARROW_RIGHT_COMMAND,
|
|
325
|
-
() => $onEscape(false),
|
|
326
|
-
COMMAND_PRIORITY_LOW
|
|
327
|
-
),
|
|
328
|
-
// When layout is the first child pressing up/left arrow will insert paragraph
|
|
329
|
-
// above it to allow adding more content. It's similar what $insertBlockNode
|
|
330
|
-
// (mainly for decorators), except it'll always be possible to continue adding
|
|
331
|
-
// new content even if leading paragraph is accidentally deleted
|
|
332
|
-
editor.registerCommand(
|
|
333
|
-
KEY_ARROW_UP_COMMAND,
|
|
334
|
-
() => $onEscape(true),
|
|
335
|
-
COMMAND_PRIORITY_LOW
|
|
336
|
-
),
|
|
337
|
-
editor.registerCommand(
|
|
338
|
-
KEY_ARROW_LEFT_COMMAND,
|
|
339
|
-
() => $onEscape(true),
|
|
340
|
-
COMMAND_PRIORITY_LOW
|
|
341
|
-
),
|
|
342
|
-
editor.registerCommand(
|
|
343
|
-
INSERT_LAYOUT_COMMAND,
|
|
344
|
-
(template) => {
|
|
345
|
-
editor.update(() => {
|
|
346
|
-
const container = $createLayoutContainerNode(template);
|
|
347
|
-
const itemsCount = getItemsCountFromTemplate(template);
|
|
348
|
-
for (let i = 0; i < itemsCount; i++) {
|
|
349
|
-
container.append(
|
|
350
|
-
$createLayoutItemNode().append($createParagraphNode())
|
|
351
|
-
);
|
|
352
|
-
}
|
|
353
|
-
$insertNodeToNearestRoot(container);
|
|
354
|
-
container.selectStart();
|
|
355
|
-
});
|
|
356
|
-
return true;
|
|
357
|
-
},
|
|
358
|
-
COMMAND_PRIORITY_EDITOR
|
|
359
|
-
),
|
|
360
|
-
editor.registerCommand(
|
|
361
|
-
UPDATE_LAYOUT_COMMAND,
|
|
362
|
-
({ template, nodeKey }) => {
|
|
363
|
-
editor.update(() => {
|
|
364
|
-
const container = $getNodeByKey(nodeKey);
|
|
365
|
-
if (!$isLayoutContainerNode(container)) {
|
|
366
|
-
return;
|
|
367
|
-
}
|
|
368
|
-
const itemsCount = getItemsCountFromTemplate(template);
|
|
369
|
-
const prevItemsCount = getItemsCountFromTemplate(
|
|
370
|
-
container.getTemplateColumns()
|
|
371
|
-
);
|
|
372
|
-
if (itemsCount > prevItemsCount) {
|
|
373
|
-
for (let i = prevItemsCount; i < itemsCount; i++) {
|
|
374
|
-
container.append(
|
|
375
|
-
$createLayoutItemNode().append($createParagraphNode())
|
|
376
|
-
);
|
|
377
|
-
}
|
|
378
|
-
} else if (itemsCount < prevItemsCount) {
|
|
379
|
-
for (let i = prevItemsCount - 1; i >= itemsCount; i--) {
|
|
380
|
-
const layoutItem = container.getChildAtIndex(i);
|
|
381
|
-
if ($isLayoutItemNode(layoutItem)) {
|
|
382
|
-
layoutItem.remove();
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
container.setTemplateColumns(template);
|
|
387
|
-
});
|
|
388
|
-
return true;
|
|
389
|
-
},
|
|
390
|
-
COMMAND_PRIORITY_EDITOR
|
|
391
|
-
),
|
|
392
|
-
editor.registerNodeTransform(LayoutItemNode, (node) => {
|
|
393
|
-
const isRemoved = $removeIsolatedLayoutItem(node);
|
|
394
|
-
if (!isRemoved) {
|
|
395
|
-
$fillLayoutItemIfEmpty(node);
|
|
396
|
-
}
|
|
397
|
-
}),
|
|
398
|
-
editor.registerNodeTransform(LayoutContainerNode, (node) => {
|
|
399
|
-
const children = node.getChildren();
|
|
400
|
-
if (!children.every($isLayoutItemNode)) {
|
|
401
|
-
for (const child of children) {
|
|
402
|
-
node.insertBefore(child);
|
|
403
|
-
}
|
|
404
|
-
node.remove();
|
|
405
|
-
}
|
|
406
|
-
})
|
|
407
|
-
);
|
|
408
|
-
}, [editor]);
|
|
409
|
-
return null;
|
|
410
|
-
}
|
|
411
|
-
function getItemsCountFromTemplate(template) {
|
|
412
|
-
return template.trim().split(/\s+/).length;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
// src/components/editor/plugins/AutoEmbedPlugin/index.tsx
|
|
416
|
-
init_react_shim();
|
|
417
|
-
import {
|
|
418
|
-
AutoEmbedOption,
|
|
419
|
-
LexicalAutoEmbedPlugin,
|
|
420
|
-
URL_MATCHER
|
|
421
|
-
} from "@lexical/react/LexicalAutoEmbedPlugin";
|
|
422
|
-
import { useLexicalComposerContext as useLexicalComposerContext5 } from "@lexical/react/LexicalComposerContext";
|
|
423
|
-
import { useMemo, useState } from "react";
|
|
424
|
-
import * as ReactDOM from "react-dom";
|
|
425
|
-
|
|
426
|
-
// src/components/editor/plugins/FigmaPlugin/index.tsx
|
|
427
|
-
init_react_shim();
|
|
428
|
-
import { useLexicalComposerContext as useLexicalComposerContext2 } from "@lexical/react/LexicalComposerContext";
|
|
429
|
-
import { $insertNodeToNearestRoot as $insertNodeToNearestRoot2 } from "@lexical/utils";
|
|
430
|
-
import { COMMAND_PRIORITY_EDITOR as COMMAND_PRIORITY_EDITOR2, createCommand as createCommand2 } from "lexical";
|
|
431
|
-
import { useEffect as useEffect2 } from "react";
|
|
432
|
-
var INSERT_FIGMA_COMMAND = createCommand2(
|
|
433
|
-
"INSERT_FIGMA_COMMAND"
|
|
434
|
-
);
|
|
435
|
-
function FigmaPlugin() {
|
|
436
|
-
const [editor] = useLexicalComposerContext2();
|
|
437
|
-
useEffect2(() => {
|
|
438
|
-
if (!editor.hasNodes([FigmaNode])) {
|
|
439
|
-
throw new Error("FigmaPlugin: FigmaNode not registered on editor");
|
|
440
|
-
}
|
|
441
|
-
return editor.registerCommand(
|
|
442
|
-
INSERT_FIGMA_COMMAND,
|
|
443
|
-
(payload) => {
|
|
444
|
-
const figmaNode = $createFigmaNode(payload);
|
|
445
|
-
$insertNodeToNearestRoot2(figmaNode);
|
|
446
|
-
return true;
|
|
447
|
-
},
|
|
448
|
-
COMMAND_PRIORITY_EDITOR2
|
|
449
|
-
);
|
|
450
|
-
}, [editor]);
|
|
451
|
-
return null;
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
// src/components/editor/plugins/YouTubePlugin/index.ts
|
|
455
|
-
init_react_shim();
|
|
456
|
-
import { useLexicalComposerContext as useLexicalComposerContext3 } from "@lexical/react/LexicalComposerContext";
|
|
457
|
-
import { $insertNodeToNearestRoot as $insertNodeToNearestRoot3 } from "@lexical/utils";
|
|
458
|
-
import { COMMAND_PRIORITY_EDITOR as COMMAND_PRIORITY_EDITOR3, createCommand as createCommand3 } from "lexical";
|
|
459
|
-
import { useEffect as useEffect3 } from "react";
|
|
460
|
-
var INSERT_YOUTUBE_COMMAND = createCommand3(
|
|
461
|
-
"INSERT_YOUTUBE_COMMAND"
|
|
462
|
-
);
|
|
463
|
-
function YouTubePlugin() {
|
|
464
|
-
const [editor] = useLexicalComposerContext3();
|
|
465
|
-
useEffect3(() => {
|
|
466
|
-
if (!editor.hasNodes([YouTubeNode])) {
|
|
467
|
-
throw new Error("YouTubePlugin: YouTubeNode not registered on editor");
|
|
468
|
-
}
|
|
469
|
-
return editor.registerCommand(
|
|
470
|
-
INSERT_YOUTUBE_COMMAND,
|
|
471
|
-
(payload) => {
|
|
472
|
-
const youTubeNode = $createYouTubeNode(payload);
|
|
473
|
-
$insertNodeToNearestRoot3(youTubeNode);
|
|
474
|
-
return true;
|
|
475
|
-
},
|
|
476
|
-
COMMAND_PRIORITY_EDITOR3
|
|
477
|
-
);
|
|
478
|
-
}, [editor]);
|
|
479
|
-
return null;
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
// src/components/editor/plugins/TwitterPlugin/index.ts
|
|
483
|
-
init_react_shim();
|
|
484
|
-
import { useLexicalComposerContext as useLexicalComposerContext4 } from "@lexical/react/LexicalComposerContext";
|
|
485
|
-
import { $insertNodeToNearestRoot as $insertNodeToNearestRoot4 } from "@lexical/utils";
|
|
486
|
-
import { COMMAND_PRIORITY_EDITOR as COMMAND_PRIORITY_EDITOR4, createCommand as createCommand4 } from "lexical";
|
|
487
|
-
import { useEffect as useEffect4 } from "react";
|
|
488
|
-
var INSERT_TWEET_COMMAND = createCommand4(
|
|
489
|
-
"INSERT_TWEET_COMMAND"
|
|
490
|
-
);
|
|
491
|
-
function TwitterPlugin() {
|
|
492
|
-
const [editor] = useLexicalComposerContext4();
|
|
493
|
-
useEffect4(() => {
|
|
494
|
-
if (!editor.hasNodes([TweetNode])) {
|
|
495
|
-
throw new Error("TwitterPlugin: TweetNode not registered on editor");
|
|
496
|
-
}
|
|
497
|
-
return editor.registerCommand(
|
|
498
|
-
INSERT_TWEET_COMMAND,
|
|
499
|
-
(payload) => {
|
|
500
|
-
const tweetNode = $createTweetNode(payload);
|
|
501
|
-
$insertNodeToNearestRoot4(tweetNode);
|
|
502
|
-
return true;
|
|
503
|
-
},
|
|
504
|
-
COMMAND_PRIORITY_EDITOR4
|
|
505
|
-
);
|
|
506
|
-
}, [editor]);
|
|
507
|
-
return null;
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
// src/components/editor/plugins/AutoEmbedPlugin/index.tsx
|
|
511
|
-
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
512
|
-
var YoutubeEmbedConfig = {
|
|
513
|
-
contentName: "Youtube Video",
|
|
514
|
-
exampleUrl: "https://www.youtube.com/watch?v=jNQXAC9IVRw",
|
|
515
|
-
// Icon for display.
|
|
516
|
-
icon: /* @__PURE__ */ jsx2(Youtube, { className: "h-4 w-4" }),
|
|
517
|
-
insertNode: (editor, result) => {
|
|
518
|
-
editor.dispatchCommand(INSERT_YOUTUBE_COMMAND, result.id);
|
|
519
|
-
},
|
|
520
|
-
keywords: ["youtube", "video"],
|
|
521
|
-
// Determine if a given URL is a match and return url data.
|
|
522
|
-
parseUrl: async (url) => {
|
|
523
|
-
const match = /^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/.exec(url);
|
|
524
|
-
const id = match ? (match == null ? void 0 : match[2].length) === 11 ? match[2] : null : null;
|
|
525
|
-
if (id != null) {
|
|
526
|
-
return {
|
|
527
|
-
id,
|
|
528
|
-
url
|
|
529
|
-
};
|
|
530
|
-
}
|
|
531
|
-
return null;
|
|
532
|
-
},
|
|
533
|
-
type: "youtube-video"
|
|
534
|
-
};
|
|
535
|
-
var TwitterEmbedConfig = {
|
|
536
|
-
// e.g. Tweet or Google Map.
|
|
537
|
-
contentName: "Tweet",
|
|
538
|
-
exampleUrl: "https://twitter.com/jack/status/20",
|
|
539
|
-
// Icon for display.
|
|
540
|
-
icon: /* @__PURE__ */ jsx2(Twitter, { className: "h-4 w-4" }),
|
|
541
|
-
// Create the Lexical embed node from the url data.
|
|
542
|
-
insertNode: (editor, result) => {
|
|
543
|
-
editor.dispatchCommand(INSERT_TWEET_COMMAND, result.id);
|
|
544
|
-
},
|
|
545
|
-
// For extra searching.
|
|
546
|
-
keywords: ["tweet", "twitter"],
|
|
547
|
-
// Determine if a given URL is a match and return url data.
|
|
548
|
-
parseUrl: (text) => {
|
|
549
|
-
const match = /^https:\/\/(twitter|x)\.com\/(#!\/)?(\w+)\/status(es)*\/(\d+)/.exec(
|
|
550
|
-
text
|
|
551
|
-
);
|
|
552
|
-
if (match != null) {
|
|
553
|
-
return {
|
|
554
|
-
id: match[5],
|
|
555
|
-
url: match[1]
|
|
556
|
-
};
|
|
557
|
-
}
|
|
558
|
-
return null;
|
|
559
|
-
},
|
|
560
|
-
type: "tweet"
|
|
561
|
-
};
|
|
562
|
-
var FigmaEmbedConfig = {
|
|
563
|
-
contentName: "Figma Document",
|
|
564
|
-
exampleUrl: "https://www.figma.com/file/LKQ4FJ4bTnCSjedbRpk931/Sample-File",
|
|
565
|
-
icon: /* @__PURE__ */ jsx2(Figma, { className: "h-4 w-4" }),
|
|
566
|
-
insertNode: (editor, result) => {
|
|
567
|
-
editor.dispatchCommand(INSERT_FIGMA_COMMAND, result.id);
|
|
568
|
-
},
|
|
569
|
-
keywords: ["figma", "figma.com", "mock-up"],
|
|
570
|
-
// Determine if a given URL is a match and return url data.
|
|
571
|
-
parseUrl: (text) => {
|
|
572
|
-
const match = /https:\/\/([\w.-]+\.)?figma.com\/(file|proto)\/([0-9a-zA-Z]{22,128})(?:\/.*)?$/.exec(
|
|
573
|
-
text
|
|
574
|
-
);
|
|
575
|
-
if (match != null) {
|
|
576
|
-
return {
|
|
577
|
-
id: match[3],
|
|
578
|
-
url: match[0]
|
|
579
|
-
};
|
|
580
|
-
}
|
|
581
|
-
return null;
|
|
582
|
-
},
|
|
583
|
-
type: "figma"
|
|
584
|
-
};
|
|
585
|
-
var EmbedConfigs = [
|
|
586
|
-
TwitterEmbedConfig,
|
|
587
|
-
YoutubeEmbedConfig,
|
|
588
|
-
FigmaEmbedConfig
|
|
589
|
-
];
|
|
590
|
-
function AutoEmbedMenuItem({
|
|
591
|
-
index,
|
|
592
|
-
isSelected,
|
|
593
|
-
onClick,
|
|
594
|
-
onMouseEnter,
|
|
595
|
-
option
|
|
596
|
-
}) {
|
|
597
|
-
let className = "item";
|
|
598
|
-
if (isSelected) {
|
|
599
|
-
className += " selected";
|
|
600
|
-
}
|
|
601
|
-
return /* @__PURE__ */ jsx2(
|
|
602
|
-
"li",
|
|
603
|
-
{
|
|
604
|
-
tabIndex: -1,
|
|
605
|
-
className,
|
|
606
|
-
ref: option.setRefElement,
|
|
607
|
-
role: "option",
|
|
608
|
-
"aria-selected": isSelected,
|
|
609
|
-
id: "typeahead-item-" + index,
|
|
610
|
-
onMouseEnter,
|
|
611
|
-
onClick,
|
|
612
|
-
children: /* @__PURE__ */ jsx2("span", { className: "text", children: option.title })
|
|
613
|
-
},
|
|
614
|
-
option.key
|
|
615
|
-
);
|
|
616
|
-
}
|
|
617
|
-
function AutoEmbedMenu({
|
|
618
|
-
options,
|
|
619
|
-
selectedItemIndex,
|
|
620
|
-
onOptionClick,
|
|
621
|
-
onOptionMouseEnter
|
|
622
|
-
}) {
|
|
623
|
-
return /* @__PURE__ */ jsx2("div", { className: "typeahead-popover", children: /* @__PURE__ */ jsx2("ul", { children: options.map((option, i) => /* @__PURE__ */ jsx2(
|
|
624
|
-
AutoEmbedMenuItem,
|
|
625
|
-
{
|
|
626
|
-
index: i,
|
|
627
|
-
isSelected: selectedItemIndex === i,
|
|
628
|
-
onClick: () => onOptionClick(option, i),
|
|
629
|
-
onMouseEnter: () => onOptionMouseEnter(i),
|
|
630
|
-
option
|
|
631
|
-
},
|
|
632
|
-
option.key
|
|
633
|
-
)) }) });
|
|
634
|
-
}
|
|
635
|
-
var debounce = (callback, delay) => {
|
|
636
|
-
let timeoutId;
|
|
637
|
-
return (text) => {
|
|
638
|
-
window.clearTimeout(timeoutId);
|
|
639
|
-
timeoutId = window.setTimeout(() => {
|
|
640
|
-
callback(text);
|
|
641
|
-
}, delay);
|
|
642
|
-
};
|
|
643
|
-
};
|
|
644
|
-
function AutoEmbedDialog({
|
|
645
|
-
embedConfig,
|
|
646
|
-
onClose
|
|
647
|
-
}) {
|
|
648
|
-
const [text, setText] = useState("");
|
|
649
|
-
const [editor] = useLexicalComposerContext5();
|
|
650
|
-
const [embedResult, setEmbedResult] = useState(null);
|
|
651
|
-
const validateText = useMemo(
|
|
652
|
-
() => debounce((inputText) => {
|
|
653
|
-
const urlMatch = URL_MATCHER.exec(inputText);
|
|
654
|
-
if (embedConfig != null && inputText != null && urlMatch != null) {
|
|
655
|
-
Promise.resolve(embedConfig.parseUrl(inputText)).then(
|
|
656
|
-
(parseResult) => {
|
|
657
|
-
setEmbedResult(parseResult);
|
|
658
|
-
}
|
|
659
|
-
);
|
|
660
|
-
} else if (embedResult != null) {
|
|
661
|
-
setEmbedResult(null);
|
|
662
|
-
}
|
|
663
|
-
}, 200),
|
|
664
|
-
[embedConfig, embedResult]
|
|
665
|
-
);
|
|
666
|
-
const onClick = () => {
|
|
667
|
-
if (embedResult != null) {
|
|
668
|
-
embedConfig.insertNode(editor, embedResult);
|
|
669
|
-
onClose();
|
|
670
|
-
}
|
|
671
|
-
};
|
|
672
|
-
return /* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-center flex-col space-y-3", children: [
|
|
673
|
-
/* @__PURE__ */ jsx2("div", { children: /* @__PURE__ */ jsx2(
|
|
674
|
-
Input,
|
|
675
|
-
{
|
|
676
|
-
type: "text",
|
|
677
|
-
className: "Input__input",
|
|
678
|
-
placeholder: embedConfig.exampleUrl,
|
|
679
|
-
value: text,
|
|
680
|
-
"data-test-id": `${embedConfig.type}-embed-modal-url`,
|
|
681
|
-
onChange: (e) => {
|
|
682
|
-
const { value } = e.target;
|
|
683
|
-
setText(value);
|
|
684
|
-
validateText(value);
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
) }),
|
|
688
|
-
/* @__PURE__ */ jsx2(
|
|
689
|
-
Button,
|
|
690
|
-
{
|
|
691
|
-
disabled: !embedResult,
|
|
692
|
-
onClick,
|
|
693
|
-
"data-test-id": `${embedConfig.type}-embed-modal-submit-btn`,
|
|
694
|
-
children: "Embed"
|
|
695
|
-
}
|
|
696
|
-
)
|
|
697
|
-
] });
|
|
698
|
-
}
|
|
699
|
-
function AutoEmbedPlugin() {
|
|
700
|
-
const [modal, showModal] = useModal();
|
|
701
|
-
const openEmbedModal = (embedConfig) => {
|
|
702
|
-
showModal(`Embed ${embedConfig.contentName}`, "type the url", (onClose) => /* @__PURE__ */ jsx2(AutoEmbedDialog, { embedConfig, onClose }));
|
|
703
|
-
};
|
|
704
|
-
const getMenuOptions = (activeEmbedConfig, embedFn, dismissFn) => {
|
|
705
|
-
return [
|
|
706
|
-
new AutoEmbedOption("Dismiss", {
|
|
707
|
-
onSelect: dismissFn
|
|
708
|
-
}),
|
|
709
|
-
new AutoEmbedOption(`Embed ${activeEmbedConfig.contentName}`, {
|
|
710
|
-
onSelect: embedFn
|
|
711
|
-
})
|
|
712
|
-
];
|
|
713
|
-
};
|
|
714
|
-
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
715
|
-
modal,
|
|
716
|
-
/* @__PURE__ */ jsx2(
|
|
717
|
-
LexicalAutoEmbedPlugin,
|
|
718
|
-
{
|
|
719
|
-
embedConfigs: EmbedConfigs,
|
|
720
|
-
onOpenEmbedModalForConfig: openEmbedModal,
|
|
721
|
-
getMenuOptions,
|
|
722
|
-
menuRenderFn: (anchorElementRef, { selectedIndex, options, selectOptionAndCleanUp, setHighlightedIndex }) => anchorElementRef.current ? ReactDOM.createPortal(
|
|
723
|
-
/* @__PURE__ */ jsx2(
|
|
724
|
-
"div",
|
|
725
|
-
{
|
|
726
|
-
className: "typeahead-popover flex items-center auto-embed-menu",
|
|
727
|
-
style: {
|
|
728
|
-
marginLeft: `${Math.max(
|
|
729
|
-
parseFloat(anchorElementRef.current.style.width) - 200,
|
|
730
|
-
0
|
|
731
|
-
)}px`,
|
|
732
|
-
width: 200
|
|
733
|
-
},
|
|
734
|
-
children: /* @__PURE__ */ jsx2(
|
|
735
|
-
AutoEmbedMenu,
|
|
736
|
-
{
|
|
737
|
-
options,
|
|
738
|
-
selectedItemIndex: selectedIndex,
|
|
739
|
-
onOptionClick: (option, index) => {
|
|
740
|
-
setHighlightedIndex(index);
|
|
741
|
-
selectOptionAndCleanUp(option);
|
|
742
|
-
},
|
|
743
|
-
onOptionMouseEnter: (index) => {
|
|
744
|
-
setHighlightedIndex(index);
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
)
|
|
748
|
-
}
|
|
749
|
-
),
|
|
750
|
-
anchorElementRef.current
|
|
751
|
-
) : null
|
|
752
|
-
}
|
|
753
|
-
)
|
|
754
|
-
] });
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
export {
|
|
758
|
-
LayoutItemNode,
|
|
759
|
-
$createLayoutItemNode,
|
|
760
|
-
LayoutContainerNode,
|
|
761
|
-
$createLayoutContainerNode,
|
|
762
|
-
Youtube,
|
|
763
|
-
Twitter,
|
|
764
|
-
Figma,
|
|
765
|
-
INSERT_LAYOUT_COMMAND,
|
|
766
|
-
LayoutPlugin,
|
|
767
|
-
FigmaPlugin,
|
|
768
|
-
YouTubePlugin,
|
|
769
|
-
TwitterPlugin,
|
|
770
|
-
YoutubeEmbedConfig,
|
|
771
|
-
TwitterEmbedConfig,
|
|
772
|
-
FigmaEmbedConfig,
|
|
773
|
-
AutoEmbedDialog,
|
|
774
|
-
AutoEmbedPlugin
|
|
775
|
-
};
|