mirror of
				https://github.com/excalidraw/excalidraw.git
				synced 2025-11-03 20:34:40 +01: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:
		@@ -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"
 | 
			
		||||
  );
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user