优化blockly多行

This commit is contained in:
ckcz123 2021-08-30 20:11:12 +08:00
parent 804e5a4039
commit 6291d1ea65
3 changed files with 23 additions and 10 deletions

View File

@ -2055,37 +2055,37 @@ return code;
*/;
animate_s
: '显示动画' IdString '位置' 'x' PosString? 'y' PosString? '相对窗口坐标' Bool '不等待执行完毕' Bool Newline
: '显示动画' EvalString '位置' 'x' PosString? 'y' PosString? '相对窗口坐标' Bool '不等待执行完毕' Bool Newline
/* animate_s
tooltip : animate显示动画,位置填hero或者1,2形式的位置,或者不填代表当前事件点
helpUrl : /_docs/#/instruction
default : ["zone","","",false,false]
allAnimates : ['IdString_0']
material : ["./project/animates/", "IdString_0"]
allAnimates : ['EvalString_0']
material : ["./project/animates/", "EvalString_0"]
menu : [['选择位置', 'editor_blockly.selectPoint(block, ["PosString_0", "PosString_1"])']]
colour : this.soundColor
var loc = PosString_0&&PosString_1?(', "loc": ['+PosString_0+','+PosString_1+']'):'';
Bool_0 = Bool_0?', "alignWindow": true':'';
Bool_1 = Bool_1?', "async": true':'';
var code = '{"type": "animate", "name": "'+IdString_0+'"'+loc+Bool_0+Bool_1+'},\n';
var code = '{"type": "animate", "name": "'+EvalString_0+'"'+loc+Bool_0+Bool_1+'},\n';
return code;
*/;
animate_1_s
: '显示动画并跟随角色' IdString '不等待执行完毕' Bool Newline
: '显示动画并跟随角色' EvalString '不等待执行完毕' Bool Newline
/* animate_1_s
tooltip : animate显示动画并跟随角色
helpUrl : /_docs/#/instruction
default : ["zone",false]
allAnimates : ['IdString_0']
material : ["./project/animates/", "IdString_0"]
allAnimates : ['EvalString_0']
material : ["./project/animates/", "EvalString_0"]
colour : this.soundColor
Bool_0 = Bool_0?', "async": true':'';
var code = '{"type": "animate", "name": "'+IdString_0+'", "loc": "hero"'+Bool_0+'},\n';
var code = '{"type": "animate", "name": "'+EvalString_0+'", "loc": "hero"'+Bool_0+'},\n';
return code;
*/;

View File

@ -1189,3 +1189,16 @@ Blockly.FieldDropdown.prototype.doValueUpdate_ = function (newValue) {
this.selectedOption_ = options[options.length - 1];
}
};
Blockly.FieldMultilineInput.prototype.getDisplayText_ = function() {
var value = this.value_;
if (!value) return Blockly.Field.NBSP;
var curr = '', text = '';
for (var i = 0; i < value.length; ++i) {
if (value[i] == '\n' || curr.length == this.maxDisplayLength) {
text += curr.replace(/\s/g, Blockly.Field.NBSP) + '\n';
curr = value[i] == '\n' ? '' : value[i];
} else curr += value[i];
}
return text + curr;
};

View File

@ -109,7 +109,7 @@
}
});
if (!isInput)
style.whiteSpace = 'pre';
style.whiteSpace = 'pre-wrap';
if (isFirefox) {
// Firefox lies about the overflow property for textareas: https://bugzilla.mozilla.org/show_bug.cgi?id=984275