mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +08:00
Implement Undo and Redo (#354)
* Implement undo and redo * Create more save points and hook up menu entry * Fix operation ordering * Remove debug statement * Fix folder changed order * Don't store overlays in the history chain * Keep selection
This commit is contained in:
committed by
Keavon Chambers
parent
47fbb8d0fa
commit
0ccb181e2c
@@ -108,7 +108,7 @@ const menuEntries: MenuListEntries = [
|
||||
children: [
|
||||
[
|
||||
{ label: "Undo", shortcut: ["Ctrl", "Z"], action: async () => (await wasm).undo() },
|
||||
{ label: "Redo", shortcut: ["Ctrl", "⇧", "Z"] },
|
||||
{ label: "Redo", shortcut: ["Ctrl", "⇧", "Z"], action: async () => (await wasm).redo() },
|
||||
],
|
||||
[
|
||||
{ label: "Cut", shortcut: ["Ctrl", "X"] },
|
||||
|
||||
@@ -212,6 +212,12 @@ pub fn undo() -> Result<(), JsValue> {
|
||||
EDITOR_STATE.with(|editor| editor.borrow_mut().handle_message(DocumentMessage::Undo)).map_err(convert_error)
|
||||
}
|
||||
|
||||
/// Redo history one step
|
||||
#[wasm_bindgen]
|
||||
pub fn redo() -> Result<(), JsValue> {
|
||||
EDITOR_STATE.with(|editor| editor.borrow_mut().handle_message(DocumentMessage::Redo)).map_err(convert_error)
|
||||
}
|
||||
|
||||
/// Select all layers
|
||||
#[wasm_bindgen]
|
||||
pub fn select_all_layers() -> Result<(), JsValue> {
|
||||
|
||||
Reference in New Issue
Block a user