tetrons 2.3.76 → 2.3.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,9 @@
1
1
  "use client";
2
+ import { MathInline } from "./extensions/MathExtension";
2
3
 
3
4
  import React, { useEffect, useRef, useState } from "react";
4
- import {
5
- useEditor,
6
- EditorContent as TiptapEditorContent,
7
- } from "@tiptap/react";
5
+ import { useEditor, EditorContent as TiptapEditorContent } from "@tiptap/react";
6
+ import type { AddOn } from "./toolbar/TetronsToolbar";
8
7
 
9
8
  import Document from "@tiptap/extension-document";
10
9
  import Paragraph from "@tiptap/extension-paragraph";
@@ -58,6 +57,7 @@ lowlight.register("ts", ts);
58
57
 
59
58
  type EditorContentProps = {
60
59
  apiKey: string;
60
+ addOns?: string[];
61
61
  };
62
62
 
63
63
  export default function EditorContent({ apiKey }: EditorContentProps) {
@@ -75,23 +75,10 @@ export default function EditorContent({ apiKey }: EditorContentProps) {
75
75
 
76
76
  const wrapperRef = useRef<HTMLDivElement>(null);
77
77
 
78
- function getApiBaseUrl(): string {
79
- if (
80
- typeof import.meta !== "undefined" &&
81
- import.meta.env?.VITE_TETRONS_API_URL
82
- ) {
83
- return import.meta.env.VITE_TETRONS_API_URL;
84
- }
85
- if (
86
- typeof process !== "undefined" &&
87
- process.env?.NEXT_PUBLIC_TETRONS_API_URL
88
- ) {
89
- return process.env.NEXT_PUBLIC_TETRONS_API_URL;
90
- }
91
- return "https://staging.tetrons.com";
92
- }
93
-
94
- const API_BASE_URL = getApiBaseUrl();
78
+ const API_BASE_URL =
79
+ typeof process !== "undefined" && process.env?.NEXT_PUBLIC_TETRONS_API_URL
80
+ ? process.env.NEXT_PUBLIC_TETRONS_API_URL
81
+ : "https://staging.tetrons.com";
95
82
 
96
83
  useEffect(() => {
97
84
  const validateKey = async () => {
@@ -171,6 +158,7 @@ export default function EditorContent({ apiKey }: EditorContentProps) {
171
158
  }),
172
159
  ]
173
160
  : []),
161
+ MathInline,
174
162
  ],
175
163
  content: "",
176
164
  editorProps: {
@@ -181,7 +169,7 @@ export default function EditorContent({ apiKey }: EditorContentProps) {
181
169
  },
182
170
  immediatelyRender: false,
183
171
  });
