catchup-library-web 1.12.7 → 1.12.9

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/index.js CHANGED
@@ -3648,6 +3648,7 @@ var InputGroup = ({
3648
3648
  useMath
3649
3649
  }) => {
3650
3650
  const textAreaRef = (0, import_react10.useRef)(null);
3651
+ const latexTextAreaRef = (0, import_react10.useRef)(null);
3651
3652
  const [showMathConstructor, setShowMathConstructor] = (0, import_react10.useState)(false);
3652
3653
  const [mathValue, setMathValue] = (0, import_react10.useState)("");
3653
3654
  const mathFieldRef = (0, import_react10.useRef)(null);
@@ -3660,6 +3661,15 @@ var InputGroup = ({
3660
3661
  textAreaRef.current.style.height = `44px`;
3661
3662
  }
3662
3663
  }, [textAreaRef, value]);
3664
+ (0, import_react10.useEffect)(() => {
3665
+ if (!latexTextAreaRef) return;
3666
+ if (!latexTextAreaRef.current) return;
3667
+ if (value) {
3668
+ latexTextAreaRef.current.style.height = `${latexTextAreaRef.current.scrollHeight}px`;
3669
+ } else {
3670
+ latexTextAreaRef.current.style.height = `44px`;
3671
+ }
3672
+ }, [latexTextAreaRef, value]);
3663
3673
  (0, import_react10.useEffect)(() => {
3664
3674
  if (!useMath) return;
3665
3675
  import("mathlive").then(({ MathfieldElement }) => {
@@ -3764,9 +3774,10 @@ var InputGroup = ({
3764
3774
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3765
3775
  "textarea",
3766
3776
  {
3777
+ ref: latexTextAreaRef,
3767
3778
  readOnly: true,
3768
3779
  value: mathValue,
3769
- className: "w-full py-2 px-4 bg-catchup-gray-50 border border-catchup-gray-100 rounded-catchup-large font-mono text-md resize-none focus:outline-none",
3780
+ className: "w-full h-[44px] py-2 px-4 bg-catchup-gray-50 border border-catchup-gray-100 rounded-catchup-large resize-none focus:outline-none",
3770
3781
  placeholder: i18n_default.t("latex_will_appear_here")
3771
3782
  }
3772
3783
  ),
@@ -3774,7 +3785,7 @@ var InputGroup = ({
3774
3785
  "button",
3775
3786
  {
3776
3787
  onClick: handleCopyLatex,
3777
- className: "absolute top-3 right-2 bg-catchup-blue-400 text-white px-3 py-1 rounded-md text-md hover:bg-catchup-blue-500 transition-colors",
3788
+ className: "absolute top-2 right-2 bg-catchup-blue-400 text-white px-3 py-1 rounded-md text-md hover:bg-catchup-blue-500 transition-colors",
3778
3789
  disabled: !mathValue,
3779
3790
  children: i18n_default.t("copy")
3780
3791
  }
package/dist/index.mjs CHANGED
@@ -3447,6 +3447,7 @@ var InputGroup = ({
3447
3447
  useMath
3448
3448
  }) => {
3449
3449
  const textAreaRef = useRef(null);
3450
+ const latexTextAreaRef = useRef(null);
3450
3451
  const [showMathConstructor, setShowMathConstructor] = useState10(false);
3451
3452
  const [mathValue, setMathValue] = useState10("");
3452
3453
  const mathFieldRef = useRef(null);
@@ -3459,6 +3460,15 @@ var InputGroup = ({
3459
3460
  textAreaRef.current.style.height = `44px`;
3460
3461
  }
3461
3462
  }, [textAreaRef, value]);
3463
+ useEffect2(() => {
3464
+ if (!latexTextAreaRef) return;
3465
+ if (!latexTextAreaRef.current) return;
3466
+ if (value) {
3467
+ latexTextAreaRef.current.style.height = `${latexTextAreaRef.current.scrollHeight}px`;
3468
+ } else {
3469
+ latexTextAreaRef.current.style.height = `44px`;
3470
+ }
3471
+ }, [latexTextAreaRef, value]);
3462
3472
  useEffect2(() => {
3463
3473
  if (!useMath) return;
3464
3474
  import("mathlive").then(({ MathfieldElement }) => {
@@ -3563,9 +3573,10 @@ var InputGroup = ({
3563
3573
  /* @__PURE__ */ jsx17(
3564
3574
  "textarea",
3565
3575
  {
3576
+ ref: latexTextAreaRef,
3566
3577
  readOnly: true,
3567
3578
  value: mathValue,
3568
- className: "w-full py-2 px-4 bg-catchup-gray-50 border border-catchup-gray-100 rounded-catchup-large font-mono text-md resize-none focus:outline-none",
3579
+ className: "w-full h-[44px] py-2 px-4 bg-catchup-gray-50 border border-catchup-gray-100 rounded-catchup-large resize-none focus:outline-none",
3569
3580
  placeholder: i18n_default.t("latex_will_appear_here")
3570
3581
  }
3571
3582
  ),
@@ -3573,7 +3584,7 @@ var InputGroup = ({
3573
3584
  "button",
3574
3585
  {
3575
3586
  onClick: handleCopyLatex,
3576
- className: "absolute top-3 right-2 bg-catchup-blue-400 text-white px-3 py-1 rounded-md text-md hover:bg-catchup-blue-500 transition-colors",
3587
+ className: "absolute top-2 right-2 bg-catchup-blue-400 text-white px-3 py-1 rounded-md text-md hover:bg-catchup-blue-500 transition-colors",
3577
3588
  disabled: !mathValue,
3578
3589
  children: i18n_default.t("copy")
3579
3590
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "catchup-library-web",
3
- "version": "1.12.7",
3
+ "version": "1.12.9",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -67,6 +67,7 @@ const InputGroup = ({
67
67
  useMath,
68
68
  }: IInputGroupProps) => {
69
69
  const textAreaRef = useRef<HTMLTextAreaElement>(null);
70
+ const latexTextAreaRef = useRef<HTMLTextAreaElement>(null);
70
71
  const [showMathConstructor, setShowMathConstructor] =
71
72
  useState<boolean>(false);
72
73
  const [mathValue, setMathValue] = useState<string>("");
@@ -82,6 +83,16 @@ const InputGroup = ({
82
83
  }
83
84
  }, [textAreaRef, value]);
84
85
 
86
+ useEffect(() => {
87
+ if (!latexTextAreaRef) return;
88
+ if (!latexTextAreaRef.current) return;
89
+ if (value) {
90
+ latexTextAreaRef.current.style.height = `${latexTextAreaRef.current.scrollHeight}px`;
91
+ } else {
92
+ latexTextAreaRef.current.style.height = `44px`;
93
+ }
94
+ }, [latexTextAreaRef, value]);
95
+
85
96
  useEffect(() => {
86
97
  if (!useMath) return;
87
98
  import("mathlive").then(({ MathfieldElement }) => {
@@ -193,21 +204,21 @@ const InputGroup = ({
193
204
  </div>
194
205
  </div>
195
206
 
196
- {/* LaTeX Output */}
197
207
  <div>
198
208
  <p className="text-md font-semibold pl-2 py-1 text-catchup-gray-400">
199
209
  {i18n.t("latex_output")}
200
210
  </p>
201
211
  <div className="relative">
202
212
  <textarea
213
+ ref={latexTextAreaRef}
203
214
  readOnly
204
215
  value={mathValue}
205
- className="w-full py-2 px-4 bg-catchup-gray-50 border border-catchup-gray-100 rounded-catchup-large font-mono text-md resize-none focus:outline-none"
216
+ className="w-full h-[44px] py-2 px-4 bg-catchup-gray-50 border border-catchup-gray-100 rounded-catchup-large resize-none focus:outline-none"
206
217
  placeholder={i18n.t("latex_will_appear_here")}
207
218
  />
208
219
  <button
209
220
  onClick={handleCopyLatex}
210
- className="absolute top-3 right-2 bg-catchup-blue-400 text-white px-3 py-1 rounded-md text-md hover:bg-catchup-blue-500 transition-colors"
221
+ className="absolute top-2 right-2 bg-catchup-blue-400 text-white px-3 py-1 rounded-md text-md hover:bg-catchup-blue-500 transition-colors"
211
222
  disabled={!mathValue}
212
223
  >
213
224
  {i18n.t("copy")}
@@ -215,22 +226,6 @@ const InputGroup = ({
215
226
  </div>
216
227
  </div>
217
228
  </div>
218
-
219
- {/* Footer */}
220
- {/* <div className="flex justify-end gap-3 p-6 border-t border-catchup-gray-100">
221
- <SecondaryButton
222
- title={i18n.t("cancel")}
223
- size="large"
224
- onClick={() => {
225
- setShowMathConstructor(false);
226
- }}
227
- />
228
- <PrimaryButton
229
- title={i18n.t("insert_latex")}
230
- size="large"
231
- onClick={handleInsertLatex}
232
- />
233
- </div> */}
234
229
  </div>
235
230
  </FullCard>
236
231
  </BaseModal>