Fix sending platform-specific shortcut keys to frontend before editor is initialized with the platform set

This commit is contained in:
Keavon Chambers
2025-12-04 15:35:30 -08:00
parent 783ea0b437
commit 2ee8e56cef
12 changed files with 77 additions and 52 deletions
+1 -20
View File
@@ -7,9 +7,8 @@
use crate::helpers::translate_key;
use crate::{EDITOR_HANDLE, EDITOR_HAS_CRASHED, Error, MESSAGE_BUFFER};
use editor::consts::FILE_EXTENSION;
use editor::messages::input_mapper::utility_types::input_keyboard::{Key, KeysGroup, ModifierKeys};
use editor::messages::input_mapper::utility_types::input_keyboard::ModifierKeys;
use editor::messages::input_mapper::utility_types::input_mouse::{EditorMouseState, ScrollDelta};
use editor::messages::input_mapper::utility_types::misc::ActionShortcut;
use editor::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
use editor::messages::portfolio::document::utility_types::network_interface::ImportOrExport;
use editor::messages::portfolio::utility_types::Platform;
@@ -68,18 +67,6 @@ pub fn is_platform_native() -> bool {
}
}
#[wasm_bindgen(js_name = shortcutAltClick)]
pub fn shortcut_alt_click() -> JsValue {
let shortcut = Some(ActionShortcut::Shortcut(KeysGroup(vec![Key::Alt, Key::MouseLeft]).into()));
serde_wasm_bindgen::to_value(&shortcut).unwrap()
}
#[wasm_bindgen(js_name = shortcutF11)]
pub fn shortcut_f11() -> JsValue {
let shortcut = Some(ActionShortcut::Shortcut(KeysGroup(vec![Key::F11]).into()));
serde_wasm_bindgen::to_value(&shortcut).unwrap()
}
// ============================================================================
/// This struct is, via wasm-bindgen, used by JS to interact with the editor backend. It does this by calling functions, which are `impl`ed
@@ -405,12 +392,6 @@ impl EditorHandle {
self.dispatch(message);
}
#[wasm_bindgen(js_name = requestWelcomeScreenButtonsLayout)]
pub fn request_welcome_screen_buttons_layout(&self) {
let message = PortfolioMessage::RequestWelcomeScreenButtonsLayout;
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 {