tetrons 2.3.73 → 2.3.74
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/app/api/ai-action/route.cjs +34 -9
- package/dist/app/api/export/route.cjs +29 -4
- package/dist/app/api/register/route.cjs +76 -14
- package/dist/app/api/register/route.mjs +32 -5
- package/dist/app/api/save/route.cjs +48 -13
- package/dist/app/api/transcribe/route.cjs +38 -12
- package/dist/app/api/validate/route.cjs +79 -14
- package/dist/app/api/validate/route.mjs +34 -5
- package/dist/index.cjs +433 -498
- package/dist/index.d.mts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.mjs +11 -69
- package/package.json +5 -9
- package/dist/chunk-37LFEKRW.cjs +0 -36
- package/dist/chunk-M2F2EU6B.mjs +0 -36
package/dist/index.cjs
CHANGED
|
@@ -1,21 +1,58 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from2, except, desc) => {
|
|
13
|
+
if (from2 && typeof from2 === "object" || typeof from2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from2))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from2[key], enumerable: !(desc = __getOwnPropDesc(from2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
4
29
|
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
|
+
EditorContent: () => EditorContent,
|
|
34
|
+
default: () => index_default,
|
|
35
|
+
getTetronsVersion: () => getTetronsVersion,
|
|
36
|
+
initializeTetrons: () => initializeTetrons,
|
|
37
|
+
isApiKeyValid: () => isApiKeyValid
|
|
38
|
+
});
|
|
39
|
+
module.exports = __toCommonJS(index_exports);
|
|
5
40
|
|
|
6
|
-
|
|
41
|
+
// src/components/tetrons/EditorContent.tsx
|
|
42
|
+
var import_react20 = __toESM(require("react"));
|
|
43
|
+
var import_react21 = require("@tiptap/react");
|
|
7
44
|
|
|
8
45
|
// node_modules/@tiptap/extension-document/dist/index.js
|
|
9
|
-
var
|
|
10
|
-
var Document =
|
|
46
|
+
var import_core = require("@tiptap/core");
|
|
47
|
+
var Document = import_core.Node.create({
|
|
11
48
|
name: "doc",
|
|
12
49
|
topNode: true,
|
|
13
50
|
content: "block+"
|
|
14
51
|
});
|
|
15
52
|
|
|
16
53
|
// node_modules/@tiptap/extension-paragraph/dist/index.js
|
|
17
|
-
|
|
18
|
-
var Paragraph =
|
|
54
|
+
var import_core2 = require("@tiptap/core");
|
|
55
|
+
var Paragraph = import_core2.Node.create({
|
|
19
56
|
name: "paragraph",
|
|
20
57
|
priority: 1e3,
|
|
21
58
|
addOptions() {
|
|
@@ -31,7 +68,7 @@ var Paragraph = _core.Node.create({
|
|
|
31
68
|
];
|
|
32
69
|
},
|
|
33
70
|
renderHTML({ HTMLAttributes }) {
|
|
34
|
-
return ["p",
|
|
71
|
+
return ["p", (0, import_core2.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
35
72
|
},
|
|
36
73
|
addCommands() {
|
|
37
74
|
return {
|
|
@@ -48,14 +85,14 @@ var Paragraph = _core.Node.create({
|
|
|
48
85
|
});
|
|
49
86
|
|
|
50
87
|
// node_modules/@tiptap/extension-text/dist/index.js
|
|
51
|
-
|
|
52
|
-
var Text =
|
|
88
|
+
var import_core3 = require("@tiptap/core");
|
|
89
|
+
var Text = import_core3.Node.create({
|
|
53
90
|
name: "text",
|
|
54
91
|
group: "inline"
|
|
55
92
|
});
|
|
56
93
|
|
|
57
94
|
// node_modules/@tiptap/extension-history/dist/index.js
|
|
58
|
-
|
|
95
|
+
var import_core4 = require("@tiptap/core");
|
|
59
96
|
|
|
60
97
|
// node_modules/rope-sequence/dist/index.js
|
|
61
98
|
var GOOD_LEAF_SIZE = 200;
|
|
@@ -503,7 +540,7 @@ var Fragment = class _Fragment {
|
|
|
503
540
|
position in this fragment. The result object will be reused
|
|
504
541
|
(overwritten) the next time the function is called. @internal
|
|
505
542
|
*/
|
|
506
|
-
findIndex(pos
|
|
543
|
+
findIndex(pos) {
|
|
507
544
|
if (pos == 0)
|
|
508
545
|
return retIndex(0, pos);
|
|
509
546
|
if (pos == this.size)
|
|
@@ -513,7 +550,7 @@ var Fragment = class _Fragment {
|
|
|
513
550
|
for (let i = 0, curPos = 0; ; i++) {
|
|
514
551
|
let cur = this.child(i), end = curPos + cur.nodeSize;
|
|
515
552
|
if (end >= pos) {
|
|
516
|
-
if (end == pos
|
|
553
|
+
if (end == pos)
|
|
517
554
|
return retIndex(i + 1, end);
|
|
518
555
|
return retIndex(i, curPos);
|
|
519
556
|
}
|
|
@@ -1356,7 +1393,7 @@ var Node4 = class _Node {
|
|
|
1356
1393
|
`blockSeparator` is given, it will be inserted to separate text
|
|
1357
1394
|
from different block nodes. If `leafText` is given, it'll be
|
|
1358
1395
|
inserted for every non-text leaf node encountered, otherwise
|
|
1359
|
-
[`leafText`](https://prosemirror.net/docs/ref/#model.NodeSpec
|
|
1396
|
+
[`leafText`](https://prosemirror.net/docs/ref/#model.NodeSpec.leafText) will be used.
|
|
1360
1397
|
*/
|
|
1361
1398
|
textBetween(from2, to, blockSeparator, leafText) {
|
|
1362
1399
|
return this.content.textBetween(from2, to, blockSeparator, leafText);
|
|
@@ -2336,7 +2373,7 @@ var DOMParser = class _DOMParser {
|
|
|
2336
2373
|
/**
|
|
2337
2374
|
Construct a DOM parser using the parsing rules listed in a
|
|
2338
2375
|
schema's [node specs](https://prosemirror.net/docs/ref/#model.NodeSpec.parseDOM), reordered by
|
|
2339
|
-
[priority](https://prosemirror.net/docs/ref/#model.
|
|
2376
|
+
[priority](https://prosemirror.net/docs/ref/#model.GenericParseRule.priority).
|
|
2340
2377
|
*/
|
|
2341
2378
|
static fromSchema(schema) {
|
|
2342
2379
|
return schema.cached.domParser || (schema.cached.domParser = new _DOMParser(schema, _DOMParser.schemaRules(schema)));
|
|
@@ -3055,6 +3092,8 @@ function renderSpec(doc3, structure, xmlNS, blockArraysIn) {
|
|
|
3055
3092
|
let space2 = name.indexOf(" ");
|
|
3056
3093
|
if (space2 > 0)
|
|
3057
3094
|
dom.setAttributeNS(name.slice(0, space2), name.slice(space2 + 1), attrs[name]);
|
|
3095
|
+
else if (name == "style" && dom.style)
|
|
3096
|
+
dom.style.cssText = attrs[name];
|
|
3058
3097
|
else
|
|
3059
3098
|
dom.setAttribute(name, attrs[name]);
|
|
3060
3099
|
}
|
|
@@ -5675,7 +5714,7 @@ var undoNoScroll = buildCommand(false, false);
|
|
|
5675
5714
|
var redoNoScroll = buildCommand(true, false);
|
|
5676
5715
|
|
|
5677
5716
|
// node_modules/@tiptap/extension-history/dist/index.js
|
|
5678
|
-
var History =
|
|
5717
|
+
var History = import_core4.Extension.create({
|
|
5679
5718
|
name: "history",
|
|
5680
5719
|
addOptions() {
|
|
5681
5720
|
return {
|
|
@@ -5711,12 +5750,12 @@ var History = _core.Extension.create({
|
|
|
5711
5750
|
});
|
|
5712
5751
|
|
|
5713
5752
|
// node_modules/@tiptap/extension-bold/dist/index.js
|
|
5714
|
-
|
|
5753
|
+
var import_core5 = require("@tiptap/core");
|
|
5715
5754
|
var starInputRegex = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/;
|
|
5716
5755
|
var starPasteRegex = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g;
|
|
5717
5756
|
var underscoreInputRegex = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/;
|
|
5718
5757
|
var underscorePasteRegex = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g;
|
|
5719
|
-
var Bold =
|
|
5758
|
+
var Bold = import_core5.Mark.create({
|
|
5720
5759
|
name: "bold",
|
|
5721
5760
|
addOptions() {
|
|
5722
5761
|
return {
|
|
@@ -5743,7 +5782,7 @@ var Bold = _core.Mark.create({
|
|
|
5743
5782
|
];
|
|
5744
5783
|
},
|
|
5745
5784
|
renderHTML({ HTMLAttributes }) {
|
|
5746
|
-
return ["strong",
|
|
5785
|
+
return ["strong", (0, import_core5.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
5747
5786
|
},
|
|
5748
5787
|
addCommands() {
|
|
5749
5788
|
return {
|
|
@@ -5766,11 +5805,11 @@ var Bold = _core.Mark.create({
|
|
|
5766
5805
|
},
|
|
5767
5806
|
addInputRules() {
|
|
5768
5807
|
return [
|
|
5769
|
-
|
|
5808
|
+
(0, import_core5.markInputRule)({
|
|
5770
5809
|
find: starInputRegex,
|
|
5771
5810
|
type: this.type
|
|
5772
5811
|
}),
|
|
5773
|
-
|
|
5812
|
+
(0, import_core5.markInputRule)({
|
|
5774
5813
|
find: underscoreInputRegex,
|
|
5775
5814
|
type: this.type
|
|
5776
5815
|
})
|
|
@@ -5778,11 +5817,11 @@ var Bold = _core.Mark.create({
|
|
|
5778
5817
|
},
|
|
5779
5818
|
addPasteRules() {
|
|
5780
5819
|
return [
|
|
5781
|
-
|
|
5820
|
+
(0, import_core5.markPasteRule)({
|
|
5782
5821
|
find: starPasteRegex,
|
|
5783
5822
|
type: this.type
|
|
5784
5823
|
}),
|
|
5785
|
-
|
|
5824
|
+
(0, import_core5.markPasteRule)({
|
|
5786
5825
|
find: underscorePasteRegex,
|
|
5787
5826
|
type: this.type
|
|
5788
5827
|
})
|
|
@@ -5791,12 +5830,12 @@ var Bold = _core.Mark.create({
|
|
|
5791
5830
|
});
|
|
5792
5831
|
|
|
5793
5832
|
// node_modules/@tiptap/extension-italic/dist/index.js
|
|
5794
|
-
|
|
5833
|
+
var import_core6 = require("@tiptap/core");
|
|
5795
5834
|
var starInputRegex2 = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/;
|
|
5796
5835
|
var starPasteRegex2 = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g;
|
|
5797
5836
|
var underscoreInputRegex2 = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/;
|
|
5798
5837
|
var underscorePasteRegex2 = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g;
|
|
5799
|
-
var Italic =
|
|
5838
|
+
var Italic = import_core6.Mark.create({
|
|
5800
5839
|
name: "italic",
|
|
5801
5840
|
addOptions() {
|
|
5802
5841
|
return {
|
|
@@ -5822,7 +5861,7 @@ var Italic = _core.Mark.create({
|
|
|
5822
5861
|
];
|
|
5823
5862
|
},
|
|
5824
5863
|
renderHTML({ HTMLAttributes }) {
|
|
5825
|
-
return ["em",
|
|
5864
|
+
return ["em", (0, import_core6.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
5826
5865
|
},
|
|
5827
5866
|
addCommands() {
|
|
5828
5867
|
return {
|
|
@@ -5845,11 +5884,11 @@ var Italic = _core.Mark.create({
|
|
|
5845
5884
|
},
|
|
5846
5885
|
addInputRules() {
|
|
5847
5886
|
return [
|
|
5848
|
-
|
|
5887
|
+
(0, import_core6.markInputRule)({
|
|
5849
5888
|
find: starInputRegex2,
|
|
5850
5889
|
type: this.type
|
|
5851
5890
|
}),
|
|
5852
|
-
|
|
5891
|
+
(0, import_core6.markInputRule)({
|
|
5853
5892
|
find: underscoreInputRegex2,
|
|
5854
5893
|
type: this.type
|
|
5855
5894
|
})
|
|
@@ -5857,11 +5896,11 @@ var Italic = _core.Mark.create({
|
|
|
5857
5896
|
},
|
|
5858
5897
|
addPasteRules() {
|
|
5859
5898
|
return [
|
|
5860
|
-
|
|
5899
|
+
(0, import_core6.markPasteRule)({
|
|
5861
5900
|
find: starPasteRegex2,
|
|
5862
5901
|
type: this.type
|
|
5863
5902
|
}),
|
|
5864
|
-
|
|
5903
|
+
(0, import_core6.markPasteRule)({
|
|
5865
5904
|
find: underscorePasteRegex2,
|
|
5866
5905
|
type: this.type
|
|
5867
5906
|
})
|
|
@@ -5870,13 +5909,13 @@ var Italic = _core.Mark.create({
|
|
|
5870
5909
|
});
|
|
5871
5910
|
|
|
5872
5911
|
// src/components/tetrons/EditorContent.tsx
|
|
5873
|
-
var
|
|
5912
|
+
var import_extension_underline = __toESM(require("@tiptap/extension-underline"));
|
|
5874
5913
|
|
|
5875
5914
|
// node_modules/@tiptap/extension-strike/dist/index.js
|
|
5876
|
-
|
|
5915
|
+
var import_core7 = require("@tiptap/core");
|
|
5877
5916
|
var inputRegex = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/;
|
|
5878
5917
|
var pasteRegex = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g;
|
|
5879
|
-
var Strike =
|
|
5918
|
+
var Strike = import_core7.Mark.create({
|
|
5880
5919
|
name: "strike",
|
|
5881
5920
|
addOptions() {
|
|
5882
5921
|
return {
|
|
@@ -5902,7 +5941,7 @@ var Strike = _core.Mark.create({
|
|
|
5902
5941
|
];
|
|
5903
5942
|
},
|
|
5904
5943
|
renderHTML({ HTMLAttributes }) {
|
|
5905
|
-
return ["s",
|
|
5944
|
+
return ["s", (0, import_core7.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
5906
5945
|
},
|
|
5907
5946
|
addCommands() {
|
|
5908
5947
|
return {
|
|
@@ -5924,7 +5963,7 @@ var Strike = _core.Mark.create({
|
|
|
5924
5963
|
},
|
|
5925
5964
|
addInputRules() {
|
|
5926
5965
|
return [
|
|
5927
|
-
|
|
5966
|
+
(0, import_core7.markInputRule)({
|
|
5928
5967
|
find: inputRegex,
|
|
5929
5968
|
type: this.type
|
|
5930
5969
|
})
|
|
@@ -5932,7 +5971,7 @@ var Strike = _core.Mark.create({
|
|
|
5932
5971
|
},
|
|
5933
5972
|
addPasteRules() {
|
|
5934
5973
|
return [
|
|
5935
|
-
|
|
5974
|
+
(0, import_core7.markPasteRule)({
|
|
5936
5975
|
find: pasteRegex,
|
|
5937
5976
|
type: this.type
|
|
5938
5977
|
})
|
|
@@ -5941,10 +5980,10 @@ var Strike = _core.Mark.create({
|
|
|
5941
5980
|
});
|
|
5942
5981
|
|
|
5943
5982
|
// node_modules/@tiptap/extension-code/dist/index.js
|
|
5944
|
-
|
|
5983
|
+
var import_core8 = require("@tiptap/core");
|
|
5945
5984
|
var inputRegex2 = /(^|[^`])`([^`]+)`(?!`)/;
|
|
5946
5985
|
var pasteRegex2 = /(^|[^`])`([^`]+)`(?!`)/g;
|
|
5947
|
-
var Code =
|
|
5986
|
+
var Code = import_core8.Mark.create({
|
|
5948
5987
|
name: "code",
|
|
5949
5988
|
addOptions() {
|
|
5950
5989
|
return {
|
|
@@ -5960,7 +5999,7 @@ var Code = _core.Mark.create({
|
|
|
5960
5999
|
];
|
|
5961
6000
|
},
|
|
5962
6001
|
renderHTML({ HTMLAttributes }) {
|
|
5963
|
-
return ["code",
|
|
6002
|
+
return ["code", (0, import_core8.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
5964
6003
|
},
|
|
5965
6004
|
addCommands() {
|
|
5966
6005
|
return {
|
|
@@ -5982,7 +6021,7 @@ var Code = _core.Mark.create({
|
|
|
5982
6021
|
},
|
|
5983
6022
|
addInputRules() {
|
|
5984
6023
|
return [
|
|
5985
|
-
|
|
6024
|
+
(0, import_core8.markInputRule)({
|
|
5986
6025
|
find: inputRegex2,
|
|
5987
6026
|
type: this.type
|
|
5988
6027
|
})
|
|
@@ -5990,7 +6029,7 @@ var Code = _core.Mark.create({
|
|
|
5990
6029
|
},
|
|
5991
6030
|
addPasteRules() {
|
|
5992
6031
|
return [
|
|
5993
|
-
|
|
6032
|
+
(0, import_core8.markPasteRule)({
|
|
5994
6033
|
find: pasteRegex2,
|
|
5995
6034
|
type: this.type
|
|
5996
6035
|
})
|
|
@@ -5999,9 +6038,9 @@ var Code = _core.Mark.create({
|
|
|
5999
6038
|
});
|
|
6000
6039
|
|
|
6001
6040
|
// node_modules/@tiptap/extension-blockquote/dist/index.js
|
|
6002
|
-
|
|
6041
|
+
var import_core9 = require("@tiptap/core");
|
|
6003
6042
|
var inputRegex3 = /^\s*>\s$/;
|
|
6004
|
-
var Blockquote =
|
|
6043
|
+
var Blockquote = import_core9.Node.create({
|
|
6005
6044
|
name: "blockquote",
|
|
6006
6045
|
addOptions() {
|
|
6007
6046
|
return {
|
|
@@ -6017,7 +6056,7 @@ var Blockquote = _core.Node.create({
|
|
|
6017
6056
|
];
|
|
6018
6057
|
},
|
|
6019
6058
|
renderHTML({ HTMLAttributes }) {
|
|
6020
|
-
return ["blockquote",
|
|
6059
|
+
return ["blockquote", (0, import_core9.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
6021
6060
|
},
|
|
6022
6061
|
addCommands() {
|
|
6023
6062
|
return {
|
|
@@ -6039,7 +6078,7 @@ var Blockquote = _core.Node.create({
|
|
|
6039
6078
|
},
|
|
6040
6079
|
addInputRules() {
|
|
6041
6080
|
return [
|
|
6042
|
-
|
|
6081
|
+
(0, import_core9.wrappingInputRule)({
|
|
6043
6082
|
find: inputRegex3,
|
|
6044
6083
|
type: this.type
|
|
6045
6084
|
})
|
|
@@ -6048,8 +6087,8 @@ var Blockquote = _core.Node.create({
|
|
|
6048
6087
|
});
|
|
6049
6088
|
|
|
6050
6089
|
// node_modules/@tiptap/extension-hard-break/dist/index.js
|
|
6051
|
-
|
|
6052
|
-
var HardBreak =
|
|
6090
|
+
var import_core10 = require("@tiptap/core");
|
|
6091
|
+
var HardBreak = import_core10.Node.create({
|
|
6053
6092
|
name: "hardBreak",
|
|
6054
6093
|
addOptions() {
|
|
6055
6094
|
return {
|
|
@@ -6067,7 +6106,7 @@ var HardBreak = _core.Node.create({
|
|
|
6067
6106
|
];
|
|
6068
6107
|
},
|
|
6069
6108
|
renderHTML({ HTMLAttributes }) {
|
|
6070
|
-
return ["br",
|
|
6109
|
+
return ["br", (0, import_core10.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes)];
|
|
6071
6110
|
},
|
|
6072
6111
|
renderText() {
|
|
6073
6112
|
return "\n";
|
|
@@ -6106,8 +6145,8 @@ var HardBreak = _core.Node.create({
|
|
|
6106
6145
|
});
|
|
6107
6146
|
|
|
6108
6147
|
// node_modules/@tiptap/extension-heading/dist/index.js
|
|
6109
|
-
|
|
6110
|
-
var Heading =
|
|
6148
|
+
var import_core11 = require("@tiptap/core");
|
|
6149
|
+
var Heading = import_core11.Node.create({
|
|
6111
6150
|
name: "heading",
|
|
6112
6151
|
addOptions() {
|
|
6113
6152
|
return {
|
|
@@ -6135,7 +6174,7 @@ var Heading = _core.Node.create({
|
|
|
6135
6174
|
renderHTML({ node, HTMLAttributes }) {
|
|
6136
6175
|
const hasLevel = this.options.levels.includes(node.attrs.level);
|
|
6137
6176
|
const level = hasLevel ? node.attrs.level : this.options.levels[0];
|
|
6138
|
-
return [`h${level}`,
|
|
6177
|
+
return [`h${level}`, (0, import_core11.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
6139
6178
|
},
|
|
6140
6179
|
addCommands() {
|
|
6141
6180
|
return {
|
|
@@ -6163,7 +6202,7 @@ var Heading = _core.Node.create({
|
|
|
6163
6202
|
},
|
|
6164
6203
|
addInputRules() {
|
|
6165
6204
|
return this.options.levels.map((level) => {
|
|
6166
|
-
return
|
|
6205
|
+
return (0, import_core11.textblockTypeInputRule)({
|
|
6167
6206
|
find: new RegExp(`^(#{${Math.min(...this.options.levels)},${level}})\\s$`),
|
|
6168
6207
|
type: this.type,
|
|
6169
6208
|
getAttributes: {
|
|
@@ -6175,8 +6214,8 @@ var Heading = _core.Node.create({
|
|
|
6175
6214
|
});
|
|
6176
6215
|
|
|
6177
6216
|
// node_modules/@tiptap/extension-horizontal-rule/dist/index.js
|
|
6178
|
-
|
|
6179
|
-
var HorizontalRule =
|
|
6217
|
+
var import_core12 = require("@tiptap/core");
|
|
6218
|
+
var HorizontalRule = import_core12.Node.create({
|
|
6180
6219
|
name: "horizontalRule",
|
|
6181
6220
|
addOptions() {
|
|
6182
6221
|
return {
|
|
@@ -6188,12 +6227,12 @@ var HorizontalRule = _core.Node.create({
|
|
|
6188
6227
|
return [{ tag: "hr" }];
|
|
6189
6228
|
},
|
|
6190
6229
|
renderHTML({ HTMLAttributes }) {
|
|
6191
|
-
return ["hr",
|
|
6230
|
+
return ["hr", (0, import_core12.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes)];
|
|
6192
6231
|
},
|
|
6193
6232
|
addCommands() {
|
|
6194
6233
|
return {
|
|
6195
6234
|
setHorizontalRule: () => ({ chain, state }) => {
|
|
6196
|
-
if (!
|
|
6235
|
+
if (!(0, import_core12.canInsertNode)(state, state.schema.nodes[this.name])) {
|
|
6197
6236
|
return false;
|
|
6198
6237
|
}
|
|
6199
6238
|
const { selection } = state;
|
|
@@ -6206,7 +6245,7 @@ var HorizontalRule = _core.Node.create({
|
|
|
6206
6245
|
}, {
|
|
6207
6246
|
type: this.name
|
|
6208
6247
|
});
|
|
6209
|
-
} else if (
|
|
6248
|
+
} else if ((0, import_core12.isNodeSelection)(selection)) {
|
|
6210
6249
|
currentChain.insertContentAt($originTo.pos, {
|
|
6211
6250
|
type: this.name
|
|
6212
6251
|
});
|
|
@@ -6242,7 +6281,7 @@ var HorizontalRule = _core.Node.create({
|
|
|
6242
6281
|
},
|
|
6243
6282
|
addInputRules() {
|
|
6244
6283
|
return [
|
|
6245
|
-
|
|
6284
|
+
(0, import_core12.nodeInputRule)({
|
|
6246
6285
|
find: /^(?:---|—-|___\s|\*\*\*\s)$/,
|
|
6247
6286
|
type: this.type
|
|
6248
6287
|
})
|
|
@@ -6251,16 +6290,16 @@ var HorizontalRule = _core.Node.create({
|
|
|
6251
6290
|
});
|
|
6252
6291
|
|
|
6253
6292
|
// src/components/tetrons/EditorContent.tsx
|
|
6254
|
-
var
|
|
6255
|
-
var
|
|
6256
|
-
var
|
|
6257
|
-
var
|
|
6258
|
-
var
|
|
6259
|
-
var
|
|
6293
|
+
var import_extension_text_align = __toESM(require("@tiptap/extension-text-align"));
|
|
6294
|
+
var import_extension_color = __toESM(require("@tiptap/extension-color"));
|
|
6295
|
+
var import_extension_highlight = __toESM(require("@tiptap/extension-highlight"));
|
|
6296
|
+
var import_extension_image2 = __toESM(require("@tiptap/extension-image"));
|
|
6297
|
+
var import_extension_link = __toESM(require("@tiptap/extension-link"));
|
|
6298
|
+
var import_extension_text_style = __toESM(require("@tiptap/extension-text-style"));
|
|
6260
6299
|
|
|
6261
6300
|
// node_modules/@tiptap/extension-list-item/dist/index.js
|
|
6262
|
-
|
|
6263
|
-
var ListItem =
|
|
6301
|
+
var import_core13 = require("@tiptap/core");
|
|
6302
|
+
var ListItem = import_core13.Node.create({
|
|
6264
6303
|
name: "listItem",
|
|
6265
6304
|
addOptions() {
|
|
6266
6305
|
return {
|
|
@@ -6279,7 +6318,7 @@ var ListItem = _core.Node.create({
|
|
|
6279
6318
|
];
|
|
6280
6319
|
},
|
|
6281
6320
|
renderHTML({ HTMLAttributes }) {
|
|
6282
|
-
return ["li",
|
|
6321
|
+
return ["li", (0, import_core13.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
6283
6322
|
},
|
|
6284
6323
|
addKeyboardShortcuts() {
|
|
6285
6324
|
return {
|
|
@@ -6291,11 +6330,11 @@ var ListItem = _core.Node.create({
|
|
|
6291
6330
|
});
|
|
6292
6331
|
|
|
6293
6332
|
// node_modules/@tiptap/extension-bullet-list/dist/index.js
|
|
6294
|
-
|
|
6333
|
+
var import_core14 = require("@tiptap/core");
|
|
6295
6334
|
var ListItemName = "listItem";
|
|
6296
6335
|
var TextStyleName = "textStyle";
|
|
6297
6336
|
var inputRegex4 = /^\s*([-+*])\s$/;
|
|
6298
|
-
var BulletList =
|
|
6337
|
+
var BulletList = import_core14.Node.create({
|
|
6299
6338
|
name: "bulletList",
|
|
6300
6339
|
addOptions() {
|
|
6301
6340
|
return {
|
|
@@ -6315,7 +6354,7 @@ var BulletList = _core.Node.create({
|
|
|
6315
6354
|
];
|
|
6316
6355
|
},
|
|
6317
6356
|
renderHTML({ HTMLAttributes }) {
|
|
6318
|
-
return ["ul",
|
|
6357
|
+
return ["ul", (0, import_core14.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
6319
6358
|
},
|
|
6320
6359
|
addCommands() {
|
|
6321
6360
|
return {
|
|
@@ -6333,12 +6372,12 @@ var BulletList = _core.Node.create({
|
|
|
6333
6372
|
};
|
|
6334
6373
|
},
|
|
6335
6374
|
addInputRules() {
|
|
6336
|
-
let inputRule =
|
|
6375
|
+
let inputRule = (0, import_core14.wrappingInputRule)({
|
|
6337
6376
|
find: inputRegex4,
|
|
6338
6377
|
type: this.type
|
|
6339
6378
|
});
|
|
6340
6379
|
if (this.options.keepMarks || this.options.keepAttributes) {
|
|
6341
|
-
inputRule =
|
|
6380
|
+
inputRule = (0, import_core14.wrappingInputRule)({
|
|
6342
6381
|
find: inputRegex4,
|
|
6343
6382
|
type: this.type,
|
|
6344
6383
|
keepMarks: this.options.keepMarks,
|
|
@@ -6356,11 +6395,11 @@ var BulletList = _core.Node.create({
|
|
|
6356
6395
|
});
|
|
6357
6396
|
|
|
6358
6397
|
// node_modules/@tiptap/extension-ordered-list/dist/index.js
|
|
6359
|
-
|
|
6398
|
+
var import_core15 = require("@tiptap/core");
|
|
6360
6399
|
var ListItemName2 = "listItem";
|
|
6361
6400
|
var TextStyleName2 = "textStyle";
|
|
6362
6401
|
var inputRegex5 = /^(\d+)\.\s$/;
|
|
6363
|
-
var OrderedList =
|
|
6402
|
+
var OrderedList = import_core15.Node.create({
|
|
6364
6403
|
name: "orderedList",
|
|
6365
6404
|
addOptions() {
|
|
6366
6405
|
return {
|
|
@@ -6397,7 +6436,7 @@ var OrderedList = _core.Node.create({
|
|
|
6397
6436
|
},
|
|
6398
6437
|
renderHTML({ HTMLAttributes }) {
|
|
6399
6438
|
const { start, ...attributesWithoutStart } = HTMLAttributes;
|
|
6400
|
-
return start === 1 ? ["ol",
|
|
6439
|
+
return start === 1 ? ["ol", (0, import_core15.mergeAttributes)(this.options.HTMLAttributes, attributesWithoutStart), 0] : ["ol", (0, import_core15.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
6401
6440
|
},
|
|
6402
6441
|
addCommands() {
|
|
6403
6442
|
return {
|
|
@@ -6415,14 +6454,14 @@ var OrderedList = _core.Node.create({
|
|
|
6415
6454
|
};
|
|
6416
6455
|
},
|
|
6417
6456
|
addInputRules() {
|
|
6418
|
-
let inputRule =
|
|
6457
|
+
let inputRule = (0, import_core15.wrappingInputRule)({
|
|
6419
6458
|
find: inputRegex5,
|
|
6420
6459
|
type: this.type,
|
|
6421
6460
|
getAttributes: (match) => ({ start: +match[1] }),
|
|
6422
6461
|
joinPredicate: (match, node) => node.childCount + node.attrs.start === +match[1]
|
|
6423
6462
|
});
|
|
6424
6463
|
if (this.options.keepMarks || this.options.keepAttributes) {
|
|
6425
|
-
inputRule =
|
|
6464
|
+
inputRule = (0, import_core15.wrappingInputRule)({
|
|
6426
6465
|
find: inputRegex5,
|
|
6427
6466
|
type: this.type,
|
|
6428
6467
|
keepMarks: this.options.keepMarks,
|
|
@@ -6439,10 +6478,10 @@ var OrderedList = _core.Node.create({
|
|
|
6439
6478
|
});
|
|
6440
6479
|
|
|
6441
6480
|
// src/components/tetrons/EditorContent.tsx
|
|
6442
|
-
var
|
|
6443
|
-
var
|
|
6444
|
-
var
|
|
6445
|
-
var
|
|
6481
|
+
var import_extension_table_row = __toESM(require("@tiptap/extension-table-row"));
|
|
6482
|
+
var import_extension_table_cell = __toESM(require("@tiptap/extension-table-cell"));
|
|
6483
|
+
var import_extension_table_header = __toESM(require("@tiptap/extension-table-header"));
|
|
6484
|
+
var import_extension_code_block_lowlight = __toESM(require("@tiptap/extension-code-block-lowlight"));
|
|
6446
6485
|
|
|
6447
6486
|
// node_modules/highlight.js/es/languages/javascript.js
|
|
6448
6487
|
var IDENT_RE = "[A-Za-z$_][0-9A-Za-z$_]*";
|
|
@@ -7960,14 +7999,14 @@ function typescript(hljs) {
|
|
|
7960
7999
|
}
|
|
7961
8000
|
|
|
7962
8001
|
// src/components/tetrons/EditorContent.tsx
|
|
7963
|
-
var
|
|
8002
|
+
var import_lowlight = require("lowlight");
|
|
7964
8003
|
|
|
7965
8004
|
// src/utils/useTypo.ts
|
|
7966
|
-
|
|
7967
|
-
var
|
|
8005
|
+
var import_react = require("react");
|
|
8006
|
+
var import_typo_js = __toESM(require("typo-js"));
|
|
7968
8007
|
function useTypo() {
|
|
7969
|
-
const [typo, setTypo] =
|
|
7970
|
-
|
|
8008
|
+
const [typo, setTypo] = (0, import_react.useState)(null);
|
|
8009
|
+
(0, import_react.useEffect)(() => {
|
|
7971
8010
|
async function loadDictionary() {
|
|
7972
8011
|
const aff = await fetch("/dictionaries/index.aff").then(
|
|
7973
8012
|
(res) => res.text()
|
|
@@ -7975,7 +8014,7 @@ function useTypo() {
|
|
|
7975
8014
|
const dic = await fetch("/dictionaries/index.dic").then(
|
|
7976
8015
|
(res) => res.text()
|
|
7977
8016
|
);
|
|
7978
|
-
const dictionary = new
|
|
8017
|
+
const dictionary = new import_typo_js.default("en_US", aff, dic, { platform: "any" });
|
|
7979
8018
|
setTypo(dictionary);
|
|
7980
8019
|
}
|
|
7981
8020
|
loadDictionary();
|
|
@@ -7984,9 +8023,9 @@ function useTypo() {
|
|
|
7984
8023
|
}
|
|
7985
8024
|
|
|
7986
8025
|
// src/components/tetrons/extensions/Spellcheck.ts
|
|
7987
|
-
|
|
8026
|
+
var import_core16 = require("@tiptap/core");
|
|
7988
8027
|
var wordMatchRegex = () => /(?:^|\s)([a-zA-Z]{2,})(?=\s|$)/g;
|
|
7989
|
-
var Spellcheck =
|
|
8028
|
+
var Spellcheck = import_core16.Mark.create({
|
|
7990
8029
|
name: "spellcheck",
|
|
7991
8030
|
addOptions() {
|
|
7992
8031
|
return {
|
|
@@ -7995,7 +8034,7 @@ var Spellcheck = _core.Mark.create({
|
|
|
7995
8034
|
},
|
|
7996
8035
|
addInputRules() {
|
|
7997
8036
|
return [
|
|
7998
|
-
|
|
8037
|
+
(0, import_core16.markInputRule)({
|
|
7999
8038
|
find: wordMatchRegex(),
|
|
8000
8039
|
type: this.type,
|
|
8001
8040
|
getAttributes: (match) => this.options.spellcheckFn(match[1]) ? false : { "data-spellcheck": "true" }
|
|
@@ -8023,8 +8062,8 @@ var Spellcheck = _core.Mark.create({
|
|
|
8023
8062
|
});
|
|
8024
8063
|
|
|
8025
8064
|
// src/components/tetrons/toolbar/extensions/Comment.ts
|
|
8026
|
-
|
|
8027
|
-
var Comment =
|
|
8065
|
+
var import_core17 = require("@tiptap/core");
|
|
8066
|
+
var Comment = import_core17.Mark.create({
|
|
8028
8067
|
name: "comment",
|
|
8029
8068
|
addOptions() {
|
|
8030
8069
|
return {
|
|
@@ -8048,7 +8087,7 @@ var Comment = _core.Mark.create({
|
|
|
8048
8087
|
renderHTML({ HTMLAttributes }) {
|
|
8049
8088
|
return [
|
|
8050
8089
|
"span",
|
|
8051
|
-
|
|
8090
|
+
(0, import_core17.mergeAttributes)(HTMLAttributes, {
|
|
8052
8091
|
"data-comment": HTMLAttributes.comment,
|
|
8053
8092
|
class: "comment-highlight",
|
|
8054
8093
|
title: HTMLAttributes.comment,
|
|
@@ -8070,8 +8109,8 @@ var Comment = _core.Mark.create({
|
|
|
8070
8109
|
});
|
|
8071
8110
|
|
|
8072
8111
|
// src/components/tetrons/toolbar/marks/Subscript.ts
|
|
8073
|
-
|
|
8074
|
-
var Subscript =
|
|
8112
|
+
var import_core18 = require("@tiptap/core");
|
|
8113
|
+
var Subscript = import_core18.Mark.create({
|
|
8075
8114
|
name: "subscript",
|
|
8076
8115
|
excludes: "superscript",
|
|
8077
8116
|
parseHTML() {
|
|
@@ -8087,7 +8126,7 @@ var Subscript = _core.Mark.create({
|
|
|
8087
8126
|
},
|
|
8088
8127
|
addInputRules() {
|
|
8089
8128
|
return [
|
|
8090
|
-
|
|
8129
|
+
(0, import_core18.markInputRule)({
|
|
8091
8130
|
find: /~([^~]+)~/,
|
|
8092
8131
|
type: this.type
|
|
8093
8132
|
})
|
|
@@ -8095,7 +8134,7 @@ var Subscript = _core.Mark.create({
|
|
|
8095
8134
|
},
|
|
8096
8135
|
addPasteRules() {
|
|
8097
8136
|
return [
|
|
8098
|
-
|
|
8137
|
+
(0, import_core18.markPasteRule)({
|
|
8099
8138
|
find: /~([^~]+)~/g,
|
|
8100
8139
|
type: this.type
|
|
8101
8140
|
})
|
|
@@ -8104,8 +8143,8 @@ var Subscript = _core.Mark.create({
|
|
|
8104
8143
|
});
|
|
8105
8144
|
|
|
8106
8145
|
// src/components/tetrons/toolbar/marks/Superscript.ts
|
|
8107
|
-
|
|
8108
|
-
var Superscript =
|
|
8146
|
+
var import_core19 = require("@tiptap/core");
|
|
8147
|
+
var Superscript = import_core19.Mark.create({
|
|
8109
8148
|
name: "superscript",
|
|
8110
8149
|
excludes: "subscript",
|
|
8111
8150
|
parseHTML() {
|
|
@@ -8121,7 +8160,7 @@ var Superscript = _core.Mark.create({
|
|
|
8121
8160
|
},
|
|
8122
8161
|
addInputRules() {
|
|
8123
8162
|
return [
|
|
8124
|
-
|
|
8163
|
+
(0, import_core19.markInputRule)({
|
|
8125
8164
|
find: /\^([^^]+)\^/,
|
|
8126
8165
|
type: this.type
|
|
8127
8166
|
})
|
|
@@ -8129,7 +8168,7 @@ var Superscript = _core.Mark.create({
|
|
|
8129
8168
|
},
|
|
8130
8169
|
addPasteRules() {
|
|
8131
8170
|
return [
|
|
8132
|
-
|
|
8171
|
+
(0, import_core19.markPasteRule)({
|
|
8133
8172
|
find: /\^([^^]+)\^/g,
|
|
8134
8173
|
type: this.type
|
|
8135
8174
|
})
|
|
@@ -8138,7 +8177,7 @@ var Superscript = _core.Mark.create({
|
|
|
8138
8177
|
});
|
|
8139
8178
|
|
|
8140
8179
|
// src/components/tetrons/toolbar/extensions/ResizableTable.ts
|
|
8141
|
-
var
|
|
8180
|
+
var import_extension_table = require("@tiptap/extension-table");
|
|
8142
8181
|
|
|
8143
8182
|
// node_modules/prosemirror-view/dist/index.js
|
|
8144
8183
|
var domIndex = function(node) {
|
|
@@ -8516,7 +8555,7 @@ function posFromCaret(view, node, offset, coords) {
|
|
|
8516
8555
|
return null;
|
|
8517
8556
|
if (desc.dom.nodeType == 1 && (desc.node.isBlock && desc.parent || !desc.contentDOM) && // Ignore elements with zero-size bounding rectangles
|
|
8518
8557
|
((rect = desc.dom.getBoundingClientRect()).width || rect.height)) {
|
|
8519
|
-
if (desc.node.isBlock && desc.parent) {
|
|
8558
|
+
if (desc.node.isBlock && desc.parent && !/^T(R|BODY|HEAD|FOOT)$/.test(desc.dom.nodeName)) {
|
|
8520
8559
|
if (!sawBlock && rect.left > coords.left || rect.top > coords.top)
|
|
8521
8560
|
outsideBlock = desc.posBefore;
|
|
8522
8561
|
else if (!sawBlock && rect.right < coords.left || rect.bottom < coords.top)
|
|
@@ -11504,16 +11543,16 @@ editHandlers.drop = (view, _event) => {
|
|
|
11504
11543
|
tr.deleteSelection();
|
|
11505
11544
|
}
|
|
11506
11545
|
let pos = tr.mapping.map(insertPos);
|
|
11507
|
-
let
|
|
11546
|
+
let isNode = slice2.openStart == 0 && slice2.openEnd == 0 && slice2.content.childCount == 1;
|
|
11508
11547
|
let beforeInsert = tr.doc;
|
|
11509
|
-
if (
|
|
11548
|
+
if (isNode)
|
|
11510
11549
|
tr.replaceRangeWith(pos, pos, slice2.content.firstChild);
|
|
11511
11550
|
else
|
|
11512
11551
|
tr.replaceRange(pos, pos, slice2);
|
|
11513
11552
|
if (tr.doc.eq(beforeInsert))
|
|
11514
11553
|
return;
|
|
11515
11554
|
let $pos = tr.doc.resolve(pos);
|
|
11516
|
-
if (
|
|
11555
|
+
if (isNode && NodeSelection.isSelectable(slice2.content.firstChild) && $pos.nodeAfter && $pos.nodeAfter.sameMarkup(slice2.content.firstChild)) {
|
|
11517
11556
|
tr.setSelection(new NodeSelection($pos));
|
|
11518
11557
|
} else {
|
|
11519
11558
|
let end = tr.mapping.map(insertPos);
|
|
@@ -12549,7 +12588,7 @@ function ruleFromNode(dom) {
|
|
|
12549
12588
|
}
|
|
12550
12589
|
return null;
|
|
12551
12590
|
}
|
|
12552
|
-
var isInline = /^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;
|
|
12591
|
+
var isInline = /^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;
|
|
12553
12592
|
function readDOMChange(view, from2, to, typeOver, addedNodes) {
|
|
12554
12593
|
let compositionID = view.input.compositionPendingChanges || (view.composing ? view.input.compositionID : 0);
|
|
12555
12594
|
view.input.compositionPendingChanges = 0;
|
|
@@ -15195,10 +15234,10 @@ function tableEditing({
|
|
|
15195
15234
|
}
|
|
15196
15235
|
|
|
15197
15236
|
// src/components/tetrons/toolbar/extensions/ResizableTable.ts
|
|
15198
|
-
var ResizableTable =
|
|
15237
|
+
var ResizableTable = import_extension_table.Table.extend({
|
|
15199
15238
|
addOptions() {
|
|
15200
15239
|
return {
|
|
15201
|
-
...
|
|
15240
|
+
...this.parent?.(),
|
|
15202
15241
|
resizable: true
|
|
15203
15242
|
};
|
|
15204
15243
|
},
|
|
@@ -15208,8 +15247,8 @@ var ResizableTable = _extensiontable.Table.extend({
|
|
|
15208
15247
|
});
|
|
15209
15248
|
|
|
15210
15249
|
// src/components/tetrons/toolbar/extensions/Embed.ts
|
|
15211
|
-
|
|
15212
|
-
var Embed =
|
|
15250
|
+
var import_core20 = require("@tiptap/core");
|
|
15251
|
+
var Embed = import_core20.Node.create({
|
|
15213
15252
|
name: "embed",
|
|
15214
15253
|
group: "block",
|
|
15215
15254
|
atom: true,
|
|
@@ -15224,7 +15263,7 @@ var Embed = _core.Node.create({
|
|
|
15224
15263
|
return [{ tag: "iframe[src]" }];
|
|
15225
15264
|
},
|
|
15226
15265
|
renderHTML({ HTMLAttributes }) {
|
|
15227
|
-
return ["iframe",
|
|
15266
|
+
return ["iframe", (0, import_core20.mergeAttributes)(HTMLAttributes)];
|
|
15228
15267
|
},
|
|
15229
15268
|
addCommands() {
|
|
15230
15269
|
return {
|
|
@@ -15302,8 +15341,8 @@ var Embed = _core.Node.create({
|
|
|
15302
15341
|
});
|
|
15303
15342
|
|
|
15304
15343
|
// src/components/tetrons/toolbar/extensions/FontFamily.ts
|
|
15305
|
-
|
|
15306
|
-
var FontFamily =
|
|
15344
|
+
var import_core21 = require("@tiptap/core");
|
|
15345
|
+
var FontFamily = import_core21.Mark.create({
|
|
15307
15346
|
name: "fontFamily",
|
|
15308
15347
|
addAttributes() {
|
|
15309
15348
|
return {
|
|
@@ -15321,7 +15360,7 @@ var FontFamily = _core.Mark.create({
|
|
|
15321
15360
|
return [{ style: "font-family" }];
|
|
15322
15361
|
},
|
|
15323
15362
|
renderHTML({ HTMLAttributes }) {
|
|
15324
|
-
return ["span",
|
|
15363
|
+
return ["span", (0, import_core21.mergeAttributes)(HTMLAttributes), 0];
|
|
15325
15364
|
},
|
|
15326
15365
|
addCommands() {
|
|
15327
15366
|
return {
|
|
@@ -15331,8 +15370,8 @@ var FontFamily = _core.Mark.create({
|
|
|
15331
15370
|
});
|
|
15332
15371
|
|
|
15333
15372
|
// src/components/tetrons/toolbar/extensions/FontSize.ts
|
|
15334
|
-
|
|
15335
|
-
var FontSize =
|
|
15373
|
+
var import_core22 = require("@tiptap/core");
|
|
15374
|
+
var FontSize = import_core22.Mark.create({
|
|
15336
15375
|
name: "fontSize",
|
|
15337
15376
|
addAttributes() {
|
|
15338
15377
|
return {
|
|
@@ -15350,7 +15389,7 @@ var FontSize = _core.Mark.create({
|
|
|
15350
15389
|
return [{ style: "font-size" }];
|
|
15351
15390
|
},
|
|
15352
15391
|
renderHTML({ HTMLAttributes }) {
|
|
15353
|
-
return ["span",
|
|
15392
|
+
return ["span", (0, import_core22.mergeAttributes)(HTMLAttributes), 0];
|
|
15354
15393
|
},
|
|
15355
15394
|
addCommands() {
|
|
15356
15395
|
return {
|
|
@@ -15360,24 +15399,24 @@ var FontSize = _core.Mark.create({
|
|
|
15360
15399
|
});
|
|
15361
15400
|
|
|
15362
15401
|
// src/components/tetrons/ResizableImage.ts
|
|
15363
|
-
|
|
15364
|
-
|
|
15402
|
+
var import_extension_image = __toESM(require("@tiptap/extension-image"));
|
|
15403
|
+
var import_react4 = require("@tiptap/react");
|
|
15365
15404
|
|
|
15366
15405
|
// src/components/tetrons/ResizableImageComponent.tsx
|
|
15367
|
-
|
|
15368
|
-
|
|
15406
|
+
var import_react2 = __toESM(require("react"));
|
|
15407
|
+
var import_react3 = require("@tiptap/react");
|
|
15369
15408
|
var ResizableImageComponent = ({
|
|
15370
15409
|
node,
|
|
15371
15410
|
updateAttributes,
|
|
15372
15411
|
selected
|
|
15373
15412
|
}) => {
|
|
15374
15413
|
const { src, alt, title, width, height } = node.attrs;
|
|
15375
|
-
const defaultWidth =
|
|
15376
|
-
const defaultHeight =
|
|
15414
|
+
const defaultWidth = width ?? 300;
|
|
15415
|
+
const defaultHeight = height ?? 200;
|
|
15377
15416
|
const aspectRatio = defaultHeight > 0 ? defaultWidth / defaultHeight : 4 / 3;
|
|
15378
|
-
const wrapperRef =
|
|
15379
|
-
const [isResizing, setIsResizing] =
|
|
15380
|
-
|
|
15417
|
+
const wrapperRef = (0, import_react2.useRef)(null);
|
|
15418
|
+
const [isResizing, setIsResizing] = (0, import_react2.useState)(false);
|
|
15419
|
+
(0, import_react2.useEffect)(() => {
|
|
15381
15420
|
const handleMouseMove2 = (e) => {
|
|
15382
15421
|
if (!isResizing || !wrapperRef.current) return;
|
|
15383
15422
|
const rect = wrapperRef.current.getBoundingClientRect();
|
|
@@ -15402,8 +15441,8 @@ var ResizableImageComponent = ({
|
|
|
15402
15441
|
window.removeEventListener("mouseup", handleMouseUp);
|
|
15403
15442
|
};
|
|
15404
15443
|
}, [isResizing, updateAttributes, aspectRatio]);
|
|
15405
|
-
return /* @__PURE__ */
|
|
15406
|
-
|
|
15444
|
+
return /* @__PURE__ */ import_react2.default.createElement(
|
|
15445
|
+
import_react3.NodeViewWrapper,
|
|
15407
15446
|
{
|
|
15408
15447
|
ref: wrapperRef,
|
|
15409
15448
|
contentEditable: false,
|
|
@@ -15421,12 +15460,12 @@ var ResizableImageComponent = ({
|
|
|
15421
15460
|
padding: 2
|
|
15422
15461
|
}
|
|
15423
15462
|
},
|
|
15424
|
-
/* @__PURE__ */
|
|
15463
|
+
/* @__PURE__ */ import_react2.default.createElement(
|
|
15425
15464
|
"img",
|
|
15426
15465
|
{
|
|
15427
15466
|
src,
|
|
15428
|
-
alt:
|
|
15429
|
-
title:
|
|
15467
|
+
alt: alt ?? "",
|
|
15468
|
+
title: title ?? "",
|
|
15430
15469
|
loading: "lazy",
|
|
15431
15470
|
style: {
|
|
15432
15471
|
width: "100%",
|
|
@@ -15439,7 +15478,7 @@ var ResizableImageComponent = ({
|
|
|
15439
15478
|
draggable: false
|
|
15440
15479
|
}
|
|
15441
15480
|
),
|
|
15442
|
-
/* @__PURE__ */
|
|
15481
|
+
/* @__PURE__ */ import_react2.default.createElement(
|
|
15443
15482
|
"div",
|
|
15444
15483
|
{
|
|
15445
15484
|
onMouseDown: (e) => {
|
|
@@ -15464,11 +15503,11 @@ var ResizableImageComponent = ({
|
|
|
15464
15503
|
var ResizableImageComponent_default = ResizableImageComponent;
|
|
15465
15504
|
|
|
15466
15505
|
// src/components/tetrons/ResizableImage.ts
|
|
15467
|
-
var ResizableImage =
|
|
15506
|
+
var ResizableImage = import_extension_image.default.extend({
|
|
15468
15507
|
name: "resizableImage",
|
|
15469
15508
|
addAttributes() {
|
|
15470
15509
|
return {
|
|
15471
|
-
...
|
|
15510
|
+
...this.parent?.(),
|
|
15472
15511
|
width: { default: null },
|
|
15473
15512
|
height: { default: null }
|
|
15474
15513
|
};
|
|
@@ -15487,26 +15526,26 @@ var ResizableImage = _extensionimage2.default.extend({
|
|
|
15487
15526
|
];
|
|
15488
15527
|
},
|
|
15489
15528
|
addNodeView() {
|
|
15490
|
-
return
|
|
15529
|
+
return (0, import_react4.ReactNodeViewRenderer)(ResizableImageComponent_default);
|
|
15491
15530
|
}
|
|
15492
15531
|
});
|
|
15493
15532
|
|
|
15494
15533
|
// src/components/tetrons/ResizableVideo.ts
|
|
15495
|
-
|
|
15496
|
-
|
|
15534
|
+
var import_core23 = require("@tiptap/core");
|
|
15535
|
+
var import_react7 = require("@tiptap/react");
|
|
15497
15536
|
|
|
15498
15537
|
// src/components/tetrons/ResizableVideoComponent.tsx
|
|
15499
|
-
|
|
15500
|
-
|
|
15538
|
+
var import_react5 = __toESM(require("react"));
|
|
15539
|
+
var import_react6 = require("@tiptap/react");
|
|
15501
15540
|
var ResizableVideoComponent = ({
|
|
15502
15541
|
node,
|
|
15503
15542
|
updateAttributes,
|
|
15504
15543
|
selected
|
|
15505
15544
|
}) => {
|
|
15506
15545
|
const { src, controls, width, height } = node.attrs;
|
|
15507
|
-
const wrapperRef =
|
|
15508
|
-
const videoRef =
|
|
15509
|
-
|
|
15546
|
+
const wrapperRef = (0, import_react5.useRef)(null);
|
|
15547
|
+
const videoRef = (0, import_react5.useRef)(null);
|
|
15548
|
+
(0, import_react5.useEffect)(() => {
|
|
15510
15549
|
const video = videoRef.current;
|
|
15511
15550
|
if (!video) return;
|
|
15512
15551
|
const observer = new ResizeObserver(() => {
|
|
@@ -15517,8 +15556,8 @@ var ResizableVideoComponent = ({
|
|
|
15517
15556
|
observer.observe(video);
|
|
15518
15557
|
return () => observer.disconnect();
|
|
15519
15558
|
}, [updateAttributes]);
|
|
15520
|
-
return /* @__PURE__ */
|
|
15521
|
-
|
|
15559
|
+
return /* @__PURE__ */ import_react5.default.createElement(
|
|
15560
|
+
import_react6.NodeViewWrapper,
|
|
15522
15561
|
{
|
|
15523
15562
|
ref: wrapperRef,
|
|
15524
15563
|
contentEditable: false,
|
|
@@ -15531,7 +15570,7 @@ var ResizableVideoComponent = ({
|
|
|
15531
15570
|
display: "inline-block"
|
|
15532
15571
|
}
|
|
15533
15572
|
},
|
|
15534
|
-
/* @__PURE__ */
|
|
15573
|
+
/* @__PURE__ */ import_react5.default.createElement(
|
|
15535
15574
|
"video",
|
|
15536
15575
|
{
|
|
15537
15576
|
ref: videoRef,
|
|
@@ -15548,7 +15587,7 @@ var ResizableVideoComponent = ({
|
|
|
15548
15587
|
var ResizableVideoComponent_default = ResizableVideoComponent;
|
|
15549
15588
|
|
|
15550
15589
|
// src/components/tetrons/ResizableVideo.ts
|
|
15551
|
-
var ResizableVideo =
|
|
15590
|
+
var ResizableVideo = import_core23.Node.create({
|
|
15552
15591
|
name: "video",
|
|
15553
15592
|
group: "block",
|
|
15554
15593
|
draggable: true,
|
|
@@ -15590,15 +15629,15 @@ var ResizableVideo = _core.Node.create({
|
|
|
15590
15629
|
};
|
|
15591
15630
|
},
|
|
15592
15631
|
addNodeView() {
|
|
15593
|
-
return
|
|
15632
|
+
return (0, import_react7.ReactNodeViewRenderer)(ResizableVideoComponent_default);
|
|
15594
15633
|
}
|
|
15595
15634
|
});
|
|
15596
15635
|
|
|
15597
15636
|
// src/components/tetrons/toolbar/TableContextMenu.tsx
|
|
15598
|
-
|
|
15637
|
+
var import_react8 = __toESM(require("react"));
|
|
15599
15638
|
function TableContextMenu({ editor }) {
|
|
15600
|
-
const [menuPosition, setMenuPosition] =
|
|
15601
|
-
|
|
15639
|
+
const [menuPosition, setMenuPosition] = (0, import_react8.useState)(null);
|
|
15640
|
+
(0, import_react8.useEffect)(() => {
|
|
15602
15641
|
const handleContextMenu = (event) => {
|
|
15603
15642
|
const target = event.target;
|
|
15604
15643
|
if (target.closest("td") || target.closest("th")) {
|
|
@@ -15623,13 +15662,13 @@ function TableContextMenu({ editor }) {
|
|
|
15623
15662
|
const deleteRow = () => editor.chain().focus().deleteRow().run();
|
|
15624
15663
|
const deleteCol = () => editor.chain().focus().deleteColumn().run();
|
|
15625
15664
|
if (!menuPosition) return null;
|
|
15626
|
-
return /* @__PURE__ */
|
|
15665
|
+
return /* @__PURE__ */ import_react8.default.createElement(
|
|
15627
15666
|
"ul",
|
|
15628
15667
|
{
|
|
15629
15668
|
className: "absolute bg-white shadow border rounded text-sm z-50",
|
|
15630
15669
|
style: { top: menuPosition.y, left: menuPosition.x }
|
|
15631
15670
|
},
|
|
15632
|
-
/* @__PURE__ */
|
|
15671
|
+
/* @__PURE__ */ import_react8.default.createElement(
|
|
15633
15672
|
"li",
|
|
15634
15673
|
{
|
|
15635
15674
|
className: "px-3 py-1 hover:bg-gray-100 cursor-pointer",
|
|
@@ -15637,7 +15676,7 @@ function TableContextMenu({ editor }) {
|
|
|
15637
15676
|
},
|
|
15638
15677
|
"Insert Row Above"
|
|
15639
15678
|
),
|
|
15640
|
-
/* @__PURE__ */
|
|
15679
|
+
/* @__PURE__ */ import_react8.default.createElement(
|
|
15641
15680
|
"li",
|
|
15642
15681
|
{
|
|
15643
15682
|
className: "px-3 py-1 hover:bg-gray-100 cursor-pointer",
|
|
@@ -15645,7 +15684,7 @@ function TableContextMenu({ editor }) {
|
|
|
15645
15684
|
},
|
|
15646
15685
|
"Insert Row Below"
|
|
15647
15686
|
),
|
|
15648
|
-
/* @__PURE__ */
|
|
15687
|
+
/* @__PURE__ */ import_react8.default.createElement(
|
|
15649
15688
|
"li",
|
|
15650
15689
|
{
|
|
15651
15690
|
className: "px-3 py-1 hover:bg-gray-100 cursor-pointer",
|
|
@@ -15653,7 +15692,7 @@ function TableContextMenu({ editor }) {
|
|
|
15653
15692
|
},
|
|
15654
15693
|
"Insert Column Left"
|
|
15655
15694
|
),
|
|
15656
|
-
/* @__PURE__ */
|
|
15695
|
+
/* @__PURE__ */ import_react8.default.createElement(
|
|
15657
15696
|
"li",
|
|
15658
15697
|
{
|
|
15659
15698
|
className: "px-3 py-1 hover:bg-gray-100 cursor-pointer",
|
|
@@ -15661,7 +15700,7 @@ function TableContextMenu({ editor }) {
|
|
|
15661
15700
|
},
|
|
15662
15701
|
"Insert Column Right"
|
|
15663
15702
|
),
|
|
15664
|
-
/* @__PURE__ */
|
|
15703
|
+
/* @__PURE__ */ import_react8.default.createElement(
|
|
15665
15704
|
"li",
|
|
15666
15705
|
{
|
|
15667
15706
|
className: "px-3 py-1 hover:bg-red-100 cursor-pointer",
|
|
@@ -15669,7 +15708,7 @@ function TableContextMenu({ editor }) {
|
|
|
15669
15708
|
},
|
|
15670
15709
|
"Delete Row"
|
|
15671
15710
|
),
|
|
15672
|
-
/* @__PURE__ */
|
|
15711
|
+
/* @__PURE__ */ import_react8.default.createElement(
|
|
15673
15712
|
"li",
|
|
15674
15713
|
{
|
|
15675
15714
|
className: "px-3 py-1 hover:bg-red-100 cursor-pointer",
|
|
@@ -15681,34 +15720,28 @@ function TableContextMenu({ editor }) {
|
|
|
15681
15720
|
}
|
|
15682
15721
|
|
|
15683
15722
|
// src/components/tetrons/toolbar/TetronsToolbar.tsx
|
|
15684
|
-
|
|
15723
|
+
var import_react19 = __toESM(require("react"));
|
|
15685
15724
|
|
|
15686
15725
|
// src/components/tetrons/toolbar/ActionGroup.tsx
|
|
15687
|
-
|
|
15688
|
-
|
|
15689
|
-
|
|
15690
|
-
|
|
15691
|
-
|
|
15692
|
-
|
|
15693
|
-
|
|
15694
|
-
var _md = require('react-icons/md');
|
|
15726
|
+
var import_react10 = __toESM(require("react"));
|
|
15727
|
+
var import_md = require("react-icons/md");
|
|
15695
15728
|
|
|
15696
15729
|
// src/components/tetrons/toolbar/ToolbarButton.tsx
|
|
15697
|
-
|
|
15698
|
-
var ToolbarButton =
|
|
15730
|
+
var import_react9 = __toESM(require("react"));
|
|
15731
|
+
var ToolbarButton = import_react9.default.forwardRef(
|
|
15699
15732
|
({ icon: Icon, onClick, disabled = false, title, label, isActive = false }, ref) => {
|
|
15700
|
-
return /* @__PURE__ */
|
|
15733
|
+
return /* @__PURE__ */ import_react9.default.createElement(
|
|
15701
15734
|
"button",
|
|
15702
15735
|
{
|
|
15703
15736
|
type: "button",
|
|
15704
15737
|
ref,
|
|
15705
15738
|
onClick,
|
|
15706
15739
|
disabled,
|
|
15707
|
-
title:
|
|
15708
|
-
"aria-label":
|
|
15740
|
+
title: title ?? label,
|
|
15741
|
+
"aria-label": title ?? label,
|
|
15709
15742
|
className: `toolbar-button ${isActive ? "active" : ""}`
|
|
15710
15743
|
},
|
|
15711
|
-
/* @__PURE__ */
|
|
15744
|
+
/* @__PURE__ */ import_react9.default.createElement(Icon, { size: 20 })
|
|
15712
15745
|
);
|
|
15713
15746
|
}
|
|
15714
15747
|
);
|
|
@@ -15717,9 +15750,9 @@ var ToolbarButton_default = ToolbarButton;
|
|
|
15717
15750
|
|
|
15718
15751
|
// src/components/tetrons/toolbar/ActionGroup.tsx
|
|
15719
15752
|
function ActionGroup({ editor }) {
|
|
15720
|
-
const [dropdownOpen, setDropdownOpen] =
|
|
15721
|
-
const dropdownRef =
|
|
15722
|
-
|
|
15753
|
+
const [dropdownOpen, setDropdownOpen] = (0, import_react10.useState)(false);
|
|
15754
|
+
const dropdownRef = (0, import_react10.useRef)(null);
|
|
15755
|
+
(0, import_react10.useEffect)(() => {
|
|
15723
15756
|
const handleClickOutside = (event) => {
|
|
15724
15757
|
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
15725
15758
|
setDropdownOpen(false);
|
|
@@ -15797,7 +15830,7 @@ function ActionGroup({ editor }) {
|
|
|
15797
15830
|
container.classList.add("p-4", "prose");
|
|
15798
15831
|
document.body.appendChild(container);
|
|
15799
15832
|
try {
|
|
15800
|
-
const domToPdf = (await
|
|
15833
|
+
const domToPdf = (await import("dom-to-pdf")).default;
|
|
15801
15834
|
const options = {
|
|
15802
15835
|
filename: "document.pdf",
|
|
15803
15836
|
overrideWidth: 800,
|
|
@@ -15824,7 +15857,7 @@ function ActionGroup({ editor }) {
|
|
|
15824
15857
|
document.body.removeChild(link);
|
|
15825
15858
|
};
|
|
15826
15859
|
const handleDownloadDOCX = async () => {
|
|
15827
|
-
const { Document: Document2, Packer, Paragraph: Paragraph2 } = await
|
|
15860
|
+
const { Document: Document2, Packer, Paragraph: Paragraph2 } = await import("docx");
|
|
15828
15861
|
const text = editor.getText();
|
|
15829
15862
|
const doc3 = new Document2({
|
|
15830
15863
|
sections: [
|
|
@@ -15842,7 +15875,7 @@ function ActionGroup({ editor }) {
|
|
|
15842
15875
|
link.click();
|
|
15843
15876
|
document.body.removeChild(link);
|
|
15844
15877
|
};
|
|
15845
|
-
return /* @__PURE__ */
|
|
15878
|
+
return /* @__PURE__ */ import_react10.default.createElement("div", { className: "action-group", role: "group", "aria-label": "Editor actions" }, /* @__PURE__ */ import_react10.default.createElement(ToolbarButton_default, { icon: import_md.MdZoomIn, onClick: zoomIn, title: "Zoom In" }), /* @__PURE__ */ import_react10.default.createElement(ToolbarButton_default, { icon: import_md.MdZoomOut, onClick: zoomOut, title: "Zoom Out" }), /* @__PURE__ */ import_react10.default.createElement(ToolbarButton_default, { icon: import_md.MdPrint, onClick: handlePrint, title: "Print" }), /* @__PURE__ */ import_react10.default.createElement(ToolbarButton_default, { icon: import_md.MdSave, onClick: handleSave, title: "Save" }), /* @__PURE__ */ import_react10.default.createElement("div", { className: "relative", ref: dropdownRef }, /* @__PURE__ */ import_react10.default.createElement(
|
|
15846
15879
|
"button",
|
|
15847
15880
|
{
|
|
15848
15881
|
type: "button",
|
|
@@ -15852,9 +15885,9 @@ function ActionGroup({ editor }) {
|
|
|
15852
15885
|
className: "export-button",
|
|
15853
15886
|
title: "Export"
|
|
15854
15887
|
},
|
|
15855
|
-
/* @__PURE__ */
|
|
15856
|
-
/* @__PURE__ */
|
|
15857
|
-
), dropdownOpen && /* @__PURE__ */
|
|
15888
|
+
/* @__PURE__ */ import_react10.default.createElement(import_md.MdDownload, null),
|
|
15889
|
+
/* @__PURE__ */ import_react10.default.createElement("span", { className: "text-sm" })
|
|
15890
|
+
), dropdownOpen && /* @__PURE__ */ import_react10.default.createElement("div", { className: "export-dropdown" }, /* @__PURE__ */ import_react10.default.createElement(
|
|
15858
15891
|
"button",
|
|
15859
15892
|
{
|
|
15860
15893
|
type: "button",
|
|
@@ -15864,7 +15897,7 @@ function ActionGroup({ editor }) {
|
|
|
15864
15897
|
}
|
|
15865
15898
|
},
|
|
15866
15899
|
"Export as PDF"
|
|
15867
|
-
), /* @__PURE__ */
|
|
15900
|
+
), /* @__PURE__ */ import_react10.default.createElement(
|
|
15868
15901
|
"button",
|
|
15869
15902
|
{
|
|
15870
15903
|
type: "button",
|
|
@@ -15874,7 +15907,7 @@ function ActionGroup({ editor }) {
|
|
|
15874
15907
|
}
|
|
15875
15908
|
},
|
|
15876
15909
|
"Export as HTML"
|
|
15877
|
-
), /* @__PURE__ */
|
|
15910
|
+
), /* @__PURE__ */ import_react10.default.createElement(
|
|
15878
15911
|
"button",
|
|
15879
15912
|
{
|
|
15880
15913
|
type: "button",
|
|
@@ -15888,18 +15921,13 @@ function ActionGroup({ editor }) {
|
|
|
15888
15921
|
}
|
|
15889
15922
|
|
|
15890
15923
|
// src/components/tetrons/toolbar/ClipboardGroup.tsx
|
|
15891
|
-
|
|
15892
|
-
|
|
15893
|
-
|
|
15894
|
-
|
|
15895
|
-
|
|
15896
|
-
|
|
15897
|
-
|
|
15924
|
+
var import_md2 = require("react-icons/md");
|
|
15925
|
+
var import_react11 = __toESM(require("react"));
|
|
15898
15926
|
function ClipboardGroup({ editor }) {
|
|
15899
|
-
return /* @__PURE__ */
|
|
15927
|
+
return /* @__PURE__ */ import_react11.default.createElement("div", { className: "clipboard-group" }, /* @__PURE__ */ import_react11.default.createElement(
|
|
15900
15928
|
ToolbarButton_default,
|
|
15901
15929
|
{
|
|
15902
|
-
icon:
|
|
15930
|
+
icon: import_md2.MdContentPaste,
|
|
15903
15931
|
title: "Paste",
|
|
15904
15932
|
onClick: async () => {
|
|
15905
15933
|
try {
|
|
@@ -15910,10 +15938,10 @@ function ClipboardGroup({ editor }) {
|
|
|
15910
15938
|
}
|
|
15911
15939
|
}
|
|
15912
15940
|
}
|
|
15913
|
-
), /* @__PURE__ */
|
|
15941
|
+
), /* @__PURE__ */ import_react11.default.createElement(
|
|
15914
15942
|
ToolbarButton_default,
|
|
15915
15943
|
{
|
|
15916
|
-
icon:
|
|
15944
|
+
icon: import_md2.MdContentCut,
|
|
15917
15945
|
title: "Cut",
|
|
15918
15946
|
onClick: () => {
|
|
15919
15947
|
const { from: from2, to } = editor.state.selection;
|
|
@@ -15924,10 +15952,10 @@ function ClipboardGroup({ editor }) {
|
|
|
15924
15952
|
});
|
|
15925
15953
|
}
|
|
15926
15954
|
}
|
|
15927
|
-
), /* @__PURE__ */
|
|
15955
|
+
), /* @__PURE__ */ import_react11.default.createElement(
|
|
15928
15956
|
ToolbarButton_default,
|
|
15929
15957
|
{
|
|
15930
|
-
icon:
|
|
15958
|
+
icon: import_md2.MdContentCopy,
|
|
15931
15959
|
title: "Copy",
|
|
15932
15960
|
onClick: () => {
|
|
15933
15961
|
const { from: from2, to } = editor.state.selection;
|
|
@@ -15936,10 +15964,10 @@ function ClipboardGroup({ editor }) {
|
|
|
15936
15964
|
navigator.clipboard.writeText(selectedText);
|
|
15937
15965
|
}
|
|
15938
15966
|
}
|
|
15939
|
-
), /* @__PURE__ */
|
|
15967
|
+
), /* @__PURE__ */ import_react11.default.createElement(
|
|
15940
15968
|
ToolbarButton_default,
|
|
15941
15969
|
{
|
|
15942
|
-
icon:
|
|
15970
|
+
icon: import_md2.MdFormatPaint,
|
|
15943
15971
|
title: "Format Painter",
|
|
15944
15972
|
onClick: () => {
|
|
15945
15973
|
const currentMarks = editor.getAttributes("textStyle");
|
|
@@ -15950,34 +15978,25 @@ function ClipboardGroup({ editor }) {
|
|
|
15950
15978
|
}
|
|
15951
15979
|
|
|
15952
15980
|
// src/components/tetrons/toolbar/FontStyleGroup.tsx
|
|
15953
|
-
|
|
15954
|
-
|
|
15955
|
-
|
|
15956
|
-
|
|
15957
|
-
|
|
15958
|
-
|
|
15959
|
-
|
|
15960
|
-
|
|
15961
|
-
|
|
15962
|
-
|
|
15963
|
-
var _im = require('react-icons/im');
|
|
15964
|
-
var _bi = require('react-icons/bi');
|
|
15965
|
-
|
|
15981
|
+
var import_md3 = require("react-icons/md");
|
|
15982
|
+
var import_im = require("react-icons/im");
|
|
15983
|
+
var import_bi = require("react-icons/bi");
|
|
15984
|
+
var import_react12 = __toESM(require("react"));
|
|
15966
15985
|
function FontStyleGroup({ editor }) {
|
|
15967
|
-
const [textColor, setTextColor] =
|
|
15968
|
-
const [highlightColor, setHighlightColor] =
|
|
15969
|
-
const [fontFamily, setFontFamily] =
|
|
15970
|
-
const [fontSize, setFontSize] =
|
|
15971
|
-
|
|
15986
|
+
const [textColor, setTextColor] = (0, import_react12.useState)("#000000");
|
|
15987
|
+
const [highlightColor, setHighlightColor] = (0, import_react12.useState)("#ffff00");
|
|
15988
|
+
const [fontFamily, setFontFamily] = (0, import_react12.useState)("Arial");
|
|
15989
|
+
const [fontSize, setFontSize] = (0, import_react12.useState)("16px");
|
|
15990
|
+
(0, import_react12.useEffect)(() => {
|
|
15972
15991
|
if (!editor) return;
|
|
15973
15992
|
const updateStates = () => {
|
|
15974
15993
|
const highlight = editor.getAttributes("highlight");
|
|
15975
|
-
setHighlightColor(
|
|
15976
|
-
const color =
|
|
15994
|
+
setHighlightColor(highlight?.color || "#ffff00");
|
|
15995
|
+
const color = editor.getAttributes("textStyle")?.color;
|
|
15977
15996
|
setTextColor(color || "#000000");
|
|
15978
|
-
const fontAttr =
|
|
15997
|
+
const fontAttr = editor.getAttributes("fontFamily")?.font || "Arial";
|
|
15979
15998
|
setFontFamily(fontAttr);
|
|
15980
|
-
const sizeAttr =
|
|
15999
|
+
const sizeAttr = editor.getAttributes("fontSize")?.size || "16px";
|
|
15981
16000
|
setFontSize(sizeAttr);
|
|
15982
16001
|
};
|
|
15983
16002
|
updateStates();
|
|
@@ -15988,7 +16007,7 @@ function FontStyleGroup({ editor }) {
|
|
|
15988
16007
|
editor.off("transaction", updateStates);
|
|
15989
16008
|
};
|
|
15990
16009
|
}, [editor]);
|
|
15991
|
-
return /* @__PURE__ */
|
|
16010
|
+
return /* @__PURE__ */ import_react12.default.createElement("div", { className: "font-style-group" }, /* @__PURE__ */ import_react12.default.createElement(
|
|
15992
16011
|
"select",
|
|
15993
16012
|
{
|
|
15994
16013
|
title: "Font Family",
|
|
@@ -15999,12 +16018,12 @@ function FontStyleGroup({ editor }) {
|
|
|
15999
16018
|
editor.chain().focus().setFontFamily(value).run();
|
|
16000
16019
|
}
|
|
16001
16020
|
},
|
|
16002
|
-
/* @__PURE__ */
|
|
16003
|
-
/* @__PURE__ */
|
|
16004
|
-
/* @__PURE__ */
|
|
16005
|
-
/* @__PURE__ */
|
|
16006
|
-
/* @__PURE__ */
|
|
16007
|
-
), /* @__PURE__ */
|
|
16021
|
+
/* @__PURE__ */ import_react12.default.createElement("option", { value: "Arial" }, "Arial"),
|
|
16022
|
+
/* @__PURE__ */ import_react12.default.createElement("option", { value: "Georgia" }, "Georgia"),
|
|
16023
|
+
/* @__PURE__ */ import_react12.default.createElement("option", { value: "Times New Roman" }, "Times New Roman"),
|
|
16024
|
+
/* @__PURE__ */ import_react12.default.createElement("option", { value: "Courier New" }, "Courier New"),
|
|
16025
|
+
/* @__PURE__ */ import_react12.default.createElement("option", { value: "Verdana" }, "Verdana")
|
|
16026
|
+
), /* @__PURE__ */ import_react12.default.createElement(
|
|
16008
16027
|
"select",
|
|
16009
16028
|
{
|
|
16010
16029
|
title: "Font Size",
|
|
@@ -16015,64 +16034,64 @@ function FontStyleGroup({ editor }) {
|
|
|
16015
16034
|
editor.chain().focus().setFontSize(value).run();
|
|
16016
16035
|
}
|
|
16017
16036
|
},
|
|
16018
|
-
/* @__PURE__ */
|
|
16019
|
-
/* @__PURE__ */
|
|
16020
|
-
/* @__PURE__ */
|
|
16021
|
-
/* @__PURE__ */
|
|
16022
|
-
/* @__PURE__ */
|
|
16023
|
-
/* @__PURE__ */
|
|
16024
|
-
/* @__PURE__ */
|
|
16025
|
-
/* @__PURE__ */
|
|
16026
|
-
/* @__PURE__ */
|
|
16027
|
-
), /* @__PURE__ */
|
|
16037
|
+
/* @__PURE__ */ import_react12.default.createElement("option", { value: "12px" }, "12"),
|
|
16038
|
+
/* @__PURE__ */ import_react12.default.createElement("option", { value: "14px" }, "14"),
|
|
16039
|
+
/* @__PURE__ */ import_react12.default.createElement("option", { value: "16px" }, "16"),
|
|
16040
|
+
/* @__PURE__ */ import_react12.default.createElement("option", { value: "18px" }, "18"),
|
|
16041
|
+
/* @__PURE__ */ import_react12.default.createElement("option", { value: "24px" }, "24"),
|
|
16042
|
+
/* @__PURE__ */ import_react12.default.createElement("option", { value: "36px" }, "36"),
|
|
16043
|
+
/* @__PURE__ */ import_react12.default.createElement("option", { value: "48px" }, "48"),
|
|
16044
|
+
/* @__PURE__ */ import_react12.default.createElement("option", { value: "64px" }, "64"),
|
|
16045
|
+
/* @__PURE__ */ import_react12.default.createElement("option", { value: "72px" }, "72")
|
|
16046
|
+
), /* @__PURE__ */ import_react12.default.createElement(
|
|
16028
16047
|
ToolbarButton_default,
|
|
16029
16048
|
{
|
|
16030
|
-
icon:
|
|
16049
|
+
icon: import_md3.MdFormatBold,
|
|
16031
16050
|
label: "Bold",
|
|
16032
16051
|
onClick: () => editor.chain().focus().toggleBold().run(),
|
|
16033
16052
|
isActive: editor.isActive("bold")
|
|
16034
16053
|
}
|
|
16035
|
-
), /* @__PURE__ */
|
|
16054
|
+
), /* @__PURE__ */ import_react12.default.createElement(
|
|
16036
16055
|
ToolbarButton_default,
|
|
16037
16056
|
{
|
|
16038
|
-
icon:
|
|
16057
|
+
icon: import_md3.MdFormatItalic,
|
|
16039
16058
|
label: "Italic",
|
|
16040
16059
|
onClick: () => editor.chain().focus().toggleItalic().run(),
|
|
16041
16060
|
isActive: editor.isActive("italic")
|
|
16042
16061
|
}
|
|
16043
|
-
), /* @__PURE__ */
|
|
16062
|
+
), /* @__PURE__ */ import_react12.default.createElement(
|
|
16044
16063
|
ToolbarButton_default,
|
|
16045
16064
|
{
|
|
16046
|
-
icon:
|
|
16065
|
+
icon: import_md3.MdFormatUnderlined,
|
|
16047
16066
|
label: "Underline",
|
|
16048
16067
|
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
16049
16068
|
isActive: editor.isActive("underline")
|
|
16050
16069
|
}
|
|
16051
|
-
), /* @__PURE__ */
|
|
16070
|
+
), /* @__PURE__ */ import_react12.default.createElement(
|
|
16052
16071
|
ToolbarButton_default,
|
|
16053
16072
|
{
|
|
16054
|
-
icon:
|
|
16073
|
+
icon: import_md3.MdStrikethroughS,
|
|
16055
16074
|
label: "Strikethrough",
|
|
16056
16075
|
onClick: () => editor.chain().focus().toggleStrike().run(),
|
|
16057
16076
|
isActive: editor.isActive("strike")
|
|
16058
16077
|
}
|
|
16059
|
-
), /* @__PURE__ */
|
|
16078
|
+
), /* @__PURE__ */ import_react12.default.createElement(
|
|
16060
16079
|
ToolbarButton_default,
|
|
16061
16080
|
{
|
|
16062
|
-
icon:
|
|
16081
|
+
icon: import_md3.MdSubscript,
|
|
16063
16082
|
label: "Subscript",
|
|
16064
16083
|
onClick: () => editor.chain().focus().toggleSubscript().run(),
|
|
16065
16084
|
isActive: editor.isActive("subscript")
|
|
16066
16085
|
}
|
|
16067
|
-
), /* @__PURE__ */
|
|
16086
|
+
), /* @__PURE__ */ import_react12.default.createElement(
|
|
16068
16087
|
ToolbarButton_default,
|
|
16069
16088
|
{
|
|
16070
|
-
icon:
|
|
16089
|
+
icon: import_md3.MdSuperscript,
|
|
16071
16090
|
label: "Superscript",
|
|
16072
16091
|
onClick: () => editor.chain().focus().toggleSuperscript().run(),
|
|
16073
16092
|
isActive: editor.isActive("superscript")
|
|
16074
16093
|
}
|
|
16075
|
-
), /* @__PURE__ */
|
|
16094
|
+
), /* @__PURE__ */ import_react12.default.createElement(
|
|
16076
16095
|
"label",
|
|
16077
16096
|
{
|
|
16078
16097
|
title: "Font Color",
|
|
@@ -16080,9 +16099,9 @@ function FontStyleGroup({ editor }) {
|
|
|
16080
16099
|
className: "color-label",
|
|
16081
16100
|
style: { "--indicator-color": textColor }
|
|
16082
16101
|
},
|
|
16083
|
-
/* @__PURE__ */
|
|
16084
|
-
/* @__PURE__ */
|
|
16085
|
-
/* @__PURE__ */
|
|
16102
|
+
/* @__PURE__ */ import_react12.default.createElement(import_im.ImTextColor, { size: 20 }),
|
|
16103
|
+
/* @__PURE__ */ import_react12.default.createElement("div", { className: "color-indicator" }),
|
|
16104
|
+
/* @__PURE__ */ import_react12.default.createElement(
|
|
16086
16105
|
"input",
|
|
16087
16106
|
{
|
|
16088
16107
|
type: "color",
|
|
@@ -16094,7 +16113,7 @@ function FontStyleGroup({ editor }) {
|
|
|
16094
16113
|
}
|
|
16095
16114
|
}
|
|
16096
16115
|
)
|
|
16097
|
-
), /* @__PURE__ */
|
|
16116
|
+
), /* @__PURE__ */ import_react12.default.createElement(
|
|
16098
16117
|
"label",
|
|
16099
16118
|
{
|
|
16100
16119
|
title: "Highlight Color",
|
|
@@ -16102,9 +16121,9 @@ function FontStyleGroup({ editor }) {
|
|
|
16102
16121
|
className: "color-label",
|
|
16103
16122
|
style: { "--indicator-color": highlightColor }
|
|
16104
16123
|
},
|
|
16105
|
-
/* @__PURE__ */
|
|
16106
|
-
/* @__PURE__ */
|
|
16107
|
-
/* @__PURE__ */
|
|
16124
|
+
/* @__PURE__ */ import_react12.default.createElement(import_bi.BiSolidColorFill, { size: 20 }),
|
|
16125
|
+
/* @__PURE__ */ import_react12.default.createElement("div", { className: "color-indicator" }),
|
|
16126
|
+
/* @__PURE__ */ import_react12.default.createElement(
|
|
16108
16127
|
"input",
|
|
16109
16128
|
{
|
|
16110
16129
|
type: "color",
|
|
@@ -16116,17 +16135,17 @@ function FontStyleGroup({ editor }) {
|
|
|
16116
16135
|
}
|
|
16117
16136
|
}
|
|
16118
16137
|
)
|
|
16119
|
-
), /* @__PURE__ */
|
|
16138
|
+
), /* @__PURE__ */ import_react12.default.createElement(
|
|
16120
16139
|
ToolbarButton_default,
|
|
16121
16140
|
{
|
|
16122
|
-
icon:
|
|
16141
|
+
icon: import_md3.MdFormatClear,
|
|
16123
16142
|
label: "Clear Formatting",
|
|
16124
16143
|
onClick: () => editor.chain().focus().unsetAllMarks().run()
|
|
16125
16144
|
}
|
|
16126
|
-
), /* @__PURE__ */
|
|
16145
|
+
), /* @__PURE__ */ import_react12.default.createElement(
|
|
16127
16146
|
ToolbarButton_default,
|
|
16128
16147
|
{
|
|
16129
|
-
icon:
|
|
16148
|
+
icon: import_md3.MdFormatPaint,
|
|
16130
16149
|
label: "Apply Painter Format",
|
|
16131
16150
|
onClick: () => {
|
|
16132
16151
|
const format = JSON.parse(
|
|
@@ -16142,25 +16161,16 @@ function FontStyleGroup({ editor }) {
|
|
|
16142
16161
|
}
|
|
16143
16162
|
|
|
16144
16163
|
// src/components/tetrons/toolbar/InsertGroup.tsx
|
|
16145
|
-
|
|
16146
|
-
|
|
16147
|
-
|
|
16148
|
-
|
|
16149
|
-
|
|
16150
|
-
|
|
16151
|
-
|
|
16152
|
-
|
|
16153
|
-
|
|
16154
|
-
|
|
16155
|
-
|
|
16156
|
-
var _react5 = require('@emoji-mart/react'); var _react6 = _interopRequireDefault(_react5);
|
|
16164
|
+
var import_react13 = __toESM(require("react"));
|
|
16165
|
+
var import_md4 = require("react-icons/md");
|
|
16166
|
+
var import_react14 = __toESM(require("@emoji-mart/react"));
|
|
16157
16167
|
function InsertGroup({ editor }) {
|
|
16158
|
-
const [showTableGrid, setShowTableGrid] =
|
|
16159
|
-
const [selectedRows, setSelectedRows] =
|
|
16160
|
-
const [selectedCols, setSelectedCols] =
|
|
16161
|
-
const imageInputRef =
|
|
16162
|
-
const videoInputRef =
|
|
16163
|
-
const [showPicker, setShowPicker] =
|
|
16168
|
+
const [showTableGrid, setShowTableGrid] = (0, import_react13.useState)(false);
|
|
16169
|
+
const [selectedRows, setSelectedRows] = (0, import_react13.useState)(1);
|
|
16170
|
+
const [selectedCols, setSelectedCols] = (0, import_react13.useState)(1);
|
|
16171
|
+
const imageInputRef = (0, import_react13.useRef)(null);
|
|
16172
|
+
const videoInputRef = (0, import_react13.useRef)(null);
|
|
16173
|
+
const [showPicker, setShowPicker] = (0, import_react13.useState)(false);
|
|
16164
16174
|
const addEmoji = (emoji) => {
|
|
16165
16175
|
editor.chain().focus().insertContent(emoji.native).run();
|
|
16166
16176
|
setShowPicker(false);
|
|
@@ -16180,7 +16190,7 @@ function InsertGroup({ editor }) {
|
|
|
16180
16190
|
setSelectedCols(1);
|
|
16181
16191
|
};
|
|
16182
16192
|
const handleImageUpload = (e) => {
|
|
16183
|
-
const file =
|
|
16193
|
+
const file = e.target.files?.[0];
|
|
16184
16194
|
if (file) {
|
|
16185
16195
|
const reader = new FileReader();
|
|
16186
16196
|
reader.onload = () => {
|
|
@@ -16190,7 +16200,7 @@ function InsertGroup({ editor }) {
|
|
|
16190
16200
|
}
|
|
16191
16201
|
};
|
|
16192
16202
|
const handleVideoUpload = (e) => {
|
|
16193
|
-
const file =
|
|
16203
|
+
const file = e.target.files?.[0];
|
|
16194
16204
|
if (file) {
|
|
16195
16205
|
const reader = new FileReader();
|
|
16196
16206
|
reader.onload = () => {
|
|
@@ -16225,11 +16235,11 @@ function InsertGroup({ editor }) {
|
|
|
16225
16235
|
return url.replace("/maps/", "/maps/embed/");
|
|
16226
16236
|
}
|
|
16227
16237
|
return url;
|
|
16228
|
-
} catch
|
|
16238
|
+
} catch {
|
|
16229
16239
|
return url;
|
|
16230
16240
|
}
|
|
16231
16241
|
}
|
|
16232
|
-
return /* @__PURE__ */
|
|
16242
|
+
return /* @__PURE__ */ import_react13.default.createElement("div", { className: "insert-group" }, /* @__PURE__ */ import_react13.default.createElement(
|
|
16233
16243
|
"input",
|
|
16234
16244
|
{
|
|
16235
16245
|
type: "file",
|
|
@@ -16240,7 +16250,7 @@ function InsertGroup({ editor }) {
|
|
|
16240
16250
|
"aria-label": "Upload Image",
|
|
16241
16251
|
title: "Upload Image"
|
|
16242
16252
|
}
|
|
16243
|
-
), /* @__PURE__ */
|
|
16253
|
+
), /* @__PURE__ */ import_react13.default.createElement(
|
|
16244
16254
|
"input",
|
|
16245
16255
|
{
|
|
16246
16256
|
type: "file",
|
|
@@ -16251,23 +16261,23 @@ function InsertGroup({ editor }) {
|
|
|
16251
16261
|
"aria-label": "Upload Video",
|
|
16252
16262
|
title: "Upload Video"
|
|
16253
16263
|
}
|
|
16254
|
-
), /* @__PURE__ */
|
|
16264
|
+
), /* @__PURE__ */ import_react13.default.createElement(
|
|
16255
16265
|
ToolbarButton_default,
|
|
16256
16266
|
{
|
|
16257
|
-
icon:
|
|
16267
|
+
icon: import_md4.MdTableChart,
|
|
16258
16268
|
label: "Insert Table",
|
|
16259
16269
|
onClick: () => setShowTableGrid(!showTableGrid)
|
|
16260
16270
|
}
|
|
16261
|
-
), showTableGrid && /* @__PURE__ */
|
|
16271
|
+
), showTableGrid && /* @__PURE__ */ import_react13.default.createElement(
|
|
16262
16272
|
"div",
|
|
16263
16273
|
{
|
|
16264
16274
|
className: "table-grid-popup",
|
|
16265
16275
|
onMouseLeave: () => setShowTableGrid(false)
|
|
16266
16276
|
},
|
|
16267
|
-
/* @__PURE__ */
|
|
16277
|
+
/* @__PURE__ */ import_react13.default.createElement("div", { className: "table-grid" }, [...Array(10)].map(
|
|
16268
16278
|
(_, row) => [...Array(10)].map((_2, col) => {
|
|
16269
16279
|
const isSelected = row < selectedRows && col < selectedCols;
|
|
16270
|
-
return /* @__PURE__ */
|
|
16280
|
+
return /* @__PURE__ */ import_react13.default.createElement(
|
|
16271
16281
|
"div",
|
|
16272
16282
|
{
|
|
16273
16283
|
key: `${row}-${col}`,
|
|
@@ -16278,25 +16288,25 @@ function InsertGroup({ editor }) {
|
|
|
16278
16288
|
);
|
|
16279
16289
|
})
|
|
16280
16290
|
)),
|
|
16281
|
-
/* @__PURE__ */
|
|
16282
|
-
), /* @__PURE__ */
|
|
16291
|
+
/* @__PURE__ */ import_react13.default.createElement("div", { className: "table-grid-label" }, selectedRows, " x ", selectedCols)
|
|
16292
|
+
), /* @__PURE__ */ import_react13.default.createElement(
|
|
16283
16293
|
ToolbarButton_default,
|
|
16284
16294
|
{
|
|
16285
|
-
icon:
|
|
16295
|
+
icon: import_md4.MdInsertPhoto,
|
|
16286
16296
|
label: "Insert Image",
|
|
16287
|
-
onClick: () =>
|
|
16297
|
+
onClick: () => imageInputRef.current?.click()
|
|
16288
16298
|
}
|
|
16289
|
-
), /* @__PURE__ */
|
|
16299
|
+
), /* @__PURE__ */ import_react13.default.createElement(
|
|
16290
16300
|
ToolbarButton_default,
|
|
16291
16301
|
{
|
|
16292
|
-
icon:
|
|
16302
|
+
icon: import_md4.MdVideoLibrary,
|
|
16293
16303
|
label: "Insert Video",
|
|
16294
|
-
onClick: () =>
|
|
16304
|
+
onClick: () => videoInputRef.current?.click()
|
|
16295
16305
|
}
|
|
16296
|
-
), /* @__PURE__ */
|
|
16306
|
+
), /* @__PURE__ */ import_react13.default.createElement(
|
|
16297
16307
|
ToolbarButton_default,
|
|
16298
16308
|
{
|
|
16299
|
-
icon:
|
|
16309
|
+
icon: import_md4.MdInsertLink,
|
|
16300
16310
|
label: "Insert Link",
|
|
16301
16311
|
onClick: () => {
|
|
16302
16312
|
const url = prompt("Enter URL");
|
|
@@ -16305,10 +16315,10 @@ function InsertGroup({ editor }) {
|
|
|
16305
16315
|
}
|
|
16306
16316
|
}
|
|
16307
16317
|
}
|
|
16308
|
-
), /* @__PURE__ */
|
|
16318
|
+
), /* @__PURE__ */ import_react13.default.createElement(
|
|
16309
16319
|
ToolbarButton_default,
|
|
16310
16320
|
{
|
|
16311
|
-
icon:
|
|
16321
|
+
icon: import_md4.MdInsertComment,
|
|
16312
16322
|
label: "Insert Comment",
|
|
16313
16323
|
onClick: () => {
|
|
16314
16324
|
const comment = prompt("Enter your comment");
|
|
@@ -16319,15 +16329,15 @@ function InsertGroup({ editor }) {
|
|
|
16319
16329
|
}
|
|
16320
16330
|
}
|
|
16321
16331
|
}
|
|
16322
|
-
), /* @__PURE__ */
|
|
16332
|
+
), /* @__PURE__ */ import_react13.default.createElement("div", { className: "relative" }, /* @__PURE__ */ import_react13.default.createElement(
|
|
16323
16333
|
ToolbarButton_default,
|
|
16324
16334
|
{
|
|
16325
|
-
icon:
|
|
16335
|
+
icon: import_md4.MdInsertEmoticon,
|
|
16326
16336
|
label: "Emoji",
|
|
16327
16337
|
onClick: () => setShowPicker(!showPicker)
|
|
16328
16338
|
}
|
|
16329
|
-
), showPicker && /* @__PURE__ */
|
|
16330
|
-
|
|
16339
|
+
), showPicker && /* @__PURE__ */ import_react13.default.createElement("div", { className: "emoji-picker" }, /* @__PURE__ */ import_react13.default.createElement(
|
|
16340
|
+
import_react14.default,
|
|
16331
16341
|
{
|
|
16332
16342
|
onEmojiSelect: addEmoji,
|
|
16333
16343
|
theme: "auto",
|
|
@@ -16336,17 +16346,17 @@ function InsertGroup({ editor }) {
|
|
|
16336
16346
|
showSkinTones: true,
|
|
16337
16347
|
emojiTooltip: true
|
|
16338
16348
|
}
|
|
16339
|
-
))), /* @__PURE__ */
|
|
16349
|
+
))), /* @__PURE__ */ import_react13.default.createElement(
|
|
16340
16350
|
ToolbarButton_default,
|
|
16341
16351
|
{
|
|
16342
|
-
icon:
|
|
16352
|
+
icon: import_md4.MdHorizontalRule,
|
|
16343
16353
|
label: "Horizontal Line",
|
|
16344
16354
|
onClick: () => editor.chain().focus().setHorizontalRule().run()
|
|
16345
16355
|
}
|
|
16346
|
-
), /* @__PURE__ */
|
|
16356
|
+
), /* @__PURE__ */ import_react13.default.createElement(
|
|
16347
16357
|
ToolbarButton_default,
|
|
16348
16358
|
{
|
|
16349
|
-
icon:
|
|
16359
|
+
icon: import_md4.MdOutlineOndemandVideo,
|
|
16350
16360
|
label: "Embed",
|
|
16351
16361
|
onClick: () => {
|
|
16352
16362
|
const url = prompt(
|
|
@@ -16367,78 +16377,69 @@ function InsertGroup({ editor }) {
|
|
|
16367
16377
|
}
|
|
16368
16378
|
|
|
16369
16379
|
// src/components/tetrons/toolbar/ListAlignGroup.tsx
|
|
16370
|
-
|
|
16371
|
-
|
|
16372
|
-
|
|
16373
|
-
|
|
16374
|
-
|
|
16375
|
-
|
|
16376
|
-
|
|
16377
|
-
|
|
16378
|
-
|
|
16379
|
-
|
|
16380
|
-
|
|
16380
|
+
var import_react15 = __toESM(require("react"));
|
|
16381
|
+
var import_md5 = require("react-icons/md");
|
|
16381
16382
|
function ListAlignGroup({ editor }) {
|
|
16382
|
-
return /* @__PURE__ */
|
|
16383
|
+
return /* @__PURE__ */ import_react15.default.createElement("div", { className: "list-align-group" }, /* @__PURE__ */ import_react15.default.createElement(
|
|
16383
16384
|
ToolbarButton_default,
|
|
16384
16385
|
{
|
|
16385
|
-
icon:
|
|
16386
|
+
icon: import_md5.MdFormatListBulleted,
|
|
16386
16387
|
title: "Bulleted List",
|
|
16387
16388
|
onClick: () => editor.chain().focus().toggleBulletList().run(),
|
|
16388
16389
|
disabled: !editor.can().toggleBulletList()
|
|
16389
16390
|
}
|
|
16390
|
-
), /* @__PURE__ */
|
|
16391
|
+
), /* @__PURE__ */ import_react15.default.createElement(
|
|
16391
16392
|
ToolbarButton_default,
|
|
16392
16393
|
{
|
|
16393
|
-
icon:
|
|
16394
|
+
icon: import_md5.MdFormatListNumbered,
|
|
16394
16395
|
title: "Numbered List",
|
|
16395
16396
|
onClick: () => editor.chain().focus().toggleOrderedList().run(),
|
|
16396
16397
|
disabled: !editor.can().toggleOrderedList()
|
|
16397
16398
|
}
|
|
16398
|
-
), /* @__PURE__ */
|
|
16399
|
+
), /* @__PURE__ */ import_react15.default.createElement(
|
|
16399
16400
|
ToolbarButton_default,
|
|
16400
16401
|
{
|
|
16401
|
-
icon:
|
|
16402
|
+
icon: import_md5.MdFormatIndentIncrease,
|
|
16402
16403
|
title: "Increase Indent",
|
|
16403
16404
|
onClick: () => editor.chain().focus().sinkListItem("listItem").run(),
|
|
16404
16405
|
disabled: !editor.can().sinkListItem("listItem")
|
|
16405
16406
|
}
|
|
16406
|
-
), /* @__PURE__ */
|
|
16407
|
+
), /* @__PURE__ */ import_react15.default.createElement(
|
|
16407
16408
|
ToolbarButton_default,
|
|
16408
16409
|
{
|
|
16409
|
-
icon:
|
|
16410
|
+
icon: import_md5.MdFormatIndentDecrease,
|
|
16410
16411
|
title: "Decrease Indent",
|
|
16411
16412
|
onClick: () => editor.chain().focus().liftListItem("listItem").run(),
|
|
16412
16413
|
disabled: !editor.can().liftListItem("listItem")
|
|
16413
16414
|
}
|
|
16414
|
-
), /* @__PURE__ */
|
|
16415
|
+
), /* @__PURE__ */ import_react15.default.createElement(
|
|
16415
16416
|
ToolbarButton_default,
|
|
16416
16417
|
{
|
|
16417
|
-
icon:
|
|
16418
|
+
icon: import_md5.MdFormatAlignLeft,
|
|
16418
16419
|
title: "Align Left",
|
|
16419
16420
|
onClick: () => editor.chain().focus().setTextAlign("left").run(),
|
|
16420
16421
|
disabled: !editor.can().setTextAlign("left")
|
|
16421
16422
|
}
|
|
16422
|
-
), /* @__PURE__ */
|
|
16423
|
+
), /* @__PURE__ */ import_react15.default.createElement(
|
|
16423
16424
|
ToolbarButton_default,
|
|
16424
16425
|
{
|
|
16425
|
-
icon:
|
|
16426
|
+
icon: import_md5.MdFormatAlignCenter,
|
|
16426
16427
|
title: "Align Center",
|
|
16427
16428
|
onClick: () => editor.chain().focus().setTextAlign("center").run(),
|
|
16428
16429
|
disabled: !editor.can().setTextAlign("center")
|
|
16429
16430
|
}
|
|
16430
|
-
), /* @__PURE__ */
|
|
16431
|
+
), /* @__PURE__ */ import_react15.default.createElement(
|
|
16431
16432
|
ToolbarButton_default,
|
|
16432
16433
|
{
|
|
16433
|
-
icon:
|
|
16434
|
+
icon: import_md5.MdFormatAlignRight,
|
|
16434
16435
|
title: "Align Right",
|
|
16435
16436
|
onClick: () => editor.chain().focus().setTextAlign("right").run(),
|
|
16436
16437
|
disabled: !editor.can().setTextAlign("right")
|
|
16437
16438
|
}
|
|
16438
|
-
), /* @__PURE__ */
|
|
16439
|
+
), /* @__PURE__ */ import_react15.default.createElement(
|
|
16439
16440
|
ToolbarButton_default,
|
|
16440
16441
|
{
|
|
16441
|
-
icon:
|
|
16442
|
+
icon: import_md5.MdFormatAlignJustify,
|
|
16442
16443
|
title: "Justify",
|
|
16443
16444
|
onClick: () => editor.chain().focus().setTextAlign("justify").run(),
|
|
16444
16445
|
disabled: !editor.can().setTextAlign("justify")
|
|
@@ -16447,15 +16448,8 @@ function ListAlignGroup({ editor }) {
|
|
|
16447
16448
|
}
|
|
16448
16449
|
|
|
16449
16450
|
// src/components/tetrons/toolbar/MiscGroup.tsx
|
|
16450
|
-
|
|
16451
|
-
|
|
16452
|
-
|
|
16453
|
-
|
|
16454
|
-
|
|
16455
|
-
|
|
16456
|
-
|
|
16457
|
-
|
|
16458
|
-
|
|
16451
|
+
var import_react16 = __toESM(require("react"));
|
|
16452
|
+
var import_md6 = require("react-icons/md");
|
|
16459
16453
|
|
|
16460
16454
|
// src/utils/checkGrammar.ts
|
|
16461
16455
|
async function checkGrammar(text) {
|
|
@@ -16520,48 +16514,48 @@ Reason: ${issue.message}
|
|
|
16520
16514
|
alert("\u274C Failed to check grammar. Please try again later.");
|
|
16521
16515
|
}
|
|
16522
16516
|
};
|
|
16523
|
-
return /* @__PURE__ */
|
|
16517
|
+
return /* @__PURE__ */ import_react16.default.createElement("div", { className: "misc-group" }, /* @__PURE__ */ import_react16.default.createElement(
|
|
16524
16518
|
ToolbarButton_default,
|
|
16525
16519
|
{
|
|
16526
|
-
icon:
|
|
16520
|
+
icon: import_md6.MdUndo,
|
|
16527
16521
|
label: "Undo",
|
|
16528
16522
|
onClick: () => editor.chain().focus().undo().run(),
|
|
16529
16523
|
disabled: !editor.can().undo()
|
|
16530
16524
|
}
|
|
16531
|
-
), /* @__PURE__ */
|
|
16525
|
+
), /* @__PURE__ */ import_react16.default.createElement(
|
|
16532
16526
|
ToolbarButton_default,
|
|
16533
16527
|
{
|
|
16534
|
-
icon:
|
|
16528
|
+
icon: import_md6.MdRedo,
|
|
16535
16529
|
label: "Redo",
|
|
16536
16530
|
onClick: () => editor.chain().focus().redo().run(),
|
|
16537
16531
|
disabled: !editor.can().redo()
|
|
16538
16532
|
}
|
|
16539
|
-
), /* @__PURE__ */
|
|
16533
|
+
), /* @__PURE__ */ import_react16.default.createElement(
|
|
16540
16534
|
ToolbarButton_default,
|
|
16541
16535
|
{
|
|
16542
|
-
icon:
|
|
16536
|
+
icon: import_md6.MdRefresh,
|
|
16543
16537
|
label: "Reset Formatting",
|
|
16544
16538
|
onClick: () => editor.chain().focus().unsetAllMarks().clearNodes().run()
|
|
16545
16539
|
}
|
|
16546
|
-
), /* @__PURE__ */
|
|
16540
|
+
), /* @__PURE__ */ import_react16.default.createElement(
|
|
16547
16541
|
ToolbarButton_default,
|
|
16548
16542
|
{
|
|
16549
|
-
icon:
|
|
16543
|
+
icon: import_md6.MdCode,
|
|
16550
16544
|
label: "Toggle Code Block",
|
|
16551
16545
|
onClick: () => editor.chain().focus().toggleCodeBlock().run(),
|
|
16552
16546
|
isActive: editor.isActive("codeBlock")
|
|
16553
16547
|
}
|
|
16554
|
-
), /* @__PURE__ */
|
|
16548
|
+
), /* @__PURE__ */ import_react16.default.createElement(
|
|
16555
16549
|
ToolbarButton_default,
|
|
16556
16550
|
{
|
|
16557
|
-
icon:
|
|
16551
|
+
icon: import_md6.MdVisibility,
|
|
16558
16552
|
label: "Preview",
|
|
16559
16553
|
onClick: handlePreview
|
|
16560
16554
|
}
|
|
16561
|
-
), /* @__PURE__ */
|
|
16555
|
+
), /* @__PURE__ */ import_react16.default.createElement(
|
|
16562
16556
|
ToolbarButton_default,
|
|
16563
16557
|
{
|
|
16564
|
-
icon:
|
|
16558
|
+
icon: import_md6.MdSpellcheck,
|
|
16565
16559
|
label: "Check Grammar",
|
|
16566
16560
|
onClick: handleGrammarCheck
|
|
16567
16561
|
}
|
|
@@ -16569,11 +16563,11 @@ Reason: ${issue.message}
|
|
|
16569
16563
|
}
|
|
16570
16564
|
|
|
16571
16565
|
// src/components/tetrons/toolbar/FileGroup.tsx
|
|
16572
|
-
var
|
|
16573
|
-
var
|
|
16574
|
-
|
|
16566
|
+
var import_fa = require("react-icons/fa");
|
|
16567
|
+
var import_vsc = require("react-icons/vsc");
|
|
16568
|
+
var import_react17 = __toESM(require("react"));
|
|
16575
16569
|
function FileGroup({ editor }) {
|
|
16576
|
-
const fileInputRef =
|
|
16570
|
+
const fileInputRef = (0, import_react17.useRef)(null);
|
|
16577
16571
|
const handleNew = () => {
|
|
16578
16572
|
if (confirm(
|
|
16579
16573
|
"Are you sure you want to create a new document? Unsaved changes will be lost."
|
|
@@ -16582,10 +16576,10 @@ function FileGroup({ editor }) {
|
|
|
16582
16576
|
}
|
|
16583
16577
|
};
|
|
16584
16578
|
const handleOpen = () => {
|
|
16585
|
-
|
|
16579
|
+
fileInputRef.current?.click();
|
|
16586
16580
|
};
|
|
16587
16581
|
const handleFileChange = async (e) => {
|
|
16588
|
-
const file =
|
|
16582
|
+
const file = e.target.files?.[0];
|
|
16589
16583
|
if (!file) return;
|
|
16590
16584
|
try {
|
|
16591
16585
|
const text = await file.text();
|
|
@@ -16600,7 +16594,7 @@ function FileGroup({ editor }) {
|
|
|
16600
16594
|
e.target.value = "";
|
|
16601
16595
|
}
|
|
16602
16596
|
};
|
|
16603
|
-
return /* @__PURE__ */
|
|
16597
|
+
return /* @__PURE__ */ import_react17.default.createElement("div", { className: "file-group", role: "group", "aria-label": "File actions" }, /* @__PURE__ */ import_react17.default.createElement(
|
|
16604
16598
|
"input",
|
|
16605
16599
|
{
|
|
16606
16600
|
type: "file",
|
|
@@ -16610,10 +16604,10 @@ function FileGroup({ editor }) {
|
|
|
16610
16604
|
className: "hidden",
|
|
16611
16605
|
"aria-label": "Open JSON file"
|
|
16612
16606
|
}
|
|
16613
|
-
), /* @__PURE__ */
|
|
16607
|
+
), /* @__PURE__ */ import_react17.default.createElement(ToolbarButton_default, { icon: import_vsc.VscNewFile, onClick: handleNew, title: "New" }), /* @__PURE__ */ import_react17.default.createElement(
|
|
16614
16608
|
ToolbarButton_default,
|
|
16615
16609
|
{
|
|
16616
|
-
icon:
|
|
16610
|
+
icon: import_fa.FaRegFolderOpen,
|
|
16617
16611
|
onClick: handleOpen,
|
|
16618
16612
|
title: "Open File"
|
|
16619
16613
|
}
|
|
@@ -16621,21 +16615,21 @@ function FileGroup({ editor }) {
|
|
|
16621
16615
|
}
|
|
16622
16616
|
|
|
16623
16617
|
// src/components/tetrons/toolbar/AIGroup.tsx
|
|
16624
|
-
|
|
16625
|
-
|
|
16626
|
-
var
|
|
16627
|
-
var
|
|
16618
|
+
var import_react18 = __toESM(require("react"));
|
|
16619
|
+
var import_fa2 = require("react-icons/fa");
|
|
16620
|
+
var import_loaders = require("@uiball/loaders");
|
|
16621
|
+
var import_framer_motion = require("framer-motion");
|
|
16628
16622
|
function AiGroup({ editor }) {
|
|
16629
|
-
const [isRecording, setIsRecording] =
|
|
16630
|
-
const [audioBlob, setAudioBlob] =
|
|
16631
|
-
const [isTranscribing, setIsTranscribing] =
|
|
16632
|
-
const [transcriptionError, setTranscriptionError] =
|
|
16633
|
-
const [showPromptInput, setShowPromptInput] =
|
|
16634
|
-
const [prompt2, setPrompt] =
|
|
16635
|
-
const [isLoadingAI, setIsLoadingAI] =
|
|
16636
|
-
const [aiError, setAiError] =
|
|
16637
|
-
const mediaRecorderRef =
|
|
16638
|
-
const chunksRef =
|
|
16623
|
+
const [isRecording, setIsRecording] = (0, import_react18.useState)(false);
|
|
16624
|
+
const [audioBlob, setAudioBlob] = (0, import_react18.useState)(null);
|
|
16625
|
+
const [isTranscribing, setIsTranscribing] = (0, import_react18.useState)(false);
|
|
16626
|
+
const [transcriptionError, setTranscriptionError] = (0, import_react18.useState)("");
|
|
16627
|
+
const [showPromptInput, setShowPromptInput] = (0, import_react18.useState)(false);
|
|
16628
|
+
const [prompt2, setPrompt] = (0, import_react18.useState)("");
|
|
16629
|
+
const [isLoadingAI, setIsLoadingAI] = (0, import_react18.useState)(false);
|
|
16630
|
+
const [aiError, setAiError] = (0, import_react18.useState)("");
|
|
16631
|
+
const mediaRecorderRef = (0, import_react18.useRef)(null);
|
|
16632
|
+
const chunksRef = (0, import_react18.useRef)([]);
|
|
16639
16633
|
const startRecording = async () => {
|
|
16640
16634
|
setTranscriptionError("");
|
|
16641
16635
|
setAudioBlob(null);
|
|
@@ -16655,7 +16649,7 @@ function AiGroup({ editor }) {
|
|
|
16655
16649
|
setIsRecording(true);
|
|
16656
16650
|
};
|
|
16657
16651
|
const stopRecording = () => {
|
|
16658
|
-
|
|
16652
|
+
mediaRecorderRef.current?.stop();
|
|
16659
16653
|
setIsRecording(false);
|
|
16660
16654
|
};
|
|
16661
16655
|
const transcribeAudio = async (blob) => {
|
|
@@ -16708,7 +16702,7 @@ function AiGroup({ editor }) {
|
|
|
16708
16702
|
setIsLoadingAI(false);
|
|
16709
16703
|
}
|
|
16710
16704
|
};
|
|
16711
|
-
return /* @__PURE__ */
|
|
16705
|
+
return /* @__PURE__ */ import_react18.default.createElement("div", { className: "group relative space-y-3" }, /* @__PURE__ */ import_react18.default.createElement("div", { className: "flex gap-2 items-center" }, !isRecording ? /* @__PURE__ */ import_react18.default.createElement(
|
|
16712
16706
|
"button",
|
|
16713
16707
|
{
|
|
16714
16708
|
type: "button",
|
|
@@ -16716,8 +16710,8 @@ function AiGroup({ editor }) {
|
|
|
16716
16710
|
className: "icon-btn",
|
|
16717
16711
|
title: "Start Voice Input"
|
|
16718
16712
|
},
|
|
16719
|
-
/* @__PURE__ */
|
|
16720
|
-
) : /* @__PURE__ */
|
|
16713
|
+
/* @__PURE__ */ import_react18.default.createElement(import_fa2.FaMicrophone, { size: 18 })
|
|
16714
|
+
) : /* @__PURE__ */ import_react18.default.createElement(
|
|
16721
16715
|
"button",
|
|
16722
16716
|
{
|
|
16723
16717
|
type: "button",
|
|
@@ -16725,8 +16719,8 @@ function AiGroup({ editor }) {
|
|
|
16725
16719
|
className: "icon-btn stop-btn",
|
|
16726
16720
|
title: "Stop Recording"
|
|
16727
16721
|
},
|
|
16728
|
-
/* @__PURE__ */
|
|
16729
|
-
), /* @__PURE__ */
|
|
16722
|
+
/* @__PURE__ */ import_react18.default.createElement(import_fa2.FaStop, { size: 18 })
|
|
16723
|
+
), /* @__PURE__ */ import_react18.default.createElement(
|
|
16730
16724
|
"button",
|
|
16731
16725
|
{
|
|
16732
16726
|
type: "button",
|
|
@@ -16735,24 +16729,24 @@ function AiGroup({ editor }) {
|
|
|
16735
16729
|
title: "AI Assist"
|
|
16736
16730
|
},
|
|
16737
16731
|
"AI"
|
|
16738
|
-
)), isRecording && /* @__PURE__ */
|
|
16739
|
-
|
|
16732
|
+
)), isRecording && /* @__PURE__ */ import_react18.default.createElement("div", { className: "flex flex-col items-center" }, /* @__PURE__ */ import_react18.default.createElement(import_loaders.Waveform, { size: 30, lineWeight: 3.5, speed: 1, color: "#4F46E5" }), /* @__PURE__ */ import_react18.default.createElement("p", { className: "text-sm mt-1 text-gray-600" }, "Recording...")), isTranscribing && /* @__PURE__ */ import_react18.default.createElement("p", { className: "text-sm text-gray-500" }, "Transcribing..."), transcriptionError && /* @__PURE__ */ import_react18.default.createElement("p", { className: "text-sm text-red-600" }, transcriptionError), audioBlob && /* @__PURE__ */ import_react18.default.createElement("div", { className: "mt-2" }, /* @__PURE__ */ import_react18.default.createElement("audio", { controls: true, src: URL.createObjectURL(audioBlob) })), /* @__PURE__ */ import_react18.default.createElement(import_framer_motion.AnimatePresence, null, showPromptInput && /* @__PURE__ */ import_react18.default.createElement(
|
|
16733
|
+
import_framer_motion.motion.div,
|
|
16740
16734
|
{
|
|
16741
16735
|
className: "ai-modal-backdrop",
|
|
16742
16736
|
initial: { opacity: 0 },
|
|
16743
16737
|
animate: { opacity: 1 },
|
|
16744
16738
|
exit: { opacity: 0 }
|
|
16745
16739
|
},
|
|
16746
|
-
/* @__PURE__ */
|
|
16747
|
-
|
|
16740
|
+
/* @__PURE__ */ import_react18.default.createElement(
|
|
16741
|
+
import_framer_motion.motion.div,
|
|
16748
16742
|
{
|
|
16749
16743
|
className: "ai-modal-content",
|
|
16750
16744
|
initial: { scale: 0.9, opacity: 0 },
|
|
16751
16745
|
animate: { scale: 1, opacity: 1 },
|
|
16752
16746
|
exit: { scale: 0.9, opacity: 0 }
|
|
16753
16747
|
},
|
|
16754
|
-
/* @__PURE__ */
|
|
16755
|
-
/* @__PURE__ */
|
|
16748
|
+
/* @__PURE__ */ import_react18.default.createElement("h2", { className: "ai-modal-title" }, "AI Prompt"),
|
|
16749
|
+
/* @__PURE__ */ import_react18.default.createElement(
|
|
16756
16750
|
"textarea",
|
|
16757
16751
|
{
|
|
16758
16752
|
className: "ai-modal-textarea",
|
|
@@ -16761,15 +16755,15 @@ function AiGroup({ editor }) {
|
|
|
16761
16755
|
placeholder: "Enter your prompt here..."
|
|
16762
16756
|
}
|
|
16763
16757
|
),
|
|
16764
|
-
aiError && /* @__PURE__ */
|
|
16765
|
-
/* @__PURE__ */
|
|
16758
|
+
aiError && /* @__PURE__ */ import_react18.default.createElement("p", { className: "ai-modal-error" }, aiError),
|
|
16759
|
+
/* @__PURE__ */ import_react18.default.createElement("div", { className: "ai-modal-actions" }, /* @__PURE__ */ import_react18.default.createElement(
|
|
16766
16760
|
"button",
|
|
16767
16761
|
{
|
|
16768
16762
|
onClick: () => setShowPromptInput(false),
|
|
16769
16763
|
className: "ai-cancel-btn"
|
|
16770
16764
|
},
|
|
16771
16765
|
"Cancel"
|
|
16772
|
-
), /* @__PURE__ */
|
|
16766
|
+
), /* @__PURE__ */ import_react18.default.createElement(
|
|
16773
16767
|
"button",
|
|
16774
16768
|
{
|
|
16775
16769
|
onClick: handlePromptSubmit,
|
|
@@ -16787,8 +16781,8 @@ function TetronsToolbar({
|
|
|
16787
16781
|
editor,
|
|
16788
16782
|
version
|
|
16789
16783
|
}) {
|
|
16790
|
-
const [autoSave, setAutoSave] =
|
|
16791
|
-
|
|
16784
|
+
const [autoSave, setAutoSave] = (0, import_react19.useState)(false);
|
|
16785
|
+
(0, import_react19.useEffect)(() => {
|
|
16792
16786
|
if (!editor) return;
|
|
16793
16787
|
const handleUpdate = () => {
|
|
16794
16788
|
if (!autoSave) return;
|
|
@@ -16804,7 +16798,7 @@ function TetronsToolbar({
|
|
|
16804
16798
|
editor.off("update", handleUpdate);
|
|
16805
16799
|
};
|
|
16806
16800
|
}, [autoSave, editor]);
|
|
16807
|
-
return /* @__PURE__ */
|
|
16801
|
+
return /* @__PURE__ */ import_react19.default.createElement("div", { className: "tetrons-toolbar" }, version !== "free" && /* @__PURE__ */ import_react19.default.createElement("div", { className: "group" }, /* @__PURE__ */ import_react19.default.createElement(
|
|
16808
16802
|
"input",
|
|
16809
16803
|
{
|
|
16810
16804
|
type: "checkbox",
|
|
@@ -16812,34 +16806,35 @@ function TetronsToolbar({
|
|
|
16812
16806
|
checked: autoSave,
|
|
16813
16807
|
onChange: (e) => setAutoSave(e.target.checked)
|
|
16814
16808
|
}
|
|
16815
|
-
), /* @__PURE__ */
|
|
16809
|
+
), /* @__PURE__ */ import_react19.default.createElement("label", { htmlFor: "autoSave" }, "Auto Save")), ["pro", "premium", "platinum"].includes(version) && /* @__PURE__ */ import_react19.default.createElement(FileGroup, { editor }), /* @__PURE__ */ import_react19.default.createElement(ClipboardGroup, { editor }), /* @__PURE__ */ import_react19.default.createElement(FontStyleGroup, { editor }), /* @__PURE__ */ import_react19.default.createElement(ListAlignGroup, { editor }), ["premium", "platinum"].includes(version) && /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, /* @__PURE__ */ import_react19.default.createElement(InsertGroup, { editor }), /* @__PURE__ */ import_react19.default.createElement(ActionGroup, { editor })), version === "platinum" && /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, /* @__PURE__ */ import_react19.default.createElement(MiscGroup, { editor }), /* @__PURE__ */ import_react19.default.createElement(AiGroup, { editor })));
|
|
16816
16810
|
}
|
|
16817
16811
|
|
|
16818
16812
|
// src/components/tetrons/EditorContent.tsx
|
|
16819
|
-
var
|
|
16813
|
+
var import_meta = {};
|
|
16814
|
+
var lowlight = (0, import_lowlight.createLowlight)();
|
|
16820
16815
|
lowlight.register("js", javascript);
|
|
16821
16816
|
lowlight.register("ts", typescript);
|
|
16822
16817
|
function EditorContent({ apiKey }) {
|
|
16823
16818
|
const typo = useTypo();
|
|
16824
|
-
const [isValid, setIsValid] =
|
|
16825
|
-
const [error, setError] =
|
|
16826
|
-
const [versions, setVersions] =
|
|
16827
|
-
const [userVersion, setUserVersion] =
|
|
16828
|
-
const [currentVersionIndex, setCurrentVersionIndex] =
|
|
16819
|
+
const [isValid, setIsValid] = (0, import_react20.useState)(null);
|
|
16820
|
+
const [error, setError] = (0, import_react20.useState)(null);
|
|
16821
|
+
const [versions, setVersions] = (0, import_react20.useState)([]);
|
|
16822
|
+
const [userVersion, setUserVersion] = (0, import_react20.useState)(null);
|
|
16823
|
+
const [currentVersionIndex, setCurrentVersionIndex] = (0, import_react20.useState)(
|
|
16829
16824
|
null
|
|
16830
16825
|
);
|
|
16831
|
-
const wrapperRef =
|
|
16826
|
+
const wrapperRef = (0, import_react20.useRef)(null);
|
|
16832
16827
|
function getApiBaseUrl() {
|
|
16833
|
-
if (typeof
|
|
16834
|
-
return
|
|
16828
|
+
if (typeof import_meta !== "undefined" && import_meta.env?.VITE_TETRONS_API_URL) {
|
|
16829
|
+
return import_meta.env.VITE_TETRONS_API_URL;
|
|
16835
16830
|
}
|
|
16836
|
-
if (typeof process !== "undefined" &&
|
|
16831
|
+
if (typeof process !== "undefined" && process.env?.NEXT_PUBLIC_TETRONS_API_URL) {
|
|
16837
16832
|
return process.env.NEXT_PUBLIC_TETRONS_API_URL;
|
|
16838
16833
|
}
|
|
16839
16834
|
return "https://staging.tetrons.com";
|
|
16840
16835
|
}
|
|
16841
16836
|
const API_BASE_URL = getApiBaseUrl();
|
|
16842
|
-
|
|
16837
|
+
(0, import_react20.useEffect)(() => {
|
|
16843
16838
|
const validateKey = async () => {
|
|
16844
16839
|
try {
|
|
16845
16840
|
const res = await fetch(`${API_BASE_URL}/api/validate`, {
|
|
@@ -16860,7 +16855,7 @@ function EditorContent({ apiKey }) {
|
|
|
16860
16855
|
};
|
|
16861
16856
|
validateKey();
|
|
16862
16857
|
}, [apiKey, API_BASE_URL]);
|
|
16863
|
-
const editor =
|
|
16858
|
+
const editor = (0, import_react21.useEditor)({
|
|
16864
16859
|
extensions: [
|
|
16865
16860
|
Document,
|
|
16866
16861
|
Paragraph,
|
|
@@ -16868,39 +16863,39 @@ function EditorContent({ apiKey }) {
|
|
|
16868
16863
|
History,
|
|
16869
16864
|
Bold,
|
|
16870
16865
|
Italic,
|
|
16871
|
-
|
|
16866
|
+
import_extension_underline.default,
|
|
16872
16867
|
Strike,
|
|
16873
16868
|
Code,
|
|
16874
16869
|
Blockquote,
|
|
16875
16870
|
HardBreak,
|
|
16876
16871
|
Heading.configure({ levels: [1, 2, 3, 4, 5, 6] }),
|
|
16877
16872
|
HorizontalRule,
|
|
16878
|
-
|
|
16879
|
-
|
|
16880
|
-
|
|
16873
|
+
import_extension_text_style.default,
|
|
16874
|
+
import_extension_color.default,
|
|
16875
|
+
import_extension_highlight.default.configure({ multicolor: true }),
|
|
16881
16876
|
FontFamily,
|
|
16882
16877
|
FontSize,
|
|
16883
|
-
|
|
16878
|
+
import_extension_text_align.default.configure({ types: ["heading", "paragraph"] }),
|
|
16884
16879
|
ListItem,
|
|
16885
16880
|
BulletList,
|
|
16886
16881
|
OrderedList,
|
|
16887
16882
|
Subscript,
|
|
16888
16883
|
Superscript,
|
|
16889
|
-
|
|
16890
|
-
|
|
16884
|
+
import_extension_image2.default,
|
|
16885
|
+
import_extension_link.default.configure({
|
|
16891
16886
|
openOnClick: false,
|
|
16892
16887
|
autolink: true,
|
|
16893
16888
|
linkOnPaste: true
|
|
16894
16889
|
}),
|
|
16895
16890
|
ResizableTable.configure({ resizable: true }),
|
|
16896
|
-
|
|
16897
|
-
|
|
16898
|
-
|
|
16891
|
+
import_extension_table_row.default,
|
|
16892
|
+
import_extension_table_cell.default,
|
|
16893
|
+
import_extension_table_header.default,
|
|
16899
16894
|
Embed,
|
|
16900
16895
|
ResizableImage,
|
|
16901
16896
|
ResizableVideo,
|
|
16902
16897
|
Comment,
|
|
16903
|
-
|
|
16898
|
+
import_extension_code_block_lowlight.default.configure({
|
|
16904
16899
|
lowlight,
|
|
16905
16900
|
HTMLAttributes: {
|
|
16906
16901
|
class: "bg-gray-100 p-2 rounded font-mono text-sm overflow-auto"
|
|
@@ -16921,9 +16916,9 @@ function EditorContent({ apiKey }) {
|
|
|
16921
16916
|
},
|
|
16922
16917
|
immediatelyRender: false
|
|
16923
16918
|
});
|
|
16924
|
-
|
|
16919
|
+
(0, import_react20.useEffect)(() => {
|
|
16925
16920
|
return () => {
|
|
16926
|
-
|
|
16921
|
+
editor?.destroy();
|
|
16927
16922
|
};
|
|
16928
16923
|
}, [editor]);
|
|
16929
16924
|
const handleEditorClick = () => {
|
|
@@ -16946,15 +16941,15 @@ function EditorContent({ apiKey }) {
|
|
|
16946
16941
|
}
|
|
16947
16942
|
};
|
|
16948
16943
|
if (isValid === false) {
|
|
16949
|
-
return /* @__PURE__ */
|
|
16944
|
+
return /* @__PURE__ */ import_react20.default.createElement("div", { className: "editor-error" }, "\u26A0\uFE0F ", error);
|
|
16950
16945
|
}
|
|
16951
16946
|
if (isValid === null) {
|
|
16952
|
-
return /* @__PURE__ */
|
|
16947
|
+
return /* @__PURE__ */ import_react20.default.createElement("div", { className: "editor-loading" }, "\u{1F50D} Validating license...");
|
|
16953
16948
|
}
|
|
16954
16949
|
if (!typo) {
|
|
16955
|
-
return /* @__PURE__ */
|
|
16950
|
+
return /* @__PURE__ */ import_react20.default.createElement("div", { className: "editor-loading" }, "\u{1F4D6} Loading dictionary...");
|
|
16956
16951
|
}
|
|
16957
|
-
return /* @__PURE__ */
|
|
16952
|
+
return /* @__PURE__ */ import_react20.default.createElement("div", { className: "editor-container" }, userVersion !== "free" && /* @__PURE__ */ import_react20.default.createElement("div", { className: "editor-toolbar" }, /* @__PURE__ */ import_react20.default.createElement(
|
|
16958
16953
|
"button",
|
|
16959
16954
|
{
|
|
16960
16955
|
type: "button",
|
|
@@ -16963,7 +16958,7 @@ function EditorContent({ apiKey }) {
|
|
|
16963
16958
|
className: "editor-save-btn"
|
|
16964
16959
|
},
|
|
16965
16960
|
"Save Version"
|
|
16966
|
-
), /* @__PURE__ */
|
|
16961
|
+
), /* @__PURE__ */ import_react20.default.createElement("div", { className: "editor-versions-wrapper" }, versions.length === 0 ? /* @__PURE__ */ import_react20.default.createElement("span", { className: "editor-no-versions" }, "No saved versions") : versions.map((_, idx) => /* @__PURE__ */ import_react20.default.createElement(
|
|
16967
16962
|
"button",
|
|
16968
16963
|
{
|
|
16969
16964
|
key: idx,
|
|
@@ -16973,58 +16968,20 @@ function EditorContent({ apiKey }) {
|
|
|
16973
16968
|
title: `Restore Version ${idx + 1}`
|
|
16974
16969
|
},
|
|
16975
16970
|
`V${idx + 1}`
|
|
16976
|
-
)))), editor && userVersion && /* @__PURE__ */
|
|
16971
|
+
)))), editor && userVersion && /* @__PURE__ */ import_react20.default.createElement(TetronsToolbar, { editor, version: userVersion }), /* @__PURE__ */ import_react20.default.createElement(
|
|
16977
16972
|
"div",
|
|
16978
16973
|
{
|
|
16979
16974
|
ref: wrapperRef,
|
|
16980
16975
|
className: "editor-content-wrapper",
|
|
16981
16976
|
onClick: handleEditorClick
|
|
16982
16977
|
},
|
|
16983
|
-
editor ? /* @__PURE__ */
|
|
16978
|
+
editor ? /* @__PURE__ */ import_react20.default.createElement(import_react20.default.Fragment, null, /* @__PURE__ */ import_react20.default.createElement(import_react21.EditorContent, { editor }), /* @__PURE__ */ import_react20.default.createElement(TableContextMenu, { editor })) : /* @__PURE__ */ import_react20.default.createElement("div", { className: "editor-loading" }, "Loading editor...")
|
|
16984
16979
|
));
|
|
16985
16980
|
}
|
|
16986
16981
|
|
|
16987
16982
|
// src/index.ts
|
|
16988
16983
|
var API_VALID = false;
|
|
16989
16984
|
var API_VERSION = "";
|
|
16990
|
-
var isNode = typeof window === "undefined";
|
|
16991
|
-
var validityMap = {
|
|
16992
|
-
free: 14,
|
|
16993
|
-
pro: 30,
|
|
16994
|
-
premium: 30,
|
|
16995
|
-
platinum: 30
|
|
16996
|
-
};
|
|
16997
|
-
function getInstallDateKey() {
|
|
16998
|
-
return "tetrons_installed_at";
|
|
16999
|
-
}
|
|
17000
|
-
async function getOrCreateInstallDate() {
|
|
17001
|
-
const key = getInstallDateKey();
|
|
17002
|
-
if (isNode) {
|
|
17003
|
-
const fs = await Promise.resolve().then(() => _interopRequireWildcard(require("fs")));
|
|
17004
|
-
const path = await Promise.resolve().then(() => _interopRequireWildcard(require("path")));
|
|
17005
|
-
const usagePath = path.join(process.cwd(), ".tetrons-usage.json");
|
|
17006
|
-
if (fs.existsSync(usagePath)) {
|
|
17007
|
-
const data = JSON.parse(fs.readFileSync(usagePath, "utf-8"));
|
|
17008
|
-
return new Date(data.installedAt);
|
|
17009
|
-
}
|
|
17010
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
17011
|
-
fs.writeFileSync(usagePath, JSON.stringify({ installedAt: now }));
|
|
17012
|
-
return new Date(now);
|
|
17013
|
-
} else {
|
|
17014
|
-
const saved = localStorage.getItem(key);
|
|
17015
|
-
if (saved) return new Date(saved);
|
|
17016
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
17017
|
-
localStorage.setItem(key, now);
|
|
17018
|
-
return new Date(now);
|
|
17019
|
-
}
|
|
17020
|
-
}
|
|
17021
|
-
function getRemainingDays(installedAt, validityDays) {
|
|
17022
|
-
const now = /* @__PURE__ */ new Date();
|
|
17023
|
-
const diff = Math.floor(
|
|
17024
|
-
(now.getTime() - installedAt.getTime()) / (1e3 * 60 * 60 * 24)
|
|
17025
|
-
);
|
|
17026
|
-
return validityDays - diff;
|
|
17027
|
-
}
|
|
17028
16985
|
async function initializeTetrons(apiKey) {
|
|
17029
16986
|
const res = await fetch("https://staging.tetrons.com/api/validate", {
|
|
17030
16987
|
method: "POST",
|
|
@@ -17040,21 +16997,6 @@ async function initializeTetrons(apiKey) {
|
|
|
17040
16997
|
const data = await res.json();
|
|
17041
16998
|
API_VALID = data.valid;
|
|
17042
16999
|
API_VERSION = data.version;
|
|
17043
|
-
if (!API_VALID) {
|
|
17044
|
-
throw new Error("API Key is not valid.");
|
|
17045
|
-
}
|
|
17046
|
-
if (API_VERSION === "") {
|
|
17047
|
-
throw new Error("No license version provided.");
|
|
17048
|
-
}
|
|
17049
|
-
const validityDays = validityMap[API_VERSION];
|
|
17050
|
-
const installedAt = await getOrCreateInstallDate();
|
|
17051
|
-
const remainingDays = getRemainingDays(installedAt, validityDays);
|
|
17052
|
-
if (remainingDays <= 0) {
|
|
17053
|
-
throw new Error(`Your ${API_VERSION} license has expired.`);
|
|
17054
|
-
}
|
|
17055
|
-
console.log(
|
|
17056
|
-
`[TETRONS] Initialized: ${API_VERSION} | Remaining days: ${remainingDays}`
|
|
17057
|
-
);
|
|
17058
17000
|
}
|
|
17059
17001
|
function getTetronsVersion() {
|
|
17060
17002
|
return API_VERSION;
|
|
@@ -17062,18 +17004,11 @@ function getTetronsVersion() {
|
|
|
17062
17004
|
function isApiKeyValid() {
|
|
17063
17005
|
return API_VALID;
|
|
17064
17006
|
}
|
|
17065
|
-
async function getTetronsRemainingDays() {
|
|
17066
|
-
if (!API_VALID || API_VERSION === "") return null;
|
|
17067
|
-
const validityDays = validityMap[API_VERSION];
|
|
17068
|
-
const installedAt = await getOrCreateInstallDate();
|
|
17069
|
-
return getRemainingDays(installedAt, validityDays);
|
|
17070
|
-
}
|
|
17071
17007
|
var index_default = EditorContent;
|
|
17072
|
-
|
|
17073
|
-
|
|
17074
|
-
|
|
17075
|
-
|
|
17076
|
-
|
|
17077
|
-
|
|
17078
|
-
|
|
17079
|
-
exports.EditorContent = EditorContent; exports.default = index_default; exports.getTetronsRemainingDays = getTetronsRemainingDays; exports.getTetronsVersion = getTetronsVersion; exports.initializeTetrons = initializeTetrons; exports.isApiKeyValid = isApiKeyValid;
|
|
17008
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
17009
|
+
0 && (module.exports = {
|
|
17010
|
+
EditorContent,
|
|
17011
|
+
getTetronsVersion,
|
|
17012
|
+
initializeTetrons,
|
|
17013
|
+
isApiKeyValid
|
|
17014
|
+
});
|