@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-3IILA3IP.mjs
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
init_react_shim
|
|
3
|
-
} from "./chunk-WYCFGRFJ.mjs";
|
|
4
|
-
|
|
5
|
-
// src/components/editor/plugins/CodeActionMenuPlugin/utils.ts
|
|
6
|
-
init_react_shim();
|
|
7
|
-
import { debounce } from "lodash-es";
|
|
8
|
-
import { useMemo, useRef } from "react";
|
|
9
|
-
function useDebounce(fn, ms, maxWait) {
|
|
10
|
-
const funcRef = useRef(null);
|
|
11
|
-
funcRef.current = fn;
|
|
12
|
-
return useMemo(
|
|
13
|
-
() => debounce(
|
|
14
|
-
(...args) => {
|
|
15
|
-
if (funcRef.current) {
|
|
16
|
-
funcRef.current(...args);
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
ms,
|
|
20
|
-
{ maxWait }
|
|
21
|
-
),
|
|
22
|
-
[ms, maxWait]
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export {
|
|
27
|
-
useDebounce
|
|
28
|
-
};
|
package/dist/chunk-4DVIYZVB.mjs
DELETED
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__spreadProps,
|
|
3
|
-
__spreadValues,
|
|
4
|
-
init_react_shim
|
|
5
|
-
} from "./chunk-WYCFGRFJ.mjs";
|
|
6
|
-
|
|
7
|
-
// src/components/editor/nodes/CollapsibleNode/CollapsibleContainerNode.ts
|
|
8
|
-
init_react_shim();
|
|
9
|
-
import {
|
|
10
|
-
ElementNode
|
|
11
|
-
} from "lexical";
|
|
12
|
-
var CollapsibleContainerNode = class _CollapsibleContainerNode extends ElementNode {
|
|
13
|
-
constructor(open, key) {
|
|
14
|
-
super(key);
|
|
15
|
-
this.__open = open;
|
|
16
|
-
}
|
|
17
|
-
static getType() {
|
|
18
|
-
return "collapsible-container";
|
|
19
|
-
}
|
|
20
|
-
static clone(node) {
|
|
21
|
-
return new _CollapsibleContainerNode(node.__open, node.__key);
|
|
22
|
-
}
|
|
23
|
-
createDOM() {
|
|
24
|
-
const dom = document.createElement("details");
|
|
25
|
-
dom.classList.add("Collapsible__container");
|
|
26
|
-
dom.open = this.__open;
|
|
27
|
-
return dom;
|
|
28
|
-
}
|
|
29
|
-
updateDOM(prevNode, dom) {
|
|
30
|
-
if (prevNode.__open !== this.__open) {
|
|
31
|
-
dom.open = this.__open;
|
|
32
|
-
}
|
|
33
|
-
return false;
|
|
34
|
-
}
|
|
35
|
-
static importDOM() {
|
|
36
|
-
return {};
|
|
37
|
-
}
|
|
38
|
-
static importJSON() {
|
|
39
|
-
const node = $createCollapsibleContainerNode();
|
|
40
|
-
return node;
|
|
41
|
-
}
|
|
42
|
-
exportJSON() {
|
|
43
|
-
return __spreadProps(__spreadValues({}, super.exportJSON()), {
|
|
44
|
-
type: "collapsible-container",
|
|
45
|
-
version: 1
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
setOpen(open) {
|
|
49
|
-
const writable = this.getWritable();
|
|
50
|
-
writable.__open = open;
|
|
51
|
-
}
|
|
52
|
-
getOpen() {
|
|
53
|
-
return this.__open;
|
|
54
|
-
}
|
|
55
|
-
toggleOpen() {
|
|
56
|
-
this.setOpen(!this.getOpen());
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
function $createCollapsibleContainerNode() {
|
|
60
|
-
return new CollapsibleContainerNode(true);
|
|
61
|
-
}
|
|
62
|
-
function $isCollapsibleContainerNode(node) {
|
|
63
|
-
return node instanceof CollapsibleContainerNode;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// src/components/editor/nodes/CollapsibleNode/CollapsibleContentNode.ts
|
|
67
|
-
init_react_shim();
|
|
68
|
-
import {
|
|
69
|
-
ElementNode as ElementNode2
|
|
70
|
-
} from "lexical";
|
|
71
|
-
var CollapsibleContentNode = class _CollapsibleContentNode extends ElementNode2 {
|
|
72
|
-
static getType() {
|
|
73
|
-
return "collapsible-content";
|
|
74
|
-
}
|
|
75
|
-
static clone(node) {
|
|
76
|
-
return new _CollapsibleContentNode(node.__key);
|
|
77
|
-
}
|
|
78
|
-
createDOM() {
|
|
79
|
-
const dom = document.createElement("div");
|
|
80
|
-
dom.classList.add("Collapsible__content");
|
|
81
|
-
return dom;
|
|
82
|
-
}
|
|
83
|
-
updateDOM() {
|
|
84
|
-
return false;
|
|
85
|
-
}
|
|
86
|
-
static importDOM() {
|
|
87
|
-
return {};
|
|
88
|
-
}
|
|
89
|
-
static importJSON() {
|
|
90
|
-
return $createCollapsibleContentNode();
|
|
91
|
-
}
|
|
92
|
-
isShadowRoot() {
|
|
93
|
-
return true;
|
|
94
|
-
}
|
|
95
|
-
exportJSON() {
|
|
96
|
-
return __spreadProps(__spreadValues({}, super.exportJSON()), {
|
|
97
|
-
type: "collapsible-content",
|
|
98
|
-
version: 1
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
function $createCollapsibleContentNode() {
|
|
103
|
-
return new CollapsibleContentNode();
|
|
104
|
-
}
|
|
105
|
-
function $isCollapsibleContentNode(node) {
|
|
106
|
-
return node instanceof CollapsibleContentNode;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// src/components/editor/nodes/CollapsibleNode/CollapsibleTitleNode.ts
|
|
110
|
-
init_react_shim();
|
|
111
|
-
import {
|
|
112
|
-
$createParagraphNode,
|
|
113
|
-
$isElementNode,
|
|
114
|
-
ElementNode as ElementNode3
|
|
115
|
-
} from "lexical";
|
|
116
|
-
var CollapsibleTitleNode = class _CollapsibleTitleNode extends ElementNode3 {
|
|
117
|
-
static getType() {
|
|
118
|
-
return "collapsible-title";
|
|
119
|
-
}
|
|
120
|
-
static clone(node) {
|
|
121
|
-
return new _CollapsibleTitleNode(node.__key);
|
|
122
|
-
}
|
|
123
|
-
createDOM() {
|
|
124
|
-
const dom = document.createElement("summary");
|
|
125
|
-
dom.classList.add("Collapsible__title");
|
|
126
|
-
return dom;
|
|
127
|
-
}
|
|
128
|
-
updateDOM() {
|
|
129
|
-
return false;
|
|
130
|
-
}
|
|
131
|
-
static importDOM() {
|
|
132
|
-
return {};
|
|
133
|
-
}
|
|
134
|
-
static importJSON() {
|
|
135
|
-
return $createCollapsibleTitleNode();
|
|
136
|
-
}
|
|
137
|
-
exportJSON() {
|
|
138
|
-
return __spreadProps(__spreadValues({}, super.exportJSON()), {
|
|
139
|
-
type: "collapsible-title",
|
|
140
|
-
version: 1
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
collapseAtStart(_selection) {
|
|
144
|
-
this.getParentOrThrow().insertBefore(this);
|
|
145
|
-
return true;
|
|
146
|
-
}
|
|
147
|
-
insertNewAfter() {
|
|
148
|
-
const containerNode = this.getParentOrThrow();
|
|
149
|
-
if (!$isCollapsibleContainerNode(containerNode)) {
|
|
150
|
-
throw new Error(
|
|
151
|
-
"CollapsibleTitleNode expects to be child of CollapsibleContainerNode"
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
if (containerNode.getOpen()) {
|
|
155
|
-
const contentNode = this.getNextSibling();
|
|
156
|
-
if (!$isCollapsibleContentNode(contentNode)) {
|
|
157
|
-
throw new Error(
|
|
158
|
-
"CollapsibleTitleNode expects to have CollapsibleContentNode sibling"
|
|
159
|
-
);
|
|
160
|
-
}
|
|
161
|
-
const firstChild = contentNode.getFirstChild();
|
|
162
|
-
if ($isElementNode(firstChild)) {
|
|
163
|
-
return firstChild;
|
|
164
|
-
} else {
|
|
165
|
-
const paragraph = $createParagraphNode();
|
|
166
|
-
contentNode.append(paragraph);
|
|
167
|
-
return paragraph;
|
|
168
|
-
}
|
|
169
|
-
} else {
|
|
170
|
-
const paragraph = $createParagraphNode();
|
|
171
|
-
containerNode.insertAfter(paragraph);
|
|
172
|
-
return paragraph;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
function $createCollapsibleTitleNode() {
|
|
177
|
-
return new CollapsibleTitleNode();
|
|
178
|
-
}
|
|
179
|
-
function $isCollapsibleTitleNode(node) {
|
|
180
|
-
return node instanceof CollapsibleTitleNode;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
export {
|
|
184
|
-
CollapsibleContainerNode,
|
|
185
|
-
$createCollapsibleContainerNode,
|
|
186
|
-
$isCollapsibleContainerNode,
|
|
187
|
-
CollapsibleContentNode,
|
|
188
|
-
$createCollapsibleContentNode,
|
|
189
|
-
$isCollapsibleContentNode,
|
|
190
|
-
CollapsibleTitleNode,
|
|
191
|
-
$createCollapsibleTitleNode,
|
|
192
|
-
$isCollapsibleTitleNode
|
|
193
|
-
};
|
package/dist/chunk-4FFTOZGJ.mjs
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__spreadProps,
|
|
3
|
-
__spreadValues,
|
|
4
|
-
init_react_shim
|
|
5
|
-
} from "./chunk-WYCFGRFJ.mjs";
|
|
6
|
-
|
|
7
|
-
// src/components/providers/ToolbarContext.tsx
|
|
8
|
-
init_react_shim();
|
|
9
|
-
import {
|
|
10
|
-
createContext,
|
|
11
|
-
useCallback,
|
|
12
|
-
useContext,
|
|
13
|
-
useEffect,
|
|
14
|
-
useMemo,
|
|
15
|
-
useState
|
|
16
|
-
} from "react";
|
|
17
|
-
import { jsx } from "react/jsx-runtime";
|
|
18
|
-
var MIN_ALLOWED_FONT_SIZE = 8;
|
|
19
|
-
var MAX_ALLOWED_FONT_SIZE = 72;
|
|
20
|
-
var DEFAULT_FONT_SIZE = 15;
|
|
21
|
-
var blockTypeToBlockName = {
|
|
22
|
-
bullet: "Bulleted List",
|
|
23
|
-
check: "Check List",
|
|
24
|
-
code: "Code Block",
|
|
25
|
-
h1: "Heading 1",
|
|
26
|
-
h2: "Heading 2",
|
|
27
|
-
h3: "Heading 3",
|
|
28
|
-
h4: "Heading 4",
|
|
29
|
-
h5: "Heading 5",
|
|
30
|
-
h6: "Heading 6",
|
|
31
|
-
number: "Numbered List",
|
|
32
|
-
paragraph: "Normal",
|
|
33
|
-
quote: "Quote"
|
|
34
|
-
};
|
|
35
|
-
var INITIAL_TOOLBAR_STATE = {
|
|
36
|
-
bgColor: "#fff",
|
|
37
|
-
blockType: "paragraph",
|
|
38
|
-
canRedo: false,
|
|
39
|
-
canUndo: false,
|
|
40
|
-
codeLanguage: "",
|
|
41
|
-
elementFormat: "left",
|
|
42
|
-
fontColor: "#000",
|
|
43
|
-
fontFamily: "Arial",
|
|
44
|
-
// Current font size in px
|
|
45
|
-
fontSize: `${DEFAULT_FONT_SIZE}px`,
|
|
46
|
-
// Font size input value - for controlled input
|
|
47
|
-
fontSizeInputValue: `${DEFAULT_FONT_SIZE}`,
|
|
48
|
-
isBold: false,
|
|
49
|
-
isCode: false,
|
|
50
|
-
isImageCaption: false,
|
|
51
|
-
isItalic: false,
|
|
52
|
-
isLink: false,
|
|
53
|
-
isRTL: false,
|
|
54
|
-
isStrikethrough: false,
|
|
55
|
-
isSubscript: false,
|
|
56
|
-
isSuperscript: false,
|
|
57
|
-
isUnderline: false,
|
|
58
|
-
isLowercase: false,
|
|
59
|
-
isUppercase: false,
|
|
60
|
-
isCapitalize: false,
|
|
61
|
-
rootType: "root"
|
|
62
|
-
};
|
|
63
|
-
var Context = createContext(void 0);
|
|
64
|
-
var ToolbarContext = ({
|
|
65
|
-
children
|
|
66
|
-
}) => {
|
|
67
|
-
const [toolbarState, setToolbarState] = useState(INITIAL_TOOLBAR_STATE);
|
|
68
|
-
const selectionFontSize = toolbarState.fontSize;
|
|
69
|
-
const updateToolbarState = useCallback(
|
|
70
|
-
(key, value) => {
|
|
71
|
-
setToolbarState((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
72
|
-
[key]: value
|
|
73
|
-
}));
|
|
74
|
-
},
|
|
75
|
-
[]
|
|
76
|
-
);
|
|
77
|
-
useEffect(() => {
|
|
78
|
-
updateToolbarState("fontSizeInputValue", selectionFontSize.slice(0, -2));
|
|
79
|
-
}, [selectionFontSize, updateToolbarState]);
|
|
80
|
-
const contextValue = useMemo(() => {
|
|
81
|
-
return {
|
|
82
|
-
toolbarState,
|
|
83
|
-
updateToolbarState
|
|
84
|
-
};
|
|
85
|
-
}, [toolbarState, updateToolbarState]);
|
|
86
|
-
return /* @__PURE__ */ jsx(Context.Provider, { value: contextValue, children });
|
|
87
|
-
};
|
|
88
|
-
var useToolbarState = () => {
|
|
89
|
-
const context = useContext(Context);
|
|
90
|
-
if (context === void 0) {
|
|
91
|
-
throw new Error("useToolbarState must be used within a ToolbarProvider");
|
|
92
|
-
}
|
|
93
|
-
return context;
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
export {
|
|
97
|
-
MIN_ALLOWED_FONT_SIZE,
|
|
98
|
-
MAX_ALLOWED_FONT_SIZE,
|
|
99
|
-
DEFAULT_FONT_SIZE,
|
|
100
|
-
blockTypeToBlockName,
|
|
101
|
-
ToolbarContext,
|
|
102
|
-
useToolbarState
|
|
103
|
-
};
|
package/dist/chunk-4UMUPCDK.mjs
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
init_react_shim
|
|
3
|
-
} from "./chunk-WYCFGRFJ.mjs";
|
|
4
|
-
|
|
5
|
-
// src/components/ui/equation/KatexRenderer.tsx
|
|
6
|
-
init_react_shim();
|
|
7
|
-
import katex from "katex";
|
|
8
|
-
import { useEffect, useRef } from "react";
|
|
9
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
-
function KatexRenderer({
|
|
11
|
-
equation,
|
|
12
|
-
inline,
|
|
13
|
-
onDoubleClick
|
|
14
|
-
}) {
|
|
15
|
-
const katexElementRef = useRef(null);
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
const katexElement = katexElementRef.current;
|
|
18
|
-
if (katexElement !== null) {
|
|
19
|
-
katex.render(equation, katexElement, {
|
|
20
|
-
displayMode: !inline,
|
|
21
|
-
// true === block display //
|
|
22
|
-
errorColor: "#cc0000",
|
|
23
|
-
output: "html",
|
|
24
|
-
strict: "warn",
|
|
25
|
-
throwOnError: false,
|
|
26
|
-
trust: false
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
}, [equation, inline]);
|
|
30
|
-
return (
|
|
31
|
-
// We use an empty image tag either side to ensure Android doesn't try and compose from the
|
|
32
|
-
// inner text from Katex. There didn't seem to be any other way of making this work,
|
|
33
|
-
// without having a physical space.
|
|
34
|
-
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
35
|
-
/* @__PURE__ */ jsx(
|
|
36
|
-
"img",
|
|
37
|
-
{
|
|
38
|
-
src: "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
|
|
39
|
-
width: "0",
|
|
40
|
-
height: "0",
|
|
41
|
-
alt: ""
|
|
42
|
-
}
|
|
43
|
-
),
|
|
44
|
-
/* @__PURE__ */ jsx(
|
|
45
|
-
"span",
|
|
46
|
-
{
|
|
47
|
-
role: "button",
|
|
48
|
-
tabIndex: -1,
|
|
49
|
-
onDoubleClick,
|
|
50
|
-
ref: katexElementRef
|
|
51
|
-
}
|
|
52
|
-
),
|
|
53
|
-
/* @__PURE__ */ jsx(
|
|
54
|
-
"img",
|
|
55
|
-
{
|
|
56
|
-
src: "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
|
|
57
|
-
width: "0",
|
|
58
|
-
height: "0",
|
|
59
|
-
alt: ""
|
|
60
|
-
}
|
|
61
|
-
)
|
|
62
|
-
] })
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export {
|
|
67
|
-
KatexRenderer
|
|
68
|
-
};
|
package/dist/chunk-6D6QLRYR.mjs
DELETED
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DEFAULT_FONT_SIZE,
|
|
3
|
-
MAX_ALLOWED_FONT_SIZE,
|
|
4
|
-
MIN_ALLOWED_FONT_SIZE
|
|
5
|
-
} from "./chunk-4FFTOZGJ.mjs";
|
|
6
|
-
import {
|
|
7
|
-
init_react_shim
|
|
8
|
-
} from "./chunk-WYCFGRFJ.mjs";
|
|
9
|
-
|
|
10
|
-
// src/components/editor/utils/editorFormatting.ts
|
|
11
|
-
init_react_shim();
|
|
12
|
-
import { $createCodeNode } from "@lexical/code";
|
|
13
|
-
import {
|
|
14
|
-
INSERT_CHECK_LIST_COMMAND,
|
|
15
|
-
INSERT_ORDERED_LIST_COMMAND,
|
|
16
|
-
INSERT_UNORDERED_LIST_COMMAND
|
|
17
|
-
} from "@lexical/list";
|
|
18
|
-
import { $isDecoratorBlockNode } from "@lexical/react/LexicalDecoratorBlockNode";
|
|
19
|
-
import {
|
|
20
|
-
$createHeadingNode,
|
|
21
|
-
$createQuoteNode,
|
|
22
|
-
$isHeadingNode,
|
|
23
|
-
$isQuoteNode
|
|
24
|
-
} from "@lexical/rich-text";
|
|
25
|
-
import { $patchStyleText, $setBlocksType } from "@lexical/selection";
|
|
26
|
-
import { $isTableSelection } from "@lexical/table";
|
|
27
|
-
import { $getNearestBlockElementAncestorOrThrow } from "@lexical/utils";
|
|
28
|
-
import {
|
|
29
|
-
$createParagraphNode,
|
|
30
|
-
$getSelection,
|
|
31
|
-
$isRangeSelection,
|
|
32
|
-
$isTextNode
|
|
33
|
-
} from "lexical";
|
|
34
|
-
var calculateNextFontSize = (currentFontSize, updateType) => {
|
|
35
|
-
if (!updateType) {
|
|
36
|
-
return currentFontSize;
|
|
37
|
-
}
|
|
38
|
-
let updatedFontSize = currentFontSize;
|
|
39
|
-
switch (updateType) {
|
|
40
|
-
case 2 /* decrement */:
|
|
41
|
-
switch (true) {
|
|
42
|
-
case currentFontSize > MAX_ALLOWED_FONT_SIZE:
|
|
43
|
-
updatedFontSize = MAX_ALLOWED_FONT_SIZE;
|
|
44
|
-
break;
|
|
45
|
-
case currentFontSize >= 48:
|
|
46
|
-
updatedFontSize -= 12;
|
|
47
|
-
break;
|
|
48
|
-
case currentFontSize >= 24:
|
|
49
|
-
updatedFontSize -= 4;
|
|
50
|
-
break;
|
|
51
|
-
case currentFontSize >= 14:
|
|
52
|
-
updatedFontSize -= 2;
|
|
53
|
-
break;
|
|
54
|
-
case currentFontSize >= 9:
|
|
55
|
-
updatedFontSize -= 1;
|
|
56
|
-
break;
|
|
57
|
-
default:
|
|
58
|
-
updatedFontSize = MIN_ALLOWED_FONT_SIZE;
|
|
59
|
-
break;
|
|
60
|
-
}
|
|
61
|
-
break;
|
|
62
|
-
case 1 /* increment */:
|
|
63
|
-
switch (true) {
|
|
64
|
-
case currentFontSize < MIN_ALLOWED_FONT_SIZE:
|
|
65
|
-
updatedFontSize = MIN_ALLOWED_FONT_SIZE;
|
|
66
|
-
break;
|
|
67
|
-
case currentFontSize < 12:
|
|
68
|
-
updatedFontSize += 1;
|
|
69
|
-
break;
|
|
70
|
-
case currentFontSize < 20:
|
|
71
|
-
updatedFontSize += 2;
|
|
72
|
-
break;
|
|
73
|
-
case currentFontSize < 36:
|
|
74
|
-
updatedFontSize += 4;
|
|
75
|
-
break;
|
|
76
|
-
case currentFontSize <= 60:
|
|
77
|
-
updatedFontSize += 12;
|
|
78
|
-
break;
|
|
79
|
-
default:
|
|
80
|
-
updatedFontSize = MAX_ALLOWED_FONT_SIZE;
|
|
81
|
-
break;
|
|
82
|
-
}
|
|
83
|
-
break;
|
|
84
|
-
default:
|
|
85
|
-
break;
|
|
86
|
-
}
|
|
87
|
-
return updatedFontSize;
|
|
88
|
-
};
|
|
89
|
-
var updateFontSizeInSelection = (editor, newFontSize, updateType) => {
|
|
90
|
-
const getNextFontSize = (prevFontSize) => {
|
|
91
|
-
if (!prevFontSize) {
|
|
92
|
-
prevFontSize = `${DEFAULT_FONT_SIZE}px`;
|
|
93
|
-
}
|
|
94
|
-
prevFontSize = prevFontSize.slice(0, -2);
|
|
95
|
-
const nextFontSize = calculateNextFontSize(
|
|
96
|
-
Number(prevFontSize),
|
|
97
|
-
updateType
|
|
98
|
-
);
|
|
99
|
-
return `${nextFontSize}px`;
|
|
100
|
-
};
|
|
101
|
-
editor.update(() => {
|
|
102
|
-
if (editor.isEditable()) {
|
|
103
|
-
const selection = $getSelection();
|
|
104
|
-
if (selection !== null) {
|
|
105
|
-
$patchStyleText(selection, {
|
|
106
|
-
"font-size": newFontSize || getNextFontSize
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
};
|
|
112
|
-
var updateFontSize = (editor, updateType, inputValue) => {
|
|
113
|
-
if (inputValue !== "") {
|
|
114
|
-
const nextFontSize = calculateNextFontSize(Number(inputValue), updateType);
|
|
115
|
-
updateFontSizeInSelection(editor, String(nextFontSize) + "px", null);
|
|
116
|
-
} else {
|
|
117
|
-
updateFontSizeInSelection(editor, null, updateType);
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
var formatParagraph = (editor) => {
|
|
121
|
-
editor.update(() => {
|
|
122
|
-
const selection = $getSelection();
|
|
123
|
-
if ($isRangeSelection(selection)) {
|
|
124
|
-
$setBlocksType(selection, () => $createParagraphNode());
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
};
|
|
128
|
-
var formatHeading = (editor, blockType, headingSize) => {
|
|
129
|
-
if (blockType !== headingSize) {
|
|
130
|
-
editor.update(() => {
|
|
131
|
-
const selection = $getSelection();
|
|
132
|
-
$setBlocksType(selection, () => $createHeadingNode(headingSize));
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
var formatBulletList = (editor, blockType) => {
|
|
137
|
-
if (blockType !== "bullet") {
|
|
138
|
-
editor.dispatchCommand(INSERT_UNORDERED_LIST_COMMAND, void 0);
|
|
139
|
-
} else {
|
|
140
|
-
formatParagraph(editor);
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
var formatCheckList = (editor, blockType) => {
|
|
144
|
-
if (blockType !== "check") {
|
|
145
|
-
editor.dispatchCommand(INSERT_CHECK_LIST_COMMAND, void 0);
|
|
146
|
-
} else {
|
|
147
|
-
formatParagraph(editor);
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
var formatNumberedList = (editor, blockType) => {
|
|
151
|
-
if (blockType !== "number") {
|
|
152
|
-
editor.dispatchCommand(INSERT_ORDERED_LIST_COMMAND, void 0);
|
|
153
|
-
} else {
|
|
154
|
-
formatParagraph(editor);
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
var formatQuote = (editor, blockType) => {
|
|
158
|
-
if (blockType !== "quote") {
|
|
159
|
-
editor.update(() => {
|
|
160
|
-
const selection = $getSelection();
|
|
161
|
-
$setBlocksType(selection, () => $createQuoteNode());
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
var formatCode = (editor, blockType) => {
|
|
166
|
-
if (blockType !== "code") {
|
|
167
|
-
editor.update(() => {
|
|
168
|
-
let selection = $getSelection();
|
|
169
|
-
if (selection !== null) {
|
|
170
|
-
if (selection.isCollapsed()) {
|
|
171
|
-
$setBlocksType(selection, () => $createCodeNode());
|
|
172
|
-
} else {
|
|
173
|
-
const textContent = selection.getTextContent();
|
|
174
|
-
const codeNode = $createCodeNode();
|
|
175
|
-
selection.insertNodes([codeNode]);
|
|
176
|
-
selection = $getSelection();
|
|
177
|
-
if ($isRangeSelection(selection)) {
|
|
178
|
-
selection.insertRawText(textContent);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
var clearFormatting = (editor) => {
|
|
186
|
-
editor.update(() => {
|
|
187
|
-
const selection = $getSelection();
|
|
188
|
-
if ($isRangeSelection(selection) || $isTableSelection(selection)) {
|
|
189
|
-
const anchor = selection.anchor;
|
|
190
|
-
const focus = selection.focus;
|
|
191
|
-
const nodes = selection.getNodes();
|
|
192
|
-
const extractedNodes = selection.extract();
|
|
193
|
-
if (anchor.key === focus.key && anchor.offset === focus.offset) {
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
nodes.forEach((node, idx) => {
|
|
197
|
-
if ($isTextNode(node)) {
|
|
198
|
-
let textNode = node;
|
|
199
|
-
if (idx === 0 && anchor.offset !== 0) {
|
|
200
|
-
textNode = textNode.splitText(anchor.offset)[1] || textNode;
|
|
201
|
-
}
|
|
202
|
-
if (idx === nodes.length - 1) {
|
|
203
|
-
textNode = textNode.splitText(focus.offset)[0] || textNode;
|
|
204
|
-
}
|
|
205
|
-
const extractedTextNode = extractedNodes[0];
|
|
206
|
-
if (nodes.length === 1 && $isTextNode(extractedTextNode)) {
|
|
207
|
-
textNode = extractedTextNode;
|
|
208
|
-
}
|
|
209
|
-
if (textNode.__style !== "") {
|
|
210
|
-
textNode.setStyle("");
|
|
211
|
-
}
|
|
212
|
-
if (textNode.__format !== 0) {
|
|
213
|
-
textNode.setFormat(0);
|
|
214
|
-
$getNearestBlockElementAncestorOrThrow(textNode).setFormat("");
|
|
215
|
-
}
|
|
216
|
-
node = textNode;
|
|
217
|
-
} else if ($isHeadingNode(node) || $isQuoteNode(node)) {
|
|
218
|
-
node.replace($createParagraphNode(), true);
|
|
219
|
-
} else if ($isDecoratorBlockNode(node)) {
|
|
220
|
-
node.setFormat("");
|
|
221
|
-
}
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
});
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
export {
|
|
228
|
-
updateFontSizeInSelection,
|
|
229
|
-
updateFontSize,
|
|
230
|
-
formatParagraph,
|
|
231
|
-
formatHeading,
|
|
232
|
-
formatBulletList,
|
|
233
|
-
formatCheckList,
|
|
234
|
-
formatNumberedList,
|
|
235
|
-
formatQuote,
|
|
236
|
-
formatCode,
|
|
237
|
-
clearFormatting
|
|
238
|
-
};
|