mirror of
https://github.com/google/blockly.git
synced 2026-03-12 00:00:12 +01:00
61 lines
2.1 KiB
Plaintext
61 lines
2.1 KiB
Plaintext
***************
|
|
*** 82,99 ****
|
|
<text class="blocklyIconMark" x="8" y="13">!</text>
|
|
*/
|
|
var iconShield = Blockly.createSvgElement('path',
|
|
- {'class': 'blocklyIconShield',
|
|
'd': 'M 2,15 Q -1,15 0.5,12 L 6.5,1.7 Q 8,-1 9.5,1.7 L 15.5,12 ' +
|
|
'Q 17,15 14,15 z'},
|
|
this.iconGroup_);
|
|
this.iconMark_ = Blockly.createSvgElement('text',
|
|
- {'class': 'blocklyIconMark',
|
|
'x': Blockly.Icon.RADIUS,
|
|
'y': 2 * Blockly.Icon.RADIUS - 3}, this.iconGroup_);
|
|
this.iconMark_.appendChild(document.createTextNode('!'));
|
|
};
|
|
|
|
/**
|
|
* Show or hide the warning bubble.
|
|
* @param {boolean} visible True if the bubble should be visible.
|
|
*/
|
|
--- 82,120 ----
|
|
<text class="blocklyIconMark" x="8" y="13">!</text>
|
|
*/
|
|
var iconShield = Blockly.createSvgElement('path',
|
|
+ {'class': 'blocklyWarningIconShield',
|
|
'd': 'M 2,15 Q -1,15 0.5,12 L 6.5,1.7 Q 8,-1 9.5,1.7 L 15.5,12 ' +
|
|
'Q 17,15 14,15 z'},
|
|
this.iconGroup_);
|
|
this.iconMark_ = Blockly.createSvgElement('text',
|
|
+ {'class': 'blocklyWarningIconMark',
|
|
'x': Blockly.Icon.RADIUS,
|
|
'y': 2 * Blockly.Icon.RADIUS - 3}, this.iconGroup_);
|
|
this.iconMark_.appendChild(document.createTextNode('!'));
|
|
};
|
|
|
|
/**
|
|
+ * Create the text for the warning's bubble.
|
|
+ * @param {string} text The text to display.
|
|
+ * @return {!SVGTextElement} The top-level node of the text.
|
|
+ * @private
|
|
+ */
|
|
+ Blockly.Warning.prototype.textToDom_ = function(text) {
|
|
+ var paragraph = /** @type {!SVGTextElement} */ (
|
|
+ Blockly.createSvgElement(
|
|
+ 'text', {'class': 'blocklyText blocklyErrorWarningText', 'y': Blockly.Bubble.BORDER_WIDTH},
|
|
+ null));
|
|
+ var lines = text.split('\n');
|
|
+ for (var i = 0; i < lines.length; i++) {
|
|
+ var tspanElement = Blockly.createSvgElement('tspan',
|
|
+ {'dy': '1em', 'x': Blockly.Bubble.BORDER_WIDTH}, paragraph);
|
|
+ var textNode = document.createTextNode(lines[i]);
|
|
+ tspanElement.appendChild(textNode);
|
|
+ }
|
|
+ return paragraph;
|
|
+ };
|
|
+
|
|
+ /**
|
|
* Show or hide the warning bubble.
|
|
* @param {boolean} visible True if the bubble should be visible.
|
|
*/
|