mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-22 05:38:11 +08:00
Add support for closing document tabs (#215)
* Can only remove last document successfully * Correctly update the layer tree panel * Remove comments * Add support for randomly closing docs * Create new doc after closing last doc * Update layer panel when creating new docs * Fix bug that crashed the program when first doc was closed * Refactor to make code simpler and increase readability * Add shortcut to close active doc (Shift + C) * Add a confirmation dialog box before closing tabs * New docs get the correct title * Remove comments and fix typos * Disable 'eslint-no-alert' * Refactor and fix document title bug * Rename the FrontendMessage and ReponseType for showing close confirmation modal * Change the message displayed in the close confirmation modal Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
co-authored by
Keavon Chambers
parent
8a56d6cf46
commit
0b0873262c
@@ -26,6 +26,11 @@ pub fn select_document(document: usize) -> Result<(), JsValue> {
|
||||
EDITOR_STATE.with(|editor| editor.borrow_mut().handle_message(DocumentMessage::SelectDocument(document)).map_err(convert_error))
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn close_document(document: usize) -> Result<(), JsValue> {
|
||||
EDITOR_STATE.with(|editor| editor.borrow_mut().handle_message(DocumentMessage::CloseDocument(document)).map_err(convert_error))
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn new_document() -> Result<(), JsValue> {
|
||||
EDITOR_STATE.with(|editor| editor.borrow_mut().handle_message(DocumentMessage::NewDocument).map_err(convert_error))
|
||||
|
||||
Reference in New Issue
Block a user