Skip to content

Commit

Permalink
chore: remove dev-tools dependency from custom tooltip demo (#2450)
Browse files Browse the repository at this point in the history
  • Loading branch information
rachel-fenichel authored Aug 28, 2024
1 parent 6b36d8b commit 07b745c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 318 deletions.
3 changes: 1 addition & 2 deletions examples/custom-tooltips-demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<script src="./node_modules/blockly/blockly_compressed.js"></script>
<script src="./node_modules/blockly/blocks_compressed.js"></script>
<script src="./node_modules/blockly/msg/en.js"></script>
<script src="./node_modules/@blockly/dev-tools/dist/index.js"></script>
<script src="./index.js"></script>
<style>
html,
Expand All @@ -17,6 +16,6 @@
</head>

<body>
<div id="root"></div>
<div id="root" style="height: 600px; width: 600px"></div>
</body>
</html>
25 changes: 3 additions & 22 deletions examples/custom-tooltips-demo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,6 @@ function initTooltips() {
Blockly.Tooltip.setCustomTooltip(customTooltip);
}

/**
* Create a workspace.
* @param {HTMLElement} blocklyDiv The blockly container div.
* @param {!Blockly.BlocklyOptions} options The Blockly options.
* @returns {!Blockly.WorkspaceSvg} The created workspace.
*/
function createWorkspace(blocklyDiv, options) {
const workspace = Blockly.inject(blocklyDiv, options);

initTooltips();

return workspace;
}

document.addEventListener('DOMContentLoaded', function () {
Blockly.Blocks['custom_tooltip_1'] = {
init: function () {
Expand All @@ -76,7 +62,7 @@ document.addEventListener('DOMContentLoaded', function () {
this.setHelpUrl('');
},
};
const defaultOptions = {
const options = {
toolbox: {
kind: 'flyoutToolbox',
contents: [
Expand All @@ -86,11 +72,6 @@ document.addEventListener('DOMContentLoaded', function () {
},
};

// createPlayground is from @blockly/dev-tools.
// eslint-disable-next-line no-undef
createPlayground(
document.getElementById('root'),
createWorkspace,
defaultOptions,
);
Blockly.inject(document.getElementById('root'), options);
initTooltips();
});
Loading

0 comments on commit 07b745c

Please sign in to comment.