mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Improve pasting (#723)
* switch to selection tool on paste * align pasting via contextMenu with pasting from event * ensure only plaintext can be pasted * fix findShapeByKey regression * simplify wysiwyg pasting * improve wysiwyg blurriness
This commit is contained in:
parent
ba1a39c9f3
commit
88eacc9da7
5 changed files with 119 additions and 82 deletions
|
@ -65,7 +65,7 @@ export const SHAPES = [
|
|||
),
|
||||
value: "text",
|
||||
},
|
||||
];
|
||||
] as const;
|
||||
|
||||
export const shapesShortcutKeys = SHAPES.map((shape, index) => [
|
||||
shape.value[0],
|
||||
|
@ -73,12 +73,9 @@ export const shapesShortcutKeys = SHAPES.map((shape, index) => [
|
|||
]).flat(1);
|
||||
|
||||
export function findShapeByKey(key: string) {
|
||||
const defaultElement = "selection";
|
||||
return SHAPES.reduce((element, shape, index) => {
|
||||
if (shape.value[0] !== key && key !== (index + 1).toString()) {
|
||||
return element;
|
||||
}
|
||||
|
||||
return shape.value;
|
||||
}, defaultElement);
|
||||
return (
|
||||
SHAPES.find((shape, index) => {
|
||||
return shape.value[0] === key || key === (index + 1).toString();
|
||||
})?.value || "selection"
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue