Moved serializing the field's name up to xml.js

This commit is contained in:
Beka Westberg
2019-05-31 10:12:57 -07:00
parent 44c01ff22a
commit 2f0b02525a
3 changed files with 1 additions and 2 deletions

View File

@@ -292,7 +292,6 @@ Blockly.Field.prototype.fromXml = function(fieldElement) {
* @package
*/
Blockly.Field.prototype.toXml = function(fieldElement) {
fieldElement.setAttribute('name', this.name);
fieldElement.textContent = this.getValue();
return fieldElement;
};

View File

@@ -151,7 +151,6 @@ Blockly.FieldVariable.prototype.toXml = function(fieldElement) {
// Make sure the variable is initialized.
this.initModel();
fieldElement.setAttribute('name', this.name);
fieldElement.setAttribute('id', this.variable_.getId());
fieldElement.textContent = this.variable_.name;
fieldElement.setAttribute('variableType', this.variable_.type);

View File

@@ -109,6 +109,7 @@ Blockly.Xml.blockToDomWithXY = function(block, opt_noId) {
Blockly.Xml.fieldToDom_ = function(field) {
if (field.isSerializable()) {
var container = Blockly.Xml.utils.createElement('field');
container.setAttribute('name', field.name);
return field.toXml(container);
}
return null;