Skip to content

Commit 8200b15

Browse files
Review
1 parent 38c5402 commit 8200b15

3 files changed

Lines changed: 10 additions & 38 deletions

File tree

editor/src/application.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ impl Editor {
2828
dispatcher: Dispatcher::with_executor(executor),
2929
};
3030

31+
futures::executor::block_on(async {
32+
editor.replace_application_io(PlatformApplicationIo::new().await).await;
33+
});
34+
3135
(editor, runtime)
3236
}
3337

editor/src/messages/portfolio/document/document_message_handler.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ pub struct DocumentMessageHandler {
109109
pub graph_view_overlay_open: bool,
110110
/// The current opacity of the faded node graph background that covers up the artwork.
111111
pub graph_fade_artwork_percentage: f64,
112-
/// The resources that are currently used by the document.
113-
#[serde(skip_serializing_if = "Option::is_none", rename = "resources")]
112+
/// Resources embedded in the document.
113+
#[serde(rename = "resources", skip_serializing_if = "Option::is_none")]
114114
pub embedded_resources: Option<EmbeddedResources>,
115115

116116
// =============================================
@@ -930,9 +930,7 @@ impl MessageHandler<DocumentMessage, DocumentMessageContext<'_>> for DocumentMes
930930
if !embedded.is_empty() {
931931
self.embedded_resources = Some(embedded);
932932
}
933-
934933
let content = self.serialize_document();
935-
936934
self.embedded_resources = None;
937935

938936
responses.add(FrontendMessage::TriggerSaveDocument {

editor/src/messages/portfolio/document/utility_types/embedded_resources.rs

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,52 +4,22 @@ use graph_craft::application_io::{Resource, ResourceHash};
44
use std::collections::HashMap;
55
use std::fmt;
66

7-
#[derive(Clone, Default, Debug, PartialEq)]
7+
#[derive(Clone, Debug, PartialEq)]
88
pub struct EmbeddedResources {
99
resources: HashMap<ResourceHash, Resource>,
1010
}
1111

1212
impl EmbeddedResources {
13-
pub fn new() -> Self {
14-
Self::default()
15-
}
16-
17-
pub fn insert(&mut self, hash: ResourceHash, resource: Resource) -> Option<Resource> {
18-
self.resources.insert(hash, resource)
19-
}
20-
21-
pub fn get(&self, hash: &ResourceHash) -> Option<&Resource> {
22-
self.resources.get(hash)
23-
}
24-
25-
pub fn remove(&mut self, hash: &ResourceHash) -> Option<Resource> {
26-
self.resources.remove(hash)
27-
}
28-
29-
pub fn contains(&self, hash: &ResourceHash) -> bool {
30-
self.resources.contains_key(hash)
31-
}
32-
33-
pub fn len(&self) -> usize {
34-
self.resources.len()
35-
}
36-
3713
pub fn is_empty(&self) -> bool {
3814
self.resources.is_empty()
3915
}
40-
41-
pub fn iter(&self) -> impl Iterator<Item = (&ResourceHash, &Resource)> {
42-
self.resources.iter()
43-
}
44-
45-
pub fn hashes(&self) -> impl Iterator<Item = &ResourceHash> {
46-
self.resources.keys()
47-
}
4816
}
4917

5018
impl FromIterator<(ResourceHash, Resource)> for EmbeddedResources {
5119
fn from_iter<T: IntoIterator<Item = (ResourceHash, Resource)>>(iter: T) -> Self {
52-
Self { resources: iter.into_iter().collect() }
20+
Self {
21+
resources: iter.into_iter().collect(),
22+
}
5323
}
5424
}
5525

0 commit comments

Comments
 (0)