Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ardublockly
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
ardublockly
Commits
345b0cb6
Commit
345b0cb6
authored
Jun 29, 2015
by
Neil Fraser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove selection in Block Factory when switching modes.
parent
e3009310
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
27 deletions
+28
-27
blockly_compressed.js
blockly_compressed.js
+6
-5
core/block.js
core/block.js
+0
-2
core/blockly.js
core/blockly.js
+0
-20
core/utils.js
core/utils.js
+20
-0
demos/blockfactory/factory.js
demos/blockfactory/factory.js
+2
-0
No files found.
blockly_compressed.js
View file @
345b0cb6
This diff is collapsed.
Click to expand it.
core/block.js
View file @
345b0cb6
...
@@ -903,8 +903,6 @@ Blockly.Block.prototype.appendDummyInput = function(opt_name) {
...
@@ -903,8 +903,6 @@ Blockly.Block.prototype.appendDummyInput = function(opt_name) {
*/
*/
Blockly
.
Block
.
prototype
.
jsonInit
=
function
(
json
)
{
Blockly
.
Block
.
prototype
.
jsonInit
=
function
(
json
)
{
// Validate inputs.
// Validate inputs.
goog
.
asserts
.
assertString
(
json
[
'
message0
'
],
'
No message.
'
);
goog
.
asserts
.
assertArray
(
json
[
'
args0
'
],
'
No args.
'
);
goog
.
asserts
.
assert
(
json
[
'
output
'
]
==
undefined
||
goog
.
asserts
.
assert
(
json
[
'
output
'
]
==
undefined
||
json
[
'
previousStatement
'
]
==
undefined
,
json
[
'
previousStatement
'
]
==
undefined
,
'
Must not have both an output and a previousStatement.
'
);
'
Must not have both an output and a previousStatement.
'
);
...
...
core/blockly.js
View file @
345b0cb6
...
@@ -464,26 +464,6 @@ Blockly.hideChaff = function(opt_allowToolbox) {
...
@@ -464,26 +464,6 @@ Blockly.hideChaff = function(opt_allowToolbox) {
}
}
};
};
/**
* Deselect any selections on the webpage.
* Chrome will select text outside the SVG when double-clicking.
* Deselect this text, so that it doesn't mess up any subsequent drag.
*/
Blockly
.
removeAllRanges
=
function
()
{
if
(
getSelection
())
{
setTimeout
(
function
()
{
try
{
var
selection
=
getSelection
();
if
(
!
selection
.
isCollapsed
)
{
selection
.
removeAllRanges
();
}
}
catch
(
e
)
{
// MSIE throws 'error 800a025e' here.
}
},
0
);
}
};
/**
/**
* Return an object with all the metrics required to size scrollbars for the
* Return an object with all the metrics required to size scrollbars for the
* main workspace. The following properties are computed:
* main workspace. The following properties are computed:
...
...
core/utils.js
View file @
345b0cb6
...
@@ -325,6 +325,26 @@ Blockly.createSvgElement = function(name, attrs, opt_parent) {
...
@@ -325,6 +325,26 @@ Blockly.createSvgElement = function(name, attrs, opt_parent) {
return
e
;
return
e
;
};
};
/**
* Deselect any selections on the webpage.
* Chrome will select text outside the SVG when double-clicking.
* Deselect this text, so that it doesn't mess up any subsequent drag.
*/
Blockly
.
removeAllRanges
=
function
()
{
if
(
getSelection
())
{
setTimeout
(
function
()
{
try
{
var
selection
=
getSelection
();
if
(
!
selection
.
isCollapsed
)
{
selection
.
removeAllRanges
();
}
}
catch
(
e
)
{
// MSIE throws 'error 800a025e' here.
}
},
0
);
}
};
/**
/**
* Is this event a right-click?
* Is this event a right-click?
* @param {!Event} e Mouse event.
* @param {!Event} e Mouse event.
...
...
demos/blockfactory/factory.js
View file @
345b0cb6
...
@@ -62,6 +62,7 @@ function onchange() {
...
@@ -62,6 +62,7 @@ function onchange() {
* Update the language code.
* Update the language code.
*/
*/
function
updateLanguage
()
{
function
updateLanguage
()
{
Blockly
.
removeAllRanges
();
var
code
=
[];
var
code
=
[];
var
rootBlock
=
getRootBlock
();
var
rootBlock
=
getRootBlock
();
if
(
rootBlock
)
{
if
(
rootBlock
)
{
...
@@ -495,6 +496,7 @@ function getTypesFrom_(block, name) {
...
@@ -495,6 +496,7 @@ function getTypesFrom_(block, name) {
* Update the generator code.
* Update the generator code.
*/
*/
function
updateGenerator
()
{
function
updateGenerator
()
{
Blockly
.
removeAllRanges
();
function
makeVar
(
root
,
name
)
{
function
makeVar
(
root
,
name
)
{
name
=
name
.
toLowerCase
().
replace
(
/
\W
/g
,
'
_
'
);
name
=
name
.
toLowerCase
().
replace
(
/
\W
/g
,
'
_
'
);
return
'
var
'
+
root
+
'
_
'
+
name
;
return
'
var
'
+
root
+
'
_
'
+
name
;
...
...
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