Skip to content

Commit

Permalink
Update to support latest Blockly
Browse files Browse the repository at this point in the history
  • Loading branch information
stefaj committed Jul 4, 2016
1 parent 5d53395 commit b27b068
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion funblocks-client/src/Blockly/DesignBlock.hs
Expand Up @@ -162,7 +162,7 @@ foreign import javascript unsafe "$1.appendValueInput($2)"
foreign import javascript unsafe "$1.appendField($2)"
js_appendTextField :: FieldInput -> JSString -> IO FieldInput

foreign import javascript unsafe "$1.appendField(new Blockly.FieldLabelEmph($2))"
foreign import javascript unsafe "$1.appendField(new Blockly.FieldLabel($2, 'blocklyTextEmph'))"
js_appendTextFieldEmph :: FieldInput -> JSString -> IO FieldInput

foreign import javascript unsafe "$1.appendField(new Blockly.FieldTextInput($2), $3)"
Expand Down
2 changes: 1 addition & 1 deletion third_party/blockly
30 changes: 18 additions & 12 deletions web/blocks.html
Expand Up @@ -159,7 +159,7 @@ <h4>Projects</h4>
</block>
<block type="cwText">
<value name="TEXT">
<shadow type="text">
<shadow type="text_typed">
<field name="TEXT"></field>
</shadow>
</value>
Expand Down Expand Up @@ -399,13 +399,13 @@ <h4>Projects</h4>
</block>
</category>
<category name="Text">
<block type="text"></block>
<block type="text_typed"></block>
<block type="txtConcat">
<value name="LEFT">
<shadow type="text"></shadow>
<shadow type="text_typed"></shadow>
</value>
<value name="RIGHT">
<shadow type="text"></shadow>
<shadow type="text_typed"></shadow>
</value>
</block>
<block type="txtPrinted">
Expand All @@ -415,12 +415,12 @@ <h4>Projects</h4>
</block>
<block type="txtLowercase">
<value name="TEXT">
<shadow type="text"></shadow>
<shadow type="text_typed"></shadow>
</value>
</block>
<block type="txtUppercase">
<value name="TEXT">
<shadow type="text"></shadow>
<shadow type="text_typed"></shadow>
</value>
</block>
</category>
Expand Down Expand Up @@ -580,18 +580,18 @@ <h4>Projects</h4>
</block>
<block type="conStartWith">
<value name="TEXTMAIN">
<shadow type="text"></shadow>
<shadow type="text_typed"></shadow>
</value>
<value name="TEXTTEST">
<shadow type="text"></shadow>
<shadow type="text_typed"></shadow>
</value>
</block>
<block type="conEndWith">
<value name="TEXTMAIN">
<shadow type="text"></shadow>
<shadow type="text_typed"></shadow>
</value>
<value name="TEXTTEST">
<shadow type="text"></shadow>
<shadow type="text_typed"></shadow>
</value>
</block>
</category>
Expand Down Expand Up @@ -666,14 +666,20 @@ <h4><span class="label label-info">Generated Code</span>
$("#toggle-sidebar").toggleClass("btn-primary btn-default");

// Ugly hacks to force redraw
Blockly.fireUiEvent(window, 'resize');
// Blockly.fireUiEvent(window, 'resize');

window.dispatchEvent(new Event('resize'));
Blockly.getMainWorkspace().resize();
$(window).trigger('resize');
$('.container-fluid').redraw();
$('.container-fluid').css('display', 'none').height();
$('.container-fluid').css('display', 'block');

Blockly.resizeSvgContents(Blockly.getMainWorkspace());
Blockly.getMainWorkspace().resize();

window.dispatchEvent(new Event('resize'));
$(window).trigger('resize');

});
</script>

Expand Down

1 comment on commit b27b068

@stefaj
Copy link
Owner Author

@stefaj stefaj commented on b27b068 Jul 5, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes:

The renaming issues are fixed.
However the standard Blockly has the following quirk:

When adding a new procedure foo, and a calling block foo to the canvas, and then adding another procedure foo, the original calling block foo gets renamed to foo2

Please sign in to comment.