@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.
Files changed (152) hide show
  1. package/dist/AICommandBarPlugin-ZEC755KY.mjs +27 -0
  2. package/dist/{AIDialog-2WZUFWSC.mjs → AIDialog-HJW6PQPR.mjs} +12 -13
  3. package/dist/{AudioComponent-CKLMLB5T.mjs → AudioComponent-W5XMZPQB.mjs} +10 -6
  4. package/dist/{DynamicBlockComponent-2LOADZUX.mjs → DynamicBlockComponent-CHRL2GAQ.mjs} +7 -6
  5. package/dist/{EquationComponent-4NFG55NQ.mjs → EquationComponent-GNQHG53L.mjs} +26 -7
  6. package/dist/{ExcalidrawComponent-SIMURTCA.mjs → ExcalidrawComponent-POMYXDSG.mjs} +34 -7
  7. package/dist/{FileComponent-Y56MX5QD.mjs → FileComponent-EOVCH4V5.mjs} +9 -5
  8. package/dist/{HintComponet-ET7M2Q7S.mjs → HintComponet-QXL5ESND.mjs} +32 -8
  9. package/dist/{InlineImageComponent-FVTA4LXZ.mjs → InlineImageComponent-KDN3VGZC.mjs} +8 -3
  10. package/dist/{StoryBuilderComponent-WQSNFPMM.mjs → StoryBuilderComponent-CBRFPFTR.mjs} +9 -10
  11. package/dist/{chunk-6UVNHT3T.mjs → chunk-4SYRK2NH.mjs} +23 -1
  12. package/dist/chunk-5CJZC5IB.mjs +9086 -0
  13. package/dist/{chunk-MW6MAUY3.mjs → chunk-6NK5DONB.mjs} +1 -1
  14. package/dist/{chunk-N6ILV6NF.mjs → chunk-ACW4DLVO.mjs} +21 -7
  15. package/dist/chunk-BCGD2YXP.mjs +574 -0
  16. package/dist/{chunk-TC3IISJZ.mjs → chunk-BTR3TPIN.mjs} +18 -5
  17. package/dist/{chunk-XAVQAXOJ.mjs → chunk-CQCS5YPS.mjs} +3 -5
  18. package/dist/{chunk-YTLUQJE2.mjs → chunk-D4UBNSUW.mjs} +1 -1
  19. package/dist/{chunk-KNW2CGIP.mjs → chunk-DBRZIA43.mjs} +4 -1
  20. package/dist/{chunk-CDAMHK63.mjs → chunk-GJK2L7ZM.mjs} +23 -2
  21. package/dist/{chunk-GYYLZ3MQ.mjs → chunk-IKYVBTCJ.mjs} +43 -20
  22. package/dist/chunk-IXRA5D53.mjs +10447 -0
  23. package/dist/{chunk-W6VQSFE5.mjs → chunk-J2CEQXG4.mjs} +1 -1
  24. package/dist/{chunk-43Z4Z2KD.mjs → chunk-JTNLN4JI.mjs} +1 -1
  25. package/dist/{chunk-OE5JRLCN.mjs → chunk-ONOHG5NB.mjs} +6 -4
  26. package/dist/{chunk-XZXGYNTY.mjs → chunk-OO42URWA.mjs} +27 -6
  27. package/dist/chunk-PBVRSNGU.mjs +129 -0
  28. package/dist/chunk-QCS57TIF.mjs +1794 -0
  29. package/dist/chunk-RNEIJRUS.mjs +60 -0
  30. package/dist/chunk-TJPTGECP.mjs +1556 -0
  31. package/dist/{chunk-XYMXGU4T.mjs → chunk-TMYRA2W4.mjs} +1 -1
  32. package/dist/{chunk-ZFV2HGD3.mjs → chunk-UNEFOZTS.mjs} +1 -1
  33. package/dist/chunk-X4NI7EQS.mjs +282 -0
  34. package/dist/chunk-XAJ4GACN.mjs +746 -0
  35. package/dist/{chunk-7QRJVZQY.mjs → chunk-YVUQRJVV.mjs} +63 -18
  36. package/dist/components/editor/Core.d.ts +15 -2
  37. package/dist/components/editor/index.d.ts +16 -5
  38. package/dist/components/editor/nodes/EquationNode/EquationNode.d.ts +1 -0
  39. package/dist/components/editor/nodes/Hint/index.d.ts +2 -1
  40. package/dist/components/editor/plugins/AICommandBarPlugin/index.d.ts +73 -1
  41. package/dist/components/editor/plugins/DraggableBlockPlugin/index.d.ts +25 -3
  42. package/dist/components/editor/plugins/InlineCopilotPlugin/index.d.ts +16 -3
  43. package/dist/components/editor/plugins/LinkWithMetaData/index.d.ts +20 -25
  44. package/dist/components/editor/plugins/MarkdownPastePlugin/index.d.ts +5 -0
  45. package/dist/components/editor/plugins/MarkdownTransformers/index.d.ts +2 -0
  46. package/dist/components/editor/plugins/SlashCommand/index.d.ts +18 -1
  47. package/dist/components/editor/plugins/SmartTypographyPlugin/index.d.ts +26 -0
  48. package/dist/components/editor/utils/aiStream.d.ts +27 -0
  49. package/dist/components/editor/utils/excalidrawDiagramBuilder.d.ts +29 -0
  50. package/dist/components/editor/utils/markdownTransformers.d.ts +4 -1
  51. package/dist/components/editor/utils/url.d.ts +16 -4
  52. package/dist/components/providers/AIContext.d.ts +8 -0
  53. package/dist/components/ui/equation/equationTypography.d.ts +23 -0
  54. package/dist/core/extension.d.ts +3 -1
  55. package/dist/core/extensions/blocks-kit.d.ts +22 -1
  56. package/dist/core/extensions/copilot-and-collab.d.ts +15 -1
  57. package/dist/core/index.d.ts +2 -1
  58. package/dist/core/react/NotiqContent.d.ts +4 -1
  59. package/dist/core/react/NotiqEditor.d.ts +8 -8
  60. package/dist/core/react/index.d.ts +1 -0
  61. package/dist/core/react/node-renderers.d.ts +73 -0
  62. package/dist/core/types.d.ts +1 -0
  63. package/dist/core.js +18136 -9084
  64. package/dist/core.mjs +58 -44
  65. package/dist/hooks/instructions-messages.d.ts +13 -4
  66. package/dist/{image-TPW7PZZK.mjs → image-AL6PHM2A.mjs} +18 -13
  67. package/dist/index.js +15180 -12858
  68. package/dist/index.mjs +121 -1641
  69. package/dist/{insert-audio-C66RZRKY.mjs → insert-audio-CRWR7EO5.mjs} +6 -8
  70. package/dist/{insert-file-3DTGRO7W.mjs → insert-file-I73AZW3L.mjs} +6 -8
  71. package/dist/{insert-gif-FIMCCBAI.mjs → insert-gif-KWRC3ACT.mjs} +4 -4
  72. package/dist/{insert-image-CZV6HWQZ.mjs → insert-image-XIY6BGW5.mjs} +6 -5
  73. package/dist/{insert-poll-6BCIFY5G.mjs → insert-poll-J5YVZNZ4.mjs} +4 -3
  74. package/dist/{insert-table-ZRJP6X52.mjs → insert-table-OIMJRFFK.mjs} +1 -1
  75. package/dist/{poll-component-VHMM5KKZ.mjs → poll-component-TVHXIKGQ.mjs} +3 -2
  76. package/dist/react.js +17933 -9531
  77. package/dist/react.mjs +41 -34
  78. package/dist/{stepper-4AO5XMO7.mjs → stepper-ILF7YXTO.mjs} +64 -74
  79. package/dist/styles/notiq.css +1 -1
  80. package/package.json +2 -2
  81. package/src/styles/notiq.css +20 -0
  82. package/dist/AICommandBarPlugin-TADJ3X2Y.mjs +0 -12
  83. package/dist/CodeActionMenuPlugin-MRKY67ED.mjs +0 -14
  84. package/dist/CollaborationPlugin-TIZOQBUT.mjs +0 -405
  85. package/dist/CollaboratorsBar-TMKBOBJI.mjs +0 -20
  86. package/dist/CommentsPlugin-5M4RD6YO.mjs +0 -19
  87. package/dist/ExcalidrawPlugin-2SGPIQ6U.mjs +0 -14
  88. package/dist/ExportPlugin-OKZOLBGS.mjs +0 -42
  89. package/dist/FloatingLinkEditorPlugin-MABB34L7.mjs +0 -12
  90. package/dist/FloatingTextFormatToolbarPlugin-SO5VON7Q.mjs +0 -45
  91. package/dist/InlineCopilotPlugin-PNS5Y6OO.mjs +0 -360
  92. package/dist/MobileToolbar-JKP2MLQJ.mjs +0 -984
  93. package/dist/SlashCommand-2TNOOUBM.mjs +0 -39
  94. package/dist/TableCellActionMenuPlugin-YWBA64J7.mjs +0 -838
  95. package/dist/TableHoverActionsPlugin-2EIXHEXN.mjs +0 -265
  96. package/dist/TemplatePlugin-HNTPEXBB.mjs +0 -9
  97. package/dist/ToolbarPlugin-IIAOU4P5.mjs +0 -35
  98. package/dist/VersionHistoryPlugin-23MAZB4G.mjs +0 -371
  99. package/dist/background-color-OZJCBYCT.mjs +0 -425
  100. package/dist/block-format-MTSIXWID.mjs +0 -14
  101. package/dist/chunk-2KESP7OU.mjs +0 -809
  102. package/dist/chunk-3AHNLIME.mjs +0 -1701
  103. package/dist/chunk-3IILA3IP.mjs +0 -28
  104. package/dist/chunk-4DVIYZVB.mjs +0 -193
  105. package/dist/chunk-4FFTOZGJ.mjs +0 -103
  106. package/dist/chunk-4UMUPCDK.mjs +0 -68
  107. package/dist/chunk-6D6QLRYR.mjs +0 -238
  108. package/dist/chunk-6SRMKQSD.mjs +0 -682
  109. package/dist/chunk-ACV47ZKE.mjs +0 -201
  110. package/dist/chunk-AYNKORDO.mjs +0 -6
  111. package/dist/chunk-BGV62GC2.mjs +0 -26
  112. package/dist/chunk-D3IOUQFR.mjs +0 -441
  113. package/dist/chunk-EEBA6OAH.mjs +0 -59
  114. package/dist/chunk-EIZMKFHF.mjs +0 -32
  115. package/dist/chunk-EVPWKNE4.mjs +0 -27
  116. package/dist/chunk-FMJ7DGWP.mjs +0 -144
  117. package/dist/chunk-FYLRS4BG.mjs +0 -88
  118. package/dist/chunk-HOZ4QRFV.mjs +0 -536
  119. package/dist/chunk-IAFCQV3Z.mjs +0 -349
  120. package/dist/chunk-IU2N42JJ.mjs +0 -1763
  121. package/dist/chunk-J6ZUY5BY.mjs +0 -202
  122. package/dist/chunk-K5OAFEVY.mjs +0 -191
  123. package/dist/chunk-KDA7ZYMJ.mjs +0 -431
  124. package/dist/chunk-KXRLARGI.mjs +0 -26
  125. package/dist/chunk-LAUAYRPC.mjs +0 -944
  126. package/dist/chunk-LLCP7NVE.mjs +0 -449
  127. package/dist/chunk-LU2XWLOE.mjs +0 -219
  128. package/dist/chunk-MPTE332I.mjs +0 -787
  129. package/dist/chunk-MTQZWJHR.mjs +0 -111
  130. package/dist/chunk-OXWTZV3U.mjs +0 -174
  131. package/dist/chunk-PD5K4AGP.mjs +0 -64
  132. package/dist/chunk-PFH63ZU4.mjs +0 -33
  133. package/dist/chunk-PHRVYPVM.mjs +0 -808
  134. package/dist/chunk-R7WFRENU.mjs +0 -262
  135. package/dist/chunk-RAVYEEIC.mjs +0 -36
  136. package/dist/chunk-RJQTA6HG.mjs +0 -358
  137. package/dist/chunk-SAOJHVPE.mjs +0 -153
  138. package/dist/chunk-VGAX6YEY.mjs +0 -399
  139. package/dist/chunk-W6GAJXUS.mjs +0 -334
  140. package/dist/chunk-XYDBUQ6Z.mjs +0 -1978
  141. package/dist/chunk-XYT6XM5S.mjs +0 -496
  142. package/dist/chunk-YDDBQZ77.mjs +0 -409
  143. package/dist/chunk-YE7M2VKR.mjs +0 -132
  144. package/dist/chunk-Z6JAFF55.mjs +0 -555
  145. package/dist/chunk-ZKZ7MLSS.mjs +0 -165
  146. package/dist/color-23323E3B.mjs +0 -13
  147. package/dist/font-IJKFR4BM.mjs +0 -12
  148. package/dist/font-size-GTL6UVQL.mjs +0 -15
  149. package/dist/insert-node-MA3FXEYN.mjs +0 -245
  150. package/dist/table-dropdown-4VCRSQB6.mjs +0 -391
  151. package/dist/text-align-CSDLJUDA.mjs +0 -121
  152. package/dist/text-format-6L5N3CHZ.mjs +0 -15
@@ -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
- };
@@ -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
- };
@@ -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
- };
@@ -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
- };
@@ -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
- };