Implement "Export" entry in File menu; add Copy/Paste icons in Edit menu
This commit is contained in:
parent
d1bf68320e
commit
4bcdbbe092
|
|
@ -0,0 +1,4 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
|
||||||
|
<path d="M9,5L5,9v7h9V5H9z M13,15H6v-5h4V6h3V15z" />
|
||||||
|
<polygon points="5,1 2,4 2,13 4,13 4,12 3,12 3,5 6,5 6,2 11,2 11,4 12,4 12,1" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 204 B |
|
Before Width: | Height: | Size: 123 B After Width: | Height: | Size: 123 B |
|
|
@ -0,0 +1,4 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
|
||||||
|
<path d="M12,1H8.72C8.38,0.4,7.74,0,7,0S5.62,0.4,5.28,1H2C1.45,1,1,1.45,1,2v12c0,0.55,0.45,1,1,1h3v-1H2V2h2v1c0,0.55,0.45,1,1,1h4c0.55,0,1-0.45,1-1V2h2v2h1V2C13,1.45,12.55,1,12,1z" />
|
||||||
|
<path d="M10,5L6,9v7h9V5H10z M14,15H7v-5h4V6h3V15z" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 309 B |
|
|
@ -65,7 +65,7 @@ const menuEntries: MenuListEntries = [
|
||||||
ref: undefined,
|
ref: undefined,
|
||||||
children: [
|
children: [
|
||||||
[
|
[
|
||||||
{ label: "New", icon: "FileNew", shortcut: ["Ctrl", "N"] },
|
{ label: "New", icon: "File", shortcut: ["Ctrl", "N"] },
|
||||||
{ label: "Open…", shortcut: ["Ctrl", "O"] },
|
{ label: "Open…", shortcut: ["Ctrl", "O"] },
|
||||||
{
|
{
|
||||||
label: "Open Recent",
|
label: "Open Recent",
|
||||||
|
|
@ -94,7 +94,7 @@ const menuEntries: MenuListEntries = [
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{ label: "Import…", shortcut: ["Ctrl", "I"] },
|
{ label: "Import…", shortcut: ["Ctrl", "I"] },
|
||||||
{ label: "Export…", shortcut: ["Ctrl", "E"] },
|
{ label: "Export…", shortcut: ["Ctrl", "E"], action: async () => (await wasm).export_document() },
|
||||||
],
|
],
|
||||||
[{ label: "Quit", shortcut: ["Ctrl", "Q"] }],
|
[{ label: "Quit", shortcut: ["Ctrl", "Q"] }],
|
||||||
],
|
],
|
||||||
|
|
@ -104,13 +104,13 @@ const menuEntries: MenuListEntries = [
|
||||||
ref: undefined,
|
ref: undefined,
|
||||||
children: [
|
children: [
|
||||||
[
|
[
|
||||||
{ label: "Undo", shortcut: ["Ctrl", "Z"], action: async () => (await wasm).undo()},
|
{ label: "Undo", shortcut: ["Ctrl", "Z"], action: async () => (await wasm).undo() },
|
||||||
{ label: "Redo", shortcut: ["Ctrl", "⇧", "Z"] },
|
{ label: "Redo", shortcut: ["Ctrl", "⇧", "Z"] },
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{ label: "Cut", shortcut: ["Ctrl", "X"] },
|
{ label: "Cut", shortcut: ["Ctrl", "X"] },
|
||||||
{ label: "Copy", shortcut: ["Ctrl", "C"] },
|
{ label: "Copy", icon: "Copy", shortcut: ["Ctrl", "C"] },
|
||||||
{ label: "Paste", shortcut: ["Ctrl", "V"] },
|
{ label: "Paste", icon: "Paste", shortcut: ["Ctrl", "V"] },
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,9 @@ import ViewModePixels from "../../../../assets/16px-solid/view-mode-pixels.svg";
|
||||||
import EyeVisible from "../../../../assets/16px-solid/visibility-eye-visible.svg";
|
import EyeVisible from "../../../../assets/16px-solid/visibility-eye-visible.svg";
|
||||||
import EyeHidden from "../../../../assets/16px-solid/visibility-eye-hidden.svg";
|
import EyeHidden from "../../../../assets/16px-solid/visibility-eye-hidden.svg";
|
||||||
import GraphiteLogo from "../../../../assets/16px-solid/graphite-logo.svg";
|
import GraphiteLogo from "../../../../assets/16px-solid/graphite-logo.svg";
|
||||||
import FileNew from "../../../../assets/16px-solid/file-new.svg";
|
import File from "../../../../assets/16px-solid/file.svg";
|
||||||
|
import Copy from "../../../../assets/16px-solid/copy.svg";
|
||||||
|
import Paste from "../../../../assets/16px-solid/paste.svg";
|
||||||
|
|
||||||
import SwapButton from "../../../../assets/12px-solid/swap.svg";
|
import SwapButton from "../../../../assets/12px-solid/swap.svg";
|
||||||
import ResetColorsButton from "../../../../assets/12px-solid/reset-colors.svg";
|
import ResetColorsButton from "../../../../assets/12px-solid/reset-colors.svg";
|
||||||
|
|
@ -143,7 +145,9 @@ const icons = {
|
||||||
EyeVisible: { component: EyeVisible, size: 16 },
|
EyeVisible: { component: EyeVisible, size: 16 },
|
||||||
EyeHidden: { component: EyeHidden, size: 16 },
|
EyeHidden: { component: EyeHidden, size: 16 },
|
||||||
GraphiteLogo: { component: GraphiteLogo, size: 16 },
|
GraphiteLogo: { component: GraphiteLogo, size: 16 },
|
||||||
FileNew: { component: FileNew, size: 16 },
|
File: { component: File, size: 16 },
|
||||||
|
Copy: { component: Copy, size: 16 },
|
||||||
|
Paste: { component: Paste, size: 16 },
|
||||||
SwapButton: { component: SwapButton, size: 12 },
|
SwapButton: { component: SwapButton, size: 12 },
|
||||||
ResetColorsButton: { component: ResetColorsButton, size: 12 },
|
ResetColorsButton: { component: ResetColorsButton, size: 12 },
|
||||||
DropdownArrow: { component: DropdownArrow, size: 12 },
|
DropdownArrow: { component: DropdownArrow, size: 12 },
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,12 @@ pub fn undo() -> Result<(), JsValue> {
|
||||||
EDITOR_STATE.with(|editor| editor.borrow_mut().handle_message(DocumentMessage::Undo)).map_err(convert_error)
|
EDITOR_STATE.with(|editor| editor.borrow_mut().handle_message(DocumentMessage::Undo)).map_err(convert_error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Export the document
|
||||||
|
#[wasm_bindgen]
|
||||||
|
pub fn export_document() -> Result<(), JsValue> {
|
||||||
|
EDITOR_STATE.with(|editor| editor.borrow_mut().handle_message(DocumentMessage::ExportDocument)).map_err(convert_error)
|
||||||
|
}
|
||||||
|
|
||||||
/// Select a layer from the layer list
|
/// Select a layer from the layer list
|
||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
pub fn select_layer(path: Vec<LayerId>) -> Result<(), JsValue> {
|
pub fn select_layer(path: Vec<LayerId>) -> Result<(), JsValue> {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue