fix: enforce placeholder usage for workspace comment (#9463)

* fix: enforce placeholder usage for workspace comment

Signed-off-by: SimonShiki <sinangentoo@gmail.com>

* fix: lint

Signed-off-by: SimonShiki <sinangentoo@gmail.com>

---------

Signed-off-by: SimonShiki <sinangentoo@gmail.com>
This commit is contained in:
Simon Shiki
2025-12-06 01:19:52 +08:00
committed by GitHub
parent 8a226d8737
commit da5e8e68e3
2 changed files with 5 additions and 1 deletions

View File

@@ -8,6 +8,7 @@ import * as browserEvents from '../browser_events.js';
import {getFocusManager} from '../focus_manager.js';
import {IFocusableNode} from '../interfaces/i_focusable_node.js';
import {IFocusableTree} from '../interfaces/i_focusable_tree.js';
import {Msg} from '../msg.js';
import * as touch from '../touch.js';
import * as dom from '../utils/dom.js';
import {Rect} from '../utils/rect.js';
@@ -56,6 +57,10 @@ export class CommentEditor implements IFocusableNode {
) as HTMLTextAreaElement;
this.textArea.setAttribute('tabindex', '-1');
this.textArea.setAttribute('dir', this.workspace.RTL ? 'RTL' : 'LTR');
this.textArea.setAttribute(
'placeholder',
Msg['WORKSPACE_COMMENT_DEFAULT_TEXT'],
);
dom.addClass(this.textArea, 'blocklyCommentText');
dom.addClass(this.textArea, 'blocklyTextarea');
dom.addClass(this.textArea, 'blocklyText');

View File

@@ -636,7 +636,6 @@ export function registerCommentCreate() {
if (!workspace) return;
eventUtils.setGroup(true);
const comment = new RenderedWorkspaceComment(workspace);
comment.setPlaceholderText(Msg['WORKSPACE_COMMENT_DEFAULT_TEXT']);
comment.moveTo(
svgMath.screenToWsCoordinates(
workspace,