21
21
variable Blocks
22
22
variable Block
23
23
variable Block2
24
+ variable Defaults
24
25
variable PropertyDefaults
25
26
variable PropertyNames
26
27
variable PropertyName
@@ -63,14 +64,15 @@ Restart:
63
64
set attribute `src` of AddBlock to `resources/icon/plus.png`
64
65
on click AddBlock
65
66
begin
66
- set Block to object
67
+ set Defaults to object
67
68
put 0 into N
68
69
while N is less than the json count of PropertyNames
69
70
begin
70
71
put element N of PropertyNames into PropertyName
71
- set property PropertyName of Block to property PropertyName of PropertyDefaults
72
+ set property PropertyName of Defaults to property PropertyName of PropertyDefaults
72
73
add 1 to N
73
74
end
75
+ set property `defaults` of Block to Defaults
74
76
json add Block to Blocks
75
77
set property `blocks` of Presentation to Blocks
76
78
go to Restart
@@ -103,7 +105,8 @@ Restart:
103
105
create EditButton in Cell
104
106
set the style of EditButton to `flex:1`
105
107
put element N of Blocks into Block
106
- set the text of EditButton to property `name` of Block
108
+ put property `defaults` of Block into Defaults
109
+ set the text of EditButton to property `name` of Defaults
107
110
if N is 0
108
111
begin
109
112
create Empty in Cell
@@ -157,6 +160,7 @@ Restart:
157
160
set style `background` of EditButton to `lightgray`
158
161
set style `display` of Editor to `block`
159
162
put element SelectedBlock of Blocks into Block
163
+ put property `defaults` of Block into Defaults
160
164
put the json count of PropertyNames into N
161
165
set the elements of PropertyValue to N
162
166
put 0 into N
@@ -171,7 +175,7 @@ Restart:
171
175
index PropertyValue to N
172
176
create PropertyValue in Row
173
177
set the style of PropertyValue to `flex:1`
174
- set the text of PropertyValue to property PropertyName of Block
178
+ set the text of PropertyValue to property PropertyName of Defaults
175
179
add 1 to N
176
180
end
177
181
create Row in Editor
@@ -196,6 +200,7 @@ Restart:
196
200
add 1 to N
197
201
set element N of Blocks to Block2
198
202
set property `blocks` of Presentation to Blocks
203
+ put -1 into SelectedBlock
199
204
go to Restart
200
205
end
201
206
on click DeleteBlock
@@ -217,10 +222,11 @@ SaveSelectedBlock:
217
222
begin
218
223
put element N of PropertyNames into PropertyName
219
224
index PropertyValue to N
220
- set property PropertyName of Block to the text of PropertyValue
225
+ set property PropertyName of Defaults to the text of PropertyValue
221
226
add 1 to N
222
227
end
223
- set the text of EditButton to property `name` of Block
228
+ set the text of EditButton to property `name` of Defaults
229
+ set property `defaults` of Block to Defaults
224
230
set element SelectedBlock of Blocks to Block
225
231
set property `blocks` of Presentation to Blocks
226
232
0 commit comments