-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathindex.html
More file actions
299 lines (253 loc) · 10.4 KB
/
index.html
File metadata and controls
299 lines (253 loc) · 10.4 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
<!DOCTYPE html>
<!-- Ffau - A Blockly-based editor for teaching HTML, CSS and Javascript.
Developed by Pal Kerecsenyi and Geza Kerecsenyi.
Full details are available at the Github repo: https://github.com/codeddraig/ffau
Ffau editor will not work without its libraries. The best way to get all
of this data at once is to grab the latest release version from the
Github repo.
Ffau is open source software. This means you can re-mix, share and use
it however you want, including for commercial purposes. However, you
MUST provide attribution to the original authors if you do this.
However, Ffau is provided with NO WARRANTY whatsoever, and by using this
software, you agree to the terms of the MIT License.
Copyright (c) 2017-20 The CodeDdraig Organisation
THIS IS VERSION 2.1.5
-->
<html lang='en'>
<head>
<meta charset='utf-8'>
<!-- HEADER LIBRARIES -->
<script defer src='library/fontawesome/all.js'></script>
<!-- google's blockly stuff first -->
<script src='https://cdn.jsdelivr.net/gh/google/blockly@3.20200402.1/blockly_compressed.js'></script>
<script src='https://cdn.jsdelivr.net/gh/google/blockly@3.20200402.1/msg/js/en.js'></script>
<!-- jquery -->
<script src='https://cdn.jsdelivr.net/npm/jquery@3.2.1/dist/jquery.min.js'></script>
<!-- our blockly tweaks -->
<script src='library/ffau/blocks.js'></script>
<script src='library/ffau/generator.js'></script>
<!-- ace editor -->
<script
charset='utf-8' src='https://cdn.jsdelivr.net/npm/ace-builds@1.4.7/src-min-noconflict/ace.js'
type='text/javascript'
></script>
<!-- ffau js file -->
<script src='dist/ffau.js'></script>
<!-- ffau css file -->
<link href='dist/ffau.css' rel='stylesheet'>
<!-- tab switcher -->
<script src='library/index.js'></script>
<!-- aesthetic CSS libraries -->
<link href='https://cdn.jsdelivr.net/npm/magical-css@0.7.2/dist/magic.min.css' rel='stylesheet'>
<link href='library/layout.css' rel='stylesheet' type='text/css' />
<!-- /HEADER LIBRARIES -->
<!--Let browser know website is optimized for mobile-->
<meta content='width=device-width, initial-scale=1.0' name='viewport' />
<title>Ffau Editor</title>
</head>
<body>
<nav class='green'>
<ul class='nav-left'>
<li>
<a class='nav-brand-text'>Ffau Editor</a>
</li>
</ul>
<ul class='nav-right'>
<li class='nav-item'>
<a href='#' onclick='resetTheme()'>
<i class='fas fa-redo-alt'></i> Reset theme
</a>
</li>
<li class='nav-item'>
<a href='#' onclick='saveCode()'>
<i class='fas fa-download'></i> Download
</a>
</li>
<li class='nav-item'>
<a href='#!'>
<label for='loadText' style='cursor:pointer;'>
<i class='fas fa-upload'></i>
Upload
</label>
</a>
</li>
<input class='load' id='loadText' onchange='uploadCode()' style='display:none;' type='file'>
<li class='nav-item'>
<a href='#!' onclick='clearCode()'>
<i class='fas fa-trash'></i> Clear Workspace
</a>
</li>
</ul>
</nav>
<div class='hero green'>
<div class='hero-content'>
<h1 class='title'>The Ffau Editor</h1>
<p class='caption'>
Drag-and-drop HTML, made for teaching and learning web development.
<strong>Try it out below!</strong>
</p>
</div>
</div>
<div class='container'>
<div class='error info'>
Want to learn web development? Check out
<a class='link white' href='https://codedragon.org' target='_blank'>CodeDragon</a>
- it's where this editor comes from.
</div>
<div class='row'> <!-- row -->
<div class='col col7'>
<div id='blocklyDiv'></div>
</div>
<div class='col col5' id='preview'>
<div class='breadcrumb bottom'>
<ul class='tab-switcher'>
<li>
<a href='#!' onclick='showMePreview()'>Preview</a>
</li>
<li>
<a href='#!' onclick='showMeCode()'>Real code</a>
</li>
</ul>
<button class='toggle-edit-mode' onclick='toggleEditMode()'>
<i class='fas fa-mouse-pointer' id='mode-icon'></i> Toggle edit
mode
</button>
</div>
<div id='preview-frame'></div>
<div id='code-output'></div>
</div>
</div>
</div>
<footer class='green'>
<div class='bottom'>
© 2017-20 The CodeDdraig Organisation //
<a class='link' href='https://github.com/codeddraig/ffau'>https://github.com/codeddraig/ffau</a>
</div>
</footer>
<script>
const ffau = new Ffau();
// Render toolbox with all default categories
ffau.renderToolbox(document.body, 'toolbox', ['all']);
// initialise blockly
ffau.renderBlockly(
document.getElementById('blocklyDiv'),
document.getElementById('toolbox'),
'panda',
);
// render preview
ffau.renderPreview(
document.getElementById('preview-frame'),
);
// render code
let aceSession = ffau.renderCode(
ace,
document.getElementById('code-output'),
'textmate',
false, // Make it non read-only to allow for reverse coding
).session;
ffau.addEvent(); // Bind default update events
ffau.addSettings({
'Ffau': [
{
name: 'theme',
label:
'Theme',
type: 'dropdown',
options:
[
['Panda', 'panda'],
['Dark', 'dark'],
['Light', 'light'],
],
callback: (value) => {
ffau.setTheme(value);
},
},
],
'Ace editor': [
{
name: 'ace_theme',
label: 'Editor theme',
type: 'dropdown',
default: '1',
options:
[
['Light', '0'],
['Dark', '1'],
],
callback:
(value) => {
if (value === '0') {
ffau.editor.setOptions({
theme: 'ace/theme/dawn',
});
} else {
ffau.editor.setOptions({
theme: 'ace/theme/tomorrow_night',
});
}
},
}, {
name: 'font_size',
label: 'Ace font size',
type: 'numeric',
default: '16',
callback: (value) => {
ffau.editor.setOptions({
fontSize: value,
});
},
},
],
}, 1);
// add default event listener
ffau.addEvent();
ffau.addEvent(() => {
if (ffau.editMode) {
try {
ffau.setXML(ffau.codeToXML(ffau.editor.getValue()));
ffau.ffauWorkspace.cleanUp();
ffau.ffauWorkspace.scrollCenter();
} catch (e) {
ffau.clearWorkspace(false);
}
}
}, 'ace');
function toggleEditMode() {
ffau.toggleEditMode();
let icon = document.getElementById('mode-icon');
if (icon.classList.contains('fa-code'))
icon.classList.replace('fa-code', 'fa-mouse-pointer');
else
icon.classList.replace('fa-mouse-pointer', 'fa-code');
}
function resetTheme() {
// reset the theme to the original
ffau.updateSettings({
theme: 'panda',
ace_theme: '1',
});
}
function saveCode() {
// download as text file with default name
ffau.updateSettings({
auto_save: false,
});
ffau.downloadXML();
}
function clearCode() {
// clear the workspace
ffau.clearWorkspace();
}
function uploadCode() {
const input = document.getElementById('loadText');
let fileReader = new FileReader();
fileReader.onload = () => {
ffau.setXML(fileReader.result);
input.value = null;
};
fileReader.readAsText(input.files[0]);
}
</script>
</body>
</html>