Skip to content

Instantly share code, notes, and snippets.

View kyoncy's full-sized avatar
👻
work work walk

kyoncy kyoncy

👻
work work walk
View GitHub Profile
@kyoncy
kyoncy / downloadBlocklyWorkspaceAsImage.ts
Last active December 8, 2023 08:55
Download Blockly.Workspace as SVG or PNG file
import Blockly from 'blockly';
declare interface CustomNode extends Node {
removeAttribute(arg0: string);
}
const DOMURL = window.URL || window.webkitURL;
const getSvgBlob = (workspace: Blockly.WorkspaceSvg) => {
const canvas = workspace.svgBlockCanvas_.cloneNode(true) as CustomNode;