llmasaservice-ui 0.5.1 → 0.5.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 +13 -2
- package/dist/index.mjs +13 -2
- package/package.json +1 -1
- package/src/ChatPanel.tsx +15 -1
package/dist/index.js
CHANGED
|
@@ -340,8 +340,19 @@ var ChatPanel = ({
|
|
|
340
340
|
navigator.clipboard.writeText(text);
|
|
341
341
|
}
|
|
342
342
|
const scrollToBottom = () => {
|
|
343
|
-
var _a;
|
|
344
|
-
(
|
|
343
|
+
var _a, _b;
|
|
344
|
+
if (window.top !== window.self) {
|
|
345
|
+
(_a = bottomRef.current) == null ? void 0 : _a.scrollIntoView({ behavior: "smooth" });
|
|
346
|
+
const frameElement = window.frameElement;
|
|
347
|
+
if (frameElement) {
|
|
348
|
+
window.parent.scrollTo({
|
|
349
|
+
top: frameElement.getBoundingClientRect().top + window.scrollY,
|
|
350
|
+
behavior: "smooth"
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
} else {
|
|
354
|
+
(_b = bottomRef.current) == null ? void 0 : _b.scrollIntoView({ behavior: "smooth" });
|
|
355
|
+
}
|
|
345
356
|
};
|
|
346
357
|
const CodeBlock = (_a) => {
|
|
347
358
|
var _b = _a, { node, className, children, style } = _b, props = __objRest(_b, ["node", "className", "children", "style"]);
|
package/dist/index.mjs
CHANGED
|
@@ -307,8 +307,19 @@ var ChatPanel = ({
|
|
|
307
307
|
navigator.clipboard.writeText(text);
|
|
308
308
|
}
|
|
309
309
|
const scrollToBottom = () => {
|
|
310
|
-
var _a;
|
|
311
|
-
(
|
|
310
|
+
var _a, _b;
|
|
311
|
+
if (window.top !== window.self) {
|
|
312
|
+
(_a = bottomRef.current) == null ? void 0 : _a.scrollIntoView({ behavior: "smooth" });
|
|
313
|
+
const frameElement = window.frameElement;
|
|
314
|
+
if (frameElement) {
|
|
315
|
+
window.parent.scrollTo({
|
|
316
|
+
top: frameElement.getBoundingClientRect().top + window.scrollY,
|
|
317
|
+
behavior: "smooth"
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
} else {
|
|
321
|
+
(_b = bottomRef.current) == null ? void 0 : _b.scrollIntoView({ behavior: "smooth" });
|
|
322
|
+
}
|
|
312
323
|
};
|
|
313
324
|
const CodeBlock = (_a) => {
|
|
314
325
|
var _b = _a, { node, className, children, style } = _b, props = __objRest(_b, ["node", "className", "children", "style"]);
|
package/package.json
CHANGED
package/src/ChatPanel.tsx
CHANGED
|
@@ -344,7 +344,21 @@ const ChatPanel: React.FC<ChatPanelProps & ExtraProps> = ({
|
|
|
344
344
|
}
|
|
345
345
|
|
|
346
346
|
const scrollToBottom = () => {
|
|
347
|
-
bottomRef.current?.scrollIntoView({ behavior: "smooth" });
|
|
347
|
+
//bottomRef.current?.scrollIntoView({ behavior: "smooth" });
|
|
348
|
+
if (window.top !== window.self) {
|
|
349
|
+
// If the ChatPanel is within an iframe
|
|
350
|
+
bottomRef.current?.scrollIntoView({ behavior: "smooth" });
|
|
351
|
+
const frameElement = window.frameElement;
|
|
352
|
+
if (frameElement) {
|
|
353
|
+
window.parent.scrollTo({
|
|
354
|
+
top: frameElement.getBoundingClientRect().top + window.scrollY,
|
|
355
|
+
behavior: "smooth",
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
} else {
|
|
359
|
+
// If the ChatPanel is not within an iframe
|
|
360
|
+
bottomRef.current?.scrollIntoView({ behavior: "smooth" });
|
|
361
|
+
}
|
|
348
362
|
};
|
|
349
363
|
|
|
350
364
|
const CodeBlock = ({ node, className, children, style, ...props }: any) => {
|