-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bb3d8f5
commit 989b9d8
Showing
2 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
75 changes: 75 additions & 0 deletions
75
src/blockly10/src/BlocklyReusable/BlocklyNewBlocks/meta/comment.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import * as Blockly from 'blockly/core'; | ||
import { IBlocksSimple } from '../../blocksInterface'; | ||
|
||
|
||
|
||
export class comment implements IBlocksSimple { | ||
addWrapper(interpreter: any, globalObject: any) { | ||
|
||
} | ||
category: string= "meta"; | ||
definitionBlocksSimple (blocks:any, javaScript:any):void { | ||
const ORDER_ATOMIC = 0; | ||
blocks['comment'] = { | ||
init: function() { | ||
this.appendValueInput("TEXT") | ||
.setCheck(null) | ||
.appendField("comment /* */") | ||
.appendField(new Blockly.FieldLabelSerializable(""), "NAME"); | ||
//this.setOutput(true, null); | ||
this.setPreviousStatement(true, null); | ||
this.setNextStatement(true, null); | ||
this.setTooltip(""); | ||
this.setHelpUrl(""); | ||
} | ||
}; | ||
|
||
javaScript['comment'] = function(block: any) { | ||
// Print statement. | ||
var msg = javaScript.valueToCode(block, 'TEXT', | ||
/*javaScript.*/ORDER_ATOMIC) || '\'\''; | ||
var code= '/*\n' + msg+'\n*/;\n'; | ||
return code; | ||
}; | ||
|
||
blocks['debugger'] = { | ||
init: function() { | ||
this.appendValueInput("TEXT") | ||
.setCheck(null) | ||
.appendField("debugger") | ||
.appendField(new Blockly.FieldLabelSerializable(""), "NAME"); | ||
//this.setOutput(true, null); | ||
this.setPreviousStatement(true, null); | ||
this.setNextStatement(true, null); | ||
this.setTooltip(""); | ||
this.setHelpUrl(""); | ||
} | ||
}; | ||
|
||
javaScript['debugger'] = function(block: any) { | ||
// Print statement. | ||
var msg = javaScript.valueToCode(block, 'TEXT', | ||
/*javaScript.*/ORDER_ATOMIC) || '\'\''; | ||
var code= 'startDebugger('+ msg+",'"+ block.id+"',this);\n"; | ||
return code; | ||
}; | ||
} | ||
|
||
fieldXML() : string { | ||
return `<block type="comment"> | ||
<value name="TEXT"> | ||
<shadow type="text"> | ||
<field name="TEXT">Put here comments</field> | ||
</shadow> | ||
</value> | ||
</block> | ||
<block type="debugger"> | ||
<value name="TEXT"> | ||
<shadow type="text"> | ||
<field name="TEXT">my message for debug</field> | ||
</shadow> | ||
</value> | ||
</block> | ||
` | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters