@collabchron/notiq 1.1.11 → 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-2WZUFWSC.mjs → AIDialog-HJW6PQPR.mjs} +12 -13
- 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-SIMURTCA.mjs → ExcalidrawComponent-POMYXDSG.mjs} +34 -7
- 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-WQSNFPMM.mjs → StoryBuilderComponent-CBRFPFTR.mjs} +9 -10
- package/dist/{chunk-6UVNHT3T.mjs → chunk-4SYRK2NH.mjs} +23 -1
- package/dist/chunk-5CJZC5IB.mjs +9086 -0
- package/dist/{chunk-MW6MAUY3.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-XAVQAXOJ.mjs → chunk-CQCS5YPS.mjs} +3 -5
- package/dist/{chunk-YTLUQJE2.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-GYYLZ3MQ.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-XZXGYNTY.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-XAJ4GACN.mjs +746 -0
- package/dist/{chunk-7QRJVZQY.mjs → chunk-YVUQRJVV.mjs} +63 -18
- package/dist/components/editor/Core.d.ts +15 -2
- package/dist/components/editor/index.d.ts +16 -5
- 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/index.d.ts +2 -1
- package/dist/core/react/NotiqContent.d.ts +4 -1
- package/dist/core/react/NotiqEditor.d.ts +8 -8
- package/dist/core/react/index.d.ts +1 -0
- package/dist/core/react/node-renderers.d.ts +73 -0
- package/dist/core/types.d.ts +1 -0
- package/dist/core.js +18136 -9084
- package/dist/core.mjs +58 -44
- package/dist/hooks/instructions-messages.d.ts +13 -4
- package/dist/{image-TPW7PZZK.mjs → image-AL6PHM2A.mjs} +18 -13
- package/dist/index.js +15180 -12858
- package/dist/index.mjs +121 -1641
- package/dist/{insert-audio-C66RZRKY.mjs → insert-audio-CRWR7EO5.mjs} +6 -8
- package/dist/{insert-file-3DTGRO7W.mjs → insert-file-I73AZW3L.mjs} +6 -8
- package/dist/{insert-gif-FIMCCBAI.mjs → insert-gif-KWRC3ACT.mjs} +4 -4
- package/dist/{insert-image-CZV6HWQZ.mjs → insert-image-XIY6BGW5.mjs} +6 -5
- 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 +17933 -9531
- package/dist/react.mjs +41 -34
- package/dist/{stepper-4AO5XMO7.mjs → stepper-ILF7YXTO.mjs} +64 -74
- 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-MRKY67ED.mjs +0 -14
- package/dist/CollaborationPlugin-TIZOQBUT.mjs +0 -405
- package/dist/CollaboratorsBar-TMKBOBJI.mjs +0 -20
- package/dist/CommentsPlugin-5M4RD6YO.mjs +0 -19
- package/dist/ExcalidrawPlugin-2SGPIQ6U.mjs +0 -14
- package/dist/ExportPlugin-OKZOLBGS.mjs +0 -42
- package/dist/FloatingLinkEditorPlugin-MABB34L7.mjs +0 -12
- package/dist/FloatingTextFormatToolbarPlugin-SO5VON7Q.mjs +0 -45
- package/dist/InlineCopilotPlugin-PNS5Y6OO.mjs +0 -360
- package/dist/MobileToolbar-JKP2MLQJ.mjs +0 -984
- package/dist/SlashCommand-2TNOOUBM.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-IIAOU4P5.mjs +0 -35
- package/dist/VersionHistoryPlugin-23MAZB4G.mjs +0 -371
- package/dist/background-color-OZJCBYCT.mjs +0 -425
- package/dist/block-format-MTSIXWID.mjs +0 -14
- package/dist/chunk-2KESP7OU.mjs +0 -809
- package/dist/chunk-3AHNLIME.mjs +0 -1701
- 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-6SRMKQSD.mjs +0 -682
- package/dist/chunk-ACV47ZKE.mjs +0 -201
- package/dist/chunk-AYNKORDO.mjs +0 -6
- package/dist/chunk-BGV62GC2.mjs +0 -26
- package/dist/chunk-D3IOUQFR.mjs +0 -441
- package/dist/chunk-EEBA6OAH.mjs +0 -59
- package/dist/chunk-EIZMKFHF.mjs +0 -32
- package/dist/chunk-EVPWKNE4.mjs +0 -27
- package/dist/chunk-FMJ7DGWP.mjs +0 -144
- package/dist/chunk-FYLRS4BG.mjs +0 -88
- package/dist/chunk-HOZ4QRFV.mjs +0 -536
- package/dist/chunk-IAFCQV3Z.mjs +0 -349
- package/dist/chunk-IU2N42JJ.mjs +0 -1763
- package/dist/chunk-J6ZUY5BY.mjs +0 -202
- package/dist/chunk-K5OAFEVY.mjs +0 -191
- package/dist/chunk-KDA7ZYMJ.mjs +0 -431
- package/dist/chunk-KXRLARGI.mjs +0 -26
- package/dist/chunk-LAUAYRPC.mjs +0 -944
- package/dist/chunk-LLCP7NVE.mjs +0 -449
- package/dist/chunk-LU2XWLOE.mjs +0 -219
- package/dist/chunk-MPTE332I.mjs +0 -787
- package/dist/chunk-MTQZWJHR.mjs +0 -111
- package/dist/chunk-OXWTZV3U.mjs +0 -174
- package/dist/chunk-PD5K4AGP.mjs +0 -64
- package/dist/chunk-PFH63ZU4.mjs +0 -33
- package/dist/chunk-PHRVYPVM.mjs +0 -808
- 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-VGAX6YEY.mjs +0 -399
- package/dist/chunk-W6GAJXUS.mjs +0 -334
- package/dist/chunk-XYDBUQ6Z.mjs +0 -1978
- package/dist/chunk-XYT6XM5S.mjs +0 -496
- package/dist/chunk-YDDBQZ77.mjs +0 -409
- package/dist/chunk-YE7M2VKR.mjs +0 -132
- package/dist/chunk-Z6JAFF55.mjs +0 -555
- package/dist/chunk-ZKZ7MLSS.mjs +0 -165
- package/dist/color-23323E3B.mjs +0 -13
- package/dist/font-IJKFR4BM.mjs +0 -12
- package/dist/font-size-GTL6UVQL.mjs +0 -15
- package/dist/insert-node-MA3FXEYN.mjs +0 -245
- package/dist/table-dropdown-4VCRSQB6.mjs +0 -391
- package/dist/text-align-CSDLJUDA.mjs +0 -121
- package/dist/text-format-6L5N3CHZ.mjs +0 -15
package/dist/chunk-YDDBQZ77.mjs
DELETED
|
@@ -1,409 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CollapsibleContainerNode,
|
|
3
|
-
CollapsibleContentNode,
|
|
4
|
-
CollapsibleTitleNode
|
|
5
|
-
} from "./chunk-4DVIYZVB.mjs";
|
|
6
|
-
import {
|
|
7
|
-
LayoutContainerNode,
|
|
8
|
-
LayoutItemNode
|
|
9
|
-
} from "./chunk-W6GAJXUS.mjs";
|
|
10
|
-
import {
|
|
11
|
-
InlineImageNode,
|
|
12
|
-
StepperNode
|
|
13
|
-
} from "./chunk-2KESP7OU.mjs";
|
|
14
|
-
import {
|
|
15
|
-
FigmaNode,
|
|
16
|
-
TweetNode,
|
|
17
|
-
YouTubeNode
|
|
18
|
-
} from "./chunk-VGAX6YEY.mjs";
|
|
19
|
-
import {
|
|
20
|
-
PollNode
|
|
21
|
-
} from "./chunk-N6ILV6NF.mjs";
|
|
22
|
-
import {
|
|
23
|
-
StoryBuilderNode
|
|
24
|
-
} from "./chunk-YTLUQJE2.mjs";
|
|
25
|
-
import {
|
|
26
|
-
DynamicBlockNode
|
|
27
|
-
} from "./chunk-43Z4Z2KD.mjs";
|
|
28
|
-
import {
|
|
29
|
-
AudioNode
|
|
30
|
-
} from "./chunk-XYMXGU4T.mjs";
|
|
31
|
-
import {
|
|
32
|
-
FileNode
|
|
33
|
-
} from "./chunk-ZFV2HGD3.mjs";
|
|
34
|
-
import {
|
|
35
|
-
ImageNode
|
|
36
|
-
} from "./chunk-GYYLZ3MQ.mjs";
|
|
37
|
-
import {
|
|
38
|
-
ExcalidrawNode
|
|
39
|
-
} from "./chunk-XZXGYNTY.mjs";
|
|
40
|
-
import {
|
|
41
|
-
EquationNode
|
|
42
|
-
} from "./chunk-KNW2CGIP.mjs";
|
|
43
|
-
import {
|
|
44
|
-
Hint
|
|
45
|
-
} from "./chunk-7QRJVZQY.mjs";
|
|
46
|
-
import {
|
|
47
|
-
__spreadProps,
|
|
48
|
-
__spreadValues,
|
|
49
|
-
init_react_shim
|
|
50
|
-
} from "./chunk-WYCFGRFJ.mjs";
|
|
51
|
-
|
|
52
|
-
// src/components/editor/plugins/LinkWithMetaData/index.tsx
|
|
53
|
-
init_react_shim();
|
|
54
|
-
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
55
|
-
import {
|
|
56
|
-
$getSelection,
|
|
57
|
-
$isRangeSelection,
|
|
58
|
-
COMMAND_PRIORITY_LOW,
|
|
59
|
-
createCommand,
|
|
60
|
-
ElementNode
|
|
61
|
-
} from "lexical";
|
|
62
|
-
import { $insertNodeToNearestRoot } from "@lexical/utils";
|
|
63
|
-
import { useEffect } from "react";
|
|
64
|
-
async function fetchMetadata(url) {
|
|
65
|
-
var _a;
|
|
66
|
-
try {
|
|
67
|
-
const proxyUrl = "https://api.allorigins.win/get?url=";
|
|
68
|
-
const response = await fetch(`${proxyUrl}${encodeURIComponent(url)}`);
|
|
69
|
-
const data = await response.json();
|
|
70
|
-
const html = data.contents;
|
|
71
|
-
const parser = new DOMParser();
|
|
72
|
-
const doc = parser.parseFromString(html, "text/html");
|
|
73
|
-
const getMetaTagContent = (property) => {
|
|
74
|
-
const element = doc.querySelector(`meta[property="${property}"]`) || doc.querySelector(`meta[name="${property}"]`);
|
|
75
|
-
return element ? element.getAttribute("content") : null;
|
|
76
|
-
};
|
|
77
|
-
const metadata = {
|
|
78
|
-
title: ((_a = doc.querySelector("title")) == null ? void 0 : _a.textContent) || getMetaTagContent("og:title") || "No title",
|
|
79
|
-
description: getMetaTagContent("og:description") || getMetaTagContent("description") || "No description",
|
|
80
|
-
image: getMetaTagContent("og:image") || void 0,
|
|
81
|
-
// Use a valid fallback image URL
|
|
82
|
-
website: getMetaTagContent("og:site_name") || new URL(url).hostname
|
|
83
|
-
// Use hostname as fallback
|
|
84
|
-
};
|
|
85
|
-
return metadata;
|
|
86
|
-
} catch (error) {
|
|
87
|
-
return {
|
|
88
|
-
title: "No title",
|
|
89
|
-
description: "No description",
|
|
90
|
-
image: void 0,
|
|
91
|
-
website: new URL(url).hostname
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
var LinkWithMetaDataNode = class _LinkWithMetaDataNode extends ElementNode {
|
|
96
|
-
constructor(url, editor, key) {
|
|
97
|
-
super(key);
|
|
98
|
-
this.__metadata = null;
|
|
99
|
-
this.__url = url;
|
|
100
|
-
this.__editor = editor;
|
|
101
|
-
}
|
|
102
|
-
static clone(node) {
|
|
103
|
-
return new _LinkWithMetaDataNode(node.__url, node.__editor, node.__key);
|
|
104
|
-
}
|
|
105
|
-
static importJSON(serializedNode) {
|
|
106
|
-
const node = $createLinkNode(serializedNode.url, serializedNode.__editor);
|
|
107
|
-
node.__metadata = serializedNode.metadata;
|
|
108
|
-
node.__url = serializedNode.url;
|
|
109
|
-
return node;
|
|
110
|
-
}
|
|
111
|
-
exportJSON() {
|
|
112
|
-
return __spreadProps(__spreadValues({}, super.exportJSON()), {
|
|
113
|
-
url: this.__url,
|
|
114
|
-
metadata: this.__metadata,
|
|
115
|
-
type: "link-with-metadata",
|
|
116
|
-
version: 1
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
static getType() {
|
|
120
|
-
return "link-with-metadata";
|
|
121
|
-
}
|
|
122
|
-
// Method to update metadata
|
|
123
|
-
setMetadata(metadata) {
|
|
124
|
-
const writable = this.getWritable();
|
|
125
|
-
writable.__metadata = metadata;
|
|
126
|
-
}
|
|
127
|
-
createDOM() {
|
|
128
|
-
var _a, _b, _c;
|
|
129
|
-
const elementDIV = document.createElement("div");
|
|
130
|
-
elementDIV.className = "dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-50 border border-zinc-200 bg-white/90 text-zinc-950 shadow-md w-full cursor-pointer p-3 rounded-sm border flex flex-row items-center justify-between";
|
|
131
|
-
elementDIV.setAttribute("contenteditable", "false");
|
|
132
|
-
const container = document.createElement("div");
|
|
133
|
-
container.className = "flex flex-row w-full max-sm:flex-col max-sm:gap-y-2 justify-between items-start gap-x-2";
|
|
134
|
-
if ((_a = this.__metadata) == null ? void 0 : _a.image) {
|
|
135
|
-
const leftContainer = document.createElement("div");
|
|
136
|
-
leftContainer.className = "flex w-full h-full max-w-[250px] max-h-[100px] min-h-[100px] order-6";
|
|
137
|
-
const image = document.createElement("img");
|
|
138
|
-
image.src = this.__metadata.image;
|
|
139
|
-
image.alt = `image for ${this.__metadata.title}`;
|
|
140
|
-
image.className = "w-full h-[100px] rounded-lg object-cover";
|
|
141
|
-
leftContainer.appendChild(image);
|
|
142
|
-
container.appendChild(leftContainer);
|
|
143
|
-
}
|
|
144
|
-
const rightContainer = document.createElement("div");
|
|
145
|
-
rightContainer.className = "flex flex-col flex-1 w-full flex-wrap items-start space-y-4";
|
|
146
|
-
const titleLink = document.createElement("a");
|
|
147
|
-
titleLink.className = "font-bold break-words hover:underline";
|
|
148
|
-
titleLink.href = this.__url || "#";
|
|
149
|
-
titleLink.textContent = this.__url || "No URL provided";
|
|
150
|
-
titleLink.target = "_blank";
|
|
151
|
-
rightContainer.appendChild(titleLink);
|
|
152
|
-
const descriptionSmall = document.createElement("small");
|
|
153
|
-
descriptionSmall.className = "font-[400] dark:text-gray-200 text-gray-500";
|
|
154
|
-
descriptionSmall.textContent = ((_b = this.__metadata) == null ? void 0 : _b.description) || "Loading metadata...";
|
|
155
|
-
rightContainer.appendChild(descriptionSmall);
|
|
156
|
-
const sourceSmall = document.createElement("small");
|
|
157
|
-
sourceSmall.className = "text-sm mt-4 font-[400] dark:text-gray-300 text-gray-500/50";
|
|
158
|
-
sourceSmall.textContent = ((_c = this.__metadata) == null ? void 0 : _c.website) || "";
|
|
159
|
-
rightContainer.appendChild(sourceSmall);
|
|
160
|
-
container.appendChild(rightContainer);
|
|
161
|
-
elementDIV.appendChild(container);
|
|
162
|
-
if (this.__url && !this.__metadata) {
|
|
163
|
-
fetchMetadata(this.__url).then((metadata) => {
|
|
164
|
-
this.__editor.update(() => {
|
|
165
|
-
this.setMetadata(metadata);
|
|
166
|
-
});
|
|
167
|
-
}).catch((error) => {
|
|
168
|
-
console.error("Error fetching metadata:", error);
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
return elementDIV;
|
|
172
|
-
}
|
|
173
|
-
updateDOM(prevNode, dom) {
|
|
174
|
-
var _a, _b, _c, _d;
|
|
175
|
-
if (this.__metadata !== prevNode.__metadata) {
|
|
176
|
-
const container = dom.querySelector("div");
|
|
177
|
-
const image = dom.querySelector("img");
|
|
178
|
-
const titleLink = dom.querySelector("a");
|
|
179
|
-
const descriptionSmall = dom.querySelector("small:nth-of-type(1)");
|
|
180
|
-
const sourceSmall = dom.querySelector("small:nth-of-type(2)");
|
|
181
|
-
if (titleLink && descriptionSmall && sourceSmall) {
|
|
182
|
-
titleLink.href = this.__url || "#";
|
|
183
|
-
titleLink.textContent = ((_a = this.__metadata) == null ? void 0 : _a.title) || this.__url || "No URL provided";
|
|
184
|
-
descriptionSmall.textContent = ((_b = this.__metadata) == null ? void 0 : _b.description) || "Loading metadata...";
|
|
185
|
-
sourceSmall.textContent = ((_c = this.__metadata) == null ? void 0 : _c.website) || "";
|
|
186
|
-
}
|
|
187
|
-
if ((_d = this.__metadata) == null ? void 0 : _d.image) {
|
|
188
|
-
if (!image) {
|
|
189
|
-
const leftContainer = document.createElement("div");
|
|
190
|
-
leftContainer.className = "flex h-full flex-shrink-0 order-6";
|
|
191
|
-
const newImage = document.createElement("img");
|
|
192
|
-
newImage.src = this.__metadata.image;
|
|
193
|
-
newImage.alt = "Custom Image";
|
|
194
|
-
newImage.className = "w-24 min-h-24 max-[250px] h-[200px] rounded-lg object-fill";
|
|
195
|
-
leftContainer.appendChild(newImage);
|
|
196
|
-
container == null ? void 0 : container.insertBefore(leftContainer, container.firstChild);
|
|
197
|
-
} else {
|
|
198
|
-
image.src = this.__metadata.image;
|
|
199
|
-
}
|
|
200
|
-
} else if (image) {
|
|
201
|
-
image.remove();
|
|
202
|
-
}
|
|
203
|
-
return true;
|
|
204
|
-
}
|
|
205
|
-
return false;
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
function $createLinkNode(url, editor) {
|
|
209
|
-
return new LinkWithMetaDataNode(url, editor);
|
|
210
|
-
}
|
|
211
|
-
var TOGGLE_LINK_COMMAND_LinkWithMetaDataNode = createCommand("toggleLink");
|
|
212
|
-
function LinkWithMetaDataPlugin() {
|
|
213
|
-
const [editor] = useLexicalComposerContext();
|
|
214
|
-
useEffect(() => {
|
|
215
|
-
if (!editor.hasNodes([LinkWithMetaDataNode])) {
|
|
216
|
-
throw new Error("LinkWithMetaDataPlugin: LinkWithMetaDataNode not registered on editor");
|
|
217
|
-
}
|
|
218
|
-
}, [editor]);
|
|
219
|
-
editor.registerCommand(
|
|
220
|
-
TOGGLE_LINK_COMMAND_LinkWithMetaDataNode,
|
|
221
|
-
(url) => {
|
|
222
|
-
const selection = $getSelection();
|
|
223
|
-
if ($isRangeSelection(selection)) {
|
|
224
|
-
const linkNode = $createLinkNode(url, editor);
|
|
225
|
-
$insertNodeToNearestRoot(linkNode);
|
|
226
|
-
}
|
|
227
|
-
return true;
|
|
228
|
-
},
|
|
229
|
-
COMMAND_PRIORITY_LOW
|
|
230
|
-
);
|
|
231
|
-
return null;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
// src/components/editor/nodes/index.ts
|
|
235
|
-
init_react_shim();
|
|
236
|
-
import { CodeHighlightNode, CodeNode } from "@lexical/code";
|
|
237
|
-
import { AutoLinkNode, LinkNode } from "@lexical/link";
|
|
238
|
-
import { ListItemNode, ListNode } from "@lexical/list";
|
|
239
|
-
import { MarkNode } from "@lexical/mark";
|
|
240
|
-
import { OverflowNode } from "@lexical/overflow";
|
|
241
|
-
import { HorizontalRuleNode } from "@lexical/react/LexicalHorizontalRuleNode";
|
|
242
|
-
import { HeadingNode, QuoteNode } from "@lexical/rich-text";
|
|
243
|
-
import { TableCellNode, TableNode, TableRowNode } from "@lexical/table";
|
|
244
|
-
var nodes = [
|
|
245
|
-
HeadingNode,
|
|
246
|
-
ListNode,
|
|
247
|
-
ListItemNode,
|
|
248
|
-
QuoteNode,
|
|
249
|
-
CodeNode,
|
|
250
|
-
TableNode,
|
|
251
|
-
TableCellNode,
|
|
252
|
-
TableRowNode,
|
|
253
|
-
CodeHighlightNode,
|
|
254
|
-
StepperNode,
|
|
255
|
-
AutoLinkNode,
|
|
256
|
-
YouTubeNode,
|
|
257
|
-
Hint,
|
|
258
|
-
TweetNode,
|
|
259
|
-
LinkNode,
|
|
260
|
-
OverflowNode,
|
|
261
|
-
HorizontalRuleNode,
|
|
262
|
-
MarkNode,
|
|
263
|
-
ImageNode,
|
|
264
|
-
PollNode,
|
|
265
|
-
LayoutItemNode,
|
|
266
|
-
LayoutContainerNode,
|
|
267
|
-
CollapsibleContainerNode,
|
|
268
|
-
CollapsibleContentNode,
|
|
269
|
-
CollapsibleTitleNode,
|
|
270
|
-
LinkWithMetaDataNode,
|
|
271
|
-
InlineImageNode,
|
|
272
|
-
ExcalidrawNode,
|
|
273
|
-
FigmaNode,
|
|
274
|
-
EquationNode,
|
|
275
|
-
StoryBuilderNode,
|
|
276
|
-
DynamicBlockNode,
|
|
277
|
-
AudioNode,
|
|
278
|
-
FileNode
|
|
279
|
-
];
|
|
280
|
-
var nestedNodes = [
|
|
281
|
-
HeadingNode,
|
|
282
|
-
ListNode,
|
|
283
|
-
ListItemNode,
|
|
284
|
-
LinkNode,
|
|
285
|
-
CodeHighlightNode,
|
|
286
|
-
QuoteNode,
|
|
287
|
-
CodeNode,
|
|
288
|
-
LinkWithMetaDataNode,
|
|
289
|
-
ImageNode,
|
|
290
|
-
InlineImageNode,
|
|
291
|
-
ExcalidrawNode,
|
|
292
|
-
FigmaNode,
|
|
293
|
-
EquationNode,
|
|
294
|
-
StoryBuilderNode,
|
|
295
|
-
DynamicBlockNode,
|
|
296
|
-
AudioNode,
|
|
297
|
-
FileNode
|
|
298
|
-
];
|
|
299
|
-
var nodes_default = nodes;
|
|
300
|
-
|
|
301
|
-
// src/components/editor/plugins/AutoLinkPlugin/index.tsx
|
|
302
|
-
init_react_shim();
|
|
303
|
-
import { useLexicalComposerContext as useLexicalComposerContext2 } from "@lexical/react/LexicalComposerContext";
|
|
304
|
-
import { useEffect as useEffect2 } from "react";
|
|
305
|
-
import { $getSelection as $getSelection2, $isRangeSelection as $isRangeSelection2 } from "lexical";
|
|
306
|
-
import { $isCodeHighlightNode } from "@lexical/code";
|
|
307
|
-
var URL_REGEX = new RegExp("((https?:\\/\\/(www\\.)?)|(www\\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)(?<![-.+():%])");
|
|
308
|
-
function LexicalAutoLinkPlugin() {
|
|
309
|
-
const [editor] = useLexicalComposerContext2();
|
|
310
|
-
useEffect2(() => {
|
|
311
|
-
const handlePaste = (event) => {
|
|
312
|
-
var _a;
|
|
313
|
-
const pastedText = (_a = event.clipboardData) == null ? void 0 : _a.getData("text/plain");
|
|
314
|
-
if (pastedText && URL_REGEX.test(pastedText)) {
|
|
315
|
-
event.preventDefault();
|
|
316
|
-
pastedText.split(" ").map((TEXT) => {
|
|
317
|
-
if (URL_REGEX.test(TEXT)) {
|
|
318
|
-
editor.update(() => {
|
|
319
|
-
const selection = $getSelection2();
|
|
320
|
-
if ($isRangeSelection2(selection)) {
|
|
321
|
-
const node = selection.anchor.getNode();
|
|
322
|
-
if (!$isCodeHighlightNode(node)) {
|
|
323
|
-
if (node && node.getTextContent() === TEXT) {
|
|
324
|
-
node.remove();
|
|
325
|
-
}
|
|
326
|
-
editor.dispatchCommand(TOGGLE_LINK_COMMAND_LinkWithMetaDataNode, TEXT);
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
});
|
|
330
|
-
}
|
|
331
|
-
});
|
|
332
|
-
}
|
|
333
|
-
};
|
|
334
|
-
const rootElement = editor.getRootElement();
|
|
335
|
-
if (rootElement) {
|
|
336
|
-
rootElement.addEventListener("paste", handlePaste);
|
|
337
|
-
}
|
|
338
|
-
return () => {
|
|
339
|
-
if (rootElement) {
|
|
340
|
-
rootElement.removeEventListener("paste", handlePaste);
|
|
341
|
-
}
|
|
342
|
-
};
|
|
343
|
-
}, [editor]);
|
|
344
|
-
return null;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
// src/components/editor/plugins/CodeHighlightPlugin/index.ts
|
|
348
|
-
init_react_shim();
|
|
349
|
-
import { CodeNode as CodeNode2 } from "@lexical/code";
|
|
350
|
-
import {
|
|
351
|
-
loadCodeTheme,
|
|
352
|
-
registerCodeHighlighting,
|
|
353
|
-
ShikiTokenizer
|
|
354
|
-
} from "@lexical/code-shiki";
|
|
355
|
-
import { useLexicalComposerContext as useLexicalComposerContext3 } from "@lexical/react/LexicalComposerContext";
|
|
356
|
-
import { $nodesOfType } from "lexical";
|
|
357
|
-
import { useTheme } from "next-themes";
|
|
358
|
-
import { useEffect as useEffect3, useRef, useState } from "react";
|
|
359
|
-
var DARK_CODE_THEME = "github-dark";
|
|
360
|
-
var LIGHT_CODE_THEME = "github-light";
|
|
361
|
-
function CodeHighlightPlugin() {
|
|
362
|
-
const [editor] = useLexicalComposerContext3();
|
|
363
|
-
let resolvedTheme;
|
|
364
|
-
try {
|
|
365
|
-
const themeContext = useTheme();
|
|
366
|
-
resolvedTheme = themeContext == null ? void 0 : themeContext.resolvedTheme;
|
|
367
|
-
} catch (e) {
|
|
368
|
-
}
|
|
369
|
-
const [mounted, setMounted] = useState(false);
|
|
370
|
-
useEffect3(() => {
|
|
371
|
-
setMounted(true);
|
|
372
|
-
}, []);
|
|
373
|
-
const isDark = mounted ? resolvedTheme === "dark" || typeof document !== "undefined" && document.documentElement.classList.contains("dark") : typeof document !== "undefined" && document.documentElement.classList.contains("dark");
|
|
374
|
-
const activeTheme = isDark ? DARK_CODE_THEME : LIGHT_CODE_THEME;
|
|
375
|
-
const tokenizerRef = useRef(__spreadProps(__spreadValues({}, ShikiTokenizer), {
|
|
376
|
-
defaultTheme: activeTheme
|
|
377
|
-
}));
|
|
378
|
-
tokenizerRef.current.defaultTheme = activeTheme;
|
|
379
|
-
useEffect3(() => {
|
|
380
|
-
loadCodeTheme(DARK_CODE_THEME);
|
|
381
|
-
loadCodeTheme(LIGHT_CODE_THEME);
|
|
382
|
-
}, []);
|
|
383
|
-
useEffect3(() => {
|
|
384
|
-
return registerCodeHighlighting(editor, tokenizerRef.current);
|
|
385
|
-
}, [editor]);
|
|
386
|
-
useEffect3(() => {
|
|
387
|
-
editor.update(() => {
|
|
388
|
-
const codeNodes = $nodesOfType(CodeNode2);
|
|
389
|
-
for (const node of codeNodes) {
|
|
390
|
-
const currentTheme = node.getTheme();
|
|
391
|
-
if (!currentTheme || currentTheme === DARK_CODE_THEME || currentTheme === LIGHT_CODE_THEME || currentTheme === "one-light" || currentTheme === "one-dark-pro" || currentTheme === "poimandres") {
|
|
392
|
-
if (currentTheme !== activeTheme) {
|
|
393
|
-
node.setTheme(activeTheme);
|
|
394
|
-
node.markDirty();
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
});
|
|
399
|
-
}, [editor, activeTheme]);
|
|
400
|
-
return null;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
export {
|
|
404
|
-
LinkWithMetaDataPlugin,
|
|
405
|
-
nestedNodes,
|
|
406
|
-
nodes_default,
|
|
407
|
-
LexicalAutoLinkPlugin,
|
|
408
|
-
CodeHighlightPlugin
|
|
409
|
-
};
|
package/dist/chunk-YE7M2VKR.mjs
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
updateFontSize,
|
|
3
|
-
updateFontSizeInSelection
|
|
4
|
-
} from "./chunk-6D6QLRYR.mjs";
|
|
5
|
-
import {
|
|
6
|
-
SHORTCUTS
|
|
7
|
-
} from "./chunk-K5OAFEVY.mjs";
|
|
8
|
-
import {
|
|
9
|
-
MAX_ALLOWED_FONT_SIZE,
|
|
10
|
-
MIN_ALLOWED_FONT_SIZE
|
|
11
|
-
} from "./chunk-4FFTOZGJ.mjs";
|
|
12
|
-
import {
|
|
13
|
-
Input
|
|
14
|
-
} from "./chunk-5NRAXWYA.mjs";
|
|
15
|
-
import {
|
|
16
|
-
Button
|
|
17
|
-
} from "./chunk-OE5JRLCN.mjs";
|
|
18
|
-
import {
|
|
19
|
-
cn
|
|
20
|
-
} from "./chunk-JHXDLYEV.mjs";
|
|
21
|
-
import {
|
|
22
|
-
init_react_shim
|
|
23
|
-
} from "./chunk-WYCFGRFJ.mjs";
|
|
24
|
-
|
|
25
|
-
// src/components/ui/drop-downs/font-size.tsx
|
|
26
|
-
init_react_shim();
|
|
27
|
-
import * as React from "react";
|
|
28
|
-
import { Minus, Plus } from "lucide-react";
|
|
29
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
30
|
-
function parseAllowedFontSize(input) {
|
|
31
|
-
const match = input.match(/^(\d+(?:\.\d+)?)px$/);
|
|
32
|
-
if (match) {
|
|
33
|
-
const n = Number(match[1]);
|
|
34
|
-
if (n >= MIN_ALLOWED_FONT_SIZE && n <= MAX_ALLOWED_FONT_SIZE) {
|
|
35
|
-
return input;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return "";
|
|
39
|
-
}
|
|
40
|
-
function FontSize({
|
|
41
|
-
selectionFontSize,
|
|
42
|
-
disabled,
|
|
43
|
-
editor,
|
|
44
|
-
className,
|
|
45
|
-
classNameContent
|
|
46
|
-
}) {
|
|
47
|
-
const [inputValue, setInputValue] = React.useState(selectionFontSize);
|
|
48
|
-
const [inputChangeFlag, setInputChangeFlag] = React.useState(false);
|
|
49
|
-
const handleKeyPress = (e) => {
|
|
50
|
-
const inputValueNumber = Number(inputValue);
|
|
51
|
-
if (e.key === "Tab") {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
if (["e", "E", "+", "-"].includes(e.key) || isNaN(inputValueNumber)) {
|
|
55
|
-
e.preventDefault();
|
|
56
|
-
setInputValue("");
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
setInputChangeFlag(true);
|
|
60
|
-
if (e.key === "Enter" || e.key === "Escape") {
|
|
61
|
-
e.preventDefault();
|
|
62
|
-
updateFontSizeByInputValue(inputValueNumber);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
const handleInputBlur = () => {
|
|
66
|
-
if (inputValue !== "" && inputChangeFlag) {
|
|
67
|
-
const inputValueNumber = Number(inputValue);
|
|
68
|
-
updateFontSizeByInputValue(inputValueNumber);
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
const updateFontSizeByInputValue = (inputValueNumber) => {
|
|
72
|
-
let updatedFontSize = inputValueNumber;
|
|
73
|
-
if (inputValueNumber > MAX_ALLOWED_FONT_SIZE) {
|
|
74
|
-
updatedFontSize = MAX_ALLOWED_FONT_SIZE;
|
|
75
|
-
} else if (inputValueNumber < MIN_ALLOWED_FONT_SIZE) {
|
|
76
|
-
updatedFontSize = MIN_ALLOWED_FONT_SIZE;
|
|
77
|
-
}
|
|
78
|
-
setInputValue(String(updatedFontSize));
|
|
79
|
-
updateFontSizeInSelection(editor, String(updatedFontSize) + "px", null);
|
|
80
|
-
setInputChangeFlag(false);
|
|
81
|
-
};
|
|
82
|
-
React.useEffect(() => {
|
|
83
|
-
setInputValue(selectionFontSize);
|
|
84
|
-
}, [selectionFontSize]);
|
|
85
|
-
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-row items-center gap-1", classNameContent), children: [
|
|
86
|
-
/* @__PURE__ */ jsx(
|
|
87
|
-
Button,
|
|
88
|
-
{
|
|
89
|
-
type: "button",
|
|
90
|
-
className: cn("h-7 min-w-[29px] w-[29px] px-[6px] border-none cursor-pointer", className),
|
|
91
|
-
tip: `decrement ${SHORTCUTS.INCREASE_FONT_SIZE}`,
|
|
92
|
-
disabled: disabled || selectionFontSize !== "" && Number(inputValue) <= MIN_ALLOWED_FONT_SIZE,
|
|
93
|
-
variant: "outline",
|
|
94
|
-
size: "Toolbar",
|
|
95
|
-
onClick: () => updateFontSize(editor, 2 /* decrement */, inputValue),
|
|
96
|
-
children: /* @__PURE__ */ jsx(Minus, { className: "w-[15px] h-[15px]" })
|
|
97
|
-
}
|
|
98
|
-
),
|
|
99
|
-
/* @__PURE__ */ jsx(
|
|
100
|
-
Input,
|
|
101
|
-
{
|
|
102
|
-
type: "number",
|
|
103
|
-
value: inputValue,
|
|
104
|
-
disabled,
|
|
105
|
-
className: cn("h-7 min-w-[29px] w-[29px] px-[6px] border-none cursor-text", className),
|
|
106
|
-
min: MIN_ALLOWED_FONT_SIZE,
|
|
107
|
-
max: MAX_ALLOWED_FONT_SIZE,
|
|
108
|
-
onChange: (e) => setInputValue(e.target.value),
|
|
109
|
-
onKeyDown: handleKeyPress,
|
|
110
|
-
onBlur: handleInputBlur
|
|
111
|
-
}
|
|
112
|
-
),
|
|
113
|
-
/* @__PURE__ */ jsx(
|
|
114
|
-
Button,
|
|
115
|
-
{
|
|
116
|
-
type: "button",
|
|
117
|
-
tip: `increment ${SHORTCUTS.DECREASE_FONT_SIZE}`,
|
|
118
|
-
className: cn("h-7 min-w-[29px] w-[29px] px-[6px] border-none cursor-pointer", className),
|
|
119
|
-
disabled: disabled || selectionFontSize !== "" && Number(inputValue) >= MAX_ALLOWED_FONT_SIZE,
|
|
120
|
-
variant: "outline",
|
|
121
|
-
size: "Toolbar",
|
|
122
|
-
onClick: () => updateFontSize(editor, 1 /* increment */, inputValue),
|
|
123
|
-
children: /* @__PURE__ */ jsx(Plus, { className: "w-4 h-4" })
|
|
124
|
-
}
|
|
125
|
-
)
|
|
126
|
-
] });
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export {
|
|
130
|
-
parseAllowedFontSize,
|
|
131
|
-
FontSize
|
|
132
|
-
};
|