catchup-library-web 1.12.8 → 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 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
  ),
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 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
  ),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "catchup-library-web",
3
- "version": "1.12.8",
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 }) => {
@@ -199,9 +210,10 @@ const InputGroup = ({
199
210
  </p>
200
211
  <div className="relative">
201
212
  <textarea
213
+ ref={latexTextAreaRef}
202
214
  readOnly
203
215
  value={mathValue}
204
- className="w-full py-2 px-4 bg-catchup-gray-50 border border-catchup-gray-100 rounded-catchup-large 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"
205
217
  placeholder={i18n.t("latex_will_appear_here")}
206
218
  />
207
219
  <button