mirror of
https://github.com/open-webui/open-webui
synced 2025-01-18 00:30:51 +00:00
commit
ad7bc624c2
@ -23,15 +23,19 @@
|
||||
let floatingInputValue = '';
|
||||
|
||||
const updateButtonPosition = (event) => {
|
||||
setTimeout(async () => {
|
||||
await tick();
|
||||
|
||||
// Check if the event target is within the content container
|
||||
if (!contentContainerElement?.contains(event.target)) {
|
||||
if (
|
||||
!contentContainerElement?.contains(event.target) &&
|
||||
!buttonsContainerElement?.contains(event.target)
|
||||
) {
|
||||
closeFloatingButtons();
|
||||
return;
|
||||
}
|
||||
|
||||
setTimeout(async () => {
|
||||
await tick();
|
||||
|
||||
if (!contentContainerElement?.contains(event.target)) return;
|
||||
|
||||
let selection = window.getSelection();
|
||||
|
||||
if (selection.toString().trim().length > 0) {
|
||||
@ -51,8 +55,9 @@
|
||||
// Calculate space available on the right
|
||||
const spaceOnRight = parentRect.width - (left + buttonsContainerElement.offsetWidth);
|
||||
|
||||
if (spaceOnRight < 0) {
|
||||
// Not enough space on the right, position using 'right'
|
||||
let thirdScreenWidth = window.innerWidth / 3;
|
||||
|
||||
if (spaceOnRight < thirdScreenWidth) {
|
||||
const right = parentRect.right - rect.right;
|
||||
buttonsContainerElement.style.right = `${right}px`;
|
||||
buttonsContainerElement.style.left = 'auto'; // Reset left
|
||||
|
Loading…
Reference in New Issue
Block a user