mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
prevent pasting svg copied from excalidraw (#1288)
* prevent pasting svg copied from excalidraw * remove unnecessary template
This commit is contained in:
parent
e9b4700bba
commit
729aeacc47
2 changed files with 9 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
|||
import { ExcalidrawElement } from "./element/types";
|
||||
import { getSelectedElements } from "./scene";
|
||||
import { AppState } from "./types";
|
||||
import { SVG_EXPORT_TAG } from "./scene/export";
|
||||
|
||||
let CLIPBOARD = "";
|
||||
let PREFER_APP_CLIPBOARD = false;
|
||||
|
@ -39,6 +40,10 @@ export async function copyToAppClipboard(
|
|||
export function getAppClipboard(): {
|
||||
elements?: readonly ExcalidrawElement[];
|
||||
} {
|
||||
if (!CLIPBOARD) {
|
||||
return {};
|
||||
}
|
||||
|
||||
try {
|
||||
const clipboardElements = JSON.parse(CLIPBOARD);
|
||||
|
||||
|
@ -68,7 +73,7 @@ export async function getClipboardContent(
|
|||
: probablySupportsClipboardReadText &&
|
||||
(await navigator.clipboard.readText());
|
||||
|
||||
if (text && !PREFER_APP_CLIPBOARD) {
|
||||
if (text && !PREFER_APP_CLIPBOARD && !text.includes(SVG_EXPORT_TAG)) {
|
||||
return { text };
|
||||
}
|
||||
} catch (error) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue