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.x,
|
||||||
this.lastViewportPosition.y,
|
this.lastViewportPosition.y,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const data = await parseClipboard(event, isPlainPaste);
|
||||||
if (
|
if (
|
||||||
event &&
|
event && data.text &&
|
||||||
(!(elementUnderCursor instanceof HTMLCanvasElement) ||
|
(!(elementUnderCursor instanceof HTMLCanvasElement) ||
|
||||||
isWritableElement(target))
|
isWritableElement(target))
|
||||||
) {
|
) {
|
||||||
|
@ -2923,7 +2925,6 @@ class App extends React.Component<AppProps, AppState> {
|
||||||
// event else some browsers (FF...) will clear the clipboardData
|
// event else some browsers (FF...) will clear the clipboardData
|
||||||
// (something something security)
|
// (something something security)
|
||||||
let file = event?.clipboardData?.files[0];
|
let file = event?.clipboardData?.files[0];
|
||||||
const data = await parseClipboard(event, isPlainPaste);
|
|
||||||
if (!file && !isPlainPaste) {
|
if (!file && !isPlainPaste) {
|
||||||
if (data.mixedContent) {
|
if (data.mixedContent) {
|
||||||
return this.addElementsFromMixedContentPaste(data.mixedContent, {
|
return this.addElementsFromMixedContentPaste(data.mixedContent, {
|
||||||
|
@ -2991,12 +2992,18 @@ class App extends React.Component<AppProps, AppState> {
|
||||||
: data.elements
|
: data.elements
|
||||||
) as readonly ExcalidrawElement[];
|
) as readonly ExcalidrawElement[];
|
||||||
// TODO remove formatting from elements if isPlainPaste
|
// TODO remove formatting from elements if isPlainPaste
|
||||||
|
const position = isWritableElement(target) && this.lastPointerDownEvent
|
||||||
|
? { clientX: this.lastPointerDownEvent.pageX, clientY: this.lastPointerDownEvent.pageY }
|
||||||
|
: "cursor";
|
||||||
this.addElementsFromPasteOrLibrary({
|
this.addElementsFromPasteOrLibrary({
|
||||||
elements,
|
elements,
|
||||||
files: data.files || null,
|
files: data.files || null,
|
||||||
position: "cursor",
|
position,
|
||||||
retainSeed: isPlainPaste,
|
retainSeed: isPlainPaste,
|
||||||
});
|
});
|
||||||
|
if(isWritableElement(target)){
|
||||||
|
this.focusContainer();
|
||||||
|
}
|
||||||
} else if (data.text) {
|
} else if (data.text) {
|
||||||
if (data.text && isMaybeMermaidDefinition(data.text)) {
|
if (data.text && isMaybeMermaidDefinition(data.text)) {
|
||||||
const api = await import("@excalidraw/mermaid-to-excalidraw");
|
const api = await import("@excalidraw/mermaid-to-excalidraw");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue