File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,6 +13,12 @@ import {Size} from '../utils/size.js';
1313import { Svg } from '../utils/svg.js' ;
1414import { WorkspaceSvg } from '../workspace_svg.js' ;
1515
16+ /**
17+ * String added to the ID of a workspace comment to identify
18+ * the focusable node for the comment editor.
19+ */
20+ export const COMMENT_EDITOR_FOCUS_IDENTIFIER = '_comment_textarea_' ;
21+
1622/** The part of a comment that can be typed into. */
1723export class CommentEditor implements IFocusableNode {
1824 id ?: string ;
@@ -52,7 +58,7 @@ export class CommentEditor implements IFocusableNode {
5258 this . foreignObject . appendChild ( body ) ;
5359
5460 if ( commentId ) {
55- this . id = commentId + '_comment_textarea_' ;
61+ this . id = commentId + COMMENT_EDITOR_FOCUS_IDENTIFIER ;
5662 this . textArea . setAttribute ( 'id' , this . id ) ;
5763 }
5864
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import type {Block} from './block.js';
2222import type { BlockSvg } from './block_svg.js' ;
2323import type { BlocklyOptions } from './blockly_options.js' ;
2424import * as browserEvents from './browser_events.js' ;
25+ import { COMMENT_EDITOR_FOCUS_IDENTIFIER } from './comments/comment_editor.js' ;
2526import { RenderedWorkspaceComment } from './comments/rendered_workspace_comment.js' ;
2627import { WorkspaceComment } from './comments/workspace_comment.js' ;
2728import * as common from './common.js' ;
@@ -2779,7 +2780,7 @@ export class WorkspaceSvg
27792780
27802781 // Search for a specific workspace comment editor
27812782 // (only if id seems like it is one).
2782- const commentEditorIndicator = id . indexOf ( '_comment_textarea_' ) ;
2783+ const commentEditorIndicator = id . indexOf ( COMMENT_EDITOR_FOCUS_IDENTIFIER ) ;
27832784 if ( commentEditorIndicator !== - 1 ) {
27842785 const commentId = id . substring ( 0 , commentEditorIndicator ) ;
27852786 const comment = this . searchForWorkspaceComment ( commentId ) ;
You can’t perform that action at this time.
0 commit comments