Added a Send to menu to every chat message and kept restrictions when sending content on (#1124)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-10-28 13:28:30 +01:00
1 parent d06688ca08
commit bf54b8cd0d
73 files changed
+1923 -390

No files matched your search

+77
View File
@@ -338,4 +338,81 @@ window.dropZones = {
list: function () {
return Array.from(document.querySelectorAll('[data-drop-zone-id]'), zone => zone.getAttribute('data-drop-zone-id'))
}
}
// Keeps an open popover inside the window while its content grows or shrinks.
//
// MudBlazor 8.15 places an open popover when it opens, when the window is resized or scrolled, and when the
// component of the popover renders again. It never measures the popover afterward, though. Content which
// unfolds later, such as the unavailable tools of the tool selection or a panel of the data source selection,
// lets the popover grow out of the window until something unrelated places it again. So we place an open
// popover again whenever its size changes, at most once per frame, which keeps it at its anchor during the
// whole animation. Placing a popover may change its size once, when MudBlazor limits its height to the
// window, but placing it again at the same spot changes nothing, so this settles right away.
//
// This relies on window.mudpopoverHelper.placePopoverByNode, which is internal to MudBlazor. It exists in
// 8.15 and 9.2; without it, this does nothing. Check it with every new MudBlazor version.
const popoverResize = (function () {
const resizedPopovers = new Set()
let isPlacementPending = false
const placeResizedPopovers = function () {
isPlacementPending = false
for (const popover of resizedPopovers) {
if (popover.isConnected && popover.classList.contains('mud-popover-open'))
window.mudpopoverHelper?.placePopoverByNode?.(popover)
}
resizedPopovers.clear()
}
const resizeObserver = new ResizeObserver(function (entries) {
for (const entry of entries)
resizedPopovers.add(entry.target)
if (isPlacementPending)
return
isPlacementPending = true
requestAnimationFrame(placeResizedPopovers)
})
// MudBlazor renders the content of every popover as a direct child of the provider:
const observePopover = function (node) {
if (node instanceof Element && node.classList.contains('mud-popover'))
resizeObserver.observe(node)
}
const forgetPopover = function (node) {
if (node instanceof Element)
resizeObserver.unobserve(node)
}
const observeProvider = function () {
const provider = document.querySelector('.mud-popover-provider')
if (!provider)
return false
provider.childNodes.forEach(observePopover)
new MutationObserver(function (mutations) {
for (const mutation of mutations) {
mutation.addedNodes.forEach(observePopover)
mutation.removedNodes.forEach(forgetPopover)
}
}).observe(provider, { childList: true })
return true
}
return { observeProvider: observeProvider }
})()
// The provider appears only once Blazor has rendered the app, so we wait for it, and only for it:
if (!popoverResize.observeProvider()) {
const providerObserver = new MutationObserver(function () {
if (popoverResize.observeProvider())
providerObserver.disconnect()
})
providerObserver.observe(document.body, { childList: true, subtree: true })
}