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

fix!: Move backwards-compatibility hacks to main.js #6260

Merged
merged 5 commits into from
Jul 5, 2022
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix!: Move backwards-compatibility hacks out of tooltip.js
Move accessor properties for Blockly.Tooltip.visible and .DIV
from core/tooltip.js to core/main.js.
  • Loading branch information
cpcallen committed Jul 5, 2022
commit 8d6aa43bad37d92fadb29d72991659580ad114bc
39 changes: 39 additions & 0 deletions core/main.js
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@ const Blockly = goog.require('Blockly');
const ContextMenu = goog.require('Blockly.ContextMenu');
const Events = goog.require('Blockly.Events');
const Msg = goog.require('Blockly.Msg');
const Tooltip = goog.require('Blockly.Tooltip');
const colour = goog.require('Blockly.utils.colour');
const common = goog.require('Blockly.common');
const deprecation = goog.require('Blockly.utils.deprecation');
@@ -213,6 +214,44 @@ Object.defineProperties(Events, {
},
});


// Add accessors for properties on Blockly.Tooltip that have now been
// deprecated.
Object.defineProperties(Tooltip, {
/**
* Is a tooltip currently showing?
* @name Blockly.Tooltip.visible
* @type {boolean}
* @deprecated Use Blockly.Tooltip.isVisible() instead. (September
* 2021)
* @suppress {checkTypes}
*/
visible: {
get: function() {
deprecation.warn(
'Blockly.Tooltip.visible', 'September 2021', 'September 2022',
'Blockly.Tooltip.isVisible()');
return Tooltip.isVisible();
},
},
/**
* The HTML container. Set once by createDom.
* @name Blockly.Tooltip.DIV
* @type {HTMLDivElement}
* @deprecated Use Blockly.Tooltip.getDiv() and .setDiv().
* (September 2021)
* @suppress {checkTypes}
*/
DIV: {
get: function() {
deprecation.warn(
'Blockly.Tooltip.DIV', 'September 2021', 'September 2022',
'Blockly.Tooltip.getDiv()');
return Tooltip.getDiv();
},
},
});

// If Blockly is compiled with ADVANCED_COMPILATION and/or loaded as a
// CJS or ES module there will not be a Blockly global variable
// created. This can cause problems because a very common way of
39 changes: 0 additions & 39 deletions core/tooltip.js
Original file line number Diff line number Diff line change
@@ -20,7 +20,6 @@ goog.module('Blockly.Tooltip');
const blocklyString = goog.require('Blockly.utils.string');
const browserEvents = goog.require('Blockly.browserEvents');
const common = goog.require('Blockly.common');
const deprecation = goog.require('Blockly.utils.deprecation');


/**
@@ -90,25 +89,6 @@ const isVisible = function() {
};
exports.isVisible = isVisible;

Object.defineProperties(exports, {
/**
* Is a tooltip currently showing?
* @name Blockly.Tooltip.visible
* @type {boolean}
* @deprecated Use Blockly.Tooltip.isVisible() instead. (September
* 2021)
* @suppress {checkTypes}
*/
visible: {
get: function() {
deprecation.warn(
'Blockly.Tooltip.visible', 'September 2021', 'September 2022',
'Blockly.Tooltip.isVisible()');
return isVisible();
},
},
});

/**
* Is someone else blocking the tooltip from being shown?
* @type {boolean}
@@ -206,25 +186,6 @@ const getDiv = function() {
};
exports.getDiv = getDiv;

Object.defineProperties(exports, {
/**
* The HTML container. Set once by createDom.
* @name Blockly.Tooltip.DIV
* @type {HTMLDivElement}
* @deprecated Use Blockly.Tooltip.getDiv() and .setDiv().
* (September 2021)
* @suppress {checkTypes}
*/
DIV: {
get: function() {
deprecation.warn(
'Blockly.Tooltip.DIV', 'September 2021', 'September 2022',
'Blockly.Tooltip.getDiv()');
return getDiv();
},
},
});

/**
* Returns the tooltip text for the given element.
* @param {?Object} object The object to get the tooltip text of.