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:
David Luzar 2020-02-07 18:42:24 +01:00 committed by GitHub
parent ba1a39c9f3
commit 88eacc9da7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 119 additions and 82 deletions

View file

@ -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"
);
}