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:
akshay1992kalbhor
2021-06-22 14:28:02 +05:30
committed by Keavon Chambers
co-authored by Keavon Chambers
parent a3d96f1dae
commit b2b8c75e9e
7 changed files with 118 additions and 5 deletions
@@ -12,12 +12,14 @@ pub enum FrontendMessage {
ExpandFolder { path: Vec<LayerId>, children: Vec<LayerPanelEntry> },
SetActiveTool { tool_name: String },
SetActiveDocument { document_index: usize },
CloseDocument { document_index: usize },
NewDocument { document_name: String },
UpdateCanvas { document: String },
ExportDocument { document: String },
EnableTextInput,
DisableTextInput,
UpdateWorkingColors { primary: Color, secondary: Color },
PromptCloseConfirmationModal,
}
pub struct FrontendMessageHandler {