From 05cddf7a2b0fb2a85c0b5cbde38b1b46b231d3a3 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Sun, 15 Jan 2023 00:28:19 -0800 Subject: [PATCH] Disable image copy & paste --- packages/mindplot/src/components/Designer.ts | 29 ++++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/packages/mindplot/src/components/Designer.ts b/packages/mindplot/src/components/Designer.ts index 6ca6b067..dcb4950c 100644 --- a/packages/mindplot/src/components/Designer.ts +++ b/packages/mindplot/src/components/Designer.ts @@ -57,7 +57,6 @@ import WidgetManager from './WidgetManager'; import { TopicShapeType } from './model/INodeModel'; import { LineType } from './ConnectionLine'; import XMLSerializerFactory from './persistence/XMLSerializerFactory'; -import ImageExpoterFactory from './export/ImageExporterFactory'; class Designer extends Events { private _mindmap: Mindmap | null; @@ -399,25 +398,25 @@ class Designer extends Events { const textPlainBlob = new Blob([xmlStr], { type: 'text/plain' }); // Create image blob ... - const workspace = designer.getWorkSpace(); - const svgElement = workspace.getSVGElement(); - const size = { width: window.innerWidth, height: window.innerHeight }; + // const workspace = designer.getWorkSpace(); + // const svgElement = workspace.getSVGElement(); + // const size = { width: window.innerWidth, height: window.innerHeight }; - const imageUrl = ImageExpoterFactory.create( - 'png', - svgElement, - size.width, - size.height, - false, - ); - let imgStr = await imageUrl.exportAndEncode(); - imgStr = imgStr.replace('octet/stream', 'image/png'); - const imgBlob = await (await fetch(imgStr)).blob(); + // const imageUrl = ImageExpoterFactory.create( + // 'png', + // svgElement, + // size.width, + // size.height, + // false, + // ); + // let imgStr = await imageUrl.exportAndEncode(); + // imgStr = imgStr.replace('octet/stream', 'image/png'); + // const imgBlob = await (await fetch(imgStr)).blob(); // Finally, add to clipboard ... const clipboard = new ClipboardItem({ [textPlainBlob.type]: textPlainBlob, - [imgBlob.type]: imgBlob, + // [imgBlob.type]: imgBlob, }); navigator.clipboard.write([clipboard]).then(