Add a dropdown for resource selection and adopt it in the 'Image' node (#4543)

* Add a dropdown for resource selection and adopt it in the Image node

* Route every image upload through a new ResourceUpload handler with desktop support and migrate wired 'Image' node inputs

* Show each resource's user count in the resource picker dropdown

* Send a picked resource file to the document that requested it, list every non-font resource in the picker, and link sibling message docs
This commit is contained in:
Keavon Chambers
2026-09-18 18:14:24 -07:00
committed by GitHub
parent cb30348215
commit f90bef159c
34 changed files with 774 additions and 180 deletions
@@ -22,6 +22,11 @@ pub(super) fn handle_desktop_wrapper_message(dispatcher: &mut DesktopWrapperMess
OpenFileDialogContext::Import => {
dispatcher.queue_desktop_wrapper_message(DesktopWrapperMessage::ImportFile { path, content });
}
OpenFileDialogContext::UploadResource => {
let name = path.file_name().map(|name| name.to_string_lossy().to_string());
let message = ResourceUploadMessage::ReceiveUpload { name, data: content.into() };
dispatcher.queue_editor_message(message);
}
},
DesktopWrapperMessage::SaveFileDialogResult { path, context } => match context {
SaveFileDialogContext::Document { document_id, content } => {
@@ -26,6 +26,14 @@ pub(super) fn intercept_frontend_message(dispatcher: &mut DesktopWrapperMessageD
context: OpenFileDialogContext::Import,
});
}
FrontendMessage::TriggerUploadResource { filters } => {
dispatcher.respond(DesktopFrontendMessage::OpenFileDialog {
title: "Select File".to_string(),
filters,
multiple: false,
context: OpenFileDialogContext::UploadResource,
});
}
FrontendMessage::TriggerSaveDocument {
document_id,
name,
+1
View File
@@ -107,6 +107,7 @@ pub enum DesktopWrapperMessage {
pub enum OpenFileDialogContext {
Open,
Import,
UploadResource,
}
pub enum SaveFileDialogContext {