Don’t preserve IDs during cut/copy/paste or flyout

Previously, if the XML of a toolbox contained a block ID, the first creation of this block would inherit this ID.  Thus two realtime collaborators could realistically end up with conflict.  Likewise, cut and paste could generate similar conflict.
This commit is contained in:
Neil Fraser
2019-05-01 21:12:38 -07:00
committed by Neil Fraser
parent e06916e5e3
commit 6f433d7521
2 changed files with 2 additions and 2 deletions

View File

@@ -281,7 +281,7 @@ Blockly.copy_ = function(toCopy) {
if (toCopy.isComment) {
var xml = toCopy.toXmlWithXY();
} else {
var xml = Blockly.Xml.blockToDom(toCopy);
var xml = Blockly.Xml.blockToDom(toCopy, true);
// Copy only the selected block and internal blocks.
Blockly.Xml.deleteNext(xml);
// Encode start position in XML.

View File

@@ -794,7 +794,7 @@ Blockly.Flyout.prototype.placeNewBlock_ = function(oldBlock) {
}
// Create the new block by cloning the block in the flyout (via XML).
var xml = Blockly.Xml.blockToDom(oldBlock);
var xml = Blockly.Xml.blockToDom(oldBlock, true);
// The target workspace would normally resize during domToBlock, which will
// lead to weird jumps. Save it for terminateDrag.
targetWorkspace.setResizesEnabled(false);