mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Merge 07730ac060
into debf2ad608
This commit is contained in:
commit
56a105b4c5
1 changed files with 10 additions and 3 deletions
|
@ -3062,8 +3062,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))
|
||||||
) {
|
) {
|
||||||
|
@ -3082,7 +3084,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, {
|
||||||
|
@ -3150,12 +3151,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