mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: Fixed issue where shape details were pasted in text areas instead of actual shape
This commit is contained in:
parent
5e1ff7cafe
commit
07730ac060
1 changed files with 10 additions and 3 deletions
|
@ -2903,8 +2903,10 @@ class App extends React.Component<AppProps, AppState> {
|
|||
this.lastViewportPosition.x,
|
||||
this.lastViewportPosition.y,
|
||||
);
|
||||
|
||||
const data = await parseClipboard(event, isPlainPaste);
|
||||
if (
|
||||
event &&
|
||||
event && data.text &&
|
||||
(!(elementUnderCursor instanceof HTMLCanvasElement) ||
|
||||
isWritableElement(target))
|
||||
) {
|
||||
|
@ -2923,7 +2925,6 @@ class App extends React.Component<AppProps, AppState> {
|
|||
// event else some browsers (FF...) will clear the clipboardData
|
||||
// (something something security)
|
||||
let file = event?.clipboardData?.files[0];
|
||||
const data = await parseClipboard(event, isPlainPaste);
|
||||
if (!file && !isPlainPaste) {
|
||||
if (data.mixedContent) {
|
||||
return this.addElementsFromMixedContentPaste(data.mixedContent, {
|
||||
|
@ -2991,12 +2992,18 @@ class App extends React.Component<AppProps, AppState> {
|
|||
: data.elements
|
||||
) as readonly ExcalidrawElement[];
|
||||
// TODO remove formatting from elements if isPlainPaste
|
||||
const position = isWritableElement(target) && this.lastPointerDownEvent
|
||||
? { clientX: this.lastPointerDownEvent.pageX, clientY: this.lastPointerDownEvent.pageY }
|
||||
: "cursor";
|
||||
this.addElementsFromPasteOrLibrary({
|
||||
elements,
|
||||
files: data.files || null,
|
||||
position: "cursor",
|
||||
position,
|
||||
retainSeed: isPlainPaste,
|
||||
});
|
||||
if(isWritableElement(target)){
|
||||
this.focusContainer();
|
||||
}
|
||||
} else if (data.text) {
|
||||
if (data.text && isMaybeMermaidDefinition(data.text)) {
|
||||
const api = await import("@excalidraw/mermaid-to-excalidraw");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue