mirror of
https://github.com/google/blockly.git
synced 2026-01-09 01:50:11 +01:00
Make warnings an optional module.
This commit is contained in:
@@ -35,6 +35,7 @@ goog.require('Blockly.FieldDropdown');
|
||||
goog.require('Blockly.FieldLabel');
|
||||
goog.require('Blockly.FieldNumber');
|
||||
goog.require('Blockly.FieldVariable');
|
||||
goog.require('Blockly.Warning');
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,6 +30,7 @@ goog.require('Blockly.FieldCheckbox');
|
||||
goog.require('Blockly.FieldLabel');
|
||||
goog.require('Blockly.FieldTextInput');
|
||||
goog.require('Blockly.Mutator');
|
||||
goog.require('Blockly.Warning');
|
||||
|
||||
|
||||
Blockly.Blocks['procedures_defnoreturn'] = {
|
||||
|
||||
1
build.py
1
build.py
@@ -237,6 +237,7 @@ goog.provide('Blockly.FieldNumber');
|
||||
goog.provide('Blockly.FieldTextInput');
|
||||
goog.provide('Blockly.FieldVariable');
|
||||
goog.provide('Blockly.Mutator');
|
||||
goog.provide('Blockly.Warning');
|
||||
"""))
|
||||
# Read in all the source files.
|
||||
filenames = glob.glob(os.path.join("blocks", "*.js"))
|
||||
|
||||
@@ -40,7 +40,6 @@ goog.require('Blockly.utils.Coordinate');
|
||||
goog.require('Blockly.utils.dom');
|
||||
goog.require('Blockly.utils.object');
|
||||
goog.require('Blockly.utils.Rect');
|
||||
goog.require('Blockly.Warning');
|
||||
|
||||
|
||||
/**
|
||||
@@ -1107,7 +1106,7 @@ Blockly.BlockSvg.prototype.setCommentText = function(text) {
|
||||
}
|
||||
if (shouldHaveComment) {
|
||||
this.commentIcon_ = new Blockly.Comment(this);
|
||||
this.comment = this.commentIcon_; // For backwards compatibility.
|
||||
this.comment = this.commentIcon_; // For backwards compatibility.
|
||||
} else {
|
||||
this.commentIcon_.dispose();
|
||||
this.commentIcon_ = null;
|
||||
@@ -1127,6 +1126,9 @@ Blockly.BlockSvg.prototype.setCommentText = function(text) {
|
||||
* maintain multiple warnings.
|
||||
*/
|
||||
Blockly.BlockSvg.prototype.setWarningText = function(text, opt_id) {
|
||||
if (!Blockly.Warning) {
|
||||
throw Error('Missing require for Blockly.Warning');
|
||||
}
|
||||
if (!this.warningTextDb_) {
|
||||
// Create a database of warning PIDs.
|
||||
// Only runs once per block (and only those with warnings).
|
||||
|
||||
@@ -30,31 +30,31 @@ goog.provide('Blockly.blockRendering.Types');
|
||||
* @enum {number}
|
||||
*/
|
||||
Blockly.blockRendering.Types = {
|
||||
NONE: 0, // None
|
||||
FIELD: 1 << 0, // Field.
|
||||
HAT: 1 << 1, // Hat.
|
||||
ICON: 1 << 2, // Icon.
|
||||
SPACER: 1 << 3, // Spacer.
|
||||
BETWEEN_ROW_SPACER: 1 << 4, // Between Row Spacer.
|
||||
IN_ROW_SPACER: 1 << 5, // In Row Spacer.
|
||||
NONE: 0, // None
|
||||
FIELD: 1 << 0, // Field.
|
||||
HAT: 1 << 1, // Hat.
|
||||
ICON: 1 << 2, // Icon.
|
||||
SPACER: 1 << 3, // Spacer.
|
||||
BETWEEN_ROW_SPACER: 1 << 4, // Between Row Spacer.
|
||||
IN_ROW_SPACER: 1 << 5, // In Row Spacer.
|
||||
EXTERNAL_VALUE_INPUT: 1 << 6, // External Value Input.
|
||||
INPUT: 1 << 7, // Input
|
||||
INLINE_INPUT: 1 << 8, // Inline Input.
|
||||
STATEMENT_INPUT: 1 << 9, // Statement Input.
|
||||
CONNECTION: 1 << 10, // Connection.
|
||||
INPUT: 1 << 7, // Input.
|
||||
INLINE_INPUT: 1 << 8, // Inline Input.
|
||||
STATEMENT_INPUT: 1 << 9, // Statement Input.
|
||||
CONNECTION: 1 << 10, // Connection.
|
||||
PREVIOUS_CONNECTION: 1 << 11, // Previous Connection.
|
||||
NEXT_CONNECTION: 1 << 12, // Next Connection.
|
||||
OUTPUT_CONNECTION: 1 << 13, // Output Connection.
|
||||
CORNER: 1 << 14, // Corner.
|
||||
LEFT_SQUARE_CORNER: 1 << 15, // Square Corner.
|
||||
LEFT_ROUND_CORNER: 1 << 16, // Round Corner.
|
||||
NEXT_CONNECTION: 1 << 12, // Next Connection.
|
||||
OUTPUT_CONNECTION: 1 << 13, // Output Connection.
|
||||
CORNER: 1 << 14, // Corner.
|
||||
LEFT_SQUARE_CORNER: 1 << 15, // Square Corner.
|
||||
LEFT_ROUND_CORNER: 1 << 16, // Round Corner.
|
||||
RIGHT_SQUARE_CORNER: 1 << 17, // Right Square Corner.
|
||||
RIGHT_ROUND_CORNER: 1 << 18, // Right Round Corner.
|
||||
JAGGED_EDGE: 1 << 19, // Jagged Edge.
|
||||
ROW: 1 << 20, // Row
|
||||
TOP_ROW: 1 << 21, // Top Row.
|
||||
BOTTOM_ROW: 1 << 22, // Bototm Row.
|
||||
INPUT_ROW: 1 << 23, // Input Row.
|
||||
RIGHT_ROUND_CORNER: 1 << 18, // Right Round Corner.
|
||||
JAGGED_EDGE: 1 << 19, // Jagged Edge.
|
||||
ROW: 1 << 20, // Row.
|
||||
TOP_ROW: 1 << 21, // Top Row.
|
||||
BOTTOM_ROW: 1 << 22, // Bottom Row.
|
||||
INPUT_ROW: 1 << 23 // Input Row.
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -62,6 +62,7 @@ goog.require('Blockly.ZoomControls');
|
||||
// None of these should be required when using advanced compilation since
|
||||
// individual block files should include the requirements they depend on.
|
||||
goog.require('Blockly.Mutator');
|
||||
goog.require('Blockly.Warning');
|
||||
goog.require('Blockly.FieldAngle');
|
||||
goog.require('Blockly.FieldCheckbox');
|
||||
goog.require('Blockly.FieldColour');
|
||||
|
||||
@@ -208,7 +208,8 @@ goog.provide('Blockly.FieldMultilineInput');
|
||||
goog.provide('Blockly.FieldNumber');
|
||||
goog.provide('Blockly.FieldTextInput');
|
||||
goog.provide('Blockly.FieldVariable');
|
||||
goog.provide('Blockly.Mutator');`;
|
||||
goog.provide('Blockly.Mutator');
|
||||
goog.provide('Blockly.Warning');`;
|
||||
return gulp.src('blocks/*.js', {base: './'})
|
||||
// Add Blockly.Blocks to be compatible with the compiler.
|
||||
.pipe(gulp.replace(`goog.provide('Blockly.Constants.Colour');`,
|
||||
|
||||
Reference in New Issue
Block a user