mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 14:18:04 +08:00
Integrate document-format storage into the editor (#4265)
* Integrate document-format storage into the editor * Address review feedback: drop redundant clones and dedupe metadata traversal * Extract DocumentHistory and move storage-metadata tests to their own file * Extract storage diffing/IO, gate validation and .gdd save behind preferences, restructure tests * Address PR review: save-format/path consistency, autosave persistence, and view-settings/diff fixes * Skip storage remount on .gdd open and split value/timestamp drift in attribute diff * Rename storage tests module and surface .gdd open failures with per-resource diff detail * Add debug-menu toggle to hide the storage preferences section * Hopefully fix async tests * Shorten comments * Fix tests * Review * Review * Review * Block on future mesages in tests * Review * Shorten comments --------- Co-authored-by: Timon <me@timon.zip>
This commit is contained in:
@@ -37,13 +37,14 @@ pub(super) fn intercept_frontend_message(dispatcher: &mut DesktopWrapperMessageD
|
||||
if let Some(path) = path {
|
||||
dispatcher.respond(DesktopFrontendMessage::WriteFile { path, content });
|
||||
} else {
|
||||
let extension = std::path::Path::new(&name).extension().and_then(|extension| extension.to_str()).unwrap_or("*").to_string();
|
||||
dispatcher.respond(DesktopFrontendMessage::SaveFileDialog {
|
||||
title: "Save Document".to_string(),
|
||||
default_filename: name,
|
||||
default_folder: folder,
|
||||
filters: vec![FileFilter {
|
||||
name: "Graphite".to_string(),
|
||||
extensions: vec!["graphite".to_string()],
|
||||
name: "Graphite Document".to_string(),
|
||||
extensions: vec![extension],
|
||||
}],
|
||||
context: SaveFileDialogContext::Document { document_id, content },
|
||||
});
|
||||
|
||||
@@ -26,7 +26,7 @@ pub struct DesktopWrapper {
|
||||
}
|
||||
|
||||
impl DesktopWrapper {
|
||||
pub fn new(uuid_random_seed: u64, resource_storage: Arc<dyn ResourceStorage>, wgpu_context: WgpuContext, schedule_wake: Wake) -> Self {
|
||||
pub fn new(uuid_random_seed: u64, resource_storage: Arc<dyn ResourceStorage>, working_copy_root: std::path::PathBuf, wgpu_context: WgpuContext, schedule_wake: Wake) -> Self {
|
||||
#[cfg(target_os = "windows")]
|
||||
let host = Host::Windows;
|
||||
#[cfg(target_os = "macos")]
|
||||
@@ -37,7 +37,7 @@ impl DesktopWrapper {
|
||||
let application_io = PlatformApplicationIo::new_with_context(wgpu_context);
|
||||
|
||||
Self {
|
||||
editor: Editor::new(env, uuid_random_seed, resource_storage, application_io, schedule_wake),
|
||||
editor: Editor::new(env, uuid_random_seed, resource_storage, Some(working_copy_root), application_io, schedule_wake),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user