Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
appinventor-sources
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
appinventor-sources
Commits
68089664
Unverified
Commit
68089664
authored
Feb 22, 2021
by
Beka Westberg
Committed by
GitHub
Feb 22, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix deprecation being inconsistent (#2219)
parent
4a41f72d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
26 deletions
+28
-26
appinventor/blocklyeditor/src/blocks/components.js
appinventor/blocklyeditor/src/blocks/components.js
+28
-25
appinventor/blocklyeditor/src/component_database.js
appinventor/blocklyeditor/src/component_database.js
+0
-1
No files found.
appinventor/blocklyeditor/src/blocks/components.js
View file @
68089664
...
...
@@ -197,6 +197,19 @@ Blockly.ComponentBlock.addGenericOption = function(block, options) {
options
.
splice
(
options
.
length
-
1
,
0
,
item
);
};
/**
* Marks the passed block as a badBlock() and disables it if the data associated
* with the block is not defined, or the data is marked as deprecated.
* @param {Blockly.BlockSvg} block The block to check for deprecation.
* @param {EventDescriptor|MethodDescriptor|PropertyDescriptor} data The data
* associated with the block which is possibly deprecated.
*/
Blockly
.
ComponentBlock
.
checkDeprecated
=
function
(
block
,
data
)
{
if
(
data
&&
data
.
deprecated
&&
block
.
workspace
==
Blockly
.
mainWorkspace
)
{
block
.
setDisabled
(
true
);
}
}
/**
* Create an event block of the given type for a component with the given
* instance name. eventType is one of the "events" objects in a typeJsonString
...
...
@@ -301,12 +314,10 @@ Blockly.Blocks.component_event = {
input
.
init
();
}
if
(
eventType
&&
eventType
.
deprecated
===
"
true
"
&&
this
.
workspace
===
Blockly
.
mainWorkspace
)
{
this
.
badBlock
();
this
.
setDisabled
(
true
);
}
this
.
verify
();
// verify the block and mark it accordingly
// Set as badBlock if it doesn't exist.
this
.
verify
();
// Disable it if it does exist and is deprecated.
Blockly
.
ComponentBlock
.
checkDeprecated
(
this
,
eventType
);
this
.
rendered
=
oldRendered
;
},
...
...
@@ -770,15 +781,10 @@ Blockly.Blocks.component_method = {
this
.
errors
=
[{
name
:
"
checkIfUndefinedBlock
"
},
{
name
:
"
checkIsInDefinition
"
},
{
name
:
"
checkComponentNotExistsError
"
},
{
name
:
"
checkGenericComponentSocket
"
}];
// mark the block bad if the method isn't defined or is marked deprecated
var
method
=
this
.
getMethodTypeObject
();
if
((
!
method
||
method
.
deprecated
===
true
||
method
.
deprecated
===
'
true
'
)
&&
this
.
workspace
===
Blockly
.
mainWorkspace
)
{
this
.
badBlock
();
this
.
setDisabled
(
true
);
}
this
.
verify
();
// verify the block and mark it accordingly
// Set as badBlock if it doesn't exist.
this
.
verify
();
// Disable it if it does exist and is deprecated.
Blockly
.
ComponentBlock
.
checkDeprecated
(
this
,
this
.
getMethodTypeObject
());
this
.
rendered
=
oldRendered
;
},
...
...
@@ -1029,9 +1035,9 @@ Blockly.Blocks.component_set_get = {
this
.
setColour
(
Blockly
.
ComponentBlock
.
COLOUR_GET
);
}
var
tooltipDescription
;
if
(
this
.
propertyName
)
{
tooltipDescription
=
componentDb
.
getInternationalizedPropertyDescription
(
this
.
getTypeName
(),
this
.
propertyName
,
this
.
propertyObject
.
description
);
if
(
this
.
propertyName
&&
this
.
propertyObject
)
{
tooltipDescription
=
componentDb
.
getInternationalizedPropertyDescription
(
this
.
getTypeName
(),
this
.
propertyName
,
this
.
propertyObject
.
description
);
}
else
{
tooltipDescription
=
Blockly
.
Msg
.
UNDEFINED_BLOCK_TOOLTIP
;
}
...
...
@@ -1126,13 +1132,10 @@ Blockly.Blocks.component_set_get = {
{
name
:
"
checkComponentNotExistsError
"
},
{
name
:
'
checkGenericComponentSocket
'
},
{
name
:
'
checkEmptySetterSocket
'
}];
if
(
thisBlock
.
propertyObject
&&
this
.
propertyObject
.
deprecated
===
"
true
"
&&
this
.
workspace
===
Blockly
.
mainWorkspace
)
{
// [lyn, 2015/12/27] mark deprecated properties as bad
this
.
badBlock
();
this
.
setDisabled
(
true
);
}
// Set as badBlock if it doesn't exist.
this
.
verify
();
// Disable it if it does exist and is deprecated.
Blockly
.
ComponentBlock
.
checkDeprecated
(
this
,
this
.
propertyObject
);
for
(
var
i
=
0
,
input
;
input
=
this
.
inputList
[
i
];
i
++
)
{
input
.
init
();
...
...
appinventor/blocklyeditor/src/component_database.js
View file @
68089664
...
...
@@ -351,7 +351,6 @@ Blockly.ComponentDatabase.prototype.populateTypes = function(componentInfos) {
info
.
properties
[
property
.
name
]
=
property
;
if
(
typeof
property
[
'
deprecated
'
]
===
'
string
'
)
{
property
[
'
deprecated
'
]
=
JSON
.
parse
(
property
[
'
deprecated
'
]);
if
(
property
[
'
deprecated
'
])
continue
;
}
if
(
property
[
'
rw
'
]
==
'
read-write
'
)
{
property
.
mutability
=
Blockly
.
PROPERTY_READWRITEABLE
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment