tetrons 2.3.75 → 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 +343 -128
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.mjs +416 -198
- 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, {
|
|
@@ -34,25 +97,82 @@ __export(index_exports, {
|
|
|
34
97
|
default: () => index_default,
|
|
35
98
|
getTetronsVersion: () => getTetronsVersion,
|
|
36
99
|
initializeTetrons: () => initializeTetrons,
|
|
37
|
-
isApiKeyValid: () => isApiKeyValid
|
|
100
|
+
isApiKeyValid: () => isApiKeyValid,
|
|
101
|
+
isTetronsLicenseValid: () => isTetronsLicenseValid
|
|
38
102
|
});
|
|
39
103
|
module.exports = __toCommonJS(index_exports);
|
|
40
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
|
+
|
|
41
161
|
// src/components/tetrons/EditorContent.tsx
|
|
42
|
-
var
|
|
43
|
-
var
|
|
162
|
+
var import_react22 = __toESM(require("react"));
|
|
163
|
+
var import_react23 = require("@tiptap/react");
|
|
44
164
|
|
|
45
165
|
// node_modules/@tiptap/extension-document/dist/index.js
|
|
46
|
-
var
|
|
47
|
-
var Document =
|
|
166
|
+
var import_core2 = require("@tiptap/core");
|
|
167
|
+
var Document = import_core2.Node.create({
|
|
48
168
|
name: "doc",
|
|
49
169
|
topNode: true,
|
|
50
170
|
content: "block+"
|
|
51
171
|
});
|
|
52
172
|
|
|
53
173
|
// node_modules/@tiptap/extension-paragraph/dist/index.js
|
|
54
|
-
var
|
|
55
|
-
var Paragraph =
|
|
174
|
+
var import_core3 = require("@tiptap/core");
|
|
175
|
+
var Paragraph = import_core3.Node.create({
|
|
56
176
|
name: "paragraph",
|
|
57
177
|
priority: 1e3,
|
|
58
178
|
addOptions() {
|
|
@@ -68,7 +188,7 @@ var Paragraph = import_core2.Node.create({
|
|
|
68
188
|
];
|
|
69
189
|
},
|
|
70
190
|
renderHTML({ HTMLAttributes }) {
|
|
71
|
-
return ["p", (0,
|
|
191
|
+
return ["p", (0, import_core3.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
72
192
|
},
|
|
73
193
|
addCommands() {
|
|
74
194
|
return {
|
|
@@ -85,14 +205,14 @@ var Paragraph = import_core2.Node.create({
|
|
|
85
205
|
});
|
|
86
206
|
|
|
87
207
|
// node_modules/@tiptap/extension-text/dist/index.js
|
|
88
|
-
var
|
|
89
|
-
var Text =
|
|
208
|
+
var import_core4 = require("@tiptap/core");
|
|
209
|
+
var Text = import_core4.Node.create({
|
|
90
210
|
name: "text",
|
|
91
211
|
group: "inline"
|
|
92
212
|
});
|
|
93
213
|
|
|
94
214
|
// node_modules/@tiptap/extension-history/dist/index.js
|
|
95
|
-
var
|
|
215
|
+
var import_core5 = require("@tiptap/core");
|
|
96
216
|
|
|
97
217
|
// node_modules/rope-sequence/dist/index.js
|
|
98
218
|
var GOOD_LEAF_SIZE = 200;
|
|
@@ -1309,7 +1429,7 @@ var NodeRange = class {
|
|
|
1309
1429
|
}
|
|
1310
1430
|
};
|
|
1311
1431
|
var emptyAttrs = /* @__PURE__ */ Object.create(null);
|
|
1312
|
-
var
|
|
1432
|
+
var Node5 = class _Node {
|
|
1313
1433
|
/**
|
|
1314
1434
|
@internal
|
|
1315
1435
|
*/
|
|
@@ -1710,7 +1830,7 @@ var Node4 = class _Node {
|
|
|
1710
1830
|
return node;
|
|
1711
1831
|
}
|
|
1712
1832
|
};
|
|
1713
|
-
|
|
1833
|
+
Node5.prototype.text = void 0;
|
|
1714
1834
|
function wrapMarks(marks, str) {
|
|
1715
1835
|
for (let i = marks.length - 1; i >= 0; i--)
|
|
1716
1836
|
str = marks[i].type.name + "(" + str + ")";
|
|
@@ -5714,7 +5834,7 @@ var undoNoScroll = buildCommand(false, false);
|
|
|
5714
5834
|
var redoNoScroll = buildCommand(true, false);
|
|
5715
5835
|
|
|
5716
5836
|
// node_modules/@tiptap/extension-history/dist/index.js
|
|
5717
|
-
var History =
|
|
5837
|
+
var History = import_core5.Extension.create({
|
|
5718
5838
|
name: "history",
|
|
5719
5839
|
addOptions() {
|
|
5720
5840
|
return {
|
|
@@ -5750,12 +5870,12 @@ var History = import_core4.Extension.create({
|
|
|
5750
5870
|
});
|
|
5751
5871
|
|
|
5752
5872
|
// node_modules/@tiptap/extension-bold/dist/index.js
|
|
5753
|
-
var
|
|
5873
|
+
var import_core6 = require("@tiptap/core");
|
|
5754
5874
|
var starInputRegex = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/;
|
|
5755
5875
|
var starPasteRegex = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g;
|
|
5756
5876
|
var underscoreInputRegex = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/;
|
|
5757
5877
|
var underscorePasteRegex = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g;
|
|
5758
|
-
var Bold =
|
|
5878
|
+
var Bold = import_core6.Mark.create({
|
|
5759
5879
|
name: "bold",
|
|
5760
5880
|
addOptions() {
|
|
5761
5881
|
return {
|
|
@@ -5782,7 +5902,7 @@ var Bold = import_core5.Mark.create({
|
|
|
5782
5902
|
];
|
|
5783
5903
|
},
|
|
5784
5904
|
renderHTML({ HTMLAttributes }) {
|
|
5785
|
-
return ["strong", (0,
|
|
5905
|
+
return ["strong", (0, import_core6.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
5786
5906
|
},
|
|
5787
5907
|
addCommands() {
|
|
5788
5908
|
return {
|
|
@@ -5805,11 +5925,11 @@ var Bold = import_core5.Mark.create({
|
|
|
5805
5925
|
},
|
|
5806
5926
|
addInputRules() {
|
|
5807
5927
|
return [
|
|
5808
|
-
(0,
|
|
5928
|
+
(0, import_core6.markInputRule)({
|
|
5809
5929
|
find: starInputRegex,
|
|
5810
5930
|
type: this.type
|
|
5811
5931
|
}),
|
|
5812
|
-
(0,
|
|
5932
|
+
(0, import_core6.markInputRule)({
|
|
5813
5933
|
find: underscoreInputRegex,
|
|
5814
5934
|
type: this.type
|
|
5815
5935
|
})
|
|
@@ -5817,11 +5937,11 @@ var Bold = import_core5.Mark.create({
|
|
|
5817
5937
|
},
|
|
5818
5938
|
addPasteRules() {
|
|
5819
5939
|
return [
|
|
5820
|
-
(0,
|
|
5940
|
+
(0, import_core6.markPasteRule)({
|
|
5821
5941
|
find: starPasteRegex,
|
|
5822
5942
|
type: this.type
|
|
5823
5943
|
}),
|
|
5824
|
-
(0,
|
|
5944
|
+
(0, import_core6.markPasteRule)({
|
|
5825
5945
|
find: underscorePasteRegex,
|
|
5826
5946
|
type: this.type
|
|
5827
5947
|
})
|
|
@@ -5830,12 +5950,12 @@ var Bold = import_core5.Mark.create({
|
|
|
5830
5950
|
});
|
|
5831
5951
|
|
|
5832
5952
|
// node_modules/@tiptap/extension-italic/dist/index.js
|
|
5833
|
-
var
|
|
5953
|
+
var import_core7 = require("@tiptap/core");
|
|
5834
5954
|
var starInputRegex2 = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/;
|
|
5835
5955
|
var starPasteRegex2 = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g;
|
|
5836
5956
|
var underscoreInputRegex2 = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/;
|
|
5837
5957
|
var underscorePasteRegex2 = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g;
|
|
5838
|
-
var Italic =
|
|
5958
|
+
var Italic = import_core7.Mark.create({
|
|
5839
5959
|
name: "italic",
|
|
5840
5960
|
addOptions() {
|
|
5841
5961
|
return {
|
|
@@ -5861,7 +5981,7 @@ var Italic = import_core6.Mark.create({
|
|
|
5861
5981
|
];
|
|
5862
5982
|
},
|
|
5863
5983
|
renderHTML({ HTMLAttributes }) {
|
|
5864
|
-
return ["em", (0,
|
|
5984
|
+
return ["em", (0, import_core7.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
5865
5985
|
},
|
|
5866
5986
|
addCommands() {
|
|
5867
5987
|
return {
|
|
@@ -5884,11 +6004,11 @@ var Italic = import_core6.Mark.create({
|
|
|
5884
6004
|
},
|
|
5885
6005
|
addInputRules() {
|
|
5886
6006
|
return [
|
|
5887
|
-
(0,
|
|
6007
|
+
(0, import_core7.markInputRule)({
|
|
5888
6008
|
find: starInputRegex2,
|
|
5889
6009
|
type: this.type
|
|
5890
6010
|
}),
|
|
5891
|
-
(0,
|
|
6011
|
+
(0, import_core7.markInputRule)({
|
|
5892
6012
|
find: underscoreInputRegex2,
|
|
5893
6013
|
type: this.type
|
|
5894
6014
|
})
|
|
@@ -5896,11 +6016,11 @@ var Italic = import_core6.Mark.create({
|
|
|
5896
6016
|
},
|
|
5897
6017
|
addPasteRules() {
|
|
5898
6018
|
return [
|
|
5899
|
-
(0,
|
|
6019
|
+
(0, import_core7.markPasteRule)({
|
|
5900
6020
|
find: starPasteRegex2,
|
|
5901
6021
|
type: this.type
|
|
5902
6022
|
}),
|
|
5903
|
-
(0,
|
|
6023
|
+
(0, import_core7.markPasteRule)({
|
|
5904
6024
|
find: underscorePasteRegex2,
|
|
5905
6025
|
type: this.type
|
|
5906
6026
|
})
|
|
@@ -5912,10 +6032,10 @@ var Italic = import_core6.Mark.create({
|
|
|
5912
6032
|
var import_extension_underline = __toESM(require("@tiptap/extension-underline"));
|
|
5913
6033
|
|
|
5914
6034
|
// node_modules/@tiptap/extension-strike/dist/index.js
|
|
5915
|
-
var
|
|
6035
|
+
var import_core8 = require("@tiptap/core");
|
|
5916
6036
|
var inputRegex = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/;
|
|
5917
6037
|
var pasteRegex = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g;
|
|
5918
|
-
var Strike =
|
|
6038
|
+
var Strike = import_core8.Mark.create({
|
|
5919
6039
|
name: "strike",
|
|
5920
6040
|
addOptions() {
|
|
5921
6041
|
return {
|
|
@@ -5941,7 +6061,7 @@ var Strike = import_core7.Mark.create({
|
|
|
5941
6061
|
];
|
|
5942
6062
|
},
|
|
5943
6063
|
renderHTML({ HTMLAttributes }) {
|
|
5944
|
-
return ["s", (0,
|
|
6064
|
+
return ["s", (0, import_core8.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
5945
6065
|
},
|
|
5946
6066
|
addCommands() {
|
|
5947
6067
|
return {
|
|
@@ -5963,7 +6083,7 @@ var Strike = import_core7.Mark.create({
|
|
|
5963
6083
|
},
|
|
5964
6084
|
addInputRules() {
|
|
5965
6085
|
return [
|
|
5966
|
-
(0,
|
|
6086
|
+
(0, import_core8.markInputRule)({
|
|
5967
6087
|
find: inputRegex,
|
|
5968
6088
|
type: this.type
|
|
5969
6089
|
})
|
|
@@ -5971,7 +6091,7 @@ var Strike = import_core7.Mark.create({
|
|
|
5971
6091
|
},
|
|
5972
6092
|
addPasteRules() {
|
|
5973
6093
|
return [
|
|
5974
|
-
(0,
|
|
6094
|
+
(0, import_core8.markPasteRule)({
|
|
5975
6095
|
find: pasteRegex,
|
|
5976
6096
|
type: this.type
|
|
5977
6097
|
})
|
|
@@ -5980,10 +6100,10 @@ var Strike = import_core7.Mark.create({
|
|
|
5980
6100
|
});
|
|
5981
6101
|
|
|
5982
6102
|
// node_modules/@tiptap/extension-code/dist/index.js
|
|
5983
|
-
var
|
|
6103
|
+
var import_core9 = require("@tiptap/core");
|
|
5984
6104
|
var inputRegex2 = /(^|[^`])`([^`]+)`(?!`)/;
|
|
5985
6105
|
var pasteRegex2 = /(^|[^`])`([^`]+)`(?!`)/g;
|
|
5986
|
-
var Code =
|
|
6106
|
+
var Code = import_core9.Mark.create({
|
|
5987
6107
|
name: "code",
|
|
5988
6108
|
addOptions() {
|
|
5989
6109
|
return {
|
|
@@ -5999,7 +6119,7 @@ var Code = import_core8.Mark.create({
|
|
|
5999
6119
|
];
|
|
6000
6120
|
},
|
|
6001
6121
|
renderHTML({ HTMLAttributes }) {
|
|
6002
|
-
return ["code", (0,
|
|
6122
|
+
return ["code", (0, import_core9.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
6003
6123
|
},
|
|
6004
6124
|
addCommands() {
|
|
6005
6125
|
return {
|
|
@@ -6021,7 +6141,7 @@ var Code = import_core8.Mark.create({
|
|
|
6021
6141
|
},
|
|
6022
6142
|
addInputRules() {
|
|
6023
6143
|
return [
|
|
6024
|
-
(0,
|
|
6144
|
+
(0, import_core9.markInputRule)({
|
|
6025
6145
|
find: inputRegex2,
|
|
6026
6146
|
type: this.type
|
|
6027
6147
|
})
|
|
@@ -6029,7 +6149,7 @@ var Code = import_core8.Mark.create({
|
|
|
6029
6149
|
},
|
|
6030
6150
|
addPasteRules() {
|
|
6031
6151
|
return [
|
|
6032
|
-
(0,
|
|
6152
|
+
(0, import_core9.markPasteRule)({
|
|
6033
6153
|
find: pasteRegex2,
|
|
6034
6154
|
type: this.type
|
|
6035
6155
|
})
|
|
@@ -6038,9 +6158,9 @@ var Code = import_core8.Mark.create({
|
|
|
6038
6158
|
});
|
|
6039
6159
|
|
|
6040
6160
|
// node_modules/@tiptap/extension-blockquote/dist/index.js
|
|
6041
|
-
var
|
|
6161
|
+
var import_core10 = require("@tiptap/core");
|
|
6042
6162
|
var inputRegex3 = /^\s*>\s$/;
|
|
6043
|
-
var Blockquote =
|
|
6163
|
+
var Blockquote = import_core10.Node.create({
|
|
6044
6164
|
name: "blockquote",
|
|
6045
6165
|
addOptions() {
|
|
6046
6166
|
return {
|
|
@@ -6056,7 +6176,7 @@ var Blockquote = import_core9.Node.create({
|
|
|
6056
6176
|
];
|
|
6057
6177
|
},
|
|
6058
6178
|
renderHTML({ HTMLAttributes }) {
|
|
6059
|
-
return ["blockquote", (0,
|
|
6179
|
+
return ["blockquote", (0, import_core10.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
6060
6180
|
},
|
|
6061
6181
|
addCommands() {
|
|
6062
6182
|
return {
|
|
@@ -6078,7 +6198,7 @@ var Blockquote = import_core9.Node.create({
|
|
|
6078
6198
|
},
|
|
6079
6199
|
addInputRules() {
|
|
6080
6200
|
return [
|
|
6081
|
-
(0,
|
|
6201
|
+
(0, import_core10.wrappingInputRule)({
|
|
6082
6202
|
find: inputRegex3,
|
|
6083
6203
|
type: this.type
|
|
6084
6204
|
})
|
|
@@ -6087,8 +6207,8 @@ var Blockquote = import_core9.Node.create({
|
|
|
6087
6207
|
});
|
|
6088
6208
|
|
|
6089
6209
|
// node_modules/@tiptap/extension-hard-break/dist/index.js
|
|
6090
|
-
var
|
|
6091
|
-
var HardBreak =
|
|
6210
|
+
var import_core11 = require("@tiptap/core");
|
|
6211
|
+
var HardBreak = import_core11.Node.create({
|
|
6092
6212
|
name: "hardBreak",
|
|
6093
6213
|
addOptions() {
|
|
6094
6214
|
return {
|
|
@@ -6106,7 +6226,7 @@ var HardBreak = import_core10.Node.create({
|
|
|
6106
6226
|
];
|
|
6107
6227
|
},
|
|
6108
6228
|
renderHTML({ HTMLAttributes }) {
|
|
6109
|
-
return ["br", (0,
|
|
6229
|
+
return ["br", (0, import_core11.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes)];
|
|
6110
6230
|
},
|
|
6111
6231
|
renderText() {
|
|
6112
6232
|
return "\n";
|
|
@@ -6145,8 +6265,8 @@ var HardBreak = import_core10.Node.create({
|
|
|
6145
6265
|
});
|
|
6146
6266
|
|
|
6147
6267
|
// node_modules/@tiptap/extension-heading/dist/index.js
|
|
6148
|
-
var
|
|
6149
|
-
var Heading =
|
|
6268
|
+
var import_core12 = require("@tiptap/core");
|
|
6269
|
+
var Heading = import_core12.Node.create({
|
|
6150
6270
|
name: "heading",
|
|
6151
6271
|
addOptions() {
|
|
6152
6272
|
return {
|
|
@@ -6174,7 +6294,7 @@ var Heading = import_core11.Node.create({
|
|
|
6174
6294
|
renderHTML({ node, HTMLAttributes }) {
|
|
6175
6295
|
const hasLevel = this.options.levels.includes(node.attrs.level);
|
|
6176
6296
|
const level = hasLevel ? node.attrs.level : this.options.levels[0];
|
|
6177
|
-
return [`h${level}`, (0,
|
|
6297
|
+
return [`h${level}`, (0, import_core12.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
6178
6298
|
},
|
|
6179
6299
|
addCommands() {
|
|
6180
6300
|
return {
|
|
@@ -6202,7 +6322,7 @@ var Heading = import_core11.Node.create({
|
|
|
6202
6322
|
},
|
|
6203
6323
|
addInputRules() {
|
|
6204
6324
|
return this.options.levels.map((level) => {
|
|
6205
|
-
return (0,
|
|
6325
|
+
return (0, import_core12.textblockTypeInputRule)({
|
|
6206
6326
|
find: new RegExp(`^(#{${Math.min(...this.options.levels)},${level}})\\s$`),
|
|
6207
6327
|
type: this.type,
|
|
6208
6328
|
getAttributes: {
|
|
@@ -6214,8 +6334,8 @@ var Heading = import_core11.Node.create({
|
|
|
6214
6334
|
});
|
|
6215
6335
|
|
|
6216
6336
|
// node_modules/@tiptap/extension-horizontal-rule/dist/index.js
|
|
6217
|
-
var
|
|
6218
|
-
var HorizontalRule =
|
|
6337
|
+
var import_core13 = require("@tiptap/core");
|
|
6338
|
+
var HorizontalRule = import_core13.Node.create({
|
|
6219
6339
|
name: "horizontalRule",
|
|
6220
6340
|
addOptions() {
|
|
6221
6341
|
return {
|
|
@@ -6227,12 +6347,12 @@ var HorizontalRule = import_core12.Node.create({
|
|
|
6227
6347
|
return [{ tag: "hr" }];
|
|
6228
6348
|
},
|
|
6229
6349
|
renderHTML({ HTMLAttributes }) {
|
|
6230
|
-
return ["hr", (0,
|
|
6350
|
+
return ["hr", (0, import_core13.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes)];
|
|
6231
6351
|
},
|
|
6232
6352
|
addCommands() {
|
|
6233
6353
|
return {
|
|
6234
6354
|
setHorizontalRule: () => ({ chain, state }) => {
|
|
6235
|
-
if (!(0,
|
|
6355
|
+
if (!(0, import_core13.canInsertNode)(state, state.schema.nodes[this.name])) {
|
|
6236
6356
|
return false;
|
|
6237
6357
|
}
|
|
6238
6358
|
const { selection } = state;
|
|
@@ -6245,7 +6365,7 @@ var HorizontalRule = import_core12.Node.create({
|
|
|
6245
6365
|
}, {
|
|
6246
6366
|
type: this.name
|
|
6247
6367
|
});
|
|
6248
|
-
} else if ((0,
|
|
6368
|
+
} else if ((0, import_core13.isNodeSelection)(selection)) {
|
|
6249
6369
|
currentChain.insertContentAt($originTo.pos, {
|
|
6250
6370
|
type: this.name
|
|
6251
6371
|
});
|
|
@@ -6281,7 +6401,7 @@ var HorizontalRule = import_core12.Node.create({
|
|
|
6281
6401
|
},
|
|
6282
6402
|
addInputRules() {
|
|
6283
6403
|
return [
|
|
6284
|
-
(0,
|
|
6404
|
+
(0, import_core13.nodeInputRule)({
|
|
6285
6405
|
find: /^(?:---|—-|___\s|\*\*\*\s)$/,
|
|
6286
6406
|
type: this.type
|
|
6287
6407
|
})
|
|
@@ -6298,8 +6418,8 @@ var import_extension_link = __toESM(require("@tiptap/extension-link"));
|
|
|
6298
6418
|
var import_extension_text_style = __toESM(require("@tiptap/extension-text-style"));
|
|
6299
6419
|
|
|
6300
6420
|
// node_modules/@tiptap/extension-list-item/dist/index.js
|
|
6301
|
-
var
|
|
6302
|
-
var ListItem =
|
|
6421
|
+
var import_core14 = require("@tiptap/core");
|
|
6422
|
+
var ListItem = import_core14.Node.create({
|
|
6303
6423
|
name: "listItem",
|
|
6304
6424
|
addOptions() {
|
|
6305
6425
|
return {
|
|
@@ -6318,7 +6438,7 @@ var ListItem = import_core13.Node.create({
|
|
|
6318
6438
|
];
|
|
6319
6439
|
},
|
|
6320
6440
|
renderHTML({ HTMLAttributes }) {
|
|
6321
|
-
return ["li", (0,
|
|
6441
|
+
return ["li", (0, import_core14.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
6322
6442
|
},
|
|
6323
6443
|
addKeyboardShortcuts() {
|
|
6324
6444
|
return {
|
|
@@ -6330,11 +6450,11 @@ var ListItem = import_core13.Node.create({
|
|
|
6330
6450
|
});
|
|
6331
6451
|
|
|
6332
6452
|
// node_modules/@tiptap/extension-bullet-list/dist/index.js
|
|
6333
|
-
var
|
|
6453
|
+
var import_core15 = require("@tiptap/core");
|
|
6334
6454
|
var ListItemName = "listItem";
|
|
6335
6455
|
var TextStyleName = "textStyle";
|
|
6336
6456
|
var inputRegex4 = /^\s*([-+*])\s$/;
|
|
6337
|
-
var BulletList =
|
|
6457
|
+
var BulletList = import_core15.Node.create({
|
|
6338
6458
|
name: "bulletList",
|
|
6339
6459
|
addOptions() {
|
|
6340
6460
|
return {
|
|
@@ -6354,7 +6474,7 @@ var BulletList = import_core14.Node.create({
|
|
|
6354
6474
|
];
|
|
6355
6475
|
},
|
|
6356
6476
|
renderHTML({ HTMLAttributes }) {
|
|
6357
|
-
return ["ul", (0,
|
|
6477
|
+
return ["ul", (0, import_core15.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
6358
6478
|
},
|
|
6359
6479
|
addCommands() {
|
|
6360
6480
|
return {
|
|
@@ -6372,12 +6492,12 @@ var BulletList = import_core14.Node.create({
|
|
|
6372
6492
|
};
|
|
6373
6493
|
},
|
|
6374
6494
|
addInputRules() {
|
|
6375
|
-
let inputRule = (0,
|
|
6495
|
+
let inputRule = (0, import_core15.wrappingInputRule)({
|
|
6376
6496
|
find: inputRegex4,
|
|
6377
6497
|
type: this.type
|
|
6378
6498
|
});
|
|
6379
6499
|
if (this.options.keepMarks || this.options.keepAttributes) {
|
|
6380
|
-
inputRule = (0,
|
|
6500
|
+
inputRule = (0, import_core15.wrappingInputRule)({
|
|
6381
6501
|
find: inputRegex4,
|
|
6382
6502
|
type: this.type,
|
|
6383
6503
|
keepMarks: this.options.keepMarks,
|
|
@@ -6395,11 +6515,11 @@ var BulletList = import_core14.Node.create({
|
|
|
6395
6515
|
});
|
|
6396
6516
|
|
|
6397
6517
|
// node_modules/@tiptap/extension-ordered-list/dist/index.js
|
|
6398
|
-
var
|
|
6518
|
+
var import_core16 = require("@tiptap/core");
|
|
6399
6519
|
var ListItemName2 = "listItem";
|
|
6400
6520
|
var TextStyleName2 = "textStyle";
|
|
6401
6521
|
var inputRegex5 = /^(\d+)\.\s$/;
|
|
6402
|
-
var OrderedList =
|
|
6522
|
+
var OrderedList = import_core16.Node.create({
|
|
6403
6523
|
name: "orderedList",
|
|
6404
6524
|
addOptions() {
|
|
6405
6525
|
return {
|
|
@@ -6436,7 +6556,7 @@ var OrderedList = import_core15.Node.create({
|
|
|
6436
6556
|
},
|
|
6437
6557
|
renderHTML({ HTMLAttributes }) {
|
|
6438
6558
|
const { start, ...attributesWithoutStart } = HTMLAttributes;
|
|
6439
|
-
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];
|
|
6440
6560
|
},
|
|
6441
6561
|
addCommands() {
|
|
6442
6562
|
return {
|
|
@@ -6454,14 +6574,14 @@ var OrderedList = import_core15.Node.create({
|
|
|
6454
6574
|
};
|
|
6455
6575
|
},
|
|
6456
6576
|
addInputRules() {
|
|
6457
|
-
let inputRule = (0,
|
|
6577
|
+
let inputRule = (0, import_core16.wrappingInputRule)({
|
|
6458
6578
|
find: inputRegex5,
|
|
6459
6579
|
type: this.type,
|
|
6460
6580
|
getAttributes: (match) => ({ start: +match[1] }),
|
|
6461
6581
|
joinPredicate: (match, node) => node.childCount + node.attrs.start === +match[1]
|
|
6462
6582
|
});
|
|
6463
6583
|
if (this.options.keepMarks || this.options.keepAttributes) {
|
|
6464
|
-
inputRule = (0,
|
|
6584
|
+
inputRule = (0, import_core16.wrappingInputRule)({
|
|
6465
6585
|
find: inputRegex5,
|
|
6466
6586
|
type: this.type,
|
|
6467
6587
|
keepMarks: this.options.keepMarks,
|
|
@@ -8023,9 +8143,9 @@ function useTypo() {
|
|
|
8023
8143
|
}
|
|
8024
8144
|
|
|
8025
8145
|
// src/components/tetrons/extensions/Spellcheck.ts
|
|
8026
|
-
var
|
|
8146
|
+
var import_core17 = require("@tiptap/core");
|
|
8027
8147
|
var wordMatchRegex = () => /(?:^|\s)([a-zA-Z]{2,})(?=\s|$)/g;
|
|
8028
|
-
var Spellcheck =
|
|
8148
|
+
var Spellcheck = import_core17.Mark.create({
|
|
8029
8149
|
name: "spellcheck",
|
|
8030
8150
|
addOptions() {
|
|
8031
8151
|
return {
|
|
@@ -8034,7 +8154,7 @@ var Spellcheck = import_core16.Mark.create({
|
|
|
8034
8154
|
},
|
|
8035
8155
|
addInputRules() {
|
|
8036
8156
|
return [
|
|
8037
|
-
(0,
|
|
8157
|
+
(0, import_core17.markInputRule)({
|
|
8038
8158
|
find: wordMatchRegex(),
|
|
8039
8159
|
type: this.type,
|
|
8040
8160
|
getAttributes: (match) => this.options.spellcheckFn(match[1]) ? false : { "data-spellcheck": "true" }
|
|
@@ -8062,8 +8182,8 @@ var Spellcheck = import_core16.Mark.create({
|
|
|
8062
8182
|
});
|
|
8063
8183
|
|
|
8064
8184
|
// src/components/tetrons/toolbar/extensions/Comment.ts
|
|
8065
|
-
var
|
|
8066
|
-
var Comment =
|
|
8185
|
+
var import_core18 = require("@tiptap/core");
|
|
8186
|
+
var Comment = import_core18.Mark.create({
|
|
8067
8187
|
name: "comment",
|
|
8068
8188
|
addOptions() {
|
|
8069
8189
|
return {
|
|
@@ -8087,7 +8207,7 @@ var Comment = import_core17.Mark.create({
|
|
|
8087
8207
|
renderHTML({ HTMLAttributes }) {
|
|
8088
8208
|
return [
|
|
8089
8209
|
"span",
|
|
8090
|
-
(0,
|
|
8210
|
+
(0, import_core18.mergeAttributes)(HTMLAttributes, {
|
|
8091
8211
|
"data-comment": HTMLAttributes.comment,
|
|
8092
8212
|
class: "comment-highlight",
|
|
8093
8213
|
title: HTMLAttributes.comment,
|
|
@@ -8109,8 +8229,8 @@ var Comment = import_core17.Mark.create({
|
|
|
8109
8229
|
});
|
|
8110
8230
|
|
|
8111
8231
|
// src/components/tetrons/toolbar/marks/Subscript.ts
|
|
8112
|
-
var
|
|
8113
|
-
var Subscript =
|
|
8232
|
+
var import_core19 = require("@tiptap/core");
|
|
8233
|
+
var Subscript = import_core19.Mark.create({
|
|
8114
8234
|
name: "subscript",
|
|
8115
8235
|
excludes: "superscript",
|
|
8116
8236
|
parseHTML() {
|
|
@@ -8126,7 +8246,7 @@ var Subscript = import_core18.Mark.create({
|
|
|
8126
8246
|
},
|
|
8127
8247
|
addInputRules() {
|
|
8128
8248
|
return [
|
|
8129
|
-
(0,
|
|
8249
|
+
(0, import_core19.markInputRule)({
|
|
8130
8250
|
find: /~([^~]+)~/,
|
|
8131
8251
|
type: this.type
|
|
8132
8252
|
})
|
|
@@ -8134,7 +8254,7 @@ var Subscript = import_core18.Mark.create({
|
|
|
8134
8254
|
},
|
|
8135
8255
|
addPasteRules() {
|
|
8136
8256
|
return [
|
|
8137
|
-
(0,
|
|
8257
|
+
(0, import_core19.markPasteRule)({
|
|
8138
8258
|
find: /~([^~]+)~/g,
|
|
8139
8259
|
type: this.type
|
|
8140
8260
|
})
|
|
@@ -8143,8 +8263,8 @@ var Subscript = import_core18.Mark.create({
|
|
|
8143
8263
|
});
|
|
8144
8264
|
|
|
8145
8265
|
// src/components/tetrons/toolbar/marks/Superscript.ts
|
|
8146
|
-
var
|
|
8147
|
-
var Superscript =
|
|
8266
|
+
var import_core20 = require("@tiptap/core");
|
|
8267
|
+
var Superscript = import_core20.Mark.create({
|
|
8148
8268
|
name: "superscript",
|
|
8149
8269
|
excludes: "subscript",
|
|
8150
8270
|
parseHTML() {
|
|
@@ -8160,7 +8280,7 @@ var Superscript = import_core19.Mark.create({
|
|
|
8160
8280
|
},
|
|
8161
8281
|
addInputRules() {
|
|
8162
8282
|
return [
|
|
8163
|
-
(0,
|
|
8283
|
+
(0, import_core20.markInputRule)({
|
|
8164
8284
|
find: /\^([^^]+)\^/,
|
|
8165
8285
|
type: this.type
|
|
8166
8286
|
})
|
|
@@ -8168,7 +8288,7 @@ var Superscript = import_core19.Mark.create({
|
|
|
8168
8288
|
},
|
|
8169
8289
|
addPasteRules() {
|
|
8170
8290
|
return [
|
|
8171
|
-
(0,
|
|
8291
|
+
(0, import_core20.markPasteRule)({
|
|
8172
8292
|
find: /\^([^^]+)\^/g,
|
|
8173
8293
|
type: this.type
|
|
8174
8294
|
})
|
|
@@ -15247,8 +15367,8 @@ var ResizableTable = import_extension_table.Table.extend({
|
|
|
15247
15367
|
});
|
|
15248
15368
|
|
|
15249
15369
|
// src/components/tetrons/toolbar/extensions/Embed.ts
|
|
15250
|
-
var
|
|
15251
|
-
var Embed =
|
|
15370
|
+
var import_core21 = require("@tiptap/core");
|
|
15371
|
+
var Embed = import_core21.Node.create({
|
|
15252
15372
|
name: "embed",
|
|
15253
15373
|
group: "block",
|
|
15254
15374
|
atom: true,
|
|
@@ -15263,7 +15383,7 @@ var Embed = import_core20.Node.create({
|
|
|
15263
15383
|
return [{ tag: "iframe[src]" }];
|
|
15264
15384
|
},
|
|
15265
15385
|
renderHTML({ HTMLAttributes }) {
|
|
15266
|
-
return ["iframe", (0,
|
|
15386
|
+
return ["iframe", (0, import_core21.mergeAttributes)(HTMLAttributes)];
|
|
15267
15387
|
},
|
|
15268
15388
|
addCommands() {
|
|
15269
15389
|
return {
|
|
@@ -15341,8 +15461,8 @@ var Embed = import_core20.Node.create({
|
|
|
15341
15461
|
});
|
|
15342
15462
|
|
|
15343
15463
|
// src/components/tetrons/toolbar/extensions/FontFamily.ts
|
|
15344
|
-
var
|
|
15345
|
-
var FontFamily =
|
|
15464
|
+
var import_core22 = require("@tiptap/core");
|
|
15465
|
+
var FontFamily = import_core22.Mark.create({
|
|
15346
15466
|
name: "fontFamily",
|
|
15347
15467
|
addAttributes() {
|
|
15348
15468
|
return {
|
|
@@ -15360,7 +15480,7 @@ var FontFamily = import_core21.Mark.create({
|
|
|
15360
15480
|
return [{ style: "font-family" }];
|
|
15361
15481
|
},
|
|
15362
15482
|
renderHTML({ HTMLAttributes }) {
|
|
15363
|
-
return ["span", (0,
|
|
15483
|
+
return ["span", (0, import_core22.mergeAttributes)(HTMLAttributes), 0];
|
|
15364
15484
|
},
|
|
15365
15485
|
addCommands() {
|
|
15366
15486
|
return {
|
|
@@ -15370,8 +15490,8 @@ var FontFamily = import_core21.Mark.create({
|
|
|
15370
15490
|
});
|
|
15371
15491
|
|
|
15372
15492
|
// src/components/tetrons/toolbar/extensions/FontSize.ts
|
|
15373
|
-
var
|
|
15374
|
-
var FontSize =
|
|
15493
|
+
var import_core23 = require("@tiptap/core");
|
|
15494
|
+
var FontSize = import_core23.Mark.create({
|
|
15375
15495
|
name: "fontSize",
|
|
15376
15496
|
addAttributes() {
|
|
15377
15497
|
return {
|
|
@@ -15389,7 +15509,7 @@ var FontSize = import_core22.Mark.create({
|
|
|
15389
15509
|
return [{ style: "font-size" }];
|
|
15390
15510
|
},
|
|
15391
15511
|
renderHTML({ HTMLAttributes }) {
|
|
15392
|
-
return ["span", (0,
|
|
15512
|
+
return ["span", (0, import_core23.mergeAttributes)(HTMLAttributes), 0];
|
|
15393
15513
|
},
|
|
15394
15514
|
addCommands() {
|
|
15395
15515
|
return {
|
|
@@ -15531,7 +15651,7 @@ var ResizableImage = import_extension_image.default.extend({
|
|
|
15531
15651
|
});
|
|
15532
15652
|
|
|
15533
15653
|
// src/components/tetrons/ResizableVideo.ts
|
|
15534
|
-
var
|
|
15654
|
+
var import_core24 = require("@tiptap/core");
|
|
15535
15655
|
var import_react7 = require("@tiptap/react");
|
|
15536
15656
|
|
|
15537
15657
|
// src/components/tetrons/ResizableVideoComponent.tsx
|
|
@@ -15587,7 +15707,7 @@ var ResizableVideoComponent = ({
|
|
|
15587
15707
|
var ResizableVideoComponent_default = ResizableVideoComponent;
|
|
15588
15708
|
|
|
15589
15709
|
// src/components/tetrons/ResizableVideo.ts
|
|
15590
|
-
var ResizableVideo =
|
|
15710
|
+
var ResizableVideo = import_core24.Node.create({
|
|
15591
15711
|
name: "video",
|
|
15592
15712
|
group: "block",
|
|
15593
15713
|
draggable: true,
|
|
@@ -15720,7 +15840,7 @@ function TableContextMenu({ editor }) {
|
|
|
15720
15840
|
}
|
|
15721
15841
|
|
|
15722
15842
|
// src/components/tetrons/toolbar/TetronsToolbar.tsx
|
|
15723
|
-
var
|
|
15843
|
+
var import_react21 = __toESM(require("react"));
|
|
15724
15844
|
|
|
15725
15845
|
// src/components/tetrons/toolbar/ActionGroup.tsx
|
|
15726
15846
|
var import_react10 = __toESM(require("react"));
|
|
@@ -16776,13 +16896,66 @@ function AiGroup({ editor }) {
|
|
|
16776
16896
|
)));
|
|
16777
16897
|
}
|
|
16778
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
|
+
|
|
16779
16951
|
// src/components/tetrons/toolbar/TetronsToolbar.tsx
|
|
16780
16952
|
function TetronsToolbar({
|
|
16781
16953
|
editor,
|
|
16782
|
-
version
|
|
16954
|
+
version,
|
|
16955
|
+
addOns = []
|
|
16783
16956
|
}) {
|
|
16784
|
-
const [autoSave, setAutoSave] = (0,
|
|
16785
|
-
(0,
|
|
16957
|
+
const [autoSave, setAutoSave] = (0, import_react21.useState)(false);
|
|
16958
|
+
(0, import_react21.useEffect)(() => {
|
|
16786
16959
|
if (!editor) return;
|
|
16787
16960
|
const handleUpdate = () => {
|
|
16788
16961
|
if (!autoSave) return;
|
|
@@ -16798,7 +16971,7 @@ function TetronsToolbar({
|
|
|
16798
16971
|
editor.off("update", handleUpdate);
|
|
16799
16972
|
};
|
|
16800
16973
|
}, [autoSave, editor]);
|
|
16801
|
-
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(
|
|
16802
16975
|
"input",
|
|
16803
16976
|
{
|
|
16804
16977
|
type: "checkbox",
|
|
@@ -16806,35 +16979,25 @@ function TetronsToolbar({
|
|
|
16806
16979
|
checked: autoSave,
|
|
16807
16980
|
onChange: (e) => setAutoSave(e.target.checked)
|
|
16808
16981
|
}
|
|
16809
|
-
), /* @__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 }));
|
|
16810
16983
|
}
|
|
16811
16984
|
|
|
16812
16985
|
// src/components/tetrons/EditorContent.tsx
|
|
16813
|
-
var import_meta = {};
|
|
16814
16986
|
var lowlight = (0, import_lowlight.createLowlight)();
|
|
16815
16987
|
lowlight.register("js", javascript);
|
|
16816
16988
|
lowlight.register("ts", typescript);
|
|
16817
16989
|
function EditorContent({ apiKey }) {
|
|
16818
16990
|
const typo = useTypo();
|
|
16819
|
-
const [isValid, setIsValid] = (0,
|
|
16820
|
-
const [error, setError] = (0,
|
|
16821
|
-
const [versions, setVersions] = (0,
|
|
16822
|
-
const [userVersion, setUserVersion] = (0,
|
|
16823
|
-
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)(
|
|
16824
16996
|
null
|
|
16825
16997
|
);
|
|
16826
|
-
const wrapperRef = (0,
|
|
16827
|
-
|
|
16828
|
-
|
|
16829
|
-
return import_meta.env.VITE_TETRONS_API_URL;
|
|
16830
|
-
}
|
|
16831
|
-
if (typeof process !== "undefined" && process.env?.NEXT_PUBLIC_TETRONS_API_URL) {
|
|
16832
|
-
return process.env.NEXT_PUBLIC_TETRONS_API_URL;
|
|
16833
|
-
}
|
|
16834
|
-
return "https://staging.tetrons.com";
|
|
16835
|
-
}
|
|
16836
|
-
const API_BASE_URL = getApiBaseUrl();
|
|
16837
|
-
(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)(() => {
|
|
16838
17001
|
const validateKey = async () => {
|
|
16839
17002
|
try {
|
|
16840
17003
|
const res = await fetch(`${API_BASE_URL}/api/validate`, {
|
|
@@ -16855,7 +17018,7 @@ function EditorContent({ apiKey }) {
|
|
|
16855
17018
|
};
|
|
16856
17019
|
validateKey();
|
|
16857
17020
|
}, [apiKey, API_BASE_URL]);
|
|
16858
|
-
const editor = (0,
|
|
17021
|
+
const editor = (0, import_react23.useEditor)({
|
|
16859
17022
|
extensions: [
|
|
16860
17023
|
Document,
|
|
16861
17024
|
Paragraph,
|
|
@@ -16905,7 +17068,8 @@ function EditorContent({ apiKey }) {
|
|
|
16905
17068
|
Spellcheck.configure({
|
|
16906
17069
|
spellcheckFn: (word) => typo.check(word)
|
|
16907
17070
|
})
|
|
16908
|
-
] : []
|
|
17071
|
+
] : [],
|
|
17072
|
+
MathInline
|
|
16909
17073
|
],
|
|
16910
17074
|
content: "",
|
|
16911
17075
|
editorProps: {
|
|
@@ -16916,7 +17080,7 @@ function EditorContent({ apiKey }) {
|
|
|
16916
17080
|
},
|
|
16917
17081
|
immediatelyRender: false
|
|
16918
17082
|
});
|
|
16919
|
-
(0,
|
|
17083
|
+
(0, import_react22.useEffect)(() => {
|
|
16920
17084
|
return () => {
|
|
16921
17085
|
editor?.destroy();
|
|
16922
17086
|
};
|
|
@@ -16941,15 +17105,22 @@ function EditorContent({ apiKey }) {
|
|
|
16941
17105
|
}
|
|
16942
17106
|
};
|
|
16943
17107
|
if (isValid === false) {
|
|
16944
|
-
return /* @__PURE__ */
|
|
17108
|
+
return /* @__PURE__ */ import_react22.default.createElement("div", { className: "editor-error" }, "\u26A0\uFE0F ", error);
|
|
16945
17109
|
}
|
|
16946
17110
|
if (isValid === null) {
|
|
16947
|
-
return /* @__PURE__ */
|
|
17111
|
+
return /* @__PURE__ */ import_react22.default.createElement("div", { className: "editor-loading" }, "\u{1F50D} Validating license...");
|
|
16948
17112
|
}
|
|
16949
17113
|
if (!typo) {
|
|
16950
|
-
return /* @__PURE__ */
|
|
17114
|
+
return /* @__PURE__ */ import_react22.default.createElement("div", { className: "editor-loading" }, "\u{1F4D6} Loading dictionary...");
|
|
16951
17115
|
}
|
|
16952
|
-
|
|
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(
|
|
16953
17124
|
"button",
|
|
16954
17125
|
{
|
|
16955
17126
|
type: "button",
|
|
@@ -16958,7 +17129,7 @@ function EditorContent({ apiKey }) {
|
|
|
16958
17129
|
className: "editor-save-btn"
|
|
16959
17130
|
},
|
|
16960
17131
|
"Save Version"
|
|
16961
|
-
), /* @__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(
|
|
16962
17133
|
"button",
|
|
16963
17134
|
{
|
|
16964
17135
|
key: idx,
|
|
@@ -16968,17 +17139,53 @@ function EditorContent({ apiKey }) {
|
|
|
16968
17139
|
title: `Restore Version ${idx + 1}`
|
|
16969
17140
|
},
|
|
16970
17141
|
`V${idx + 1}`
|
|
16971
|
-
)))), 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(
|
|
16972
17150
|
"div",
|
|
16973
17151
|
{
|
|
16974
17152
|
ref: wrapperRef,
|
|
16975
17153
|
className: "editor-content-wrapper",
|
|
16976
17154
|
onClick: handleEditorClick
|
|
16977
17155
|
},
|
|
16978
|
-
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...")
|
|
16979
17157
|
));
|
|
16980
17158
|
}
|
|
16981
17159
|
|
|
17160
|
+
// src/utils/licenseTracker.ts
|
|
17161
|
+
var getLicenseKey = (plan) => `__tetrons_license_start_${plan}__`;
|
|
17162
|
+
var PLAN_DURATIONS = {
|
|
17163
|
+
free: 14,
|
|
17164
|
+
pro: 30,
|
|
17165
|
+
premium: 30,
|
|
17166
|
+
platinum: 30
|
|
17167
|
+
};
|
|
17168
|
+
function initLicenseTracking(plan) {
|
|
17169
|
+
if (typeof window === "undefined") return;
|
|
17170
|
+
const key = getLicenseKey(plan);
|
|
17171
|
+
const now = Date.now();
|
|
17172
|
+
const stored = localStorage.getItem(key);
|
|
17173
|
+
if (!stored) {
|
|
17174
|
+
localStorage.setItem(key, now.toString());
|
|
17175
|
+
}
|
|
17176
|
+
}
|
|
17177
|
+
function isLicenseValid(plan) {
|
|
17178
|
+
if (typeof window === "undefined") return true;
|
|
17179
|
+
const key = getLicenseKey(plan);
|
|
17180
|
+
const stored = localStorage.getItem(key);
|
|
17181
|
+
if (!stored) return false;
|
|
17182
|
+
const startedAt = parseInt(stored, 10);
|
|
17183
|
+
const now = Date.now();
|
|
17184
|
+
const diffDays = Math.floor((now - startedAt) / (1e3 * 60 * 60 * 24));
|
|
17185
|
+
const allowedDays = PLAN_DURATIONS[plan];
|
|
17186
|
+
return diffDays <= allowedDays;
|
|
17187
|
+
}
|
|
17188
|
+
|
|
16982
17189
|
// src/index.ts
|
|
16983
17190
|
var API_VALID = false;
|
|
16984
17191
|
var API_VERSION = "";
|
|
@@ -16997,6 +17204,9 @@ async function initializeTetrons(apiKey) {
|
|
|
16997
17204
|
const data = await res.json();
|
|
16998
17205
|
API_VALID = data.valid;
|
|
16999
17206
|
API_VERSION = data.version;
|
|
17207
|
+
if (API_VALID && typeof window !== "undefined") {
|
|
17208
|
+
initLicenseTracking(API_VERSION);
|
|
17209
|
+
}
|
|
17000
17210
|
}
|
|
17001
17211
|
function getTetronsVersion() {
|
|
17002
17212
|
return API_VERSION;
|
|
@@ -17004,11 +17214,16 @@ function getTetronsVersion() {
|
|
|
17004
17214
|
function isApiKeyValid() {
|
|
17005
17215
|
return API_VALID;
|
|
17006
17216
|
}
|
|
17217
|
+
function isTetronsLicenseValid() {
|
|
17218
|
+
if (!API_VALID || !API_VERSION) return false;
|
|
17219
|
+
return isLicenseValid(API_VERSION);
|
|
17220
|
+
}
|
|
17007
17221
|
var index_default = EditorContent;
|
|
17008
17222
|
// Annotate the CommonJS export names for ESM import in node:
|
|
17009
17223
|
0 && (module.exports = {
|
|
17010
17224
|
EditorContent,
|
|
17011
17225
|
getTetronsVersion,
|
|
17012
17226
|
initializeTetrons,
|
|
17013
|
-
isApiKeyValid
|
|
17227
|
+
isApiKeyValid,
|
|
17228
|
+
isTetronsLicenseValid
|
|
17014
17229
|
});
|