mirror of
https://github.com/google/blockly.git
synced 2026-01-09 18:10:08 +01:00
Merge pull request #2526 from BeksOmega/fixes/FieldNameXML
Moved Serializing the Field's Name up to xml.js
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user