In the June 2019 release we renamed a significant number of utility functions. These scripts should help with your renaming, but you should still check that the output is what you expect.
Use blockly_rename_bash_v3.sh
if you are on a Mac.
Note that the script does not rename goog.math.Rect
to Blockly.utils.Rect
because the constructor format has changed. You will need to do that rename manually.
The full list of renames:
-
Blockly.utils.toRadians -> Blockly.utils.math.toRadians
-
Blockly.utils.toDegrees -> Blockly.utils.math.toDegrees
-
Blockly.utils.clampNumber -> Blockly.utils.math.clamp
-
Blockly.SVG_NS -> Blockly.utils.dom.SVG_NS
-
Blockly.HTML_NS -> Blockly.utils.dom.HTML_NS
-
Blockly.utils.createSvgElement -> Blockly.utils.dom.createSvgElement
-
Blockly.utils.addClass -> Blockly.utils.dom.addClass
-
Blockly.utils.removeClass -> Blockly.utils.dom.removeClass
-
Blockly.utils.hasClass -> Blockly.utils.dom.hasClass
-
Blockly.utils.removeNode -> Blockly.utils.dom.removeNode
-
Blockly.utils.insertAfter -> Blockly.utils.dom.insertAfter
-
Blockly.utils.containsNode -> Blockly.utils.dom.containsNode
-
Blockly.utils.setCssTransform -> Blockly.utils.dom.setCssTransform
-
Blockly.utils.startsWith -> Blockly.utils.string.startsWith
-
Blockly.utils.shortestStringLength -> Blockly.utils.string.shortestStringLength
-
Blockly.utils.commonWordPrefix -> Blockly.utils.string.commonWordPrefix
-
Blockly.utils.commonWordSuffix -> Blockly.utils.string.commonWordSuffix
-
Blockly.utils.wrap -> Blockly.utils.string.wrap
-
Blockly.Xml.utils -> Blockly.utils.xml
-
Blockly.BlockAnimations => Blockly.blockAnimations
Additionally, as part of our drive to eliminate Closure, the following dependencies are no longer being used. If you have your own uses of these components, then you should either use the new Blockly equivalents, or else explicitly 'require' these from Closure.
-
goog.math.Coordinate -> Blockly.utils.Coordinate
-
goog.math.Rect -> Blockly.utils.Rect
Note the constructor format has changed:
new goog.math.Rect(left, top, width, height)
-> new Blockly.utils.Rect(top, bottom, left, right)
-
goog.userAgent -> Blockly.utils.userAgent
-
goog.color -> Blockly.utils.colour
-
goog.global -> Blockly.utils.global