Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove dev-tools dependency from custom tooltip demo #2450

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading