-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblockly-editor.html
More file actions
115 lines (101 loc) · 2.9 KB
/
blockly-editor.html
File metadata and controls
115 lines (101 loc) · 2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DoIt-R 图形化编程界面</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
height: 100vh;
}
header {
background-color: #2196F3;
color: white;
padding: 10px 20px;
text-align: center;
}
main {
display: flex;
flex: 1;
overflow: hidden;
}
#blocklyArea {
flex: 1;
position: relative;
}
#blocklyDiv {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.controls {
position: absolute;
top: 10px;
right: 10px;
z-index: 10;
display: flex;
gap: 10px;
}
button {
padding: 8px 16px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
}
button:hover {
background-color: #45a049;
}
#codeOutput {
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 200px;
background-color: #f5f5f5;
border-top: 1px solid #ddd;
padding: 10px;
font-family: monospace;
overflow: auto;
transform: translateY(100%);
transition: transform 0.3s ease;
}
#codeOutput.visible {
transform: translateY(0);
}
</style>
</head>
<body>
<header>
<h1>DoIt-R 图形化编程界面</h1>
</header>
<main>
<div id="blocklyArea">
<div class="controls">
<button id="runCode">运行代码</button>
<button id="showCode">显示代码</button>
<button id="clearWorkspace">清空工作区</button>
</div>
<div id="blocklyDiv"></div>
</div>
</main>
<div id="codeOutput"></div>
<!-- 引入 Blockly -->
<script src="node_modules/blockly/blockly_compressed.js"></script>
<script src="node_modules/blockly/blocks_compressed.js"></script>
<script src="node_modules/blockly/javascript_compressed.js"></script>
<script src="node_modules/blockly/msg/zh-hans.js"></script>
<!-- 引入连续工具箱插件 -->
<script src="node_modules/@blockly/continuous-toolbox/index.js"></script>
<!-- 主应用脚本 -->
<script src="blockly-app.js"></script>
</body>
</html>