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