1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <title>ACE in Action</title>
- <script src="../demo/kitchen-sink/require.js"></script>
- <style type="text/css" media="screen">
- .editor {
- position: relative;
- width: 500px;
- height: 100px;
- }
- </style>
- </head>
- <body>
- <div id="editor-container"></div>
- <script>
- require.config({
- paths: { ace: "../lib/ace" }
- })
- require(["ace/ace"], function(ace) {
- var root = document.getElementById("editor-container")
- setInterval(function() {
- while (root.firstChild) {
- root.firstChild.env.editor.destroy()
- root.firstChild.parentNode.removeChild(root.firstChild)
- }
- for (var i = 0; i < 5; i++) {
- var editor = ace.edit(document.createElement("div"))
- editor.container.className += " editor"
- editor.setOption("mode", "ace/mode/javascript")
- editor.setValue("some\ncode\n" + Date.now())
- root.appendChild(editor.container)
- }
- }, 1500);
- })
- </script>
- </body>
- </html>
|