iobroker.javascript 7.0.5 → 7.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -8
- package/admin/asset-manifest.json +5 -5
- package/admin/google-blockly/blockly_compressed.js +1469 -1704
- package/admin/google-blockly/blocks_compressed.js +164 -218
- package/admin/google-blockly/javascript_compressed.js +100 -328
- package/admin/google-blockly/msg/js/de.js +64 -70
- package/admin/google-blockly/msg/js/en.js +14 -20
- package/admin/google-blockly/msg/js/es.js +39 -45
- package/admin/google-blockly/msg/js/fr.js +59 -65
- package/admin/google-blockly/msg/js/it.js +19 -25
- package/admin/google-blockly/msg/js/nl.js +55 -61
- package/admin/google-blockly/msg/js/pl.js +46 -52
- package/admin/google-blockly/msg/js/pt.js +30 -36
- package/admin/google-blockly/msg/js/ru.js +41 -47
- package/admin/google-blockly/msg/js/uk.js +13 -17
- package/admin/google-blockly/msg/js/zh-cn.js +86 -92
- package/admin/google-blockly/own/blocks_action.js +4 -4
- package/admin/google-blockly/own/blocks_other.js +103 -0
- package/admin/google-blockly/own/blocks_procedures.js +63 -62
- package/admin/google-blockly/own/blocks_sendto.js +62 -60
- package/admin/google-blockly/own/blocks_switch.js +40 -29
- package/admin/google-blockly/own/blocks_system.js +113 -170
- package/admin/google-blockly/own/blocks_time.js +35 -35
- package/admin/google-blockly/own/blocks_timeout.js +42 -42
- package/admin/google-blockly/own/blocks_trigger.js +47 -62
- package/admin/google-blockly/own/blocks_words.js +8 -9
- package/admin/google-blockly/own/field_cron.js +189 -139
- package/admin/google-blockly/own/field_oid.js +250 -170
- package/admin/google-blockly/own/field_script.js +16 -16
- package/admin/static/js/759.7f25ba6c.chunk.js.map +1 -1
- package/admin/static/js/98.bf3dfa2b.chunk.js +2 -0
- package/admin/static/js/98.bf3dfa2b.chunk.js.map +1 -0
- package/admin/static/js/{main.eee05982.js → main.d9e7d255.js} +2 -2
- package/admin/static/js/{main.eee05982.js.map → main.d9e7d255.js.map} +1 -1
- package/admin/tab.html +1 -1
- package/admin/vs/base/browser/ui/codicons/codicon/codicon.ttf +0 -0
- package/admin-config/vsFont/codicon.json +1 -1
- package/io-package.json +40 -40
- package/lib/typescriptTools.js +29 -30
- package/main.js +4 -4
- package/package.json +3 -3
- package/admin/google-blockly/own/blocks_logic.js +0 -64
- package/admin/google-blockly/own/blocks_number.js +0 -25
- package/admin/google-blockly/own/blocks_text.js +0 -23
- package/admin/static/js/98.3bc0a67c.chunk.js +0 -2
- package/admin/static/js/98.3bc0a67c.chunk.js.map +0 -1
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Visual Blocks Editor
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2012 Google Inc.
|
|
6
|
+
* https://developers.google.com/blockly/
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License.
|
|
10
|
+
* You may obtain a copy of the License at
|
|
11
|
+
*
|
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
*
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
* See the License for the specific language governing permissions and
|
|
18
|
+
* limitations under the License.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @fileoverview Text input field.
|
|
23
|
+
* @author fraser@google.com (Neil Fraser)
|
|
24
|
+
*/
|
|
1
25
|
'use strict';
|
|
2
26
|
|
|
3
27
|
if (typeof goog !== 'undefined') {
|
|
@@ -10,82 +34,90 @@ if (typeof goog !== 'undefined') {
|
|
|
10
34
|
goog.require('goog.userAgent');
|
|
11
35
|
}
|
|
12
36
|
|
|
13
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Class for an editable text field.
|
|
39
|
+
* @param {string} text The initial content of the field.
|
|
40
|
+
* @param {string} type Type of objects (default: state)
|
|
41
|
+
* @extends {Blockly.Field}
|
|
42
|
+
* @constructor
|
|
43
|
+
*/
|
|
44
|
+
Blockly.FieldOID = function(text, type) {
|
|
45
|
+
Blockly.FieldOID.superClass_.constructor.call(this, text);
|
|
46
|
+
this._type = type;
|
|
47
|
+
};
|
|
14
48
|
|
|
15
|
-
|
|
16
|
-
|
|
49
|
+
if (typeof goog !== 'undefined') {
|
|
50
|
+
goog.inherits(Blockly.FieldOID, Blockly.Field);
|
|
51
|
+
} else {
|
|
52
|
+
Blockly.utils.object.inherits(Blockly.FieldOID, Blockly.Field);
|
|
53
|
+
}
|
|
17
54
|
|
|
18
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Point size of text. Should match blocklyText's font-size in CSS.
|
|
57
|
+
*/
|
|
58
|
+
Blockly.FieldOID.FONTSIZE = 11;
|
|
19
59
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Mouse cursor style when over the hotspot that initiates the editor.
|
|
62
|
+
*/
|
|
63
|
+
Blockly.FieldOID.prototype.CURSOR = 'pointer';
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Allow browser to spellcheck this field.
|
|
67
|
+
* @private
|
|
68
|
+
*/
|
|
69
|
+
Blockly.FieldOID.prototype.spellcheck_ = false;
|
|
24
70
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Close the input widget if this input is being deleted.
|
|
73
|
+
*/
|
|
74
|
+
Blockly.FieldOID.prototype.dispose = function() {
|
|
75
|
+
Blockly.WidgetDiv.hideIfOwner(this);
|
|
76
|
+
Blockly.FieldOID.superClass_.dispose.call(this);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Set the text in this field.
|
|
81
|
+
* @param {?string} id New ID.
|
|
82
|
+
* @override
|
|
83
|
+
*/
|
|
84
|
+
Blockly.FieldOID.prototype.setValue = function(id) {
|
|
85
|
+
if (id === null) {
|
|
86
|
+
return; // No change if null.
|
|
28
87
|
}
|
|
29
88
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
89
|
+
const objects = window.main.objects;
|
|
90
|
+
|
|
91
|
+
if (objects && !objects[id] && typeof window.main.getObject === 'function') {
|
|
92
|
+
this._idName = id || Blockly.Field.NBSP;
|
|
93
|
+
const that = this;
|
|
94
|
+
window.main.getObject(id, function (err, obj) {
|
|
95
|
+
if (obj) {
|
|
96
|
+
objects[obj._id] = objects[obj._id] || obj;
|
|
97
|
+
let text = objects[obj._id].common && objects[obj._id].common.name && objects[obj._id].common.name;
|
|
98
|
+
if (text) {
|
|
99
|
+
if (typeof text === 'object') {
|
|
100
|
+
text = text[systemLang] || text.en;
|
|
101
|
+
}
|
|
102
|
+
if (text.length > that.maxDisplayLength) {
|
|
103
|
+
// Truncate displayed string and add an ellipsis ('...').
|
|
104
|
+
text = text.substring(0, that.maxDisplayLength - 2) + '\u2026';
|
|
105
|
+
}
|
|
106
|
+
text.trim();
|
|
107
|
+
// Replace whitespace with non-breaking spaces so the text doesn't collapse.
|
|
108
|
+
text = text.replace(/\s/g, Blockly.Field.NBSP);
|
|
109
|
+
|
|
43
110
|
if (text) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
if (text.length > this.maxDisplayLength) {
|
|
48
|
-
// Truncate displayed string and add an ellipsis ('...').
|
|
49
|
-
text = text.substring(0, this.maxDisplayLength - 2) + '\u2026';
|
|
50
|
-
}
|
|
51
|
-
text.trim();
|
|
52
|
-
// Replace whitespace with non-breaking spaces so the text doesn't collapse.
|
|
53
|
-
text = text.replace(/\s/g, Blockly.Field.NBSP);
|
|
54
|
-
|
|
55
|
-
if (text) {
|
|
56
|
-
this._idName = text;
|
|
57
|
-
this.forceRerender();
|
|
58
|
-
}
|
|
111
|
+
that._idName = text;
|
|
112
|
+
that.forceRerender();
|
|
59
113
|
}
|
|
60
114
|
}
|
|
61
|
-
});
|
|
62
|
-
} else {
|
|
63
|
-
var text = objects && objects[id] && objects[id].common && objects[id].common.name ? objects[id].common.name : id;
|
|
64
|
-
if (typeof text === 'object') {
|
|
65
|
-
text = text[systemLang] || text.en;
|
|
66
|
-
}
|
|
67
|
-
if (text.length > this.maxDisplayLength) {
|
|
68
|
-
// Truncate displayed string and add an ellipsis ('...').
|
|
69
|
-
text = text.substring(0, this.maxDisplayLength - 2) + '\u2026';
|
|
70
115
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
text = Blockly.Field.NBSP;
|
|
77
|
-
}
|
|
78
|
-
this._idName = text;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
super.setValue(id);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
getDisplayText_() {
|
|
85
|
-
var text = this._idName || this.text_;
|
|
86
|
-
if (!text) {
|
|
87
|
-
// Prevent the field from disappearing if empty.
|
|
88
|
-
return Blockly.Field.NBSP;
|
|
116
|
+
});
|
|
117
|
+
} else {
|
|
118
|
+
let text = objects && objects[id] && objects[id].common && objects[id].common.name ? objects[id].common.name : id;
|
|
119
|
+
if (typeof text === 'object') {
|
|
120
|
+
text = text[systemLang] || text.en;
|
|
89
121
|
}
|
|
90
122
|
if (text.length > this.maxDisplayLength) {
|
|
91
123
|
// Truncate displayed string and add an ellipsis ('...').
|
|
@@ -93,123 +125,171 @@ class FieldOID extends Blockly.Field {
|
|
|
93
125
|
}
|
|
94
126
|
// Replace whitespace with non-breaking spaces so the text doesn't collapse.
|
|
95
127
|
text = text.replace(/\s/g, Blockly.Field.NBSP);
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
128
|
+
|
|
129
|
+
if (!text) {
|
|
130
|
+
// Prevent the field from disappearing if empty.
|
|
131
|
+
text = Blockly.Field.NBSP;
|
|
99
132
|
}
|
|
100
|
-
|
|
133
|
+
this._idName = text;
|
|
101
134
|
}
|
|
102
135
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
136
|
+
Blockly.Field.prototype.setValue.call(this, id);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Get the text from this field as displayed on screen. May differ from getText
|
|
141
|
+
* due to ellipsis, and other formatting.
|
|
142
|
+
* @return {string} Currently displayed text.
|
|
143
|
+
* @protected
|
|
144
|
+
*/
|
|
145
|
+
Blockly.FieldOID.prototype.getDisplayText_ = function() {
|
|
146
|
+
let text = this._idName || this.text_;
|
|
147
|
+
if (!text) {
|
|
148
|
+
// Prevent the field from disappearing if empty.
|
|
149
|
+
return Blockly.Field.NBSP;
|
|
150
|
+
}
|
|
151
|
+
if (text.length > this.maxDisplayLength) {
|
|
152
|
+
// Truncate displayed string and add an ellipsis ('...').
|
|
153
|
+
text = text.substring(0, this.maxDisplayLength - 2) + '\u2026';
|
|
106
154
|
}
|
|
155
|
+
// Replace whitespace with non-breaking spaces so the text doesn't collapse.
|
|
156
|
+
text = text.replace(/\s/g, Blockly.Field.NBSP);
|
|
157
|
+
if (this.sourceBlock_.RTL) {
|
|
158
|
+
// The SVG is LTR, force text to be RTL.
|
|
159
|
+
text += '\u200F';
|
|
160
|
+
}
|
|
161
|
+
return text;
|
|
162
|
+
};
|
|
107
163
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
this.setValue(text);
|
|
120
|
-
this.validate_();
|
|
121
|
-
} else if (goog.userAgent.WEBKIT) {
|
|
122
|
-
// Cursor key. Render the source block to show the caret moving.
|
|
123
|
-
// Chrome only (version 26, OS X).
|
|
124
|
-
this.sourceBlock_.render();
|
|
125
|
-
}
|
|
164
|
+
/**
|
|
165
|
+
* Show the inline free-text editor on top of the text.
|
|
166
|
+
* @param {boolean=} opt_quietInput True if editor should be created without
|
|
167
|
+
* focus. Defaults to false.
|
|
168
|
+
* @private
|
|
169
|
+
*/
|
|
170
|
+
Blockly.FieldOID.prototype.showEditor_ = function(opt_quietInput) {
|
|
171
|
+
this.workspace_ = this.sourceBlock_.workspace;
|
|
172
|
+
const that = this;
|
|
173
|
+
window.main && window.main.selectIdDialog && window.main.selectIdDialog(this.getValue(), this._type, function (newId) { newId !== null && that.setValue(newId);});
|
|
174
|
+
};
|
|
126
175
|
|
|
127
|
-
|
|
128
|
-
|
|
176
|
+
/**
|
|
177
|
+
* Handle key down to the editor.
|
|
178
|
+
* @param {!Event} e Keyboard event.
|
|
179
|
+
* @private
|
|
180
|
+
*/
|
|
181
|
+
/*Blockly.FieldOID.prototype.onHtmlInputKeyDown_ = function(e) {
|
|
182
|
+
const htmlInput = Blockly.FieldOID.htmlInput_;
|
|
183
|
+
const tabKey = 9, enterKey = 13, escKey = 27;
|
|
184
|
+
if (e.keyCode == enterKey) {
|
|
185
|
+
Blockly.WidgetDiv.hide();
|
|
186
|
+
} else if (e.keyCode == escKey) {
|
|
187
|
+
htmlInput.value = htmlInput.defaultValue;
|
|
188
|
+
Blockly.WidgetDiv.hide();
|
|
189
|
+
} else if (e.keyCode == tabKey) {
|
|
190
|
+
Blockly.WidgetDiv.hide();
|
|
191
|
+
this.sourceBlock_.tab(this, !e.shiftKey);
|
|
192
|
+
e.preventDefault();
|
|
129
193
|
}
|
|
194
|
+
};*/
|
|
130
195
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
196
|
+
/**
|
|
197
|
+
* Handle a change to the editor.
|
|
198
|
+
* @param {!Event} e Keyboard event.
|
|
199
|
+
* @private
|
|
200
|
+
*/
|
|
201
|
+
Blockly.FieldOID.prototype.onHtmlInputChange_ = function(e) {
|
|
202
|
+
const htmlInput = Blockly.FieldOID.htmlInput_;
|
|
203
|
+
// Update source block.
|
|
204
|
+
const text = htmlInput.value;
|
|
205
|
+
if (text !== htmlInput.oldValue_) {
|
|
206
|
+
htmlInput.oldValue_ = text;
|
|
207
|
+
this.setValue(text);
|
|
208
|
+
this.validate_();
|
|
209
|
+
} else if (goog.userAgent.WEBKIT) {
|
|
210
|
+
// Cursor key. Render the source block to show the caret moving.
|
|
211
|
+
// Chrome only (version 26, OS X).
|
|
212
|
+
this.sourceBlock_.render();
|
|
213
|
+
}
|
|
214
|
+
this.resizeEditor_();
|
|
215
|
+
Blockly.svgResize(this.sourceBlock_.workspace);
|
|
216
|
+
};
|
|
217
|
+
/*
|
|
218
|
+
* Check to see if the contents of the editor validates.
|
|
219
|
+
* Style the editor accordingly.
|
|
220
|
+
* @private
|
|
221
|
+
*/
|
|
222
|
+
Blockly.FieldOID.prototype.validate_ = function() {
|
|
223
|
+
goog.asserts.assertObject(Blockly.FieldOID.htmlInput_);
|
|
140
224
|
|
|
141
|
-
|
|
225
|
+
const htmlInput = Blockly.FieldOID.htmlInput_;
|
|
142
226
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
227
|
+
if (htmlInput.value) {
|
|
228
|
+
Blockly.addClass_(htmlInput, 'blocklyInvalidInput');
|
|
229
|
+
} else {
|
|
230
|
+
Blockly.removeClass_(htmlInput, 'blocklyInvalidInput');
|
|
148
231
|
}
|
|
232
|
+
};
|
|
149
233
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
-
// Shift by a few pixels to line up exactly.
|
|
168
|
-
xy.y += 1;
|
|
169
|
-
if (goog.userAgent.GECKO && Blockly.WidgetDiv.DIV.style.top) {
|
|
170
|
-
// Firefox mis-reports the location of the border by a pixel
|
|
171
|
-
// once the WidgetDiv is moved into position.
|
|
172
|
-
xy.x -= 1;
|
|
173
|
-
xy.y -= 1;
|
|
174
|
-
}
|
|
175
|
-
if (goog.userAgent.WEBKIT) {
|
|
176
|
-
xy.y -= 3;
|
|
177
|
-
}
|
|
178
|
-
div.style.left = xy.x + 'px';
|
|
179
|
-
div.style.top = xy.y + 'px';
|
|
234
|
+
/**
|
|
235
|
+
* Resize the editor and the underlying block to fit the text.
|
|
236
|
+
* @private
|
|
237
|
+
*/
|
|
238
|
+
Blockly.FieldOID.prototype.resizeEditor_ = function() {
|
|
239
|
+
const div = Blockly.WidgetDiv.DIV;
|
|
240
|
+
const bBox = this.fieldGroup_.getBBox();
|
|
241
|
+
div.style.width = bBox.width * this.workspace_.scale + 'px';
|
|
242
|
+
div.style.height = bBox.height * this.workspace_.scale + 'px';
|
|
243
|
+
const xy = this.getAbsoluteXY_();
|
|
244
|
+
// In RTL mode block fields and LTR input fields the left edge moves,
|
|
245
|
+
// whereas the right edge is fixed. Reposition the editor.
|
|
246
|
+
if (this.sourceBlock_.RTL) {
|
|
247
|
+
const borderBBox = this.getScaledBBox_();
|
|
248
|
+
xy.x += borderBBox.width;
|
|
249
|
+
xy.x -= div.offsetWidth;
|
|
180
250
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
widgetDispose_() {
|
|
189
|
-
return () => {
|
|
190
|
-
var htmlInput = this.htmlInput_;
|
|
191
|
-
// Save the edit (if it validates).
|
|
192
|
-
var text = htmlInput.value;
|
|
193
|
-
this.setValue(text);
|
|
194
|
-
this.sourceBlock_.rendered && this.sourceBlock_.render();
|
|
195
|
-
|
|
196
|
-
Blockly.unbindEvent_(htmlInput.onKeyDownWrapper_);
|
|
197
|
-
Blockly.unbindEvent_(htmlInput.onKeyUpWrapper_);
|
|
198
|
-
Blockly.unbindEvent_(htmlInput.onKeyPressWrapper_);
|
|
199
|
-
|
|
200
|
-
this.workspace_.removeChangeListener(htmlInput.onWorkspaceChangeWrapper_);
|
|
201
|
-
|
|
202
|
-
this.htmlInput_ = null;
|
|
203
|
-
|
|
204
|
-
// Delete style properties.
|
|
205
|
-
let style = Blockly.WidgetDiv.DIV.style;
|
|
206
|
-
style.width = 'auto';
|
|
207
|
-
style.height = 'auto';
|
|
208
|
-
style.fontSize = '';
|
|
209
|
-
};
|
|
251
|
+
// Shift by a few pixels to line up exactly.
|
|
252
|
+
xy.y += 1;
|
|
253
|
+
if (goog.userAgent.GECKO && Blockly.WidgetDiv.DIV.style.top) {
|
|
254
|
+
// Firefox mis-reports the location of the border by a pixel
|
|
255
|
+
// once the WidgetDiv is moved into position.
|
|
256
|
+
xy.x -= 1;
|
|
257
|
+
xy.y -= 1;
|
|
210
258
|
}
|
|
211
|
-
|
|
259
|
+
if (goog.userAgent.WEBKIT) {
|
|
260
|
+
xy.y -= 3;
|
|
261
|
+
}
|
|
262
|
+
div.style.left = xy.x + 'px';
|
|
263
|
+
div.style.top = xy.y + 'px';
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Close the editor, save the results, and dispose of the editable
|
|
268
|
+
* text field's elements.
|
|
269
|
+
* @return {!Function} Closure to call on destruction of the WidgetDiv.
|
|
270
|
+
* @private
|
|
271
|
+
*/
|
|
272
|
+
Blockly.FieldOID.prototype.widgetDispose_ = function() {
|
|
273
|
+
const thisField = this;
|
|
274
|
+
return function() {
|
|
275
|
+
const htmlInput = Blockly.FieldOID.htmlInput_;
|
|
276
|
+
// Save the edit (if it validates).
|
|
277
|
+
const text = htmlInput.value;
|
|
278
|
+
thisField.setValue(text);
|
|
279
|
+
thisField.sourceBlock_.rendered && thisField.sourceBlock_.render();
|
|
280
|
+
Blockly.unbindEvent_(htmlInput.onKeyDownWrapper_);
|
|
281
|
+
Blockly.unbindEvent_(htmlInput.onKeyUpWrapper_);
|
|
282
|
+
Blockly.unbindEvent_(htmlInput.onKeyPressWrapper_);
|
|
283
|
+
|
|
284
|
+
thisField.workspace_.removeChangeListener(
|
|
285
|
+
htmlInput.onWorkspaceChangeWrapper_);
|
|
212
286
|
|
|
213
|
-
Blockly.FieldOID =
|
|
287
|
+
Blockly.FieldOID.htmlInput_ = null;
|
|
214
288
|
|
|
215
|
-
//
|
|
289
|
+
// Delete style properties.
|
|
290
|
+
const style = Blockly.WidgetDiv.DIV.style;
|
|
291
|
+
style.width = 'auto';
|
|
292
|
+
style.height = 'auto';
|
|
293
|
+
style.fontSize = '';
|
|
294
|
+
};
|
|
295
|
+
};
|
|
@@ -63,7 +63,7 @@ Blockly.b64DecodeUnicode = function(text) {
|
|
|
63
63
|
* @constructor
|
|
64
64
|
*/
|
|
65
65
|
Blockly.FieldScript = function(text) {
|
|
66
|
-
|
|
66
|
+
Blockly.FieldScript.superClass_.constructor.call(this, text);
|
|
67
67
|
};
|
|
68
68
|
if (typeof goog !== 'undefined') {
|
|
69
69
|
goog.inherits(Blockly.FieldScript, Blockly.Field);
|
|
@@ -115,15 +115,15 @@ Blockly.FieldScript.prototype.setValue = function (text) {
|
|
|
115
115
|
*/
|
|
116
116
|
Blockly.FieldScript.prototype.showEditor_ = function(opt_quietInput) {
|
|
117
117
|
this.workspace_ = this.sourceBlock_.workspace;
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
118
|
+
const that = this;
|
|
119
|
+
const base64 = that.getValue();
|
|
120
|
+
let args = null;
|
|
121
|
+
let isReturn = false;
|
|
122
122
|
if (this.sourceBlock_ && this.sourceBlock_.arguments_) {
|
|
123
123
|
args = this.sourceBlock_.arguments_;
|
|
124
124
|
}
|
|
125
125
|
if (this.sourceBlock_.getProcedureDef) {
|
|
126
|
-
|
|
126
|
+
const options = this.sourceBlock_.getProcedureDef();
|
|
127
127
|
isReturn = options[2];
|
|
128
128
|
}
|
|
129
129
|
|
|
@@ -139,10 +139,10 @@ Blockly.FieldScript.prototype.showEditor_ = function(opt_quietInput) {
|
|
|
139
139
|
*/
|
|
140
140
|
Blockly.FieldScript.prototype.render_ = function() {
|
|
141
141
|
// the implementation is taken from field.js => Blockly.Field.prototype.updateSize_
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
142
|
+
const constants = this.getConstants();
|
|
143
|
+
const xOffset = this.borderRect_ ? this.getConstants().FIELD_BORDER_RECT_X_PADDING : 0;
|
|
144
|
+
const totalWidth = xOffset * 2 + 12;
|
|
145
|
+
let totalHeight = constants.FIELD_TEXT_HEIGHT;
|
|
146
146
|
|
|
147
147
|
if (this.borderRect_) {
|
|
148
148
|
totalHeight = Math.max(totalHeight, constants.FIELD_BORDER_RECT_HEIGHT);
|
|
@@ -161,7 +161,7 @@ Blockly.FieldScript.prototype.render_ = function() {
|
|
|
161
161
|
* @private
|
|
162
162
|
*/
|
|
163
163
|
Blockly.FieldScript.prototype.updateTextNode_ = function() {
|
|
164
|
-
|
|
164
|
+
const width = (Blockly.BlockSvg.SEP_SPACE_X || 5) * 3;
|
|
165
165
|
if (!this.textElement_) {
|
|
166
166
|
// Not rendered yet.
|
|
167
167
|
return;
|
|
@@ -169,7 +169,7 @@ Blockly.FieldScript.prototype.updateTextNode_ = function() {
|
|
|
169
169
|
// Empty the text element.
|
|
170
170
|
goog.dom.removeChildren(/** @type {!Element} */ (this.textElement_));
|
|
171
171
|
|
|
172
|
-
|
|
172
|
+
const textNode = document.createTextNode('...');
|
|
173
173
|
this.textElement_.appendChild(textNode);
|
|
174
174
|
|
|
175
175
|
// Cached width is obsolete. Clear it.
|
|
@@ -183,12 +183,12 @@ Blockly.FieldScript.prototype.updateTextNode_ = function() {
|
|
|
183
183
|
* @private
|
|
184
184
|
*/
|
|
185
185
|
/*Blockly.FieldScript.prototype.widgetDispose_ = function() {
|
|
186
|
-
|
|
186
|
+
const thisField = this;
|
|
187
187
|
return function() {
|
|
188
|
-
|
|
188
|
+
const htmlInput = Blockly.FieldScript.htmlInput_;
|
|
189
189
|
|
|
190
190
|
// Save the edit (if it validates).
|
|
191
|
-
|
|
191
|
+
const text = htmlInput.value;
|
|
192
192
|
thisField.setValue(text);
|
|
193
193
|
thisField.sourceBlock_.rendered && thisField.sourceBlock_.render();
|
|
194
194
|
Blockly.unbindEvent_(htmlInput.onKeyDownWrapper_);
|
|
@@ -201,7 +201,7 @@ Blockly.FieldScript.prototype.updateTextNode_ = function() {
|
|
|
201
201
|
Blockly.FieldScript.htmlInput_ = null;
|
|
202
202
|
|
|
203
203
|
// Delete style properties.
|
|
204
|
-
|
|
204
|
+
const style = Blockly.WidgetDiv.DIV.style;
|
|
205
205
|
style.width = 'auto';
|
|
206
206
|
style.height = 'auto';
|
|
207
207
|
style.fontSize = '';
|