Skip to content

Commit

Permalink
Use paste icon for paste menu item
Browse files Browse the repository at this point in the history
Some IconProvider-related changes moved from f29aeec.
  • Loading branch information
personalizedrefrigerator committed Aug 27, 2024
1 parent 28714fe commit bdf9eef
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
8 changes: 7 additions & 1 deletion packages/js-draw/src/toolbar/IconProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,13 @@ export default class IconProvider {
`);
}

/** Unused. @deprecated */
public makeCopyIcon(): IconElemType {
return this.makeIconFromPath(`
M 45,10 45,55 90,55 90,10 45,10 z
M 10,25 10,90 70,90 70,60 40,60 40,25 10,25 z
`);
}

public makePasteIcon(): IconElemType {
const icon = this.makeIconFromPath(`
M 50 0 L 50 5 L 35 5 L 40 24.75 L 20 25 L 20 100 L 85 100 L 100 90 L 100 24 L 75.1 24.3 L 80 5 L 65 5 L 65 0 L 50 0 z
Expand Down
4 changes: 2 additions & 2 deletions packages/js-draw/src/tools/SelectionTool/SelectionTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ export default class SelectionTool extends BaseTool {
},
}, {
text: 'Copy to clipboard', // TODO: localize
icon: () => this.editor.icons.makeDuplicateSelectionIcon(),
icon: () => this.editor.icons.makeCopyIcon(),
key: async () => {
const clipboardHandler = new ClipboardHandler(this.editor);
await clipboardHandler.copy();
},
}] : [{
text: 'Paste', // TODO: Localize
icon: () => this.editor.icons.makeSelectionIcon(),
icon: () => this.editor.icons.makePasteIcon(),
key: async () => {
const clipboardHandler = new ClipboardHandler(this.editor);
await clipboardHandler.paste();
Expand Down
1 change: 1 addition & 0 deletions packages/material-icons/src/icons/ContentPaste.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions packages/material-icons/src/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import Close from './icons/Close.svg';
import Shapes from './icons/Shapes.svg';
import Draw from './icons/Draw.svg';
import InkPen from './icons/InkPen.svg';
import ContentPaste from './icons/ContentPaste.svg';

const icon = (data: string) => {
const icon = document.createElement('div');
Expand Down Expand Up @@ -162,6 +163,12 @@ class MaterialIconProvider extends IconProvider {
public override makeDuplicateSelectionIcon(): IconElemType {
return icon(ContentCopy);
}
public override makeCopyIcon(): IconElemType {
return icon(ContentCopy);
}
public override makePasteIcon(): IconElemType {
return icon(ContentPaste);
}
public override makeDeleteSelectionIcon(): IconElemType {
return icon(Delete);
}
Expand Down

0 comments on commit bdf9eef

Please sign in to comment.