-
Notifications
You must be signed in to change notification settings - Fork 661
Expand file tree
/
Copy pathindex.html
More file actions
85 lines (81 loc) · 1.86 KB
/
Copy pathindex.html
File metadata and controls
85 lines (81 loc) · 1.86 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
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Blockly Demo: Fixed Blockly</title>
<script src="../lib/blockly/blockly_compressed.js"></script>
<script src="../lib/blockly/blocks_compressed.js"></script>
<script src="../lib/blockly/msg/en.js"></script>
<style>
body {
background-color: #fff;
font-family: sans-serif;
}
h1 {
font-weight: normal;
font-size: 140%;
}
.demo {
padding: 1rem;
}
</style>
</head>
<body>
<div class="demo">
<p>
This is a simple demo of injecting Blockly into a fixed-sized 'div'
element.
</p>
<p>
→ More info on
<a
href="https://developers.google.com/blockly/guides/configure/web/fixed-size"
>injecting fixed-sized Blockly</a
>…
</p>
<div id="blocklyDiv" style="height: 480px; width: 600px"></div>
</div>
<script>
const toolbox = {
kind: 'flyoutToolbox',
contents: [
{
kind: 'block',
type: 'controls_if',
},
{
kind: 'block',
type: 'logic_compare',
},
{
kind: 'block',
type: 'controls_repeat_ext',
},
{
kind: 'block',
type: 'math_number',
fields: {
NUM: 123,
},
},
{
kind: 'block',
type: 'math_arithmetic',
},
{
kind: 'block',
type: 'text',
},
{
kind: 'block',
type: 'text_print',
},
],
};
const demoWorkspace = Blockly.inject('blocklyDiv', {
media: '../lib/blockly/media/',
toolbox: toolbox,
});
</script>
</body>
</html>