Migrate hideChaff() from Blockly to WorkspaceSvg (#5460)

* Add hideChaff() to core/workspace_svg.js

* Mark Blockly.hideChaff as deprecated

* Update uses of Blockly.hideChaff() to WorkspaceSvg.hideChaff() in core

* Update uses of Blockly.hideChaff() to WorkspaceSvg.hideChaff() in demos

* Style and formatting fixes

* Switch from accessor to stub wrapper for Blockly.hideChaff

Co-authored-by: Christopher Allen <cpcallen+github@gmail.com>

Co-authored-by: Christopher Allen <cpcallen+github@gmail.com>
This commit is contained in:
Aaron Dodson
2021-09-15 13:41:20 -07:00
committed by GitHub
parent 0e43ddc4ba
commit 6a4a359f7b
20 changed files with 73 additions and 58 deletions

View File

@@ -631,7 +631,7 @@ AppController.prototype.confirmLeavePage = function(e) {
* @param {string} id ID of element to show.
*/
AppController.prototype.openModal = function(id) {
Blockly.hideChaff();
Blockly.common.getMainWorkspace().hideChaff();
this.modalName_ = id;
document.getElementById(id).style.display = 'block';
document.getElementById('modalShadow').style.display = 'block';

View File

@@ -88,7 +88,7 @@ BlockFactory.formatChange = function() {
var languageTA = document.getElementById('languageTA');
if (document.getElementById('format').value == 'Manual-JSON' ||
document.getElementById('format').value == 'Manual-JS') {
Blockly.hideChaff();
Blockly.common.getMainWorkspace().hideChaff();
mask.style.display = 'block';
languagePre.style.display = 'none';
languageTA.style.display = 'block';

View File

@@ -35,7 +35,7 @@ function formatChange() {
var languagePre = document.getElementById('languagePre');
var languageTA = document.getElementById('languageTA');
if (document.getElementById('format').value == 'Manual') {
Blockly.hideChaff();
Blockly.common.getMainWorkspace().hideChaff();
mask.style.display = 'block';
languagePre.style.display = 'none';
languageTA.style.display = 'block';

View File

@@ -112,7 +112,7 @@
}
function toggleEditable() {
Blockly.hideChaff();
workspace.hideChaff();
var blocks = workspace.getAllBlocks(false);
for(var i = 0, block; block = blocks[i]; i++) {
block.setEditable(!block.isEditable());
@@ -120,7 +120,7 @@
}
function toggleCollapsed() {
Blockly.hideChaff();
workspace.hideChaff();
var blocks = workspace.getAllBlocks(false);
for(var i = 0, block; block = blocks[i]; i++) {
block.setCollapsed(!block.isCollapsed());