|
222 | 222 |
|
223 | 223 | function createFileUploader(element, tree, editor){
|
224 | 224 | var xmlHttp;
|
| 225 | + |
| 226 | + var refresh = ce("button"); |
| 227 | + refresh.innerHTML = 'Refresh List'; |
| 228 | + ge(element).appendChild(refresh); |
| 229 | + |
225 | 230 | var input = ce("input");
|
226 | 231 | input.type = "file";
|
227 | 232 | input.multiple = false;
|
228 | 233 | input.name = "data";
|
229 | 234 | input.id="upload-select";
|
230 | 235 | ge(element).appendChild(input);
|
| 236 | + |
231 | 237 | var path = ce("input");
|
232 | 238 | path.id = "upload-path";
|
233 | 239 | path.type = "text";
|
234 | 240 | path.name = "path";
|
235 | 241 | path.defaultValue = "/";
|
236 | 242 | ge(element).appendChild(path);
|
| 243 | + |
237 | 244 | var button = ce("button");
|
238 | 245 | button.innerHTML = 'Upload';
|
239 | 246 | ge(element).appendChild(button);
|
| 247 | + |
240 | 248 | var mkfile = ce("button");
|
241 | 249 | mkfile.innerHTML = 'Create';
|
242 | 250 | ge(element).appendChild(mkfile);
|
|
274 | 282 | editor.execCommand('saveCommand');
|
275 | 283 | };
|
276 | 284 |
|
| 285 | + refresh.onclick = function(e){ |
| 286 | + tree.refreshPath(path.value); |
| 287 | + }; |
| 288 | + |
277 | 289 | button.onclick = function(e){
|
278 | 290 | if(input.files.length === 0){
|
279 | 291 | return;
|
|
294 | 306 | if(typeof name !== undefined){
|
295 | 307 | filename = name;
|
296 | 308 | }
|
297 |
| - path.value = "/"+filename; |
| 309 | + path.value = "/"+filename+"."+ext; |
298 | 310 | };
|
299 | 311 | }
|
300 | 312 |
|
|
594 | 606 | editor.loadUrl(vars.file);
|
595 | 607 | };
|
596 | 608 | </script>
|
597 |
| -<script id='ace' src="/ace.js" type="text/javascript" charset="utf-8"></script> |
| 609 | +<script id='ace' src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.6/ace.js" type="text/javascript" charset="utf-8"></script> |
598 | 610 | <script>
|
599 | 611 | if (typeof ace.edit == "undefined") {
|
600 | 612 | var script = document.createElement('script');
|
601 |
| - script.src = "https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.6/ace.js"; |
| 613 | + script.src = "/ace.js"; |
602 | 614 | script.async = false;
|
603 | 615 | document.head.appendChild(script);
|
604 | 616 | }
|
|
0 commit comments