Home
-
{
- isFilesShowing = false
- }}>
-
-
-
- File Menu
-
- {
- const code = generateJavascriptCode()
- console.log(code)
- }}>Export to JavaScript
- {
- const code = generateJavascriptCode()
- if(code) {
- navigator.clipboard.writeText(code)
+
+
+
+ File Menu
+
+ {
+ const code = generateJavascriptCode();
+ console.log(code);
+ }}>Export to JavaScript
+ {
+ const code = generateJavascriptCode();
+ if (code) {
+ navigator.clipboard.writeText(code);
}
- }}>Copy to clipboard
-
- {
- dispatch("save")
- }}>Save file
- {
- dispatch("load")
- }}>Load File
-
-
-
+ }}>Copy to clipboard
+
+
{
+ dispatch("save");
+ }}>Save file
+
{
+ dispatch("load");
+ }}>Load File
+
+
+
+
+
+ {
+ dispatch("toggle_toolbox")
+ }}>Hide Toolbox
+
+
{/await}
{/if}
diff --git a/src/lib/utils/BlockGen/Blockly/Generators/GenerateCode.ts b/src/lib/utils/BlockGen/Blockly/Generators/GenerateCode.ts
index e9c65c5..1740b61 100644
--- a/src/lib/utils/BlockGen/Blockly/Generators/GenerateCode.ts
+++ b/src/lib/utils/BlockGen/Blockly/Generators/GenerateCode.ts
@@ -1,7 +1,7 @@
-import Blockly from "blockly"
-import generator from "blockly/javascript"
-const { javascriptGenerator } = generator
+import Blockly from "blockly";
+import generator from "blockly/javascript";
+const { javascriptGenerator } = generator;
export function generateJavascriptCode(workspace: Blockly.Workspace = Blockly.getMainWorkspace()) {
- return javascriptGenerator.workspaceToCode(workspace) as string
-}
\ No newline at end of file
+ return javascriptGenerator.workspaceToCode(workspace) as string;
+}
diff --git a/src/routes/editor/+page.svelte b/src/routes/editor/+page.svelte
index 3d6c6fb..f9971f8 100644
--- a/src/routes/editor/+page.svelte
+++ b/src/routes/editor/+page.svelte
@@ -15,6 +15,7 @@
let workspace: Blockly.WorkspaceSvg;
let toolboxJson: Blockly.utils.toolbox.ToolboxDefinition;
let toolbox: Toolbox;
+ let isToolBoxHidden = false;
let currentFile: string;
let discodesWorkspaceID: string;
@@ -51,8 +52,16 @@
saveWorkspace(currentFile)}
on:load={() => loadWorkspace(currentFile)}
+ on:toggle_toolbox={() => {
+ if(workspace) {
+ const toolbox = workspace.getToolbox();
+ toolbox?.setVisible(isToolBoxHidden)
+ isToolBoxHidden = !isToolBoxHidden
+ }
+ }}
/>