mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-16 23:08:05 +08:00
Add cut, copy, and paste to the Edit menu (#440)
* Add cut * Hook up edit dropdown * Use copy message
This commit is contained in:
@@ -109,9 +109,9 @@ function makeMenuEntries(editor: EditorState): MenuListEntries {
|
||||
{ label: "Redo", shortcut: ["KeyControl", "KeyShift", "KeyZ"], action: async () => editor.instance.redo() },
|
||||
],
|
||||
[
|
||||
{ label: "Cut", shortcut: ["KeyControl", "KeyX"] },
|
||||
{ label: "Copy", icon: "Copy", shortcut: ["KeyControl", "KeyC"] },
|
||||
{ label: "Paste", icon: "Paste", shortcut: ["KeyControl", "KeyV"] },
|
||||
{ label: "Cut", shortcut: ["KeyControl", "KeyX"], action: async () => editor.instance.cut() },
|
||||
{ label: "Copy", icon: "Copy", shortcut: ["KeyControl", "KeyC"], action: async () => editor.instance.copy() },
|
||||
{ label: "Paste", icon: "Paste", shortcut: ["KeyControl", "KeyV"], action: async () => editor.instance.paste() },
|
||||
],
|
||||
],
|
||||
},
|
||||
|
||||
@@ -349,6 +349,24 @@ impl JsEditorHandle {
|
||||
self.dispatch(message);
|
||||
}
|
||||
|
||||
/// Cut selected layers
|
||||
pub fn cut(&self) {
|
||||
let message = DocumentsMessage::Cut(Clipboard::User);
|
||||
self.dispatch(message);
|
||||
}
|
||||
|
||||
/// Copy selected layers
|
||||
pub fn copy(&self) {
|
||||
let message = DocumentsMessage::Copy(Clipboard::User);
|
||||
self.dispatch(message);
|
||||
}
|
||||
|
||||
/// Paste selected layers
|
||||
pub fn paste(&self) {
|
||||
let message = DocumentsMessage::Paste(Clipboard::User);
|
||||
self.dispatch(message);
|
||||
}
|
||||
|
||||
pub fn select_layer(&self, paths: Vec<LayerId>, ctrl: bool, shift: bool) {
|
||||
let message = DocumentMessage::SelectLayer(paths, ctrl, shift);
|
||||
self.dispatch(message);
|
||||
|
||||
Reference in New Issue
Block a user