mirror of
https://github.com/scratchfoundation/scratch-blocks.git
synced 2025-08-28 22:10:31 -04:00
Force focus after block comments are created
This commit is contained in:
parent
c72e6934b4
commit
e0830881f6
2 changed files with 8 additions and 3 deletions
|
@ -293,6 +293,7 @@ Blockly.ContextMenu.blockCommentOption = function(block) {
|
|||
commentOption.text = Blockly.Msg.ADD_COMMENT;
|
||||
commentOption.callback = function() {
|
||||
block.setCommentText('');
|
||||
block.comment.focus();
|
||||
};
|
||||
}
|
||||
return commentOption;
|
||||
|
|
|
@ -244,9 +244,6 @@ Blockly.ScratchBlockComment.prototype.createEditor_ = function() {
|
|||
this.text_ = textarea.value;
|
||||
}
|
||||
});
|
||||
setTimeout(function() {
|
||||
textarea.focus();
|
||||
}, 0);
|
||||
|
||||
// Label for comment top bar when comment is minimized
|
||||
this.label_ = this.getLabelText();
|
||||
|
@ -637,3 +634,10 @@ Blockly.ScratchBlockComment.prototype.dispose = function() {
|
|||
this.workspace.removeTopComment(this);
|
||||
Blockly.Icon.prototype.dispose.call(this);
|
||||
};
|
||||
|
||||
/**
|
||||
* Focus this comments textarea.
|
||||
*/
|
||||
Blockly.ScratchBlockComment.prototype.focus = function() {
|
||||
this.textarea_.focus();
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue