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 = '';
|
let floatingInputValue = '';
|
||||||
|
|
||||||
const updateButtonPosition = (event) => {
|
const updateButtonPosition = (event) => {
|
||||||
setTimeout(async () => {
|
if (
|
||||||
await tick();
|
!contentContainerElement?.contains(event.target) &&
|
||||||
|
!buttonsContainerElement?.contains(event.target)
|
||||||
// Check if the event target is within the content container
|
) {
|
||||||
if (!contentContainerElement?.contains(event.target)) {
|
|
||||||
closeFloatingButtons();
|
closeFloatingButtons();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setTimeout(async () => {
|
||||||
|
await tick();
|
||||||
|
|
||||||
|
if (!contentContainerElement?.contains(event.target)) return;
|
||||||
|
|
||||||
let selection = window.getSelection();
|
let selection = window.getSelection();
|
||||||
|
|
||||||
if (selection.toString().trim().length > 0) {
|
if (selection.toString().trim().length > 0) {
|
||||||
@ -51,8 +55,9 @@
|
|||||||
// Calculate space available on the right
|
// Calculate space available on the right
|
||||||
const spaceOnRight = parentRect.width - (left + buttonsContainerElement.offsetWidth);
|
const spaceOnRight = parentRect.width - (left + buttonsContainerElement.offsetWidth);
|
||||||
|
|
||||||
if (spaceOnRight < 0) {
|
let thirdScreenWidth = window.innerWidth / 3;
|
||||||
// Not enough space on the right, position using 'right'
|
|
||||||
|
if (spaceOnRight < thirdScreenWidth) {
|
||||||
const right = parentRect.right - rect.right;
|
const right = parentRect.right - rect.right;
|
||||||
buttonsContainerElement.style.right = `${right}px`;
|
buttonsContainerElement.style.right = `${right}px`;
|
||||||
buttonsContainerElement.style.left = 'auto'; // Reset left
|
buttonsContainerElement.style.left = 'auto'; // Reset left
|
||||||
|
Loading…
Reference in New Issue
Block a user