Skip to content

Commit

Permalink
Issue google#4475 fix (google#4758)
Browse files Browse the repository at this point in the history
* Issue google#4475 fix
  • Loading branch information
nixgc authored Apr 8, 2021
1 parent 4be82c0 commit dd5d351
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
1 change: 0 additions & 1 deletion blocks/lists.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
'use strict';

goog.provide('Blockly.Blocks.lists'); // Deprecated
goog.provide('Blockly.Constants.Lists');

goog.require('Blockly');
Expand Down
24 changes: 12 additions & 12 deletions core/events/block_events.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Blockly.Events.BlockBase.prototype.fromJson = function(json) {
* @extends {Blockly.Events.BlockBase}
* @constructor
*/
Blockly.Events.Change = function(opt_block, opt_element, opt_name, opt_oldValue,
Blockly.Events.BlockChange = function(opt_block, opt_element, opt_name, opt_oldValue,
opt_newValue) {
Blockly.Events.Change.superClass_.constructor.call(this, opt_block);
if (!opt_block) {
Expand All @@ -99,7 +99,7 @@ Blockly.Events.Change = function(opt_block, opt_element, opt_name, opt_oldValue,
this.oldValue = typeof opt_oldValue == 'undefined' ? '' : opt_oldValue;
this.newValue = typeof opt_newValue == 'undefined' ? '' : opt_newValue;
};
Blockly.utils.object.inherits(Blockly.Events.Change, Blockly.Events.BlockBase);
Blockly.utils.object.inherits(Blockly.Events.BlockChange, Blockly.Events.BlockBase);

/**
* Class for a block change event.
Expand All @@ -112,20 +112,20 @@ Blockly.utils.object.inherits(Blockly.Events.Change, Blockly.Events.BlockBase);
* @extends {Blockly.Events.BlockBase}
* @constructor
*/
Blockly.Events.BlockChange = Blockly.Events.Change;
Blockly.Events.Change = Blockly.Events.BlockChange;

/**
* Type of this event.
* @type {string}
*/
Blockly.Events.Change.prototype.type = Blockly.Events.CHANGE;
Blockly.Events.BlockChange.prototype.type = Blockly.Events.CHANGE;

/**
* Encode the event as JSON.
* @return {!Object} JSON representation.
*/
Blockly.Events.Change.prototype.toJson = function() {
var json = Blockly.Events.Change.superClass_.toJson.call(this);
Blockly.Events.BlockChange.prototype.toJson = function() {
var json = Blockly.Events.BlockChange.superClass_.toJson.call(this);
json['element'] = this.element;
if (this.name) {
json['name'] = this.name;
Expand All @@ -139,8 +139,8 @@ Blockly.Events.Change.prototype.toJson = function() {
* Decode the JSON event.
* @param {!Object} json JSON representation.
*/
Blockly.Events.Change.prototype.fromJson = function(json) {
Blockly.Events.Change.superClass_.fromJson.call(this, json);
Blockly.Events.BlockChange.prototype.fromJson = function(json) {
Blockly.Events.BlockChange.superClass_.fromJson.call(this, json);
this.element = json['element'];
this.name = json['name'];
this.oldValue = json['oldValue'];
Expand All @@ -151,15 +151,15 @@ Blockly.Events.Change.prototype.fromJson = function(json) {
* Does this event record any change of state?
* @return {boolean} False if something changed.
*/
Blockly.Events.Change.prototype.isNull = function() {
Blockly.Events.BlockChange.prototype.isNull = function() {
return this.oldValue == this.newValue;
};

/**
* Run a change event.
* @param {boolean} forward True if run forward, false if run backward (undo).
*/
Blockly.Events.Change.prototype.run = function(forward) {
Blockly.Events.BlockChange.prototype.run = function(forward) {
var workspace = this.getEventWorkspace_();
var block = workspace.getBlockById(this.blockId);
if (!block) {
Expand Down Expand Up @@ -202,7 +202,7 @@ Blockly.Events.Change.prototype.run = function(forward) {
var dom = Blockly.Xml.textToDom(/** @type {string} */ (value) || '<mutation/>');
block.domToMutation(dom);
}
Blockly.Events.fire(new (Blockly.Events.get(Blockly.Events.CHANGE))(
Blockly.Events.fire(new Blockly.Events.BlockChange(
block, 'mutation', null, oldMutation, value));
break;
default:
Expand Down Expand Up @@ -568,6 +568,6 @@ Blockly.registry.register(Blockly.registry.Type.EVENT, Blockly.Events.CREATE,
Blockly.registry.register(Blockly.registry.Type.EVENT, Blockly.Events.DELETE,
Blockly.Events.Delete);
Blockly.registry.register(Blockly.registry.Type.EVENT, Blockly.Events.CHANGE,
Blockly.Events.Change);
Blockly.Events.BlockChange);
Blockly.registry.register(Blockly.registry.Type.EVENT, Blockly.Events.MOVE,
Blockly.Events.Move);

0 comments on commit dd5d351

Please sign in to comment.