import Blockly from 'blockly';
const vex = require('vex-js');
vex.registerPlugin(require('vex-dialog'));

// CSSの読み込み
import 'vex-js/dist/css/vex.css';
// ※ css名とclassNameを合わせてください
import 'vex-js/dist/css/vex-theme-os.css';
vex.defaultOptions.className = 'vex-theme-os';

// Blocklyの alert, confirm, prompt を上書き
const emptycb = () => {}; // eslint-disable-line
Blockly.alert = (msg, cb) => vex.dialog.alert({ message: msg, callback: cb ?? emptycb });
Blockly.confirm = (msg, cb) => vex.dialog.confirm({ message: msg, callback: cb ?? emptycb });
Blockly.prompt = (msg, value, cb) => vex.dialog.prompt({ message: msg, value: value, callback: cb ?? emptycb });
