tetrons 2.3.76 → 2.3.77
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/components/tetrons/EditorContent.tsx +29 -23
- package/dist/dictionaries/dictionaries/index.aff +205 -0
- package/dist/dictionaries/dictionaries/index.dic +49569 -0
- package/dist/index.cjs +303 -126
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +378 -197
- package/dist/styles/tetrons.css +9 -0
- package/package.json +5 -3
package/dist/index.cjs
CHANGED
|
@@ -5,6 +5,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __esm = (fn, res) => function __init() {
|
|
9
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
|
+
};
|
|
8
11
|
var __export = (target, all) => {
|
|
9
12
|
for (var name in all)
|
|
10
13
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -27,6 +30,66 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
30
|
));
|
|
28
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
32
|
|
|
33
|
+
// src/components/tetrons/toolbar/MathModal.js
|
|
34
|
+
var MathModal_exports = {};
|
|
35
|
+
__export(MathModal_exports, {
|
|
36
|
+
default: () => MathModal
|
|
37
|
+
});
|
|
38
|
+
function MathModal({
|
|
39
|
+
isOpen,
|
|
40
|
+
onClose,
|
|
41
|
+
onSubmit,
|
|
42
|
+
value,
|
|
43
|
+
setValue
|
|
44
|
+
}) {
|
|
45
|
+
(0, import_react19.useEffect)(() => {
|
|
46
|
+
const onEsc = (e) => {
|
|
47
|
+
if (e.key === "Escape") onClose();
|
|
48
|
+
};
|
|
49
|
+
if (isOpen) {
|
|
50
|
+
window.addEventListener("keydown", onEsc);
|
|
51
|
+
}
|
|
52
|
+
return () => window.removeEventListener("keydown", onEsc);
|
|
53
|
+
}, [isOpen, onClose]);
|
|
54
|
+
if (!isOpen) return null;
|
|
55
|
+
return /* @__PURE__ */ React.createElement("div", { className: "ai-modal-backdrop" }, /* @__PURE__ */ React.createElement("div", { className: "ai-modal-content" }, /* @__PURE__ */ React.createElement("div", { className: "ai-modal-title" }, "Insert LaTeX Equation"), /* @__PURE__ */ React.createElement(
|
|
56
|
+
"textarea",
|
|
57
|
+
{
|
|
58
|
+
className: "ai-modal-textarea",
|
|
59
|
+
placeholder: "Enter LaTeX code here...",
|
|
60
|
+
value,
|
|
61
|
+
onChange: (e) => setValue(e.target.value)
|
|
62
|
+
}
|
|
63
|
+
), /* @__PURE__ */ React.createElement("div", { className: "ai-modal-preview" }, /* @__PURE__ */ React.createElement("strong", null, "Preview:"), /* @__PURE__ */ React.createElement("div", { className: "ai-modal-preview-output" }, /* @__PURE__ */ React.createElement("span", { dangerouslySetInnerHTML: { __html: renderLatex(value) } }))), /* @__PURE__ */ React.createElement("div", { className: "ai-modal-actions" }, /* @__PURE__ */ React.createElement("button", { type: "button", className: "ai-cancel-btn", onClick: onClose }, "Cancel"), /* @__PURE__ */ React.createElement(
|
|
64
|
+
"button",
|
|
65
|
+
{
|
|
66
|
+
className: "ai-submit-btn",
|
|
67
|
+
onClick: () => onSubmit(value),
|
|
68
|
+
disabled: !value.trim()
|
|
69
|
+
},
|
|
70
|
+
"Insert"
|
|
71
|
+
))));
|
|
72
|
+
}
|
|
73
|
+
function renderLatex(latex) {
|
|
74
|
+
try {
|
|
75
|
+
return import_katex2.default.renderToString(latex, {
|
|
76
|
+
throwOnError: false,
|
|
77
|
+
displayMode: false
|
|
78
|
+
});
|
|
79
|
+
} catch {
|
|
80
|
+
return `<span style="color: red;">Invalid LaTeX</span>`;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
var import_react19, import_katex2, import_katex_min;
|
|
84
|
+
var init_MathModal = __esm({
|
|
85
|
+
"src/components/tetrons/toolbar/MathModal.js"() {
|
|
86
|
+
"use strict";
|
|
87
|
+
import_react19 = require("react");
|
|
88
|
+
import_katex2 = __toESM(require("katex"));
|
|
89
|
+
import_katex_min = require("katex/dist/katex.min.css");
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
30
93
|
// src/index.ts
|
|
31
94
|
var index_exports = {};
|
|
32
95
|
__export(index_exports, {
|
|
@@ -39,21 +102,77 @@ __export(index_exports, {
|
|
|
39
102
|
});
|
|
40
103
|
module.exports = __toCommonJS(index_exports);
|
|
41
104
|
|
|
105
|
+
// src/components/tetrons/extensions/MathExtension.ts
|
|
106
|
+
var import_core = require("@tiptap/core");
|
|
107
|
+
var import_katex = __toESM(require("katex"));
|
|
108
|
+
var MathInline = import_core.Node.create({
|
|
109
|
+
name: "mathInline",
|
|
110
|
+
inline: true,
|
|
111
|
+
group: "inline",
|
|
112
|
+
atom: true,
|
|
113
|
+
addAttributes() {
|
|
114
|
+
return {
|
|
115
|
+
formula: {
|
|
116
|
+
default: ""
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
},
|
|
120
|
+
parseHTML() {
|
|
121
|
+
return [{ tag: "span[data-math-inline]" }];
|
|
122
|
+
},
|
|
123
|
+
renderHTML({ HTMLAttributes }) {
|
|
124
|
+
return [
|
|
125
|
+
"span",
|
|
126
|
+
(0, import_core.mergeAttributes)(HTMLAttributes, {
|
|
127
|
+
"data-math-inline": "",
|
|
128
|
+
class: "math-inline"
|
|
129
|
+
}),
|
|
130
|
+
HTMLAttributes.formula
|
|
131
|
+
];
|
|
132
|
+
},
|
|
133
|
+
addNodeView() {
|
|
134
|
+
return ({ node }) => {
|
|
135
|
+
const span = document.createElement("span");
|
|
136
|
+
try {
|
|
137
|
+
span.innerHTML = import_katex.default.renderToString(node.attrs.formula, {
|
|
138
|
+
throwOnError: false,
|
|
139
|
+
displayMode: false
|
|
140
|
+
});
|
|
141
|
+
} catch {
|
|
142
|
+
span.textContent = node.attrs.formula;
|
|
143
|
+
}
|
|
144
|
+
return {
|
|
145
|
+
dom: span
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
},
|
|
149
|
+
addCommands() {
|
|
150
|
+
return {
|
|
151
|
+
insertMathInline: (formula) => ({ commands }) => {
|
|
152
|
+
return commands.insertContent({
|
|
153
|
+
type: this.name,
|
|
154
|
+
attrs: { formula }
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
|
|
42
161
|
// src/components/tetrons/EditorContent.tsx
|
|
43
|
-
var
|
|
44
|
-
var
|
|
162
|
+
var import_react22 = __toESM(require("react"));
|
|
163
|
+
var import_react23 = require("@tiptap/react");
|
|
45
164
|
|
|
46
165
|
// node_modules/@tiptap/extension-document/dist/index.js
|
|
47
|
-
var
|
|
48
|
-
var Document =
|
|
166
|
+
var import_core2 = require("@tiptap/core");
|
|
167
|
+
var Document = import_core2.Node.create({
|
|
49
168
|
name: "doc",
|
|
50
169
|
topNode: true,
|
|
51
170
|
content: "block+"
|
|
52
171
|
});
|
|
53
172
|
|
|
54
173
|
// node_modules/@tiptap/extension-paragraph/dist/index.js
|
|
55
|
-
var
|
|
56
|
-
var Paragraph =
|
|
174
|
+
var import_core3 = require("@tiptap/core");
|
|
175
|
+
var Paragraph = import_core3.Node.create({
|
|
57
176
|
name: "paragraph",
|
|
58
177
|
priority: 1e3,
|
|
59
178
|
addOptions() {
|
|
@@ -69,7 +188,7 @@ var Paragraph = import_core2.Node.create({
|
|
|
69
188
|
];
|
|
70
189
|
},
|
|
71
190
|
renderHTML({ HTMLAttributes }) {
|
|
72
|
-
return ["p", (0,
|
|
191
|
+
return ["p", (0, import_core3.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
73
192
|
},
|
|
74
193
|
addCommands() {
|
|
75
194
|
return {
|
|
@@ -86,14 +205,14 @@ var Paragraph = import_core2.Node.create({
|
|
|
86
205
|
});
|
|
87
206
|
|
|
88
207
|
// node_modules/@tiptap/extension-text/dist/index.js
|
|
89
|
-
var
|
|
90
|
-
var Text =
|
|
208
|
+
var import_core4 = require("@tiptap/core");
|
|
209
|
+
var Text = import_core4.Node.create({
|
|
91
210
|
name: "text",
|
|
92
211
|
group: "inline"
|
|
93
212
|
});
|
|
94
213
|
|
|
95
214
|
// node_modules/@tiptap/extension-history/dist/index.js
|
|
96
|
-
var
|
|
215
|
+
var import_core5 = require("@tiptap/core");
|
|
97
216
|
|
|
98
217
|
// node_modules/rope-sequence/dist/index.js
|
|
99
218
|
var GOOD_LEAF_SIZE = 200;
|
|
@@ -1310,7 +1429,7 @@ var NodeRange = class {
|
|
|
1310
1429
|
}
|
|
1311
1430
|
};
|
|
1312
1431
|
var emptyAttrs = /* @__PURE__ */ Object.create(null);
|
|
1313
|
-
var
|
|
1432
|
+
var Node5 = class _Node {
|
|
1314
1433
|
/**
|
|
1315
1434
|
@internal
|
|
1316
1435
|
*/
|
|
@@ -1711,7 +1830,7 @@ var Node4 = class _Node {
|
|
|
1711
1830
|
return node;
|
|
1712
1831
|
}
|
|
1713
1832
|
};
|
|
1714
|
-
|
|
1833
|
+
Node5.prototype.text = void 0;
|
|
1715
1834
|
function wrapMarks(marks, str) {
|
|
1716
1835
|
for (let i = marks.length - 1; i >= 0; i--)
|
|
1717
1836
|
str = marks[i].type.name + "(" + str + ")";
|
|
@@ -5715,7 +5834,7 @@ var undoNoScroll = buildCommand(false, false);
|
|
|
5715
5834
|
var redoNoScroll = buildCommand(true, false);
|
|
5716
5835
|
|
|
5717
5836
|
// node_modules/@tiptap/extension-history/dist/index.js
|
|
5718
|
-
var History =
|
|
5837
|
+
var History = import_core5.Extension.create({
|
|
5719
5838
|
name: "history",
|
|
5720
5839
|
addOptions() {
|
|
5721
5840
|
return {
|
|
@@ -5751,12 +5870,12 @@ var History = import_core4.Extension.create({
|
|
|
5751
5870
|
});
|
|
5752
5871
|
|
|
5753
5872
|
// node_modules/@tiptap/extension-bold/dist/index.js
|
|
5754
|
-
var
|
|
5873
|
+
var import_core6 = require("@tiptap/core");
|
|
5755
5874
|
var starInputRegex = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/;
|
|
5756
5875
|
var starPasteRegex = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g;
|
|
5757
5876
|
var underscoreInputRegex = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/;
|
|
5758
5877
|
var underscorePasteRegex = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g;
|
|
5759
|
-
var Bold =
|
|
5878
|
+
var Bold = import_core6.Mark.create({
|
|
5760
5879
|
name: "bold",
|
|
5761
5880
|
addOptions() {
|
|
5762
5881
|
return {
|
|
@@ -5783,7 +5902,7 @@ var Bold = import_core5.Mark.create({
|
|
|
5783
5902
|
];
|
|
5784
5903
|
},
|
|
5785
5904
|
renderHTML({ HTMLAttributes }) {
|
|
5786
|
-
return ["strong", (0,
|
|
5905
|
+
return ["strong", (0, import_core6.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
5787
5906
|
},
|
|
5788
5907
|
addCommands() {
|
|
5789
5908
|
return {
|
|
@@ -5806,11 +5925,11 @@ var Bold = import_core5.Mark.create({
|
|
|
5806
5925
|
},
|
|
5807
5926
|
addInputRules() {
|
|
5808
5927
|
return [
|
|
5809
|
-
(0,
|
|
5928
|
+
(0, import_core6.markInputRule)({
|
|
5810
5929
|
find: starInputRegex,
|
|
5811
5930
|
type: this.type
|
|
5812
5931
|
}),
|
|
5813
|
-
(0,
|
|
5932
|
+
(0, import_core6.markInputRule)({
|
|
5814
5933
|
find: underscoreInputRegex,
|
|
5815
5934
|
type: this.type
|
|
5816
5935
|
})
|
|
@@ -5818,11 +5937,11 @@ var Bold = import_core5.Mark.create({
|
|
|
5818
5937
|
},
|
|
5819
5938
|
addPasteRules() {
|
|
5820
5939
|
return [
|
|
5821
|
-
(0,
|
|
5940
|
+
(0, import_core6.markPasteRule)({
|
|
5822
5941
|
find: starPasteRegex,
|
|
5823
5942
|
type: this.type
|
|
5824
5943
|
}),
|
|
5825
|
-
(0,
|
|
5944
|
+
(0, import_core6.markPasteRule)({
|
|
5826
5945
|
find: underscorePasteRegex,
|
|
5827
5946
|
type: this.type
|
|
5828
5947
|
})
|
|
@@ -5831,12 +5950,12 @@ var Bold = import_core5.Mark.create({
|
|
|
5831
5950
|
});
|
|
5832
5951
|
|
|
5833
5952
|
// node_modules/@tiptap/extension-italic/dist/index.js
|
|
5834
|
-
var
|
|
5953
|
+
var import_core7 = require("@tiptap/core");
|
|
5835
5954
|
var starInputRegex2 = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/;
|
|
5836
5955
|
var starPasteRegex2 = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g;
|
|
5837
5956
|
var underscoreInputRegex2 = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/;
|
|
5838
5957
|
var underscorePasteRegex2 = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g;
|
|
5839
|
-
var Italic =
|
|
5958
|
+
var Italic = import_core7.Mark.create({
|
|
5840
5959
|
name: "italic",
|
|
5841
5960
|
addOptions() {
|
|
5842
5961
|
return {
|
|
@@ -5862,7 +5981,7 @@ var Italic = import_core6.Mark.create({
|
|
|
5862
5981
|
];
|
|
5863
5982
|
},
|
|
5864
5983
|
renderHTML({ HTMLAttributes }) {
|
|
5865
|
-
return ["em", (0,
|
|
5984
|
+
return ["em", (0, import_core7.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
5866
5985
|
},
|
|
5867
5986
|
addCommands() {
|
|
5868
5987
|
return {
|
|
@@ -5885,11 +6004,11 @@ var Italic = import_core6.Mark.create({
|
|
|
5885
6004
|
},
|
|
5886
6005
|
addInputRules() {
|
|
5887
6006
|
return [
|
|
5888
|
-
(0,
|
|
6007
|
+
(0, import_core7.markInputRule)({
|
|
5889
6008
|
find: starInputRegex2,
|
|
5890
6009
|
type: this.type
|
|
5891
6010
|
}),
|
|
5892
|
-
(0,
|
|
6011
|
+
(0, import_core7.markInputRule)({
|
|
5893
6012
|
find: underscoreInputRegex2,
|
|
5894
6013
|
type: this.type
|
|
5895
6014
|
})
|
|
@@ -5897,11 +6016,11 @@ var Italic = import_core6.Mark.create({
|
|
|
5897
6016
|
},
|
|
5898
6017
|
addPasteRules() {
|
|
5899
6018
|
return [
|
|
5900
|
-
(0,
|
|
6019
|
+
(0, import_core7.markPasteRule)({
|
|
5901
6020
|
find: starPasteRegex2,
|
|
5902
6021
|
type: this.type
|
|
5903
6022
|
}),
|
|
5904
|
-
(0,
|
|
6023
|
+
(0, import_core7.markPasteRule)({
|
|
5905
6024
|
find: underscorePasteRegex2,
|
|
5906
6025
|
type: this.type
|
|
5907
6026
|
})
|
|
@@ -5913,10 +6032,10 @@ var Italic = import_core6.Mark.create({
|
|
|
5913
6032
|
var import_extension_underline = __toESM(require("@tiptap/extension-underline"));
|
|
5914
6033
|
|
|
5915
6034
|
// node_modules/@tiptap/extension-strike/dist/index.js
|
|
5916
|
-
var
|
|
6035
|
+
var import_core8 = require("@tiptap/core");
|
|
5917
6036
|
var inputRegex = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/;
|
|
5918
6037
|
var pasteRegex = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g;
|
|
5919
|
-
var Strike =
|
|
6038
|
+
var Strike = import_core8.Mark.create({
|
|
5920
6039
|
name: "strike",
|
|
5921
6040
|
addOptions() {
|
|
5922
6041
|
return {
|
|
@@ -5942,7 +6061,7 @@ var Strike = import_core7.Mark.create({
|
|
|
5942
6061
|
];
|
|
5943
6062
|
},
|
|
5944
6063
|
renderHTML({ HTMLAttributes }) {
|
|
5945
|
-
return ["s", (0,
|
|
6064
|
+
return ["s", (0, import_core8.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
5946
6065
|
},
|
|
5947
6066
|
addCommands() {
|
|
5948
6067
|
return {
|
|
@@ -5964,7 +6083,7 @@ var Strike = import_core7.Mark.create({
|
|
|
5964
6083
|
},
|
|
5965
6084
|
addInputRules() {
|
|
5966
6085
|
return [
|
|
5967
|
-
(0,
|
|
6086
|
+
(0, import_core8.markInputRule)({
|
|
5968
6087
|
find: inputRegex,
|
|
5969
6088
|
type: this.type
|
|
5970
6089
|
})
|
|
@@ -5972,7 +6091,7 @@ var Strike = import_core7.Mark.create({
|
|
|
5972
6091
|
},
|
|
5973
6092
|
addPasteRules() {
|
|
5974
6093
|
return [
|
|
5975
|
-
(0,
|
|
6094
|
+
(0, import_core8.markPasteRule)({
|
|
5976
6095
|
find: pasteRegex,
|
|
5977
6096
|
type: this.type
|
|
5978
6097
|
})
|
|
@@ -5981,10 +6100,10 @@ var Strike = import_core7.Mark.create({
|
|
|
5981
6100
|
});
|
|
5982
6101
|
|
|
5983
6102
|
// node_modules/@tiptap/extension-code/dist/index.js
|
|
5984
|
-
var
|
|
6103
|
+
var import_core9 = require("@tiptap/core");
|
|
5985
6104
|
var inputRegex2 = /(^|[^`])`([^`]+)`(?!`)/;
|
|
5986
6105
|
var pasteRegex2 = /(^|[^`])`([^`]+)`(?!`)/g;
|
|
5987
|
-
var Code =
|
|
6106
|
+
var Code = import_core9.Mark.create({
|
|
5988
6107
|
name: "code",
|
|
5989
6108
|
addOptions() {
|
|
5990
6109
|
return {
|
|
@@ -6000,7 +6119,7 @@ var Code = import_core8.Mark.create({
|
|
|
6000
6119
|
];
|
|
6001
6120
|
},
|
|
6002
6121
|
renderHTML({ HTMLAttributes }) {
|
|
6003
|
-
return ["code", (0,
|
|
6122
|
+
return ["code", (0, import_core9.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
6004
6123
|
},
|
|
6005
6124
|
addCommands() {
|
|
6006
6125
|
return {
|
|
@@ -6022,7 +6141,7 @@ var Code = import_core8.Mark.create({
|
|
|
6022
6141
|
},
|
|
6023
6142
|
addInputRules() {
|
|
6024
6143
|
return [
|
|
6025
|
-
(0,
|
|
6144
|
+
(0, import_core9.markInputRule)({
|
|
6026
6145
|
find: inputRegex2,
|
|
6027
6146
|
type: this.type
|
|
6028
6147
|
})
|
|
@@ -6030,7 +6149,7 @@ var Code = import_core8.Mark.create({
|
|
|
6030
6149
|
},
|
|
6031
6150
|
addPasteRules() {
|
|
6032
6151
|
return [
|
|
6033
|
-
(0,
|
|
6152
|
+
(0, import_core9.markPasteRule)({
|
|
6034
6153
|
find: pasteRegex2,
|
|
6035
6154
|
type: this.type
|
|
6036
6155
|
})
|
|
@@ -6039,9 +6158,9 @@ var Code = import_core8.Mark.create({
|
|
|
6039
6158
|
});
|
|
6040
6159
|
|
|
6041
6160
|
// node_modules/@tiptap/extension-blockquote/dist/index.js
|
|
6042
|
-
var
|
|
6161
|
+
var import_core10 = require("@tiptap/core");
|
|
6043
6162
|
var inputRegex3 = /^\s*>\s$/;
|
|
6044
|
-
var Blockquote =
|
|
6163
|
+
var Blockquote = import_core10.Node.create({
|
|
6045
6164
|
name: "blockquote",
|
|
6046
6165
|
addOptions() {
|
|
6047
6166
|
return {
|
|
@@ -6057,7 +6176,7 @@ var Blockquote = import_core9.Node.create({
|
|
|
6057
6176
|
];
|
|
6058
6177
|
},
|
|
6059
6178
|
renderHTML({ HTMLAttributes }) {
|
|
6060
|
-
return ["blockquote", (0,
|
|
6179
|
+
return ["blockquote", (0, import_core10.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
6061
6180
|
},
|
|
6062
6181
|
addCommands() {
|
|
6063
6182
|
return {
|
|
@@ -6079,7 +6198,7 @@ var Blockquote = import_core9.Node.create({
|
|
|
6079
6198
|
},
|
|
6080
6199
|
addInputRules() {
|
|
6081
6200
|
return [
|
|
6082
|
-
(0,
|
|
6201
|
+
(0, import_core10.wrappingInputRule)({
|
|
6083
6202
|
find: inputRegex3,
|
|
6084
6203
|
type: this.type
|
|
6085
6204
|
})
|
|
@@ -6088,8 +6207,8 @@ var Blockquote = import_core9.Node.create({
|
|
|
6088
6207
|
});
|
|
6089
6208
|
|
|
6090
6209
|
// node_modules/@tiptap/extension-hard-break/dist/index.js
|
|
6091
|
-
var
|
|
6092
|
-
var HardBreak =
|
|
6210
|
+
var import_core11 = require("@tiptap/core");
|
|
6211
|
+
var HardBreak = import_core11.Node.create({
|
|
6093
6212
|
name: "hardBreak",
|
|
6094
6213
|
addOptions() {
|
|
6095
6214
|
return {
|
|
@@ -6107,7 +6226,7 @@ var HardBreak = import_core10.Node.create({
|
|
|
6107
6226
|
];
|
|
6108
6227
|
},
|
|
6109
6228
|
renderHTML({ HTMLAttributes }) {
|
|
6110
|
-
return ["br", (0,
|
|
6229
|
+
return ["br", (0, import_core11.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes)];
|
|
6111
6230
|
},
|
|
6112
6231
|
renderText() {
|
|
6113
6232
|
return "\n";
|
|
@@ -6146,8 +6265,8 @@ var HardBreak = import_core10.Node.create({
|
|
|
6146
6265
|
});
|
|
6147
6266
|
|
|
6148
6267
|
// node_modules/@tiptap/extension-heading/dist/index.js
|
|
6149
|
-
var
|
|
6150
|
-
var Heading =
|
|
6268
|
+
var import_core12 = require("@tiptap/core");
|
|
6269
|
+
var Heading = import_core12.Node.create({
|
|
6151
6270
|
name: "heading",
|
|
6152
6271
|
addOptions() {
|
|
6153
6272
|
return {
|
|
@@ -6175,7 +6294,7 @@ var Heading = import_core11.Node.create({
|
|
|
6175
6294
|
renderHTML({ node, HTMLAttributes }) {
|
|
6176
6295
|
const hasLevel = this.options.levels.includes(node.attrs.level);
|
|
6177
6296
|
const level = hasLevel ? node.attrs.level : this.options.levels[0];
|
|
6178
|
-
return [`h${level}`, (0,
|
|
6297
|
+
return [`h${level}`, (0, import_core12.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
6179
6298
|
},
|
|
6180
6299
|
addCommands() {
|
|
6181
6300
|
return {
|
|
@@ -6203,7 +6322,7 @@ var Heading = import_core11.Node.create({
|
|
|
6203
6322
|
},
|
|
6204
6323
|
addInputRules() {
|
|
6205
6324
|
return this.options.levels.map((level) => {
|
|
6206
|
-
return (0,
|
|
6325
|
+
return (0, import_core12.textblockTypeInputRule)({
|
|
6207
6326
|
find: new RegExp(`^(#{${Math.min(...this.options.levels)},${level}})\\s$`),
|
|
6208
6327
|
type: this.type,
|
|
6209
6328
|
getAttributes: {
|
|
@@ -6215,8 +6334,8 @@ var Heading = import_core11.Node.create({
|
|
|
6215
6334
|
});
|
|
6216
6335
|
|
|
6217
6336
|
// node_modules/@tiptap/extension-horizontal-rule/dist/index.js
|
|
6218
|
-
var
|
|
6219
|
-
var HorizontalRule =
|
|
6337
|
+
var import_core13 = require("@tiptap/core");
|
|
6338
|
+
var HorizontalRule = import_core13.Node.create({
|
|
6220
6339
|
name: "horizontalRule",
|
|
6221
6340
|
addOptions() {
|
|
6222
6341
|
return {
|
|
@@ -6228,12 +6347,12 @@ var HorizontalRule = import_core12.Node.create({
|
|
|
6228
6347
|
return [{ tag: "hr" }];
|
|
6229
6348
|
},
|
|
6230
6349
|
renderHTML({ HTMLAttributes }) {
|
|
6231
|
-
return ["hr", (0,
|
|
6350
|
+
return ["hr", (0, import_core13.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes)];
|
|
6232
6351
|
},
|
|
6233
6352
|
addCommands() {
|
|
6234
6353
|
return {
|
|
6235
6354
|
setHorizontalRule: () => ({ chain, state }) => {
|
|
6236
|
-
if (!(0,
|
|
6355
|
+
if (!(0, import_core13.canInsertNode)(state, state.schema.nodes[this.name])) {
|
|
6237
6356
|
return false;
|
|
6238
6357
|
}
|
|
6239
6358
|
const { selection } = state;
|
|
@@ -6246,7 +6365,7 @@ var HorizontalRule = import_core12.Node.create({
|
|
|
6246
6365
|
}, {
|
|
6247
6366
|
type: this.name
|
|
6248
6367
|
});
|
|
6249
|
-
} else if ((0,
|
|
6368
|
+
} else if ((0, import_core13.isNodeSelection)(selection)) {
|
|
6250
6369
|
currentChain.insertContentAt($originTo.pos, {
|
|
6251
6370
|
type: this.name
|
|
6252
6371
|
});
|
|
@@ -6282,7 +6401,7 @@ var HorizontalRule = import_core12.Node.create({
|
|
|
6282
6401
|
},
|
|
6283
6402
|
addInputRules() {
|
|
6284
6403
|
return [
|
|
6285
|
-
(0,
|
|
6404
|
+
(0, import_core13.nodeInputRule)({
|
|
6286
6405
|
find: /^(?:---|—-|___\s|\*\*\*\s)$/,
|
|
6287
6406
|
type: this.type
|
|
6288
6407
|
})
|
|
@@ -6299,8 +6418,8 @@ var import_extension_link = __toESM(require("@tiptap/extension-link"));
|
|
|
6299
6418
|
var import_extension_text_style = __toESM(require("@tiptap/extension-text-style"));
|
|
6300
6419
|
|
|
6301
6420
|
// node_modules/@tiptap/extension-list-item/dist/index.js
|
|
6302
|
-
var
|
|
6303
|
-
var ListItem =
|
|
6421
|
+
var import_core14 = require("@tiptap/core");
|
|
6422
|
+
var ListItem = import_core14.Node.create({
|
|
6304
6423
|
name: "listItem",
|
|
6305
6424
|
addOptions() {
|
|
6306
6425
|
return {
|
|
@@ -6319,7 +6438,7 @@ var ListItem = import_core13.Node.create({
|
|
|
6319
6438
|
];
|
|
6320
6439
|
},
|
|
6321
6440
|
renderHTML({ HTMLAttributes }) {
|
|
6322
|
-
return ["li", (0,
|
|
6441
|
+
return ["li", (0, import_core14.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
6323
6442
|
},
|
|
6324
6443
|
addKeyboardShortcuts() {
|
|
6325
6444
|
return {
|
|
@@ -6331,11 +6450,11 @@ var ListItem = import_core13.Node.create({
|
|
|
6331
6450
|
});
|
|
6332
6451
|
|
|
6333
6452
|
// node_modules/@tiptap/extension-bullet-list/dist/index.js
|
|
6334
|
-
var
|
|
6453
|
+
var import_core15 = require("@tiptap/core");
|
|
6335
6454
|
var ListItemName = "listItem";
|
|
6336
6455
|
var TextStyleName = "textStyle";
|
|
6337
6456
|
var inputRegex4 = /^\s*([-+*])\s$/;
|
|
6338
|
-
var BulletList =
|
|
6457
|
+
var BulletList = import_core15.Node.create({
|
|
6339
6458
|
name: "bulletList",
|
|
6340
6459
|
addOptions() {
|
|
6341
6460
|
return {
|
|
@@ -6355,7 +6474,7 @@ var BulletList = import_core14.Node.create({
|
|
|
6355
6474
|
];
|
|
6356
6475
|
},
|
|
6357
6476
|
renderHTML({ HTMLAttributes }) {
|
|
6358
|
-
return ["ul", (0,
|
|
6477
|
+
return ["ul", (0, import_core15.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
6359
6478
|
},
|
|
6360
6479
|
addCommands() {
|
|
6361
6480
|
return {
|
|
@@ -6373,12 +6492,12 @@ var BulletList = import_core14.Node.create({
|
|
|
6373
6492
|
};
|
|
6374
6493
|
},
|
|
6375
6494
|
addInputRules() {
|
|
6376
|
-
let inputRule = (0,
|
|
6495
|
+
let inputRule = (0, import_core15.wrappingInputRule)({
|
|
6377
6496
|
find: inputRegex4,
|
|
6378
6497
|
type: this.type
|
|
6379
6498
|
});
|
|
6380
6499
|
if (this.options.keepMarks || this.options.keepAttributes) {
|
|
6381
|
-
inputRule = (0,
|
|
6500
|
+
inputRule = (0, import_core15.wrappingInputRule)({
|
|
6382
6501
|
find: inputRegex4,
|
|
6383
6502
|
type: this.type,
|
|
6384
6503
|
keepMarks: this.options.keepMarks,
|
|
@@ -6396,11 +6515,11 @@ var BulletList = import_core14.Node.create({
|
|
|
6396
6515
|
});
|
|
6397
6516
|
|
|
6398
6517
|
// node_modules/@tiptap/extension-ordered-list/dist/index.js
|
|
6399
|
-
var
|
|
6518
|
+
var import_core16 = require("@tiptap/core");
|
|
6400
6519
|
var ListItemName2 = "listItem";
|
|
6401
6520
|
var TextStyleName2 = "textStyle";
|
|
6402
6521
|
var inputRegex5 = /^(\d+)\.\s$/;
|
|
6403
|
-
var OrderedList =
|
|
6522
|
+
var OrderedList = import_core16.Node.create({
|
|
6404
6523
|
name: "orderedList",
|
|
6405
6524
|
addOptions() {
|
|
6406
6525
|
return {
|
|
@@ -6437,7 +6556,7 @@ var OrderedList = import_core15.Node.create({
|
|
|
6437
6556
|
},
|
|
6438
6557
|
renderHTML({ HTMLAttributes }) {
|
|
6439
6558
|
const { start, ...attributesWithoutStart } = HTMLAttributes;
|
|
6440
|
-
return start === 1 ? ["ol", (0,
|
|
6559
|
+
return start === 1 ? ["ol", (0, import_core16.mergeAttributes)(this.options.HTMLAttributes, attributesWithoutStart), 0] : ["ol", (0, import_core16.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
6441
6560
|
},
|
|
6442
6561
|
addCommands() {
|
|
6443
6562
|
return {
|
|
@@ -6455,14 +6574,14 @@ var OrderedList = import_core15.Node.create({
|
|
|
6455
6574
|
};
|
|
6456
6575
|
},
|
|
6457
6576
|
addInputRules() {
|
|
6458
|
-
let inputRule = (0,
|
|
6577
|
+
let inputRule = (0, import_core16.wrappingInputRule)({
|
|
6459
6578
|
find: inputRegex5,
|
|
6460
6579
|
type: this.type,
|
|
6461
6580
|
getAttributes: (match) => ({ start: +match[1] }),
|
|
6462
6581
|
joinPredicate: (match, node) => node.childCount + node.attrs.start === +match[1]
|
|
6463
6582
|
});
|
|
6464
6583
|
if (this.options.keepMarks || this.options.keepAttributes) {
|
|
6465
|
-
inputRule = (0,
|
|
6584
|
+
inputRule = (0, import_core16.wrappingInputRule)({
|
|
6466
6585
|
find: inputRegex5,
|
|
6467
6586
|
type: this.type,
|
|
6468
6587
|
keepMarks: this.options.keepMarks,
|
|
@@ -8024,9 +8143,9 @@ function useTypo() {
|
|
|
8024
8143
|
}
|
|
8025
8144
|
|
|
8026
8145
|
// src/components/tetrons/extensions/Spellcheck.ts
|
|
8027
|
-
var
|
|
8146
|
+
var import_core17 = require("@tiptap/core");
|
|
8028
8147
|
var wordMatchRegex = () => /(?:^|\s)([a-zA-Z]{2,})(?=\s|$)/g;
|
|
8029
|
-
var Spellcheck =
|
|
8148
|
+
var Spellcheck = import_core17.Mark.create({
|
|
8030
8149
|
name: "spellcheck",
|
|
8031
8150
|
addOptions() {
|
|
8032
8151
|
return {
|
|
@@ -8035,7 +8154,7 @@ var Spellcheck = import_core16.Mark.create({
|
|
|
8035
8154
|
},
|
|
8036
8155
|
addInputRules() {
|
|
8037
8156
|
return [
|
|
8038
|
-
(0,
|
|
8157
|
+
(0, import_core17.markInputRule)({
|
|
8039
8158
|
find: wordMatchRegex(),
|
|
8040
8159
|
type: this.type,
|
|
8041
8160
|
getAttributes: (match) => this.options.spellcheckFn(match[1]) ? false : { "data-spellcheck": "true" }
|
|
@@ -8063,8 +8182,8 @@ var Spellcheck = import_core16.Mark.create({
|
|
|
8063
8182
|
});
|
|
8064
8183
|
|
|
8065
8184
|
// src/components/tetrons/toolbar/extensions/Comment.ts
|
|
8066
|
-
var
|
|
8067
|
-
var Comment =
|
|
8185
|
+
var import_core18 = require("@tiptap/core");
|
|
8186
|
+
var Comment = import_core18.Mark.create({
|
|
8068
8187
|
name: "comment",
|
|
8069
8188
|
addOptions() {
|
|
8070
8189
|
return {
|
|
@@ -8088,7 +8207,7 @@ var Comment = import_core17.Mark.create({
|
|
|
8088
8207
|
renderHTML({ HTMLAttributes }) {
|
|
8089
8208
|
return [
|
|
8090
8209
|
"span",
|
|
8091
|
-
(0,
|
|
8210
|
+
(0, import_core18.mergeAttributes)(HTMLAttributes, {
|
|
8092
8211
|
"data-comment": HTMLAttributes.comment,
|
|
8093
8212
|
class: "comment-highlight",
|
|
8094
8213
|
title: HTMLAttributes.comment,
|
|
@@ -8110,8 +8229,8 @@ var Comment = import_core17.Mark.create({
|
|
|
8110
8229
|
});
|
|
8111
8230
|
|
|
8112
8231
|
// src/components/tetrons/toolbar/marks/Subscript.ts
|
|
8113
|
-
var
|
|
8114
|
-
var Subscript =
|
|
8232
|
+
var import_core19 = require("@tiptap/core");
|
|
8233
|
+
var Subscript = import_core19.Mark.create({
|
|
8115
8234
|
name: "subscript",
|
|
8116
8235
|
excludes: "superscript",
|
|
8117
8236
|
parseHTML() {
|
|
@@ -8127,7 +8246,7 @@ var Subscript = import_core18.Mark.create({
|
|
|
8127
8246
|
},
|
|
8128
8247
|
addInputRules() {
|
|
8129
8248
|
return [
|
|
8130
|
-
(0,
|
|
8249
|
+
(0, import_core19.markInputRule)({
|
|
8131
8250
|
find: /~([^~]+)~/,
|
|
8132
8251
|
type: this.type
|
|
8133
8252
|
})
|
|
@@ -8135,7 +8254,7 @@ var Subscript = import_core18.Mark.create({
|
|
|
8135
8254
|
},
|
|
8136
8255
|
addPasteRules() {
|
|
8137
8256
|
return [
|
|
8138
|
-
(0,
|
|
8257
|
+
(0, import_core19.markPasteRule)({
|
|
8139
8258
|
find: /~([^~]+)~/g,
|
|
8140
8259
|
type: this.type
|
|
8141
8260
|
})
|
|
@@ -8144,8 +8263,8 @@ var Subscript = import_core18.Mark.create({
|
|
|
8144
8263
|
});
|
|
8145
8264
|
|
|
8146
8265
|
// src/components/tetrons/toolbar/marks/Superscript.ts
|
|
8147
|
-
var
|
|
8148
|
-
var Superscript =
|
|
8266
|
+
var import_core20 = require("@tiptap/core");
|
|
8267
|
+
var Superscript = import_core20.Mark.create({
|
|
8149
8268
|
name: "superscript",
|
|
8150
8269
|
excludes: "subscript",
|
|
8151
8270
|
parseHTML() {
|
|
@@ -8161,7 +8280,7 @@ var Superscript = import_core19.Mark.create({
|
|
|
8161
8280
|
},
|
|
8162
8281
|
addInputRules() {
|
|
8163
8282
|
return [
|
|
8164
|
-
(0,
|
|
8283
|
+
(0, import_core20.markInputRule)({
|
|
8165
8284
|
find: /\^([^^]+)\^/,
|
|
8166
8285
|
type: this.type
|
|
8167
8286
|
})
|
|
@@ -8169,7 +8288,7 @@ var Superscript = import_core19.Mark.create({
|
|
|
8169
8288
|
},
|
|
8170
8289
|
addPasteRules() {
|
|
8171
8290
|
return [
|
|
8172
|
-
(0,
|
|
8291
|
+
(0, import_core20.markPasteRule)({
|
|
8173
8292
|
find: /\^([^^]+)\^/g,
|
|
8174
8293
|
type: this.type
|
|
8175
8294
|
})
|
|
@@ -15248,8 +15367,8 @@ var ResizableTable = import_extension_table.Table.extend({
|
|
|
15248
15367
|
});
|
|
15249
15368
|
|
|
15250
15369
|
// src/components/tetrons/toolbar/extensions/Embed.ts
|
|
15251
|
-
var
|
|
15252
|
-
var Embed =
|
|
15370
|
+
var import_core21 = require("@tiptap/core");
|
|
15371
|
+
var Embed = import_core21.Node.create({
|
|
15253
15372
|
name: "embed",
|
|
15254
15373
|
group: "block",
|
|
15255
15374
|
atom: true,
|
|
@@ -15264,7 +15383,7 @@ var Embed = import_core20.Node.create({
|
|
|
15264
15383
|
return [{ tag: "iframe[src]" }];
|
|
15265
15384
|
},
|
|
15266
15385
|
renderHTML({ HTMLAttributes }) {
|
|
15267
|
-
return ["iframe", (0,
|
|
15386
|
+
return ["iframe", (0, import_core21.mergeAttributes)(HTMLAttributes)];
|
|
15268
15387
|
},
|
|
15269
15388
|
addCommands() {
|
|
15270
15389
|
return {
|
|
@@ -15342,8 +15461,8 @@ var Embed = import_core20.Node.create({
|
|
|
15342
15461
|
});
|
|
15343
15462
|
|
|
15344
15463
|
// src/components/tetrons/toolbar/extensions/FontFamily.ts
|
|
15345
|
-
var
|
|
15346
|
-
var FontFamily =
|
|
15464
|
+
var import_core22 = require("@tiptap/core");
|
|
15465
|
+
var FontFamily = import_core22.Mark.create({
|
|
15347
15466
|
name: "fontFamily",
|
|
15348
15467
|
addAttributes() {
|
|
15349
15468
|
return {
|
|
@@ -15361,7 +15480,7 @@ var FontFamily = import_core21.Mark.create({
|
|
|
15361
15480
|
return [{ style: "font-family" }];
|
|
15362
15481
|
},
|
|
15363
15482
|
renderHTML({ HTMLAttributes }) {
|
|
15364
|
-
return ["span", (0,
|
|
15483
|
+
return ["span", (0, import_core22.mergeAttributes)(HTMLAttributes), 0];
|
|
15365
15484
|
},
|
|
15366
15485
|
addCommands() {
|
|
15367
15486
|
return {
|
|
@@ -15371,8 +15490,8 @@ var FontFamily = import_core21.Mark.create({
|
|
|
15371
15490
|
});
|
|
15372
15491
|
|
|
15373
15492
|
// src/components/tetrons/toolbar/extensions/FontSize.ts
|
|
15374
|
-
var
|
|
15375
|
-
var FontSize =
|
|
15493
|
+
var import_core23 = require("@tiptap/core");
|
|
15494
|
+
var FontSize = import_core23.Mark.create({
|
|
15376
15495
|
name: "fontSize",
|
|
15377
15496
|
addAttributes() {
|
|
15378
15497
|
return {
|
|
@@ -15390,7 +15509,7 @@ var FontSize = import_core22.Mark.create({
|
|
|
15390
15509
|
return [{ style: "font-size" }];
|
|
15391
15510
|
},
|
|
15392
15511
|
renderHTML({ HTMLAttributes }) {
|
|
15393
|
-
return ["span", (0,
|
|
15512
|
+
return ["span", (0, import_core23.mergeAttributes)(HTMLAttributes), 0];
|
|
15394
15513
|
},
|
|
15395
15514
|
addCommands() {
|
|
15396
15515
|
return {
|
|
@@ -15532,7 +15651,7 @@ var ResizableImage = import_extension_image.default.extend({
|
|
|
15532
15651
|
});
|
|
15533
15652
|
|
|
15534
15653
|
// src/components/tetrons/ResizableVideo.ts
|
|
15535
|
-
var
|
|
15654
|
+
var import_core24 = require("@tiptap/core");
|
|
15536
15655
|
var import_react7 = require("@tiptap/react");
|
|
15537
15656
|
|
|
15538
15657
|
// src/components/tetrons/ResizableVideoComponent.tsx
|
|
@@ -15588,7 +15707,7 @@ var ResizableVideoComponent = ({
|
|
|
15588
15707
|
var ResizableVideoComponent_default = ResizableVideoComponent;
|
|
15589
15708
|
|
|
15590
15709
|
// src/components/tetrons/ResizableVideo.ts
|
|
15591
|
-
var ResizableVideo =
|
|
15710
|
+
var ResizableVideo = import_core24.Node.create({
|
|
15592
15711
|
name: "video",
|
|
15593
15712
|
group: "block",
|
|
15594
15713
|
draggable: true,
|
|
@@ -15721,7 +15840,7 @@ function TableContextMenu({ editor }) {
|
|
|
15721
15840
|
}
|
|
15722
15841
|
|
|
15723
15842
|
// src/components/tetrons/toolbar/TetronsToolbar.tsx
|
|
15724
|
-
var
|
|
15843
|
+
var import_react21 = __toESM(require("react"));
|
|
15725
15844
|
|
|
15726
15845
|
// src/components/tetrons/toolbar/ActionGroup.tsx
|
|
15727
15846
|
var import_react10 = __toESM(require("react"));
|
|
@@ -16777,13 +16896,66 @@ function AiGroup({ editor }) {
|
|
|
16777
16896
|
)));
|
|
16778
16897
|
}
|
|
16779
16898
|
|
|
16899
|
+
// src/components/tetrons/toolbar/AddOnGroup.tsx
|
|
16900
|
+
var import_react20 = __toESM(require("react"));
|
|
16901
|
+
var import_fa3 = require("react-icons/fa");
|
|
16902
|
+
var import_dynamic = __toESM(require("next/dynamic"));
|
|
16903
|
+
var import_katex_min2 = require("katex/dist/katex.min.css");
|
|
16904
|
+
var MathModal2 = (0, import_dynamic.default)(() => Promise.resolve().then(() => (init_MathModal(), MathModal_exports)), { ssr: false });
|
|
16905
|
+
var AddOnGroup = ({ editor }) => {
|
|
16906
|
+
const [isModalOpen, setModalOpen] = (0, import_react20.useState)(false);
|
|
16907
|
+
const [latexValue, setLatexValue] = (0, import_react20.useState)("");
|
|
16908
|
+
if (!editor) return null;
|
|
16909
|
+
const insertCodeBlock = () => {
|
|
16910
|
+
editor.chain().focus().toggleCodeBlock().run();
|
|
16911
|
+
};
|
|
16912
|
+
const handleMathInsert = (latex) => {
|
|
16913
|
+
editor.chain().focus().insertContent({
|
|
16914
|
+
type: "mathInline",
|
|
16915
|
+
attrs: { formula: latex }
|
|
16916
|
+
}).run();
|
|
16917
|
+
setModalOpen(false);
|
|
16918
|
+
setLatexValue("");
|
|
16919
|
+
};
|
|
16920
|
+
return /* @__PURE__ */ import_react20.default.createElement(import_react20.default.Fragment, null, /* @__PURE__ */ import_react20.default.createElement("div", { className: "group flex gap-2 items-center" }, /* @__PURE__ */ import_react20.default.createElement(
|
|
16921
|
+
"button",
|
|
16922
|
+
{
|
|
16923
|
+
type: "button",
|
|
16924
|
+
onClick: insertCodeBlock,
|
|
16925
|
+
className: "icon-btn",
|
|
16926
|
+
title: "Insert Code Block"
|
|
16927
|
+
},
|
|
16928
|
+
/* @__PURE__ */ import_react20.default.createElement(import_fa3.FaCode, { size: 18 })
|
|
16929
|
+
), /* @__PURE__ */ import_react20.default.createElement(
|
|
16930
|
+
"button",
|
|
16931
|
+
{
|
|
16932
|
+
type: "button",
|
|
16933
|
+
onClick: () => setModalOpen(true),
|
|
16934
|
+
className: "icon-btn",
|
|
16935
|
+
title: "Insert Math Equation"
|
|
16936
|
+
},
|
|
16937
|
+
/* @__PURE__ */ import_react20.default.createElement(import_fa3.FaSuperscript, { size: 18 })
|
|
16938
|
+
)), /* @__PURE__ */ import_react20.default.createElement(
|
|
16939
|
+
MathModal2,
|
|
16940
|
+
{
|
|
16941
|
+
isOpen: isModalOpen,
|
|
16942
|
+
onClose: () => setModalOpen(false),
|
|
16943
|
+
onSubmit: handleMathInsert,
|
|
16944
|
+
value: latexValue,
|
|
16945
|
+
setValue: setLatexValue
|
|
16946
|
+
}
|
|
16947
|
+
));
|
|
16948
|
+
};
|
|
16949
|
+
var AddOnGroup_default = AddOnGroup;
|
|
16950
|
+
|
|
16780
16951
|
// src/components/tetrons/toolbar/TetronsToolbar.tsx
|
|
16781
16952
|
function TetronsToolbar({
|
|
16782
16953
|
editor,
|
|
16783
|
-
version
|
|
16954
|
+
version,
|
|
16955
|
+
addOns = []
|
|
16784
16956
|
}) {
|
|
16785
|
-
const [autoSave, setAutoSave] = (0,
|
|
16786
|
-
(0,
|
|
16957
|
+
const [autoSave, setAutoSave] = (0, import_react21.useState)(false);
|
|
16958
|
+
(0, import_react21.useEffect)(() => {
|
|
16787
16959
|
if (!editor) return;
|
|
16788
16960
|
const handleUpdate = () => {
|
|
16789
16961
|
if (!autoSave) return;
|
|
@@ -16799,7 +16971,7 @@ function TetronsToolbar({
|
|
|
16799
16971
|
editor.off("update", handleUpdate);
|
|
16800
16972
|
};
|
|
16801
16973
|
}, [autoSave, editor]);
|
|
16802
|
-
return /* @__PURE__ */
|
|
16974
|
+
return /* @__PURE__ */ import_react21.default.createElement("div", { className: "tetrons-toolbar" }, version !== "free" && /* @__PURE__ */ import_react21.default.createElement("div", { className: "group" }, /* @__PURE__ */ import_react21.default.createElement(
|
|
16803
16975
|
"input",
|
|
16804
16976
|
{
|
|
16805
16977
|
type: "checkbox",
|
|
@@ -16807,35 +16979,25 @@ function TetronsToolbar({
|
|
|
16807
16979
|
checked: autoSave,
|
|
16808
16980
|
onChange: (e) => setAutoSave(e.target.checked)
|
|
16809
16981
|
}
|
|
16810
|
-
), /* @__PURE__ */
|
|
16982
|
+
), /* @__PURE__ */ import_react21.default.createElement("label", { htmlFor: "autoSave" }, "Auto Save")), ["pro", "premium", "platinum"].includes(version) && /* @__PURE__ */ import_react21.default.createElement(FileGroup, { editor }), /* @__PURE__ */ import_react21.default.createElement(ClipboardGroup, { editor }), /* @__PURE__ */ import_react21.default.createElement(FontStyleGroup, { editor }), /* @__PURE__ */ import_react21.default.createElement(ListAlignGroup, { editor }), ["premium", "platinum"].includes(version) && /* @__PURE__ */ import_react21.default.createElement(import_react21.default.Fragment, null, /* @__PURE__ */ import_react21.default.createElement(InsertGroup, { editor }), /* @__PURE__ */ import_react21.default.createElement(ActionGroup, { editor })), version === "platinum" && /* @__PURE__ */ import_react21.default.createElement(import_react21.default.Fragment, null, /* @__PURE__ */ import_react21.default.createElement(MiscGroup, { editor }), /* @__PURE__ */ import_react21.default.createElement(AiGroup, { editor })), addOns.length > 0 && /* @__PURE__ */ import_react21.default.createElement(AddOnGroup_default, { editor }));
|
|
16811
16983
|
}
|
|
16812
16984
|
|
|
16813
16985
|
// src/components/tetrons/EditorContent.tsx
|
|
16814
|
-
var import_meta = {};
|
|
16815
16986
|
var lowlight = (0, import_lowlight.createLowlight)();
|
|
16816
16987
|
lowlight.register("js", javascript);
|
|
16817
16988
|
lowlight.register("ts", typescript);
|
|
16818
16989
|
function EditorContent({ apiKey }) {
|
|
16819
16990
|
const typo = useTypo();
|
|
16820
|
-
const [isValid, setIsValid] = (0,
|
|
16821
|
-
const [error, setError] = (0,
|
|
16822
|
-
const [versions, setVersions] = (0,
|
|
16823
|
-
const [userVersion, setUserVersion] = (0,
|
|
16824
|
-
const [currentVersionIndex, setCurrentVersionIndex] = (0,
|
|
16991
|
+
const [isValid, setIsValid] = (0, import_react22.useState)(null);
|
|
16992
|
+
const [error, setError] = (0, import_react22.useState)(null);
|
|
16993
|
+
const [versions, setVersions] = (0, import_react22.useState)([]);
|
|
16994
|
+
const [userVersion, setUserVersion] = (0, import_react22.useState)(null);
|
|
16995
|
+
const [currentVersionIndex, setCurrentVersionIndex] = (0, import_react22.useState)(
|
|
16825
16996
|
null
|
|
16826
16997
|
);
|
|
16827
|
-
const wrapperRef = (0,
|
|
16828
|
-
|
|
16829
|
-
|
|
16830
|
-
return import_meta.env.VITE_TETRONS_API_URL;
|
|
16831
|
-
}
|
|
16832
|
-
if (typeof process !== "undefined" && process.env?.NEXT_PUBLIC_TETRONS_API_URL) {
|
|
16833
|
-
return process.env.NEXT_PUBLIC_TETRONS_API_URL;
|
|
16834
|
-
}
|
|
16835
|
-
return "https://staging.tetrons.com";
|
|
16836
|
-
}
|
|
16837
|
-
const API_BASE_URL = getApiBaseUrl();
|
|
16838
|
-
(0, import_react20.useEffect)(() => {
|
|
16998
|
+
const wrapperRef = (0, import_react22.useRef)(null);
|
|
16999
|
+
const API_BASE_URL = typeof process !== "undefined" && process.env?.NEXT_PUBLIC_TETRONS_API_URL ? process.env.NEXT_PUBLIC_TETRONS_API_URL : "https://staging.tetrons.com";
|
|
17000
|
+
(0, import_react22.useEffect)(() => {
|
|
16839
17001
|
const validateKey = async () => {
|
|
16840
17002
|
try {
|
|
16841
17003
|
const res = await fetch(`${API_BASE_URL}/api/validate`, {
|
|
@@ -16856,7 +17018,7 @@ function EditorContent({ apiKey }) {
|
|
|
16856
17018
|
};
|
|
16857
17019
|
validateKey();
|
|
16858
17020
|
}, [apiKey, API_BASE_URL]);
|
|
16859
|
-
const editor = (0,
|
|
17021
|
+
const editor = (0, import_react23.useEditor)({
|
|
16860
17022
|
extensions: [
|
|
16861
17023
|
Document,
|
|
16862
17024
|
Paragraph,
|
|
@@ -16906,7 +17068,8 @@ function EditorContent({ apiKey }) {
|
|
|
16906
17068
|
Spellcheck.configure({
|
|
16907
17069
|
spellcheckFn: (word) => typo.check(word)
|
|
16908
17070
|
})
|
|
16909
|
-
] : []
|
|
17071
|
+
] : [],
|
|
17072
|
+
MathInline
|
|
16910
17073
|
],
|
|
16911
17074
|
content: "",
|
|
16912
17075
|
editorProps: {
|
|
@@ -16917,7 +17080,7 @@ function EditorContent({ apiKey }) {
|
|
|
16917
17080
|
},
|
|
16918
17081
|
immediatelyRender: false
|
|
16919
17082
|
});
|
|
16920
|
-
(0,
|
|
17083
|
+
(0, import_react22.useEffect)(() => {
|
|
16921
17084
|
return () => {
|
|
16922
17085
|
editor?.destroy();
|
|
16923
17086
|
};
|
|
@@ -16942,15 +17105,22 @@ function EditorContent({ apiKey }) {
|
|
|
16942
17105
|
}
|
|
16943
17106
|
};
|
|
16944
17107
|
if (isValid === false) {
|
|
16945
|
-
return /* @__PURE__ */
|
|
17108
|
+
return /* @__PURE__ */ import_react22.default.createElement("div", { className: "editor-error" }, "\u26A0\uFE0F ", error);
|
|
16946
17109
|
}
|
|
16947
17110
|
if (isValid === null) {
|
|
16948
|
-
return /* @__PURE__ */
|
|
17111
|
+
return /* @__PURE__ */ import_react22.default.createElement("div", { className: "editor-loading" }, "\u{1F50D} Validating license...");
|
|
16949
17112
|
}
|
|
16950
17113
|
if (!typo) {
|
|
16951
|
-
return /* @__PURE__ */
|
|
17114
|
+
return /* @__PURE__ */ import_react22.default.createElement("div", { className: "editor-loading" }, "\u{1F4D6} Loading dictionary...");
|
|
16952
17115
|
}
|
|
16953
|
-
|
|
17116
|
+
const versionAddOnsMap = {
|
|
17117
|
+
free: [],
|
|
17118
|
+
pro: ["code"],
|
|
17119
|
+
premium: ["code", "math"],
|
|
17120
|
+
platinum: ["code", "math"]
|
|
17121
|
+
};
|
|
17122
|
+
const enabledAddOns = userVersion ? versionAddOnsMap[userVersion] || [] : [];
|
|
17123
|
+
return /* @__PURE__ */ import_react22.default.createElement("div", { className: "editor-container" }, userVersion !== "free" && /* @__PURE__ */ import_react22.default.createElement("div", { className: "editor-toolbar" }, /* @__PURE__ */ import_react22.default.createElement(
|
|
16954
17124
|
"button",
|
|
16955
17125
|
{
|
|
16956
17126
|
type: "button",
|
|
@@ -16959,7 +17129,7 @@ function EditorContent({ apiKey }) {
|
|
|
16959
17129
|
className: "editor-save-btn"
|
|
16960
17130
|
},
|
|
16961
17131
|
"Save Version"
|
|
16962
|
-
), /* @__PURE__ */
|
|
17132
|
+
), /* @__PURE__ */ import_react22.default.createElement("div", { className: "editor-versions-wrapper" }, versions.length === 0 ? /* @__PURE__ */ import_react22.default.createElement("span", { className: "editor-no-versions" }, "No saved versions") : versions.map((_, idx) => /* @__PURE__ */ import_react22.default.createElement(
|
|
16963
17133
|
"button",
|
|
16964
17134
|
{
|
|
16965
17135
|
key: idx,
|
|
@@ -16969,14 +17139,21 @@ function EditorContent({ apiKey }) {
|
|
|
16969
17139
|
title: `Restore Version ${idx + 1}`
|
|
16970
17140
|
},
|
|
16971
17141
|
`V${idx + 1}`
|
|
16972
|
-
)))), editor && userVersion && /* @__PURE__ */
|
|
17142
|
+
)))), editor && userVersion && /* @__PURE__ */ import_react22.default.createElement(
|
|
17143
|
+
TetronsToolbar,
|
|
17144
|
+
{
|
|
17145
|
+
editor,
|
|
17146
|
+
version: userVersion,
|
|
17147
|
+
addOns: enabledAddOns
|
|
17148
|
+
}
|
|
17149
|
+
), /* @__PURE__ */ import_react22.default.createElement(
|
|
16973
17150
|
"div",
|
|
16974
17151
|
{
|
|
16975
17152
|
ref: wrapperRef,
|
|
16976
17153
|
className: "editor-content-wrapper",
|
|
16977
17154
|
onClick: handleEditorClick
|
|
16978
17155
|
},
|
|
16979
|
-
editor ? /* @__PURE__ */
|
|
17156
|
+
editor ? /* @__PURE__ */ import_react22.default.createElement(import_react22.default.Fragment, null, /* @__PURE__ */ import_react22.default.createElement(import_react23.EditorContent, { editor }), /* @__PURE__ */ import_react22.default.createElement(TableContextMenu, { editor })) : /* @__PURE__ */ import_react22.default.createElement("div", { className: "editor-loading" }, "Loading editor...")
|
|
16980
17157
|
));
|
|
16981
17158
|
}
|
|
16982
17159
|
|