mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-24 08:28:11 +08:00
Improve UX of importing vs. opening files (#3661)
* wip * fix drag and drop * fix * fix tests * fix tests * fix warning * Partial code review * add dialog * fix web * fix web * push back release candidate expiry * Code review * Reduce code duplication for pasting files in frontend --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
@@ -22,6 +22,7 @@ use js_sys::{Object, Reflect};
|
||||
use serde::Serialize;
|
||||
use serde_wasm_bindgen::{self, from_value};
|
||||
use std::cell::RefCell;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::atomic::{AtomicU64, Ordering};
|
||||
use std::time::Duration;
|
||||
use wasm_bindgen::JsCast;
|
||||
@@ -414,13 +415,15 @@ impl EditorHandle {
|
||||
self.dispatch(message);
|
||||
}
|
||||
|
||||
#[wasm_bindgen(js_name = openDocumentFile)]
|
||||
pub fn open_document_file(&self, document_name: String, document_serialized_content: String) {
|
||||
let message = PortfolioMessage::OpenDocumentFile {
|
||||
document_name: Some(document_name),
|
||||
document_path: None,
|
||||
document_serialized_content,
|
||||
};
|
||||
#[wasm_bindgen(js_name = openFile)]
|
||||
pub fn open_file(&self, path: String, content: Vec<u8>) {
|
||||
let message = PortfolioMessage::OpenFile { path: PathBuf::from(path), content };
|
||||
self.dispatch(message);
|
||||
}
|
||||
|
||||
#[wasm_bindgen(js_name = importFile)]
|
||||
pub fn import_file(&self, path: String, content: Vec<u8>) {
|
||||
let message = PortfolioMessage::ImportFile { path: PathBuf::from(path), content };
|
||||
self.dispatch(message);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user