diff --git a/app/MindWork AI Studio/Assistants/DocumentAnalysis/DocumentAnalysisAssistant.razor b/app/MindWork AI Studio/Assistants/DocumentAnalysis/DocumentAnalysisAssistant.razor
index ec801e84..64d549a9 100644
--- a/app/MindWork AI Studio/Assistants/DocumentAnalysis/DocumentAnalysisAssistant.razor
+++ b/app/MindWork AI Studio/Assistants/DocumentAnalysis/DocumentAnalysisAssistant.razor
@@ -103,7 +103,7 @@ else
@T("Documents for the analysis")
-
+
diff --git a/app/MindWork AI Studio/Components/AttachDocuments.razor.cs b/app/MindWork AI Studio/Components/AttachDocuments.razor.cs
index b98f86e5..acfc0dd2 100644
--- a/app/MindWork AI Studio/Components/AttachDocuments.razor.cs
+++ b/app/MindWork AI Studio/Components/AttachDocuments.razor.cs
@@ -17,6 +17,18 @@ public partial class AttachDocuments : MSGComponentBase
[Parameter]
public string Name { get; set; } = string.Empty;
+
+ ///
+ /// On which layer to register the drop area. Higher layers have priority over lower layers.
+ ///
+ [Parameter]
+ public int Layer { get; set; }
+
+ ///
+ /// When true, pause catching dropped files. Default is false.
+ ///
+ [Parameter]
+ public bool PauseCatchingDrops { get; set; }
[Parameter]
public HashSet DocumentPaths { get; set; } = [];
@@ -63,6 +75,7 @@ public partial class AttachDocuments : MSGComponentBase
private const Placement TOOLBAR_TOOLTIP_PLACEMENT = Placement.Top;
private static readonly string DROP_FILES_HERE_TEXT = TB("Drop files here to attach them.");
+ private uint numDropAreasAboveThis;
private bool isComponentHovered;
private bool isDraggingOver;
@@ -70,7 +83,10 @@ public partial class AttachDocuments : MSGComponentBase
protected override async Task OnInitializedAsync()
{
- this.ApplyFilters([], [ Event.TAURI_EVENT_RECEIVED ]);
+ this.ApplyFilters([], [ Event.TAURI_EVENT_RECEIVED, Event.REGISTER_FILE_DROP_AREA, Event.UNREGISTER_FILE_DROP_AREA ]);
+
+ // Register this drop area:
+ await this.MessageBus.SendMessage(this, Event.REGISTER_FILE_DROP_AREA, this.Layer);
await base.OnInitializedAsync();
}
@@ -78,7 +94,35 @@ public partial class AttachDocuments : MSGComponentBase
{
switch (triggeredEvent)
{
+ case Event.REGISTER_FILE_DROP_AREA when sendingComponent != this:
+ {
+ if(data is int layer && layer > this.Layer)
+ {
+ this.numDropAreasAboveThis++;
+ this.PauseCatchingDrops = true;
+ }
+
+ break;
+ }
+
+ case Event.UNREGISTER_FILE_DROP_AREA when sendingComponent != this:
+ {
+ if(data is int layer && layer > this.Layer)
+ {
+ if(this.numDropAreasAboveThis > 0)
+ this.numDropAreasAboveThis--;
+
+ if(this.numDropAreasAboveThis is 0)
+ this.PauseCatchingDrops = false;
+ }
+
+ break;
+ }
+
case Event.TAURI_EVENT_RECEIVED when data is TauriEvent { EventType: TauriEventType.FILE_DROP_HOVERED }:
+ if(this.PauseCatchingDrops)
+ return;
+
if(!this.isComponentHovered && !this.CatchAllDocuments)
{
this.Logger.LogDebug("Attach documents component '{Name}' is not hovered, ignoring file drop hovered event.", this.Name);
@@ -91,11 +135,17 @@ public partial class AttachDocuments : MSGComponentBase
break;
case Event.TAURI_EVENT_RECEIVED when data is TauriEvent { EventType: TauriEventType.FILE_DROP_CANCELED }:
+ if(this.PauseCatchingDrops)
+ return;
+
this.isDraggingOver = false;
this.StateHasChanged();
break;
case Event.TAURI_EVENT_RECEIVED when data is TauriEvent { EventType: TauriEventType.WINDOW_NOT_FOCUSED }:
+ if(this.PauseCatchingDrops)
+ return;
+
this.isDraggingOver = false;
this.isComponentHovered = false;
this.ClearDragClass();
@@ -103,6 +153,9 @@ public partial class AttachDocuments : MSGComponentBase
break;
case Event.TAURI_EVENT_RECEIVED when data is TauriEvent { EventType: TauriEventType.FILE_DROP_DROPPED, Payload: var paths }:
+ if(this.PauseCatchingDrops)
+ return;
+
if(!this.isComponentHovered && !this.CatchAllDocuments)
{
this.Logger.LogDebug("Attach documents component '{Name}' is not hovered, ignoring file drop dropped event.", this.Name);
@@ -198,6 +251,9 @@ public partial class AttachDocuments : MSGComponentBase
private void OnMouseEnter(EventArgs _)
{
+ if(this.PauseCatchingDrops)
+ return;
+
this.Logger.LogDebug("Attach documents component '{Name}' is hovered.", this.Name);
this.isComponentHovered = true;
this.SetDragClass();
@@ -206,6 +262,9 @@ public partial class AttachDocuments : MSGComponentBase
private void OnMouseLeave(EventArgs _)
{
+ if(this.PauseCatchingDrops)
+ return;
+
this.Logger.LogDebug("Attach documents component '{Name}' is no longer hovered.", this.Name);
this.isComponentHovered = false;
this.ClearDragClass();
diff --git a/app/MindWork AI Studio/Components/ChatComponent.razor b/app/MindWork AI Studio/Components/ChatComponent.razor
index 6396ba9a..9d8f0072 100644
--- a/app/MindWork AI Studio/Components/ChatComponent.razor
+++ b/app/MindWork AI Studio/Components/ChatComponent.razor
@@ -82,7 +82,7 @@
}
-
+
@if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_AUTOMATICALLY)
{
diff --git a/app/MindWork AI Studio/Dialogs/ChatTemplateDialog.razor b/app/MindWork AI Studio/Dialogs/ChatTemplateDialog.razor
index 4498e41c..0a72ef07 100644
--- a/app/MindWork AI Studio/Dialogs/ChatTemplateDialog.razor
+++ b/app/MindWork AI Studio/Dialogs/ChatTemplateDialog.razor
@@ -86,9 +86,10 @@
diff --git a/app/MindWork AI Studio/Tools/DropLayers.cs b/app/MindWork AI Studio/Tools/DropLayers.cs
new file mode 100644
index 00000000..8f1a370b
--- /dev/null
+++ b/app/MindWork AI Studio/Tools/DropLayers.cs
@@ -0,0 +1,11 @@
+namespace AIStudio.Tools;
+
+public static class DropLayers
+{
+ public const int ROOT = 0;
+
+ public const int PAGES = 10;
+ public const int ASSISTANTS = 20;
+
+ public const int DIALOGS = 100;
+}
\ No newline at end of file
diff --git a/app/MindWork AI Studio/Tools/Event.cs b/app/MindWork AI Studio/Tools/Event.cs
index 9f612f04..0590c5c7 100644
--- a/app/MindWork AI Studio/Tools/Event.cs
+++ b/app/MindWork AI Studio/Tools/Event.cs
@@ -34,6 +34,10 @@ public enum Event
// RAG events:
RAG_AUTO_DATA_SOURCES_SELECTED,
+ // File attachment events:
+ REGISTER_FILE_DROP_AREA,
+ UNREGISTER_FILE_DROP_AREA,
+
// Send events:
SEND_TO_GRAMMAR_SPELLING_ASSISTANT,
SEND_TO_ICON_FINDER_ASSISTANT,