From 4cdca28fe5c92ce883cc597d517d01531bf8770e Mon Sep 17 00:00:00 2001 From: Chang Min Bark <88669927+changminbark@users.noreply.github.com> Date: Mon, 15 Jul 2024 21:39:39 -0400 Subject: [PATCH] fix: added id to rendered ws comments; made getCommentById public; added blocklyDraggable class to ws comments (#8358) --- core/comments/comment_view.ts | 2 +- core/comments/rendered_workspace_comment.ts | 1 + core/workspace.ts | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/comments/comment_view.ts b/core/comments/comment_view.ts index 8fa3ea694..bda2b9762 100644 --- a/core/comments/comment_view.ts +++ b/core/comments/comment_view.ts @@ -104,7 +104,7 @@ export class CommentView implements IRenderedElement { constructor(private readonly workspace: WorkspaceSvg) { this.svgRoot = dom.createSvgElement(Svg.G, { - 'class': 'blocklyComment blocklyEditable', + 'class': 'blocklyComment blocklyEditable blocklyDraggable', }); this.highlightRect = this.createHighlightRect(this.svgRoot); diff --git a/core/comments/rendered_workspace_comment.ts b/core/comments/rendered_workspace_comment.ts index 1234d6ef8..79caf6a1d 100644 --- a/core/comments/rendered_workspace_comment.ts +++ b/core/comments/rendered_workspace_comment.ts @@ -57,6 +57,7 @@ export class RenderedWorkspaceComment // Set the size to the default size as defined in the superclass. this.view.setSize(this.getSize()); this.view.setEditable(this.isEditable()); + this.view.getSvgRoot().setAttribute('data-id', this.id); this.addModelUpdateBindings(); diff --git a/core/workspace.ts b/core/workspace.ts index 2e9b2b0a1..16f32611b 100644 --- a/core/workspace.ts +++ b/core/workspace.ts @@ -748,7 +748,6 @@ export class Workspace implements IASTNodeLocation { * * @param id ID of comment to find. * @returns The sought after comment, or null if not found. - * @internal */ getCommentById(id: string): WorkspaceComment | null { return this.commentDB.get(id) ?? null;