add image exporting to vue component

This commit is contained in:
Loren Norman 2025-07-29 15:01:28 -04:00
parent 6949620141
commit 6ad85110eb

View file

@ -2,6 +2,8 @@
import { onMounted, onUnmounted } from 'vue' import { onMounted, onUnmounted } from 'vue'
import { dispose, inject } from "../blockly/blockly_app.js" import { dispose, inject } from "../blockly/blockly_app.js"
import initialWorkspace from "../blockly/workspace.json" import initialWorkspace from "../blockly/workspace.json"
import { imageExportRegistryItems } from '#src/image_exporter.js'
const const
{ block, blocks=[], width="100%", height="200px", toolbox=true } = defineProps( { block, blocks=[], width="100%", height="200px", toolbox=true } = defineProps(
@ -10,6 +12,30 @@
injectOptions = {}, injectOptions = {},
options = { options = {
injectOptions, injectOptions,
contextMenu: {
register: [ ...imageExportRegistryItems ]
},
// TODO: specify dummy extension data with the block defs
extensionData: {
feedOptions: [
["Group A Feed 1", "group-a.feed-1"],
["Group A Feed 2", "group-a.feed-2"],
["Group B Feed 1", "group-b.feed-1"],
["Group C Feed 1", "group-C.feed-1"],
],
weatherLocationOptions: [
[ "Industry City", "1" ],
[ "Varick", "2" ],
[ "Shenzhen", "3" ],
],
currentWeatherByLocation: {
1: {
current: {
cloudCover: "5.4321",
}
}
}
},
workspaceJson: block workspaceJson: block
? { ? {
blocks: { blocks: {