184
-
172
+
185
173
  useEffect(() => {
186
174
  return () => {
187
175
  editor?.destroy();
@@ -222,6 +210,20 @@ export default function EditorContent({ apiKey }: EditorContentProps) {
222
210
  return <div className="editor-loading">📖 Loading dictionary...</div>;
223
211
  }
224
212
 
213
+ const versionAddOnsMap: Record<
214
+ "free" | "pro" | "premium" | "platinum",
215
+ AddOn[]
216
+ > = {
217
+ free: [],
218
+ pro: ["code"],
219
+ premium: ["code", "math"],
220
+ platinum: ["code", "math"],
221
+ };
222
+
223
+ const enabledAddOns = (
224
+ userVersion ? versionAddOnsMap[userVersion] || [] : []
225
+ ) as AddOn[];
226
+
225
227
  return (
226
228
  <div className="editor-container">
227
229
  {userVersion !== "free" && (
@@ -258,7 +260,11 @@ export default function EditorContent({ apiKey }: EditorContentProps) {
258
260
  )}
259
261
 
260
262
  {editor && userVersion && (
261
- <TetronsToolbar editor={editor} version={userVersion} />
263
+ <TetronsToolbar
264
+ editor={editor}
265
+ version={userVersion}
266
+ addOns={enabledAddOns}
267
+ />
262
268
  )}
263
269
 
264
270
  <div
@@ -0,0 +1,205 @@
1
+ SET UTF-8
2
+ TRY esianrtolcdugmphbyfvkwzESIANRTOLCDUGMPHBYFVKWZ'
3
+ ICONV 1
4
+ ICONV ’ '
5
+ NOSUGGEST !
6
+
7
+ # ordinal numbers
8
+ COMPOUNDMIN 1
9
+ # only in compounds: 1th, 2th, 3th
10
+ ONLYINCOMPOUND c
11
+ # compound rules:
12
+ # 1. [0-9]*1[0-9]th (10th, 11th, 12th, 56714th, etc.)
13
+ # 2. [0-9]*[02-9](1st|2nd|3rd|[4-9]th) (21st, 22nd, 123rd, 1234th, etc.)
14
+ COMPOUNDRULE 2
15
+ COMPOUNDRULE n*1t
16
+ COMPOUNDRULE n*mp
17
+ WORDCHARS 0123456789
18
+
19
+ PFX A Y 1
20
+ PFX A 0 re .
21
+
22
+ PFX I Y 1
23
+ PFX I 0 in .
24
+
25
+ PFX U Y 1
26
+ PFX U 0 un .
27
+
28
+ PFX C Y 1
29
+ PFX C 0 de .
30
+
31
+ PFX E Y 1
32
+ PFX E 0 dis .
33
+
34
+ PFX F Y 1
35
+ PFX F 0 con .
36
+
37
+ PFX K Y 1
38
+ PFX K 0 pro .
39
+
40
+ SFX V N 2
41
+ SFX V e ive e
42
+ SFX V 0 ive [^e]
43
+
44
+ SFX N Y 3
45
+ SFX N e ion e
46
+ SFX N y ication y
47
+ SFX N 0 en [^ey]
48
+
49
+ SFX X Y 3
50
+ SFX X e ions e
51
+ SFX X y ications y
52
+ SFX X 0 ens [^ey]
53
+
54
+ SFX H N 2
55
+ SFX H y ieth y
56
+ SFX H 0 th [^y]
57
+
58
+ SFX Y Y 1
59
+ SFX Y 0 ly .
60
+
61
+ SFX G Y 2
62
+ SFX G e ing e
63
+ SFX G 0 ing [^e]
64
+
65
+ SFX J Y 2
66
+ SFX J e ings e
67
+ SFX J 0 ings [^e]
68
+
69
+ SFX D Y 4
70
+ SFX D 0 d e
71
+ SFX D y ied [^aeiou]y
72
+ SFX D 0 ed [^ey]
73
+ SFX D 0 ed [aeiou]y
74
+
75
+ SFX T N 4
76
+ SFX T 0 st e
77
+ SFX T y iest [^aeiou]y
78
+ SFX T 0 est [aeiou]y
79
+ SFX T 0 est [^ey]
80
+
81
+ SFX R Y 4
82
+ SFX R 0 r e
83
+ SFX R y ier [^aeiou]y
84
+ SFX R 0 er [aeiou]y
85
+ SFX R 0 er [^ey]
86
+
87
+ SFX Z Y 4
88
+ SFX Z 0 rs e
89
+ SFX Z y iers [^aeiou]y
90
+ SFX Z 0 ers [aeiou]y
91
+ SFX Z 0 ers [^ey]
92
+
93
+ SFX S Y 4
94
+ SFX S y ies [^aeiou]y
95
+ SFX S 0 s [aeiou]y
96
+ SFX S 0 es [sxzh]
97
+ SFX S 0 s [^sxzhy]
98
+
99
+ SFX P Y 3
100
+ SFX P y iness [^aeiou]y
101
+ SFX P 0 ness [aeiou]y
102
+ SFX P 0 ness [^y]
103
+
104
+ SFX M Y 1
105
+ SFX M 0 's .
106
+
107
+ SFX B Y 3
108
+ SFX B 0 able [^aeiou]
109
+ SFX B 0 able ee
110
+ SFX B e able [^aeiou]e
111
+
112
+ SFX L Y 1
113
+ SFX L 0 ment .
114
+
115
+ REP 90
116
+ REP a ei
117
+ REP ei a
118
+ REP a ey
119
+ REP ey a
120
+ REP ai ie
121
+ REP ie ai
122
+ REP alot a_lot
123
+ REP are air
124
+ REP are ear
125
+ REP are eir
126
+ REP air are
127
+ REP air ere
128
+ REP ere air
129
+ REP ere ear
130
+ REP ere eir
131
+ REP ear are
132
+ REP ear air
133
+ REP ear ere
134
+ REP eir are
135
+ REP eir ere
136
+ REP ch te
137
+ REP te ch
138
+ REP ch ti
139
+ REP ti ch
140
+ REP ch tu
141
+ REP tu ch
142
+ REP ch s
143
+ REP s ch
144
+ REP ch k
145
+ REP k ch
146
+ REP f ph
147
+ REP ph f
148
+ REP gh f
149
+ REP f gh
150
+ REP i igh
151
+ REP igh i
152
+ REP i uy
153
+ REP uy i
154
+ REP i ee
155
+ REP ee i
156
+ REP j di
157
+ REP di j
158
+ REP j gg
159
+ REP gg j
160
+ REP j ge
161
+ REP ge j
162
+ REP s ti
163
+ REP ti s
164
+ REP s ci
165
+ REP ci s
166
+ REP k cc
167
+ REP cc k
168
+ REP k qu
169
+ REP qu k
170
+ REP kw qu
171
+ REP o eau
172
+ REP eau o
173
+ REP o ew
174
+ REP ew o
175
+ REP oo ew
176
+ REP ew oo
177
+ REP ew ui
178
+ REP ui ew
179
+ REP oo ui
180
+ REP ui oo
181
+ REP ew u
182
+ REP u ew
183
+ REP oo u
184
+ REP u oo
185
+ REP u oe
186
+ REP oe u
187
+ REP u ieu
188
+ REP ieu u
189
+ REP ue ew
190
+ REP ew ue
191
+ REP uff ough
192
+ REP oo ieu
193
+ REP ieu oo
194
+ REP ier ear
195
+ REP ear ier
196
+ REP ear air
197
+ REP air ear
198
+ REP w qu
199
+ REP qu w
200
+ REP z ss
201
+ REP ss z
202
+ REP shun tion
203
+ REP shun sion
204
+ REP shun cion
205
+ REP size cise