From 1279c0aacefb8bbfaaa9786531a56c5a45cf24ee Mon Sep 17 00:00:00 2001 From: Aaron Dodson Date: Tue, 15 Oct 2024 13:55:58 -0700 Subject: [PATCH] fix: improve sizing and rendering of comments (#219) --- src/css.js | 3 +++ src/index.js | 4 ++++ src/scratch_comment_bubble.js | 1 + 3 files changed, 8 insertions(+) diff --git a/src/css.js b/src/css.js index 4fab79936e..589f876ec1 100644 --- a/src/css.js +++ b/src/css.js @@ -524,6 +524,9 @@ const styles = ` stroke-width: 3px; } + .blocklyCommentText::placeholder { + font-style: italic; + } .blocklyCommentTextarea { background-color: #fef49c; diff --git a/src/index.js b/src/index.js index d259ff00ee..8dbdba98d1 100644 --- a/src/index.js +++ b/src/index.js @@ -129,3 +129,7 @@ Blockly.ContextMenuRegistry.registry.unregister("blockDelete"); contextMenuItems.registerDeleteBlock(); Blockly.ContextMenuRegistry.registry.unregister("workspaceDelete"); contextMenuItems.registerDeleteAll(); +Blockly.comments.CommentView.defaultCommentSize = new Blockly.utils.Size( + 200, + 200 +); diff --git a/src/scratch_comment_bubble.js b/src/scratch_comment_bubble.js index 8a6b6d5c41..5c958416b7 100644 --- a/src/scratch_comment_bubble.js +++ b/src/scratch_comment_bubble.js @@ -17,6 +17,7 @@ export class ScratchCommentBubble extends Blockly.comments.CommentView { this.sourceBlock = sourceBlock; this.disposing = false; this.id = Blockly.utils.idGenerator.genUid(); + this.setPlaceholderText(Blockly.Msg.WORKSPACE_COMMENT_DEFAULT_TEXT); this.getSvgRoot().setAttribute( "style", `--colour-commentBorder: ${sourceBlock.getColourTertiary()};`