@copilotkit/react-ui 1.55.3 → 1.56.0

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.umd.js CHANGED
@@ -834,11 +834,11 @@ rehype_raw = __toESM(rehype_raw);
834
834
  `@copilotkit/react-textarea@${latestVersion}`,
835
835
  `&& npm install @copilotkit/runtime@${latestVersion}`
836
836
  ].join(" ");
837
- const handleCopyClick = () => {
838
- navigator.clipboard.writeText(installCommand.trim()).then(() => {
837
+ const handleCopyClick = async () => {
838
+ if (await (0, _copilotkit_shared.copyToClipboard)(installCommand.trim())) {
839
839
  setCopyStatus("Command copied to clipboard!");
840
840
  setTimeout(() => setCopyStatus(""), 1e3);
841
- });
841
+ }
842
842
  };
843
843
  if (versionStatus === "update-available" || versionStatus === "outdated") return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
844
844
  className: "copilotKitVersionInfo",
@@ -1336,7 +1336,7 @@ rehype_raw = __toESM(rehype_raw);
1336
1336
  language: match && match[1] || "",
1337
1337
  value: String(children).replace(/\n$/, ""),
1338
1338
  ...props
1339
- }, Math.random());
1339
+ });
1340
1340
  },
1341
1341
  h1: ({ children, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", {
1342
1342
  className: "copilotKitMarkdownElement",
@@ -1368,8 +1368,8 @@ rehype_raw = __toESM(rehype_raw);
1368
1368
  ...props,
1369
1369
  children
1370
1370
  }),
1371
- p: ({ children, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1372
- className: "copilotKitMarkdownElement",
1371
+ p: ({ children, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1372
+ className: "copilotKitMarkdownElement copilotKitParagraph",
1373
1373
  ...props,
1374
1374
  children
1375
1375
  }),
@@ -1417,16 +1417,12 @@ rehype_raw = __toESM(rehype_raw);
1417
1417
  const { icons, labels } = useChatContext();
1418
1418
  const { message, isLoading, onRegenerate, onCopy, onThumbsUp, onThumbsDown, isCurrentMessage, feedback, markdownTagRenderers } = props;
1419
1419
  const [copied, setCopied] = (0, react.useState)(false);
1420
- const handleCopy = () => {
1420
+ const handleCopy = async () => {
1421
1421
  const content = (message === null || message === void 0 ? void 0 : message.content) || "";
1422
- if (content && onCopy) {
1423
- navigator.clipboard.writeText(content);
1424
- setCopied(true);
1425
- onCopy(content);
1426
- setTimeout(() => setCopied(false), 2e3);
1427
- } else if (content) {
1428
- navigator.clipboard.writeText(content);
1422
+ if (!content) return;
1423
+ if (await (0, _copilotkit_shared.copyToClipboard)(content)) {
1429
1424
  setCopied(true);
1425
+ if (onCopy) onCopy(content);
1430
1426
  setTimeout(() => setCopied(false), 2e3);
1431
1427
  }
1432
1428
  };