mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-22 19:28:12 +08:00
Multi-document management (create new document; tab switching) (#210)
* Multi-docs WIP * Change to number * Add new document and switch documents * Remove keybind for previous document. Change keybind for next document. * Switch documents by clicking tabs * Remove keybind for previous document. Change keybind for next document. * multi-docs * Update package-lock.json * Hook up File>New to add new document * Remove console logs and empty lines. Start new documents from 2 instead of 1. * Fix formatting
This commit is contained in:
@@ -16,6 +16,8 @@ export enum ResponseType {
|
||||
ExpandFolder = "ExpandFolder",
|
||||
CollapseFolder = "CollapseFolder",
|
||||
SetActiveTool = "SetActiveTool",
|
||||
SetActiveDocument = "SetActiveDocument",
|
||||
NewDocument = "NewDocument",
|
||||
UpdateWorkingColors = "UpdateWorkingColors",
|
||||
}
|
||||
|
||||
@@ -52,6 +54,10 @@ function parseResponse(responseType: string, data: any): Response {
|
||||
return newExpandFolder(data.ExpandFolder);
|
||||
case "SetActiveTool":
|
||||
return newSetActiveTool(data.SetActiveTool);
|
||||
case "SetActiveDocument":
|
||||
return newSetActiveDocument(data.SetActiveDocument);
|
||||
case "NewDocument":
|
||||
return newNewDocument(data.NewDocument);
|
||||
case "UpdateCanvas":
|
||||
return newUpdateCanvas(data.UpdateCanvas);
|
||||
case "ExportDocument":
|
||||
@@ -95,6 +101,24 @@ function newSetActiveTool(input: any): SetActiveTool {
|
||||
};
|
||||
}
|
||||
|
||||
export interface SetActiveDocument {
|
||||
document_index: number;
|
||||
}
|
||||
function newSetActiveDocument(input: any): SetActiveDocument {
|
||||
return {
|
||||
document_index: input.document_index,
|
||||
};
|
||||
}
|
||||
|
||||
export interface NewDocument {
|
||||
document_name: string;
|
||||
}
|
||||
function newNewDocument(input: any): NewDocument {
|
||||
return {
|
||||
document_name: input.document_name,
|
||||
};
|
||||
}
|
||||
|
||||
export interface UpdateCanvas {
|
||||
document: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user