mirror of
https://github.com/google/blockly.git
synced 2026-01-16 05:17:09 +01:00
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:
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user