mirror of
https://github.com/google/blockly.git
synced 2026-01-07 17:10:11 +01:00
fix: copy paste with json system (#5423)
* fix: copy paste w/ json system * fix: pr comments
This commit is contained in:
committed by
alschmiedt
parent
96935c2502
commit
e7541cb315
@@ -57,8 +57,8 @@ const Tooltip = goog.require('Blockly.Tooltip');
|
||||
const Warning = goog.requireType('Blockly.Warning');
|
||||
/* eslint-disable-next-line no-unused-vars */
|
||||
const WorkspaceSvg = goog.requireType('Blockly.WorkspaceSvg');
|
||||
const Xml = goog.require('Blockly.Xml');
|
||||
const blockAnimations = goog.require('Blockly.blockAnimations');
|
||||
const blocks = goog.require('Blockly.serialization.blocks');
|
||||
const browserEvents = goog.require('Blockly.browserEvents');
|
||||
const common = goog.require('Blockly.common');
|
||||
const connectionTypes = goog.require('Blockly.connectionTypes');
|
||||
@@ -996,15 +996,9 @@ BlockSvg.prototype.toCopyData = function() {
|
||||
if (this.isInsertionMarker_) {
|
||||
return null;
|
||||
}
|
||||
const xml = /** @type {!Element} */ (Xml.blockToDom(this, true));
|
||||
// Copy only the selected block and internal blocks.
|
||||
Xml.deleteNext(xml);
|
||||
// Encode start position in XML.
|
||||
const xy = this.getRelativeToSurfaceXY();
|
||||
xml.setAttribute('x', this.RTL ? -xy.x : xy.x);
|
||||
xml.setAttribute('y', xy.y);
|
||||
return {
|
||||
xml: xml,
|
||||
saveInfo: /** @type {!blocks.State} */(blocks.save(
|
||||
this, {addCoordinates: true, addNextBlocks: false})),
|
||||
source: this.workspace,
|
||||
typeCounts: utils.getBlockTypeCounts(this, true)
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user