Commit ca9ee114 authored by Neil Fraser's avatar Neil Fraser

Remove 'id' from XML unless realtime is enabled.

parent 8aa8bbb5
......@@ -62,7 +62,10 @@ Blockly.Xml.workspaceToDom = function(workspace) {
Blockly.Xml.blockToDom_ = function(block) {
var element = goog.dom.createDom('block');
element.setAttribute('type', block.type);
if (Blockly.Realtime.isEnabled()) {
// Only used by realtime.
element.setAttribute('id', block.id);
}
if (block.mutationToDom) {
// Custom data for an advanced block.
var mutation = block.mutationToDom();
......@@ -297,6 +300,7 @@ Blockly.Xml.domToBlockHeadless_ =
}
var id = xmlBlock.getAttribute('id');
if (opt_reuseBlock && id) {
// Only used by realtime.
block = Blockly.Block.getById(id, workspace);
// TODO: The following is for debugging. It should never actually happen.
if (!block) {
......@@ -441,7 +445,7 @@ Blockly.Xml.domToBlockHeadless_ =
}
// Give the block a chance to clean up any initial inputs.
if (block.validate) {
block.validate.call(block);
block.validate();
}
return block;
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment