-
Notifications
You must be signed in to change notification settings - Fork 638
/
Copy pathindex.html
89 lines (85 loc) · 2.25 KB
/
index.html
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
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Blockly Demo: Custom Dialog</title>
<script src="./node_modules/blockly/blockly_compressed.js"></script>
<script src="./node_modules/blockly/blocks_compressed.js"></script>
<script src="./node_modules/blockly/msg/en.js"></script>
<style>
body {
background-color: #fff;
font-family: sans-serif;
}
h1 {
font-weight: normal;
font-size: 140%;
}
</style>
</head>
<body>
<p>This is a simple demo of replacing modal browser dialogs with HTML.</p>
<p>
Try creating new variables, creating variables with names already in use,
or deleting multiple blocks on the workspace.
</p>
<div id="blocklyDiv" style="height: 480px; width: 600px"></div>
<script>
// Define the toolbox
const toolbox = {
kind: 'categoryToolbox',
contents: [
{
kind: 'category',
name: 'Inputs',
colour: '%{BKY_MATH_HUE}',
contents: [
{
kind: 'block',
type: 'math_number',
gap: 32,
fields: {
NUM: 123,
},
},
{
kind: 'block',
type: 'text',
},
{
kind: 'block',
type: 'text_prompt_ext',
VALUE: {
name: 'text',
shadow: {
type: 'text',
fields: {
TEXT: 'abc',
},
},
},
},
],
},
{
kind: 'category',
name: 'Variables',
colour: '%{BKY_VARIABLES_HUE}',
custom: 'VARIABLE',
},
{
kind: 'category',
name: 'Functions',
colour: '%{BKY_PROCEDURES_HUE}',
custom: 'PROCEDURE',
},
],
};
var demoWorkspace = Blockly.inject('blocklyDiv', {
media: './node_modules/blockly/media/',
toolbox: toolbox,
});
</script>
<script src="custom-dialog.js"></script>
</body>
</html>