From 6d412571c7c53b3ef7ce6b28326e5e4e8d8b88a5 Mon Sep 17 00:00:00 2001 From: VimYoung Date: Thu, 3 Sep 2026 16:38:35 +0530 Subject: [PATCH 1/7] Broken: Basic Skeleton of DataFlow in a request --- .../clipboard/clipboard_message_handler.rs | 25 +++++++++++++------ .../messages/portfolio/portfolio_message.rs | 3 +++ .../portfolio/portfolio_message_handler.rs | 6 ++++- editor/src/node_graph_executor.rs | 5 ++++ editor/src/node_graph_executor/runtime.rs | 5 ++++ package-lock.json | 6 +++++ 6 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 package-lock.json diff --git a/editor/src/messages/clipboard/clipboard_message_handler.rs b/editor/src/messages/clipboard/clipboard_message_handler.rs index 73b72b7d6e..e50888355d 100644 --- a/editor/src/messages/clipboard/clipboard_message_handler.rs +++ b/editor/src/messages/clipboard/clipboard_message_handler.rs @@ -80,23 +80,31 @@ impl MessageHandler> for Clipboard } } ClipboardMessage::Write { content } => { - let text = match content { + match content { ClipboardContent::Svg(_) => { log::error!("SVG copying is not yet supported"); - return; + // Need to fix this. } ClipboardContent::Image { .. } => { log::error!("Image copying is not yet supported"); - return; } - ClipboardContent::Graphite(graphite) => format!("{CLIPBOARD_PREFIX}{graphite}"), - ClipboardContent::Text(text) => text, - }; - responses.add(FrontendMessage::TriggerClipboardWrite { content: text }); + // THis is where the text/json is getting copied from + // Idea is to rather than copy it only as text, I want to + // move it to the node to get the svg preview and trhen from + // there send both the data as a single write item. + ClipboardContent::Graphite(graphite) => { + let graphite_json = format!("{CLIPBOARD_PREFIX}{graphite}"); + responses.add(PortfolioMessage::RequestSvgTextCopy { graphite_json }); + } + ClipboardContent::Text(text) => { + responses.add(FrontendMessage::TriggerClipboardWrite { content: text }); + } + } } ClipboardMessage::CopyLayers => { if current_tool == &ToolType::Path { + log::debug!("Copying some path"); responses.add(PathToolMessage::Copy); return; } @@ -109,6 +117,7 @@ impl MessageHandler> for Clipboard responses.add(NodeGraphMessage::Copy); return; } + debug!("Copying something else"); let mut buffer = Vec::new(); @@ -209,12 +218,14 @@ impl MessageHandler> for Clipboard } if bytes_to_load.is_empty() { + log::debug!("Bytes to load are empty"); let mut items = items; items.extend(resources.into_iter().map(ClipboardItem::Resource)); if let Some(content) = serialize_clipboard(&items) { responses.add(ClipboardMessage::Write { content }); } } else { + log::debug!("Not empty instance of bytes"); // Load the embedded bytes from the resource storage, then write let load_handle = resource_storage.resources(); responses.add(async move { diff --git a/editor/src/messages/portfolio/portfolio_message.rs b/editor/src/messages/portfolio/portfolio_message.rs index 8edca5950d..6378508a78 100644 --- a/editor/src/messages/portfolio/portfolio_message.rs +++ b/editor/src/messages/portfolio/portfolio_message.rs @@ -219,6 +219,9 @@ pub enum PortfolioMessage { /// New sizes for the children at that split node. sizes: Vec, }, + RequestSvgTextCopy { + graphite_json: String, + }, } /// Clone helper for the non-serializable `gdd` payload: a cloned mount message carries no `Gdd`. diff --git a/editor/src/messages/portfolio/portfolio_message_handler.rs b/editor/src/messages/portfolio/portfolio_message_handler.rs index 847662e4f0..f23d721139 100644 --- a/editor/src/messages/portfolio/portfolio_message_handler.rs +++ b/editor/src/messages/portfolio/portfolio_message_handler.rs @@ -198,7 +198,8 @@ impl MessageHandler> for Portfolio } } - responses.add(PortfolioMessage::GarbageCollectResources); + // responses.add(PortfolioMessage::GarbageCollectResources); + // } PortfolioMessage::AutoSaveDocument { document_id } => { let validate = preferences.validate_storage_round_trip; @@ -1689,6 +1690,9 @@ impl MessageHandler> for Portfolio responses.add(PortfolioMessage::RequestWelcomeScreenButtonsLayout); } } + PortfolioMessage::RequestSvgTextCopy { graphite_json } => { + self.executor.copy_svg_clipboard(graphite_json); + } } } diff --git a/editor/src/node_graph_executor.rs b/editor/src/node_graph_executor.rs index a7a9abf6eb..c8b5f2dd9d 100644 --- a/editor/src/node_graph_executor.rs +++ b/editor/src/node_graph_executor.rs @@ -812,6 +812,11 @@ impl NodeGraphExecutor { Ok(()) } + + pub fn copy_svg_clipboard(&self, graphite_json: String) { + // TODO: See if to propagat ethe error here or move it up. + self.runtime_io.send(GraphRuntimeRequest::CopySvgTextClipboard(graphite_json)); + } } // TODO: Eventually remove this document upgrade code diff --git a/editor/src/node_graph_executor/runtime.rs b/editor/src/node_graph_executor/runtime.rs index 8ce1ccea57..308dc7ffe2 100644 --- a/editor/src/node_graph_executor/runtime.rs +++ b/editor/src/node_graph_executor/runtime.rs @@ -70,6 +70,7 @@ pub enum GraphRuntimeRequest { GraphUpdate(GraphUpdate), ExecutionRequest(ExecutionRequest), EditorPreferencesUpdate(EditorPreferences), + CopySvgTextClipboard(String), } #[derive(Debug, serde::Serialize, serde::Deserialize)] @@ -182,6 +183,7 @@ impl NodeRuntime { } } GraphRuntimeRequest::EditorPreferencesUpdate(_) => preferences = Some(request), + GraphRuntimeRequest::CopySvgTextClipboard(_) => todo!(), } } @@ -340,6 +342,9 @@ impl NodeRuntime { }); return texture; } + GraphRuntimeRequest::CopySvgTextClipboard(_) => { + todo!(); + } } } None diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000000..cabb54e6f1 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "Graphite", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} From 2581e7d575ef3c4c23af098552088cbc9a3acf71 Mon Sep 17 00:00:00 2001 From: VimYoung Date: Sun, 6 Sep 2026 10:37:47 +0530 Subject: [PATCH 2/7] Broken: Added selected nodes data flow across runtime --- editor/src/messages/portfolio/portfolio_message_handler.rs | 7 ++++++- editor/src/node_graph_executor.rs | 6 +++--- editor/src/node_graph_executor/runtime.rs | 4 ++++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/editor/src/messages/portfolio/portfolio_message_handler.rs b/editor/src/messages/portfolio/portfolio_message_handler.rs index f23d721139..52b033727f 100644 --- a/editor/src/messages/portfolio/portfolio_message_handler.rs +++ b/editor/src/messages/portfolio/portfolio_message_handler.rs @@ -1691,7 +1691,12 @@ impl MessageHandler> for Portfolio } } PortfolioMessage::RequestSvgTextCopy { graphite_json } => { - self.executor.copy_svg_clipboard(graphite_json); + if let Some(active_document) = self.active_document() { + let selected_nodes: Vec = active_document.network_interface.shallowest_unique_layers(&[]).map(|layer| layer.to_node()).collect(); + self.executor.copy_svg_clipboard(graphite_json, selected_nodes); + } else { + self.executor.copy_svg_clipboard(graphite_json, Vec::new()); + } } } } diff --git a/editor/src/node_graph_executor.rs b/editor/src/node_graph_executor.rs index c8b5f2dd9d..c672aaa550 100644 --- a/editor/src/node_graph_executor.rs +++ b/editor/src/node_graph_executor.rs @@ -52,6 +52,7 @@ pub enum NodeGraphUpdate { CompilationResponse(CompilationResponse), EyedropperPreview(Raster), NodeGraphUpdateMessage(NodeGraphUpdateMessage), + SvgTextCopyClipboard(String, String), } #[derive(Debug, Default)] @@ -813,9 +814,8 @@ impl NodeGraphExecutor { Ok(()) } - pub fn copy_svg_clipboard(&self, graphite_json: String) { - // TODO: See if to propagat ethe error here or move it up. - self.runtime_io.send(GraphRuntimeRequest::CopySvgTextClipboard(graphite_json)); + pub fn copy_svg_clipboard(&self, graphite_json: String, selected_nodes: Vec) { + self.runtime_io.send(GraphRuntimeRequest::CopySvgTextClipboard(graphite_json, selected_nodes)); } } diff --git a/editor/src/node_graph_executor/runtime.rs b/editor/src/node_graph_executor/runtime.rs index 308dc7ffe2..055f2ea05a 100644 --- a/editor/src/node_graph_executor/runtime.rs +++ b/editor/src/node_graph_executor/runtime.rs @@ -109,6 +109,10 @@ impl InternalNodeGraphUpdateSender { fn send_eyedropper_preview(&self, raster: Raster) { self.0.send(NodeGraphUpdate::EyedropperPreview(raster)).expect("Failed to send response") } + + fn send_svg_text_clipboard(&self, svg_string: String, text_string: String) { + self.0.send(NodeGraphUpdate::SvgTextCopyClipboard(svg_string, text_string)).expect("Failed to send response") + } } impl NodeGraphUpdateSender for InternalNodeGraphUpdateSender { From b897e65e6c86c03c2f7be40d713e1411570920e3 Mon Sep 17 00:00:00 2001 From: VimYoung Date: Sun, 6 Sep 2026 10:38:22 +0530 Subject: [PATCH 3/7] Fix: Extraction of nodes into svg and sending message --- editor/src/node_graph_executor/runtime.rs | 126 ++++++++++++++++++++-- 1 file changed, 120 insertions(+), 6 deletions(-) diff --git a/editor/src/node_graph_executor/runtime.rs b/editor/src/node_graph_executor/runtime.rs index 055f2ea05a..72258f2543 100644 --- a/editor/src/node_graph_executor/runtime.rs +++ b/editor/src/node_graph_executor/runtime.rs @@ -70,7 +70,7 @@ pub enum GraphRuntimeRequest { GraphUpdate(GraphUpdate), ExecutionRequest(ExecutionRequest), EditorPreferencesUpdate(EditorPreferences), - CopySvgTextClipboard(String), + CopySvgTextClipboard(String, Vec), } #[derive(Debug, serde::Serialize, serde::Deserialize)] @@ -167,6 +167,7 @@ impl NodeRuntime { let mut graph = None; let mut eyedropper = None; let mut execution = None; + let mut svg_clipboard = None; for request in self.receiver.try_iter() { match request { GraphRuntimeRequest::GraphUpdate(_) => graph = Some(request), @@ -187,7 +188,7 @@ impl NodeRuntime { } } GraphRuntimeRequest::EditorPreferencesUpdate(_) => preferences = Some(request), - GraphRuntimeRequest::CopySvgTextClipboard(_) => todo!(), + GraphRuntimeRequest::CopySvgTextClipboard(..) => svg_clipboard = Some(request), } } @@ -199,7 +200,7 @@ impl NodeRuntime { eyedropper.render_config.pointer = execution.render_config.pointer; } - let requests = [preferences, graph, eyedropper, execution].into_iter().flatten(); + let requests = [preferences, graph, eyedropper, execution, svg_clipboard].into_iter().flatten(); for request in requests { match request { @@ -346,9 +347,91 @@ impl NodeRuntime { }); return texture; } - GraphRuntimeRequest::CopySvgTextClipboard(_) => { - todo!(); - } + GraphRuntimeRequest::CopySvgTextClipboard(text_string_clipboard, selected_node_ids) => { + let mut combined_graphics = List::::new(); + + for monitor_node_path in &self.monitor_nodes { + // Skip inspect monitor node if active + if self.inspect_state.as_ref().is_some_and(|state| monitor_node_path.last().copied() == Some(state.monitor_node)) { + continue; + } + + let Some(parent_network_node_id) = monitor_node_path.len().checked_sub(2).and_then(|index| monitor_node_path.get(index)).copied() else { + continue; + }; + + if selected_node_ids.contains(&parent_network_node_id) { + // Introspect using the full monitor node path + if let Ok(introspected_data) = self.executor.introspect(monitor_node_path) { + if let Some(io) = introspected_data.downcast_ref::>>() { + combined_graphics.extend(io.output.clone()); + } else if let Some(io) = introspected_data.downcast_ref::>>() { + combined_graphics.push(io.output.clone()); + } + } + } + } + + if combined_graphics.is_empty() { + self.sender.send_svg_text_clipboard(String::new(), text_string_clipboard); + return None; + } + + let bounds = graphene_std::renderer::graphic_list_bounding_box(&combined_graphics, DAffine2::IDENTITY); + let raw_bounds = match bounds { + RenderBoundingBox::Rectangle(bounds) if (bounds[1] - bounds[0]) != DVec2::ZERO => bounds, + _ => [DVec2::ZERO, DVec2::ONE], + }; + + let footprint = Footprint { + transform: DAffine2::from_translation(DVec2::new(raw_bounds[0].x, raw_bounds[0].y)), + resolution: UVec2::new((raw_bounds[1].x - raw_bounds[0].x).abs().ceil() as u32, (raw_bounds[1].y - raw_bounds[0].y).abs().ceil() as u32).max(UVec2::ONE), + quality: RenderQuality::Full, + }; + + let render_params = RenderParams { + footprint, + thumbnail: false, + ..Default::default() + }; + let mut render = SvgRender::new(); + combined_graphics.render_svg(&mut render, &render_params); + render.format_svg(raw_bounds[0], raw_bounds[1]); + + self.sender.send_svg_text_clipboard(render.svg.to_svg_string(), text_string_clipboard); + } // // self.thumbnail_renders.retain(|id, _| self.monitor_nodes.iter().any(|monitor_node_path| monitor_node_path.contains(id))); + // // let mut uninspected_nodes = Vec::new(); + // // for monitor_node_path in &self.monitor_nodes { + // // if !self + // // .inspect_state + // // .as_ref() + // // .is_some_and(|inspect_state| monitor_node_path.last().copied() == Some(inspect_state.monitor_node)) + // // { + // // uninspected_nodes.push(monitor_node_path); + // // } + // // } + // for node in self.monitor_nodes.iter().flatten() { + // if selected_node_ids.contains(node) {} + // } + // for monitor_node_path in &self.monitor_nodes { + // // The monitor nodes are located within a document node, and are thus children in that network, so this gets the parent document node's ID + // let Some(parent_network_node_id) = monitor_node_path.len().checked_sub(2).and_then(|index| monitor_node_path.get(index)).copied() else { + // warn!("Monitor node has invalid node id"); + // continue; + // }; + // // Extract the monitor node's stored `Graphic` data + // let Ok(introspected_data) = self.executor.introspect(monitor_node_path) else { + // // TODO: Fix the root of the issue causing the spam of this warning (this at least temporarily disables it in release builds) + // #[cfg(debug_assertions)] + // warn!("Failed to introspect monitor node {}", self.executor.introspect(monitor_node_path).unwrap_err()); + // continue; + // }; + // if let Some(io) = introspected_data.downcast_ref::>>() { + // let bounds = graphene_std::renderer::graphic_list_bounding_box(&io.output, DAffine2::IDENTITY); + // self.svg_clipboard_produce(text_string_clipboard, &io.output, bounds); + // } + // } + // } } } None @@ -538,6 +621,37 @@ impl NodeRuntime { *old_thumbnail_svg = new_thumbnail_svg; } } + + fn svg_clipboard_produce(&self, text_string_clipboard: String, graphic: &impl Render, bounds: RenderBoundingBox) { + let raw_bounds = match bounds { + RenderBoundingBox::Rectangle(bounds) if (bounds[1] - bounds[0]) != DVec2::ZERO => bounds, + _ => [DVec2::ZERO, DVec2::ONE], + }; + let bounds = expand_to_thumbnail_aspect(raw_bounds); + let new_thumbnail_svg = { + let footprint = Footprint { + transform: DAffine2::from_translation(DVec2::new(bounds[0].x, bounds[0].y)), + resolution: UVec2::new((bounds[1].x - bounds[0].x).abs() as u32, (bounds[1].y - bounds[0].y).abs() as u32), + quality: RenderQuality::Full, + }; + + // Render the thumbnail from a `Graphic` into an SVG string + let render_params = RenderParams { + footprint, + thumbnail: true, + ..Default::default() + }; + let mut render = SvgRender::new(); + graphic.render_svg(&mut render, &render_params); + + // And give the SVG a viewbox and outer ... wrapper tag + render.format_svg(bounds[0], bounds[1]); + + render.svg + }; + + self.sender.send_svg_text_clipboard(new_thumbnail_svg.to_svg_string(), text_string_clipboard); + } } /// Returns the union of the artboards' clipping rectangles, used as the thumbnail bounds for an artboard layer so the From eedb39ecb76b962ebd9e00eed70ba4fb9d814331 Mon Sep 17 00:00:00 2001 From: VimYoung Date: Sun, 6 Sep 2026 12:07:20 +0530 Subject: [PATCH 4/7] Fix: Removed comments and unused fn --- editor/src/node_graph_executor/runtime.rs | 65 +---------------------- 1 file changed, 1 insertion(+), 64 deletions(-) diff --git a/editor/src/node_graph_executor/runtime.rs b/editor/src/node_graph_executor/runtime.rs index 72258f2543..cf32b9d8e0 100644 --- a/editor/src/node_graph_executor/runtime.rs +++ b/editor/src/node_graph_executor/runtime.rs @@ -399,39 +399,7 @@ impl NodeRuntime { render.format_svg(raw_bounds[0], raw_bounds[1]); self.sender.send_svg_text_clipboard(render.svg.to_svg_string(), text_string_clipboard); - } // // self.thumbnail_renders.retain(|id, _| self.monitor_nodes.iter().any(|monitor_node_path| monitor_node_path.contains(id))); - // // let mut uninspected_nodes = Vec::new(); - // // for monitor_node_path in &self.monitor_nodes { - // // if !self - // // .inspect_state - // // .as_ref() - // // .is_some_and(|inspect_state| monitor_node_path.last().copied() == Some(inspect_state.monitor_node)) - // // { - // // uninspected_nodes.push(monitor_node_path); - // // } - // // } - // for node in self.monitor_nodes.iter().flatten() { - // if selected_node_ids.contains(node) {} - // } - // for monitor_node_path in &self.monitor_nodes { - // // The monitor nodes are located within a document node, and are thus children in that network, so this gets the parent document node's ID - // let Some(parent_network_node_id) = monitor_node_path.len().checked_sub(2).and_then(|index| monitor_node_path.get(index)).copied() else { - // warn!("Monitor node has invalid node id"); - // continue; - // }; - // // Extract the monitor node's stored `Graphic` data - // let Ok(introspected_data) = self.executor.introspect(monitor_node_path) else { - // // TODO: Fix the root of the issue causing the spam of this warning (this at least temporarily disables it in release builds) - // #[cfg(debug_assertions)] - // warn!("Failed to introspect monitor node {}", self.executor.introspect(monitor_node_path).unwrap_err()); - // continue; - // }; - // if let Some(io) = introspected_data.downcast_ref::>>() { - // let bounds = graphene_std::renderer::graphic_list_bounding_box(&io.output, DAffine2::IDENTITY); - // self.svg_clipboard_produce(text_string_clipboard, &io.output, bounds); - // } - // } - // } + } } } None @@ -621,37 +589,6 @@ impl NodeRuntime { *old_thumbnail_svg = new_thumbnail_svg; } } - - fn svg_clipboard_produce(&self, text_string_clipboard: String, graphic: &impl Render, bounds: RenderBoundingBox) { - let raw_bounds = match bounds { - RenderBoundingBox::Rectangle(bounds) if (bounds[1] - bounds[0]) != DVec2::ZERO => bounds, - _ => [DVec2::ZERO, DVec2::ONE], - }; - let bounds = expand_to_thumbnail_aspect(raw_bounds); - let new_thumbnail_svg = { - let footprint = Footprint { - transform: DAffine2::from_translation(DVec2::new(bounds[0].x, bounds[0].y)), - resolution: UVec2::new((bounds[1].x - bounds[0].x).abs() as u32, (bounds[1].y - bounds[0].y).abs() as u32), - quality: RenderQuality::Full, - }; - - // Render the thumbnail from a `Graphic` into an SVG string - let render_params = RenderParams { - footprint, - thumbnail: true, - ..Default::default() - }; - let mut render = SvgRender::new(); - graphic.render_svg(&mut render, &render_params); - - // And give the SVG a viewbox and outer ... wrapper tag - render.format_svg(bounds[0], bounds[1]); - - render.svg - }; - - self.sender.send_svg_text_clipboard(new_thumbnail_svg.to_svg_string(), text_string_clipboard); - } } /// Returns the union of the artboards' clipping rectangles, used as the thumbnail bounds for an artboard layer so the From 32fbb6481308f67dccd06a34c1a25b909cfc4dda Mon Sep 17 00:00:00 2001 From: VimYoung Date: Sun, 6 Sep 2026 13:41:21 +0530 Subject: [PATCH 5/7] Add: First support of svg compatible copy pasting --- editor/src/messages/frontend/frontend_message.rs | 4 ++++ editor/src/node_graph_executor.rs | 8 +++++++- frontend/src/managers/clipboard.ts | 15 +++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/editor/src/messages/frontend/frontend_message.rs b/editor/src/messages/frontend/frontend_message.rs index 29daaa269b..1336320e49 100644 --- a/editor/src/messages/frontend/frontend_message.rs +++ b/editor/src/messages/frontend/frontend_message.rs @@ -153,6 +153,10 @@ pub enum FrontendMessage { TriggerClipboardWrite { content: String, }, + TriggerClipboardSvgWrite { + svg_string: String, + graphite_json: String, + }, TriggerSelectionRead { cut: bool, }, diff --git a/editor/src/node_graph_executor.rs b/editor/src/node_graph_executor.rs index c672aaa550..ea78e38ed9 100644 --- a/editor/src/node_graph_executor.rs +++ b/editor/src/node_graph_executor.rs @@ -467,6 +467,10 @@ impl NodeGraphExecutor { responses.add(EyedropperToolMessage::PreviewImage { data, width, height }); } NodeGraphUpdate::NodeGraphUpdateMessage(_) => {} + NodeGraphUpdate::SvgTextCopyClipboard(svg_string, graphite_json) => { + debug!("svg: {}", svg_string); + responses.add(FrontendMessage::TriggerClipboardSvgWrite { svg_string, graphite_json }); + } } } @@ -815,7 +819,9 @@ impl NodeGraphExecutor { } pub fn copy_svg_clipboard(&self, graphite_json: String, selected_nodes: Vec) { - self.runtime_io.send(GraphRuntimeRequest::CopySvgTextClipboard(graphite_json, selected_nodes)); + self.runtime_io + .send(GraphRuntimeRequest::CopySvgTextClipboard(graphite_json, selected_nodes)) + .expect("Failed to send runtime request"); } } diff --git a/frontend/src/managers/clipboard.ts b/frontend/src/managers/clipboard.ts index 54dcda5eb2..60ccecb145 100644 --- a/frontend/src/managers/clipboard.ts +++ b/frontend/src/managers/clipboard.ts @@ -23,6 +23,20 @@ export function createClipboardManager(subscriptions: SubscriptionsRouter, edito subscriptions.subscribeFrontendMessage("TriggerSelectionWrite", async (data) => { insertAtCaret(data.content); }); + + subscriptions.subscribeFrontendMessage("TriggerClipboardSvgWrite", (data) => { + // Adopted from https://developer.mozilla.org/en-US/docs/Web/API/ClipboardItem#browser_compatibility + if (ClipboardItem.supports("image/svg+xml")) { + navigator.clipboard?.write?.([ + new ClipboardItem({ + "image/svg+xml": data.svg_string, + "text/plain": data.graphite_json, + }), + ]); + } else { + navigator.clipboard?.writeText?.(data.graphite_json); + } + }); } export function destroyClipboardManager() { @@ -30,6 +44,7 @@ export function destroyClipboardManager() { if (!subscriptions) return; subscriptions.unsubscribeFrontendMessage("TriggerClipboardWrite"); + subscriptions.unsubscribeFrontendMessage("TriggerClipboardSvgWrite"); subscriptions.unsubscribeFrontendMessage("TriggerSelectionRead"); subscriptions.unsubscribeFrontendMessage("TriggerSelectionWrite"); } From a3dabc09627e379c0e736e335e60cd5eca93a202 Mon Sep 17 00:00:00 2001 From: VimYoung Date: Sun, 6 Sep 2026 14:52:23 +0530 Subject: [PATCH 6/7] Fix: Desktop copy intercept fix and unnecessary edits removal --- desktop/wrapper/src/intercept_frontend_message.rs | 3 +++ .../src/messages/clipboard/clipboard_message_handler.rs | 8 -------- .../src/messages/portfolio/portfolio_message_handler.rs | 3 +-- editor/src/node_graph_executor.rs | 1 - 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/desktop/wrapper/src/intercept_frontend_message.rs b/desktop/wrapper/src/intercept_frontend_message.rs index 6d13e4bc4c..c215507767 100644 --- a/desktop/wrapper/src/intercept_frontend_message.rs +++ b/desktop/wrapper/src/intercept_frontend_message.rs @@ -119,6 +119,9 @@ pub(super) fn intercept_frontend_message(dispatcher: &mut DesktopWrapperMessageD FrontendMessage::TriggerClipboardWrite { content } => { dispatcher.respond(DesktopFrontendMessage::ClipboardWrite { content }); } + FrontendMessage::TriggerClipboardSvgWrite { graphite_json, .. } => { + dispatcher.respond(DesktopFrontendMessage::ClipboardWrite { content: graphite_json }); + } FrontendMessage::WindowPointerLock => { dispatcher.respond(DesktopFrontendMessage::PointerLock); } diff --git a/editor/src/messages/clipboard/clipboard_message_handler.rs b/editor/src/messages/clipboard/clipboard_message_handler.rs index e50888355d..c8ba8544cd 100644 --- a/editor/src/messages/clipboard/clipboard_message_handler.rs +++ b/editor/src/messages/clipboard/clipboard_message_handler.rs @@ -88,10 +88,6 @@ impl MessageHandler> for Clipboard ClipboardContent::Image { .. } => { log::error!("Image copying is not yet supported"); } - // THis is where the text/json is getting copied from - // Idea is to rather than copy it only as text, I want to - // move it to the node to get the svg preview and trhen from - // there send both the data as a single write item. ClipboardContent::Graphite(graphite) => { let graphite_json = format!("{CLIPBOARD_PREFIX}{graphite}"); responses.add(PortfolioMessage::RequestSvgTextCopy { graphite_json }); @@ -104,7 +100,6 @@ impl MessageHandler> for Clipboard ClipboardMessage::CopyLayers => { if current_tool == &ToolType::Path { - log::debug!("Copying some path"); responses.add(PathToolMessage::Copy); return; } @@ -117,7 +112,6 @@ impl MessageHandler> for Clipboard responses.add(NodeGraphMessage::Copy); return; } - debug!("Copying something else"); let mut buffer = Vec::new(); @@ -218,14 +212,12 @@ impl MessageHandler> for Clipboard } if bytes_to_load.is_empty() { - log::debug!("Bytes to load are empty"); let mut items = items; items.extend(resources.into_iter().map(ClipboardItem::Resource)); if let Some(content) = serialize_clipboard(&items) { responses.add(ClipboardMessage::Write { content }); } } else { - log::debug!("Not empty instance of bytes"); // Load the embedded bytes from the resource storage, then write let load_handle = resource_storage.resources(); responses.add(async move { diff --git a/editor/src/messages/portfolio/portfolio_message_handler.rs b/editor/src/messages/portfolio/portfolio_message_handler.rs index 52b033727f..3acb95b161 100644 --- a/editor/src/messages/portfolio/portfolio_message_handler.rs +++ b/editor/src/messages/portfolio/portfolio_message_handler.rs @@ -198,8 +198,7 @@ impl MessageHandler> for Portfolio } } - // responses.add(PortfolioMessage::GarbageCollectResources); - // + responses.add(PortfolioMessage::GarbageCollectResources); } PortfolioMessage::AutoSaveDocument { document_id } => { let validate = preferences.validate_storage_round_trip; diff --git a/editor/src/node_graph_executor.rs b/editor/src/node_graph_executor.rs index ea78e38ed9..f55d5090f4 100644 --- a/editor/src/node_graph_executor.rs +++ b/editor/src/node_graph_executor.rs @@ -468,7 +468,6 @@ impl NodeGraphExecutor { } NodeGraphUpdate::NodeGraphUpdateMessage(_) => {} NodeGraphUpdate::SvgTextCopyClipboard(svg_string, graphite_json) => { - debug!("svg: {}", svg_string); responses.add(FrontendMessage::TriggerClipboardSvgWrite { svg_string, graphite_json }); } } From c06bfacfb76230e7107b6153ede2c986fd5f2638 Mon Sep 17 00:00:00 2001 From: VimYoung Date: Sun, 6 Sep 2026 14:59:29 +0530 Subject: [PATCH 7/7] Fix: removed package-lock.json --- package-lock.json | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 package-lock.json diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index cabb54e6f1..0000000000 --- a/package-lock.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Graphite", - "lockfileVersion": 3, - "requires": true, - "packages": {} -}