ソースを参照

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

master
KaiSD 4年前
コミット
619e39f873
1個のファイルの変更25行の追加0行の削除
  1. +25
    -0
      ace/index.html

+ 25
- 0
ace/index.html ファイルの表示

@@ -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;


読み込み中…
キャンセル
保存