mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-24 12:08:13 +08:00
Desktop: Add File > Save As… (#3034)
* Make file name and document name identical * Add save as action * Fix test errors * Add missing save as action * Desktop fix drop file open document file message * Address review comments * Replace file save suffix with file extension * Add comment specifying that the upload function takes a html input accept string * Fix remove file extension in web * Use let * Don't show save as menu entry in web * Don't add SaveDocumentAs in web * Remove file extension on all open document file calls --------- Co-authored-by: Dennis Kobert <dennis@kobert.dev>
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
//
|
||||
use crate::helpers::translate_key;
|
||||
use crate::{EDITOR_HANDLE, EDITOR_HAS_CRASHED, Error, MESSAGE_BUFFER};
|
||||
use editor::consts::FILE_SAVE_SUFFIX;
|
||||
use editor::consts::FILE_EXTENSION;
|
||||
use editor::messages::input_mapper::utility_types::input_keyboard::ModifierKeys;
|
||||
use editor::messages::input_mapper::utility_types::input_mouse::{EditorMouseState, ScrollDelta, ViewportBounds};
|
||||
use editor::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
|
||||
@@ -344,10 +344,10 @@ impl EditorHandle {
|
||||
cfg!(debug_assertions)
|
||||
}
|
||||
|
||||
/// Get the constant `FILE_SAVE_SUFFIX`
|
||||
#[wasm_bindgen(js_name = fileSaveSuffix)]
|
||||
pub fn file_save_suffix(&self) -> String {
|
||||
FILE_SAVE_SUFFIX.into()
|
||||
/// Get the constant `FILE_EXTENSION`
|
||||
#[wasm_bindgen(js_name = fileExtension)]
|
||||
pub fn file_extension(&self) -> String {
|
||||
FILE_EXTENSION.into()
|
||||
}
|
||||
|
||||
/// Update the value of a given UI widget, but don't commit it to the history (unless `commit_layout()` is called, which handles that)
|
||||
@@ -421,7 +421,8 @@ impl EditorHandle {
|
||||
#[wasm_bindgen(js_name = openDocumentFile)]
|
||||
pub fn open_document_file(&self, document_name: String, document_serialized_content: String) {
|
||||
let message = PortfolioMessage::OpenDocumentFile {
|
||||
document_name,
|
||||
document_name: Some(document_name),
|
||||
document_path: None,
|
||||
document_serialized_content,
|
||||
};
|
||||
self.dispatch(message);
|
||||
@@ -432,7 +433,8 @@ impl EditorHandle {
|
||||
let document_id = DocumentId(document_id);
|
||||
let message = PortfolioMessage::OpenDocumentFileWithId {
|
||||
document_id,
|
||||
document_name,
|
||||
document_name: Some(document_name),
|
||||
document_path: None,
|
||||
document_is_auto_saved: true,
|
||||
document_is_saved,
|
||||
document_serialized_content,
|
||||
|
||||
Reference in New Issue
Block a user