Skip to content

Commit 07b745c

Browse files
chore: remove dev-tools dependency from custom tooltip demo (#2450)
1 parent 6b36d8b commit 07b745c

File tree

4 files changed

+6
-318
lines changed

4 files changed

+6
-318
lines changed

examples/custom-tooltips-demo/index.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
<script src="./node_modules/blockly/blockly_compressed.js"></script>
77
<script src="./node_modules/blockly/blocks_compressed.js"></script>
88
<script src="./node_modules/blockly/msg/en.js"></script>
9-
<script src="./node_modules/@blockly/dev-tools/dist/index.js"></script>
109
<script src="./index.js"></script>
1110
<style>
1211
html,
@@ -17,6 +16,6 @@
1716
</head>
1817

1918
<body>
20-
<div id="root"></div>
19+
<div id="root" style="height: 600px; width: 600px"></div>
2120
</body>
2221
</html>

examples/custom-tooltips-demo/index.js

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,6 @@ function initTooltips() {
4343
Blockly.Tooltip.setCustomTooltip(customTooltip);
4444
}
4545

46-
/**
47-
* Create a workspace.
48-
* @param {HTMLElement} blocklyDiv The blockly container div.
49-
* @param {!Blockly.BlocklyOptions} options The Blockly options.
50-
* @returns {!Blockly.WorkspaceSvg} The created workspace.
51-
*/
52-
function createWorkspace(blocklyDiv, options) {
53-
const workspace = Blockly.inject(blocklyDiv, options);
54-
55-
initTooltips();
56-
57-
return workspace;
58-
}
59-
6046
document.addEventListener('DOMContentLoaded', function () {
6147
Blockly.Blocks['custom_tooltip_1'] = {
6248
init: function () {
@@ -76,7 +62,7 @@ document.addEventListener('DOMContentLoaded', function () {
7662
this.setHelpUrl('');
7763
},
7864
};
79-
const defaultOptions = {
65+
const options = {
8066
toolbox: {
8167
kind: 'flyoutToolbox',
8268
contents: [
@@ -86,11 +72,6 @@ document.addEventListener('DOMContentLoaded', function () {
8672
},
8773
};
8874

89-
// createPlayground is from @blockly/dev-tools.
90-
// eslint-disable-next-line no-undef
91-
createPlayground(
92-
document.getElementById('root'),
93-
createWorkspace,
94-
defaultOptions,
95-
);
75+
Blockly.inject(document.getElementById('root'), options);
76+
initTooltips();
9677
});

0 commit comments

Comments
 (0)