mirror of
https://github.com/scratchfoundation/scratch-blocks.git
synced 2025-08-14 15:09:18 -04:00
Use placeholders instead of a default value for comments
This commit is contained in:
parent
ef1de26862
commit
c72e6934b4
4 changed files with 9 additions and 3 deletions
|
@ -292,7 +292,7 @@ Blockly.ContextMenu.blockCommentOption = function(block) {
|
|||
// If there's no comment, add an option to create a comment.
|
||||
commentOption.text = Blockly.Msg.ADD_COMMENT;
|
||||
commentOption.callback = function() {
|
||||
block.setCommentText(Blockly.Msg.WORKSPACE_COMMENT_DEFAULT_TEXT);
|
||||
block.setCommentText('');
|
||||
};
|
||||
}
|
||||
return commentOption;
|
||||
|
@ -468,8 +468,7 @@ Blockly.ContextMenu.workspaceCommentOption = function(ws, e) {
|
|||
disabled = true;
|
||||
}
|
||||
var comment = new Blockly.WorkspaceCommentSvg(
|
||||
ws, Blockly.Msg.WORKSPACE_COMMENT_DEFAULT_TEXT,
|
||||
Blockly.WorkspaceCommentSvg.DEFAULT_SIZE,
|
||||
ws, '', Blockly.WorkspaceCommentSvg.DEFAULT_SIZE,
|
||||
Blockly.WorkspaceCommentSvg.DEFAULT_SIZE, false);
|
||||
|
||||
var injectionDiv = ws.getInjectionDiv();
|
||||
|
|
|
@ -695,6 +695,11 @@ Blockly.Css.CONTENT = [
|
|||
'overflow: hidden;',
|
||||
'}',
|
||||
|
||||
'.scratchCommentTextarea::placeholder {',
|
||||
'color: rgba(0,0,0,0.5);',
|
||||
'font-style: italic;',
|
||||
'}',
|
||||
|
||||
'.scratchCommentResizeSE {',
|
||||
'cursor: se-resize;',
|
||||
'fill: transparent;',
|
||||
|
|
|
@ -227,6 +227,7 @@ Blockly.ScratchBlockComment.prototype.createEditor_ = function() {
|
|||
textarea.className = 'scratchCommentTextarea scratchCommentText';
|
||||
textarea.setAttribute('dir', this.block_.RTL ? 'RTL' : 'LTR');
|
||||
textarea.setAttribute('maxlength', Blockly.ScratchBlockComment.COMMENT_TEXT_LIMIT);
|
||||
textarea.setAttribute('placeholder', Blockly.Msg.WORKSPACE_COMMENT_DEFAULT_TEXT);
|
||||
body.appendChild(textarea);
|
||||
this.textarea_ = textarea;
|
||||
this.textarea_.style.margin = (Blockly.ScratchBlockComment.TEXTAREA_OFFSET) + 'px';
|
||||
|
|
|
@ -183,6 +183,7 @@ Blockly.WorkspaceCommentSvg.prototype.createEditor_ = function() {
|
|||
textarea.className = 'scratchCommentTextarea scratchCommentText';
|
||||
textarea.setAttribute('dir', this.RTL ? 'RTL' : 'LTR');
|
||||
textarea.setAttribute('maxlength', Blockly.WorkspaceComment.COMMENT_TEXT_LIMIT);
|
||||
textarea.setAttribute('placeholder', Blockly.Msg.WORKSPACE_COMMENT_DEFAULT_TEXT);
|
||||
body.appendChild(textarea);
|
||||
this.textarea_ = textarea;
|
||||
this.textarea_.style.margin = (Blockly.WorkspaceCommentSvg.TEXTAREA_OFFSET) + 'px';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue