fix: added id to rendered ws comments; made getCommentById public; added blocklyDraggable class to ws comments (#8358)

This commit is contained in:
Chang Min Bark
2024-07-15 21:39:39 -04:00
committed by GitHub
parent e634b51e41
commit 4cdca28fe5
3 changed files with 2 additions and 2 deletions

View File

@@ -104,7 +104,7 @@ export class CommentView implements IRenderedElement {
constructor(private readonly workspace: WorkspaceSvg) { constructor(private readonly workspace: WorkspaceSvg) {
this.svgRoot = dom.createSvgElement(Svg.G, { this.svgRoot = dom.createSvgElement(Svg.G, {
'class': 'blocklyComment blocklyEditable', 'class': 'blocklyComment blocklyEditable blocklyDraggable',
}); });
this.highlightRect = this.createHighlightRect(this.svgRoot); this.highlightRect = this.createHighlightRect(this.svgRoot);

View File

@@ -57,6 +57,7 @@ export class RenderedWorkspaceComment
// Set the size to the default size as defined in the superclass. // Set the size to the default size as defined in the superclass.
this.view.setSize(this.getSize()); this.view.setSize(this.getSize());
this.view.setEditable(this.isEditable()); this.view.setEditable(this.isEditable());
this.view.getSvgRoot().setAttribute('data-id', this.id);
this.addModelUpdateBindings(); this.addModelUpdateBindings();

View File

@@ -748,7 +748,6 @@ export class Workspace implements IASTNodeLocation {
* *
* @param id ID of comment to find. * @param id ID of comment to find.
* @returns The sought after comment, or null if not found. * @returns The sought after comment, or null if not found.
* @internal
*/ */
getCommentById(id: string): WorkspaceComment | null { getCommentById(id: string): WorkspaceComment | null {
return this.commentDB.get(id) ?? null; return this.commentDB.get(id) ?? null;