File modules/editor/codemirror/mode/dart/index.html
Last commit: Sun Dec 17 01:14:09 2017 +0100 Jan Dankert Integration eines weiteren Code-Editors: Codemirror. Demnächst müssen wir hier mal aufräumen und andere Editoren rauswerfen.
1 <!doctype html> 2 3 <title>CodeMirror: Dart mode</title> 4 <meta charset="utf-8"/> 5 <link rel=stylesheet href="../../doc/docs.css"> 6 <link rel="stylesheet" href="../../lib/codemirror.css"> 7 <script src="../../lib/codemirror.js"></script> 8 <script src="../clike/clike.js"></script> 9 <script src="dart.js"></script> 10 <style>.CodeMirror {border: 1px solid #dee;}</style> 11 <div id=nav> 12 <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a> 13 14 <ul> 15 <li><a href="../../index.html">Home</a> 16 <li><a href="../../doc/manual.html">Manual</a> 17 <li><a href="https://github.com/codemirror/codemirror">Code</a> 18 </ul> 19 <ul> 20 <li><a href="../index.html">Language modes</a> 21 <li><a class=active href="#">Dart</a> 22 </ul> 23 </div> 24 25 <article> 26 <h2>Dart mode</h2> 27 <form> 28 <textarea id="code" name="code"> 29 import 'dart:math' show Random; 30 31 void main() { 32 print(new Die(n: 12).roll()); 33 } 34 35 // Define a class. 36 class Die { 37 // Define a class variable. 38 static Random shaker = new Random(); 39 40 // Define instance variables. 41 int sides, value; 42 43 // Define a method using shorthand syntax. 44 String toString() => '$value'; 45 46 // Define a constructor. 47 Die({int n: 6}) { 48 if (4 <= n && n <= 20) { 49 sides = n; 50 } else { 51 // Support for errors and exceptions. 52 throw new ArgumentError(/* */); 53 } 54 } 55 56 // Define an instance method. 57 int roll() { 58 return value = shaker.nextInt(sides) + 1; 59 } 60 } 61 </textarea> 62 </form> 63 64 <script> 65 var editor = CodeMirror.fromTextArea(document.getElementById("code"), { 66 lineNumbers: true, 67 mode: "application/dart" 68 }); 69 </script> 70 71 </article>
Downloadmodules/editor/codemirror/mode/dart/index.html
History Sun, 17 Dec 2017 01:14:09 +0100 Jan Dankert Integration eines weiteren Code-Editors: Codemirror. Demnächst müssen wir hier mal aufräumen und andere Editoren rauswerfen.