javascript - How to display file content in Ace Editor -
i testing out ace-editor display big text files server. since boasts beingness able handle files 4 millions lines , has text highlighting, makes candidate.
i've been struggling understand document , editsession ace editor. understanding, possible tell ace editor read file , display it.
i using createeditsessiont() create session , specify document. api documentation:
createeditsession(document | string text, textmode mode)
document: required. if text document, associates editsession it. otherwise, new document created, initial text
here code:
<script src="../src/ace.js"></script> <script> var docsession = new ace.createeditsession("../files/myfile.log", "ace/mode/plain_text"); var editor = ace.edit("editor"); editor.setsession(docsession); editor.settheme("ace/theme/dawn"); </script>
unfortunatly, appears on page "../files/myfile.log". guess creating file text instead of reading document. how tell display contents of myfile.log?
ace doesn't handle files in way, front-end component of editor. document in createeditsessions definition instance of aces document object, not file. load file ace need contents server ajax call. https://github.com/ajaxorg/ace/blob/v1.1.7/demo/kitchen-sink/doclist.js#l164
javascript html5 ace-editor
No comments:
Post a Comment