Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deprecate: workspace paste #7356

Merged
merged 5 commits into from
Aug 15, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions core/workspace_svg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ import * as Xml from './xml.js';
import {ZoomControls} from './zoom_controls.js';
import {ContextMenuOption} from './contextmenu_registry.js';
import * as renderManagement from './render_management.js';
import * as deprecation from './utils/deprecation.js';

/** Margin around the top/bottom/left/right after a zoomToFit call. */
const ZOOM_TO_FIT_MARGIN = 20;
Expand Down Expand Up @@ -1291,10 +1292,18 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg {
*
* @param state The representation of the thing to paste.
* @returns The pasted thing, or null if the paste was not successful.
* @deprecated v11. Use `Blockly.clipboard.paste` instead. To be removed in
* v12.
*/
paste(
state: AnyDuringMigration | Element | DocumentFragment,
): ICopyable<ICopyData> | null {
deprecation.warn(
'Blockly.WorkspaceSvg.prototype.paste',
'v11',
'v12',
'Blockly.clipboard.paste',
);
if (!this.rendered || (!state['type'] && !state['tagName'])) {
return null;
}
Expand Down Expand Up @@ -1382,10 +1391,6 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg {
for (let i = 0, connection; (connection = connections[i]); i++) {
const neighbour = connection.closest(
config.snapRadius,
// TODO: This code doesn't work because it's passing an absolute
// coordinate instead of a relative coordinate. Need to
// figure out if I'm deprecating this function or if I
// need to fix this.
BeksOmega marked this conversation as resolved.
Show resolved Hide resolved
new Coordinate(blockX, blockY),
);
if (neighbour.connection) {
Expand Down Expand Up @@ -1439,9 +1444,6 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg {
// with any blocks.
commentX += 50;
commentY += 50;
// TODO: This code doesn't work because it's using absolute coords
// where relative coords are expected. Need to figure out what I'm
// doing with this function and if I need to fix it.
comment.moveBy(commentX, commentY);
}
} finally {
Expand Down
Loading