mirror of
https://github.com/google/blockly.git
synced 2026-01-07 00:50:27 +01:00
Don't split dropdown text if there is an image.
This commit is contained in:
@@ -246,9 +246,10 @@ Blockly.FieldDropdown.prototype.trimOptions_ = function() {
|
||||
var strings = [];
|
||||
for (var i = 0; i < options.length; i++) {
|
||||
var text = options[i][0];
|
||||
if (typeof text == 'string') {
|
||||
strings.push(text);
|
||||
if (typeof text != 'string') {
|
||||
return; // No text splitting if there is an image in the list.
|
||||
}
|
||||
strings.push(text);
|
||||
}
|
||||
var shortest = Blockly.shortestStringLength(strings);
|
||||
var prefixLength = Blockly.commonWordPrefix(strings, shortest);
|
||||
@@ -270,11 +271,9 @@ Blockly.FieldDropdown.prototype.trimOptions_ = function() {
|
||||
var newOptions = [];
|
||||
for (var i = 0; i < options.length; i++) {
|
||||
var text = options[i][0];
|
||||
if (typeof text == 'string') {
|
||||
var value = options[i][1];
|
||||
text = text.substring(prefixLength, text.length - suffixLength);
|
||||
newOptions[i] = [text, value];
|
||||
}
|
||||
var value = options[i][1];
|
||||
text = text.substring(prefixLength, text.length - suffixLength);
|
||||
newOptions[i] = [text, value];
|
||||
}
|
||||
this.menuGenerator_ = newOptions;
|
||||
};
|
||||
|
||||
@@ -92,7 +92,7 @@ Blockly.hasClass_ = function(element, className) {
|
||||
|
||||
/**
|
||||
* Bind an event to a function call. When calling the function, verifies that
|
||||
* it belongs to the touch stream that is currently being processsed, and splits
|
||||
* it belongs to the touch stream that is currently being processed, and splits
|
||||
* multitouch events into multiple events as needed.
|
||||
* @param {!Node} node Node upon which to listen.
|
||||
* @param {string} name Event name to listen to (e.g. 'mousedown').
|
||||
|
||||
Reference in New Issue
Block a user