@copilotkit/react-ui 1.55.2 → 1.55.3-canary.1776243725

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