reachat 3.2.0 → 3.2.2

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
@@ -10,7 +10,7 @@
10
10
  console.error("vite-plugin-css-injected-by-js", e);
11
11
  }
12
12
  })();
13
- import { A, b, C, c, d, e, f, g, h, i, j, k, F, M, l, m, n, o, p, q, r, s, t, u, N, R, v, w, x, y, z, B, D, E, G, H, T, I, J, K, L, O, P, Q, U, V, W, X, Y, Z, _, $, a0, a1, a2, a3 } from "./index-iuJAmrEE.js";
13
+ import { A, b, C, c, d, e, f, g, h, i, j, k, F, M, l, m, n, o, p, q, r, s, t, u, N, R, v, w, x, y, z, B, D, E, G, H, T, I, J, K, L, O, P, Q, U, V, W, X, Y, Z, _, $, a0, a1, a2, a3 } from "./index-BiStNXJ4.js";
14
14
  import "react/jsx-runtime";
15
15
  import "react";
16
16
  import "reablocks";
@@ -668,6 +668,7 @@
668
668
  placeholder = "Type a message...",
669
669
  allowMultipleFiles = false,
670
670
  defaultValue,
671
+ className,
671
672
  sendIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgSend, {}),
672
673
  stopIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgStop, {}),
673
674
  attachIcon,
@@ -675,7 +676,8 @@
675
676
  commands,
676
677
  minHeight = 24,
677
678
  maxHeight = 200,
678
- autoFocus = true
679
+ autoFocus = true,
680
+ onMessageChange
679
681
  }, ref) => {
680
682
  const {
681
683
  theme,
@@ -704,6 +706,7 @@
704
706
  setValue: (value) => {
705
707
  setMessage(value);
706
708
  inputRef.current?.setValue(value);
709
+ onMessageChange?.(value);
707
710
  },
708
711
  insertText: (text) => {
709
712
  inputRef.current?.insertText(text);
@@ -726,9 +729,13 @@
726
729
  },
727
730
  [sendMessage]
728
731
  );
729
- const handleChange = React.useCallback((value) => {
730
- setMessage(value);
731
- }, []);
732
+ const handleChange = React.useCallback(
733
+ (value) => {
734
+ setMessage(value);
735
+ onMessageChange?.(value);
736
+ },
737
+ [onMessageChange]
738
+ );
732
739
  const handleFileUpload = (event) => {
733
740
  const files = event.target.files;
734
741
  if (files?.length && fileUpload) {
@@ -743,7 +750,7 @@
743
750
  () => commands ? { ...commands, trigger: commands.trigger || "/" } : void 0,
744
751
  [commands]
745
752
  );
746
- return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: containerRef, className: reablocks.cn(theme.input.base), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: reablocks.cn("relative flex-1", theme.input.input), children: [
753
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: containerRef, className: reablocks.cn(theme.input.base, className), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: reablocks.cn("relative flex-1", theme.input.input), children: [
747
754
  /* @__PURE__ */ jsxRuntime.jsx(
748
755
  RichTextInput,
749
756
  {
@@ -2106,25 +2113,18 @@
2106
2113
  ] });
2107
2114
  };
2108
2115
  const CVE_REGEX = /(CVE-(19|20)\d{2}-\d{4,7})/gi;
2109
- function remarkCve() {
2110
- return (tree, _file) => {
2111
- mdastUtilFindAndReplace.findAndReplace(tree, [[
2116
+ const remarkCve = () => (tree) => {
2117
+ mdastUtilFindAndReplace.findAndReplace(tree, [
2118
+ [
2112
2119
  CVE_REGEX,
2113
- replaceCve
2114
- ]]);
2115
- };
2116
- function replaceCve(value, id) {
2117
- return [
2118
- {
2120
+ (value) => ({
2119
2121
  type: "link",
2120
- url: `https://cve.mitre.org/cgi-bin/cvename.cgi?name=${id}`,
2121
- children: [
2122
- { children: [{ type: "text", value: value.trim() }] }
2123
- ]
2124
- }
2125
- ];
2126
- }
2127
- }
2122
+ url: `https://cve.mitre.org/cgi-bin/cvename.cgi?name=${value.trim()}`,
2123
+ children: [{ type: "text", value: value.trim() }]
2124
+ })
2125
+ ]
2126
+ ]);
2127
+ };
2128
2128
  const remarkComponent = (_options = {}) => {
2129
2129
  return () => {
2130
2130
  };