comment.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. Blockly.Blocks['comment_single'] = {
  2. init: function() {
  3. this.appendDummyInput()
  4. .appendField("Comment:")
  5. .appendField(new Blockly.FieldTextInput("will be ignored"), "BODY");
  6. this.setInputsInline(true);
  7. this.setPreviousStatement(true, null);
  8. this.setNextStatement(true, null);
  9. this.setColour(60);
  10. this.setTooltip('This is a comment, which will be ignored when you execute your code.');
  11. this.setHelpUrl('');
  12. }
  13. };
  14. Blockly.Blocks['string_multiline'] = {
  15. // Container.
  16. init: function() {
  17. this.appendDummyInput()
  18. .appendField('Multiline String:');
  19. this.appendDummyInput()
  20. .appendField(this.newQuote_(true))
  21. .appendField(new Blockly.FieldTextArea(''), 'TEXT')
  22. .appendField(this.newQuote_(false));
  23. this.setColour(Blockly.Blocks.texts.HUE);
  24. this.setOutput(true, 'String');
  25. },
  26. newQuote_: function(open) {
  27. if (open == this.RTL) {
  28. var file = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAqUlEQVQI1z3KvUpCcRiA8ef9E4JNHhI0aFEacm1o0BsI0Slx8wa8gLauoDnoBhq7DcfWhggONDmJJgqCPA7neJ7p934EOOKOnM8Q7PDElo/4x4lFb2DmuUjcUzS3URnGib9qaPNbuXvBO3sGPHJDRG6fGVdMSeWDP2q99FQdFrz26Gu5Tq7dFMzUvbXy8KXeAj57cOklgA+u1B5AoslLtGIHQMaCVnwDnADZIFIrXsoXrgAAAABJRU5ErkJggg==';
  29. } else {
  30. var file = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAn0lEQVQI1z3OMa5BURSF4f/cQhAKjUQhuQmFNwGJEUi0RKN5rU7FHKhpjEH3TEMtkdBSCY1EIv8r7nFX9e29V7EBAOvu7RPjwmWGH/VuF8CyN9/OAdvqIXYLvtRaNjx9mMTDyo+NjAN1HNcl9ZQ5oQMM3dgDUqDo1l8DzvwmtZN7mnD+PkmLa+4mhrxVA9fRowBWmVBhFy5gYEjKMfz9AylsaRRgGzvZAAAAAElFTkSuQmCC';
  31. }
  32. return new Blockly.FieldImage(file, 12, 12, '"');
  33. }
  34. };