Parcourir la source

Изменить 'ace/index.html'

master
KaiSD il y a 5 ans
Parent
révision
619e39f873
1 fichiers modifiés avec 25 ajouts et 0 suppressions
  1. +25
    -0
      ace/index.html

+ 25
- 0
ace/index.html Voir le fichier

@@ -57,12 +57,14 @@
</head>
<body>
<div class="toolbar">
<button id="btnLoad" onclick="load()" class="btn">⇑</button>
<button id="btnSave" onClick="save()" class="btn btn_g">⇩</button>
<button id="btnUndo" onClick="editor.undo()" class="btn">↶</button>
<button id="btnRedo" onClick="editor.redo()" class="btn btn_g">↷</button>
<button id="btnFs" onclick="toggleFullscreen()" class="btn">◻</button>
</div>
<div class="inner" id="editor"></div>
<div class="inner" id="editor"></div>
<script src="src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>
<script>
@@ -152,6 +154,29 @@

document.body.removeChild(element);
}

function load() {
var input = document.createElement('input');
input.type = 'file';

input.onchange = e => {

// getting a hold of the file reference
var file = e.target.files[0];

// setting up the reader
var reader = new FileReader();
reader.readAsText(file,'UTF-8');

// here we tell the reader what to do when it's done reading...
reader.onload = readerEvent => {
var content = readerEvent.target.result; // this is the content!
editor.setValue(content);
}

}
input.click();
}
window.editor = editor;


Chargement…
Annuler
Enregistrer