Изменить 'ace/index.html'
This commit is contained in:
@@ -57,12 +57,14 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="toolbar">
|
<div class="toolbar">
|
||||||
|
<button id="btnLoad" onclick="load()" class="btn">⇑</button>
|
||||||
<button id="btnSave" onClick="save()" class="btn btn_g">⇩</button>
|
<button id="btnSave" onClick="save()" class="btn btn_g">⇩</button>
|
||||||
<button id="btnUndo" onClick="editor.undo()" class="btn">↶</button>
|
<button id="btnUndo" onClick="editor.undo()" class="btn">↶</button>
|
||||||
<button id="btnRedo" onClick="editor.redo()" class="btn btn_g">↷</button>
|
<button id="btnRedo" onClick="editor.redo()" class="btn btn_g">↷</button>
|
||||||
<button id="btnFs" onclick="toggleFullscreen()" class="btn">◻</button>
|
<button id="btnFs" onclick="toggleFullscreen()" class="btn">◻</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="inner" id="editor"></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 src="src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>
|
||||||
<script>
|
<script>
|
||||||
@@ -152,6 +154,29 @@
|
|||||||
|
|
||||||
document.body.removeChild(element);
|
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;
|
window.editor = editor;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user