mirror of
https://github.com/lxsang/antos-frontend.git
synced 2024-12-27 01:38:21 +01:00
Fix CodeBlock
This commit is contained in:
parent
4afc368bdd
commit
c82da84240
@ -45,14 +45,33 @@ class CodeBlock extends this.OS.GUI.BaseApplication
|
||||
#});
|
||||
|
||||
@blen = 1024
|
||||
@btnact.set "onbtclick", (e) ->
|
||||
#@btnact.set "onbtclick", (e) ->
|
||||
#me.openSession()
|
||||
code = Blockly.JavaScript.workspaceToCode me.workspace
|
||||
console.log code
|
||||
# code = Blockly.JavaScript.workspaceToCode me.workspace
|
||||
# console.log code
|
||||
@on "resize", () ->
|
||||
Blockly.svgResize me.workspace
|
||||
@bindKey "ALT-N", () -> me.actionFile "#{me.name}-New"
|
||||
@bindKey "ALT-O", () -> me.actionFile "#{me.name}-Open"
|
||||
@bindKey "CTRL-S", () -> me.actionFile "#{me.name}-Save"
|
||||
@bindKey "ALT-W", () -> me.actionFile "#{me.name}-Saveas"
|
||||
|
||||
|
||||
menu: () ->
|
||||
me = @
|
||||
menu = [{
|
||||
text: "File",
|
||||
child: [
|
||||
{ text: "New", dataid: "#{@name}-New", shortcut: "A-N" },
|
||||
{ text: "Open", dataid: "#{@name}-Open", shortcut: "A-O" },
|
||||
{ text: "Save", dataid: "#{@name}-Save", shortcut: "C-S" },
|
||||
{ text: "Save as", dataid: "#{@name}-Saveas", shortcut: "A-W" }
|
||||
],
|
||||
onmenuselect: (e) -> me.actionFile e.item.data.dataid
|
||||
}]
|
||||
menu
|
||||
|
||||
actionFile: (n) ->
|
||||
console.log n
|
||||
openSession: () ->
|
||||
me = @
|
||||
proto = if window.location.protocol is "https:" then "wss://" else "ws://"
|
||||
|
@ -1,9 +1,9 @@
|
||||
<afx-app-window apptitle="CodeBlock" width="600" height="400">
|
||||
<afx-vbox data-id = "mybox">
|
||||
<afx-button data-height="20" text= "Action" data-id = "btn-action" ></afx-button>
|
||||
<!--afx-button data-height="20" text= "Action" data-id = "btn-action" ></afx-button-->
|
||||
<div data-id="ws"></div>
|
||||
<xml id="blockly_toolbox" data-height="0" data-id="blockly_toolbox" style="display: none">
|
||||
<category name="%{BKY_CATLOGIC}" colour="%{BKY_LOGIC_HUE}">
|
||||
<category name="Logic" colour="210">
|
||||
<block type="controls_if"></block>
|
||||
<block type="logic_compare"></block>
|
||||
<block type="logic_operation"></block>
|
||||
@ -12,7 +12,7 @@
|
||||
<block type="logic_null"></block>
|
||||
<block type="logic_ternary"></block>
|
||||
</category>
|
||||
<category name="%{BKY_CATLOOPS}" colour="%{BKY_LOOPS_HUE}">
|
||||
<category name="Loops" colour="120">
|
||||
<block type="controls_repeat_ext">
|
||||
<value name="TIMES">
|
||||
<shadow type="math_number">
|
||||
@ -41,7 +41,7 @@
|
||||
<block type="controls_forEach"></block>
|
||||
<block type="controls_flow_statements"></block>
|
||||
</category>
|
||||
<category name="%{BKY_CATMATH}" colour="%{BKY_MATH_HUE}">
|
||||
<category name="Math" colour="230">
|
||||
<block type="math_number"></block>
|
||||
<block type="math_arithmetic">
|
||||
<value name="A">
|
||||
@ -128,7 +128,7 @@
|
||||
</block>
|
||||
<block type="math_random_float"></block>
|
||||
</category>
|
||||
<category name="%{BKY_CATTEXT}" colour="%{BKY_TEXTS_HUE}">
|
||||
<category name="Text" colour="160">
|
||||
<block type="text"></block>
|
||||
<block type="text_join"></block>
|
||||
<block type="text_append">
|
||||
@ -205,7 +205,7 @@
|
||||
</value>
|
||||
</block>
|
||||
</category>
|
||||
<category name="%{BKY_CATLISTS}" colour="%{BKY_LISTS_HUE}">
|
||||
<category name="List" colour="260">
|
||||
<block type="lists_create_with">
|
||||
<mutation items="0"></mutation>
|
||||
</block>
|
||||
@ -256,7 +256,7 @@
|
||||
</block>
|
||||
<block type="lists_sort"></block>
|
||||
</category>
|
||||
<category name="%{BKY_CATCOLOUR}" colour="%{BKY_COLOUR_HUE}">
|
||||
<category name="Colour" colour="20">
|
||||
<block type="colour_picker"></block>
|
||||
<block type="colour_random"></block>
|
||||
<block type="colour_rgb">
|
||||
@ -295,8 +295,8 @@
|
||||
</block>
|
||||
</category>
|
||||
<sep></sep>
|
||||
<category name="%{BKY_CATVARIABLES}" colour="%{BKY_VARIABLES_HUE}" custom="VARIABLE"></category>
|
||||
<category name="%{BKY_CATFUNCTIONS}" colour="%{BKY_PROCEDURES_HUE}" custom="PROCEDURE"></category>
|
||||
<category name="Variables" colour="330" custom="VARIABLE"></category>
|
||||
<category name="Functions" colour="290" custom="PROCEDURE"></category>
|
||||
</xml>
|
||||
</afx-vbox>
|
||||
</afx-app-window>
|
@ -84,7 +84,7 @@ class MarkOn extends this.OS.GUI.BaseApplication
|
||||
menu = [{
|
||||
text: "File",
|
||||
child: [
|
||||
{ text: "Open", dataid: "#{@name}-New", shortcut: "A-N" },
|
||||
{ text: "New", dataid: "#{@name}-New", shortcut: "A-N" },
|
||||
{ text: "Open", dataid: "#{@name}-Open", shortcut: "A-O" },
|
||||
{ text: "Save", dataid: "#{@name}-Save", shortcut: "C-S" },
|
||||
{ text: "Save as", dataid: "#{@name}-Saveas", shortcut: "A-W" }
|
||||
|
Loading…
Reference in New Issue
Block a user