This repository was archived by the owner on May 25, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 187
Expand file tree
/
Copy pathdemo.html
More file actions
192 lines (166 loc) · 5.85 KB
/
demo.html
File metadata and controls
192 lines (166 loc) · 5.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<section id="codemirror" ng-app="doc.ui-codeMirror">
<!-- =Minimal code
--------------------------------------------------------------------------- -->
<div id="demo-mini">
<div class="page-header">
<h1>Minimal code</h1>
</div>
<div class="row">
<div class="col-md-6">
<div ui-codemirror>Code mirror here</div>
</div>
<div class="col-md-6" ng-controller="PlunkerCtrl"
ng-init="
vendor_css=['http://codemirror.net/lib/codemirror.css'];
vendor_js=['http://codemirror.net/lib/codemirror.js'];
"
>
<div class="pull-right">
<button class="btn btn-info" ng-click="edit('1.2.6', 'UI.Codemirror', 'ui-codemirror')">
<i class="glyphicon glyphicon-edit"></i> Edit in plunker
</button>
</div>
<tabset>
<tab heading="Markup">
<div plunker-content="markup">
<pre class="prettyprint"><section>
<div ui-codemirror >Code mirror here</div>
</section></pre>
</div>
</tab>
</tabset>
</div>
</div>
</div>
<!-- =General options demo
--------------------------------------------------------------------------- -->
<div id="demo-general">
<div class="page-header">
<h1>General options</h1>
</div>
<div class="row">
<div class="col-md-6">
<div ui-codemirror="{
lineNumbers: true,
theme:'twilight',
readOnly: 'nocursor',
lineWrapping : true,
mode: 'xml'
}"><html style="color: green">
<!-- this is a comment -->
<head>
<title>HTML Example</title>
</head>
<body>
The indentation tries to be <em>somewhat &quot;do what
I mean&quot;</em>... but might not match your style.
</body>
</html></div>
</div>
<div class="col-md-6" ng-controller="PlunkerCtrl"
ng-init="
vendor_css=['http://codemirror.net/lib/codemirror.css', 'http://codemirror.net/theme/twilight.css'];
vendor_js=['http://codemirror.net/lib/codemirror.js', 'http://codemirror.net/mode/xml/xml.js'];
"
>
<div class="pull-right">
<button class="btn btn-info" ng-click="edit('1.2.6', 'UI.Codemirror', 'ui-codemirror')">
<i class="glyphicon glyphicon-edit"></i> Edit in plunker
</button>
</div>
<tabset>
<tab heading="Markup">
<div plunker-content="markup">
<pre class="prettyprint"><section>
<div ui-codemirror="{
lineNumbers: true,
theme:'twilight',
readOnly: 'nocursor',
lineWrapping : true,
mode: 'xml'
}" >&lt;html style=&quot;color: green&quot;&gt;
&lt;!-- this is a comment --&gt;
&lt;head&gt;
&lt;title&gt;HTML Example&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
The indentation tries to be &lt;em&gt;somewhat &amp;quot;do what
I mean&amp;quot;&lt;/em&gt;... but might not match your style.
&lt;/body&gt;
&lt;/html&gt;</div>
</section></pre>
</div>
</tab>
</tabset>
</div>
</div>
</div>
<!-- =Mode-Changing demo
--------------------------------------------------------------------------- -->
<div id="demo-mode-changing">
<div class="page-header">
<h1>Mode-Changing demo</h1>
</div>
<div class="row" ng-controller="CodemirrorCtrl">
<div class="col-md-12">
<div ui-codemirror="cmOption" ng-model="cmModel"></div>
</div>
<div class="col-md-6">
Mode : <select class="form-control" ng-model="mode" ng-options="m for m in modes" ng-change="modeChanged()"></select>
</div>
</div>
</div>
<hr>
<div class="row">
<div class="span12" ng-controller="PlunkerCtrl"
ng-init="
vendor_css=['http://codemirror.net/lib/codemirror.css'];
vendor_js=['http://codemirror.net/lib/codemirror.js', 'http://codemirror.net/mode/scheme/scheme.js', 'http://codemirror.net/mode/javascript/javascript.js', 'http://codemirror.net/mode/xml/xml.js'];
"
>
<div class="pull-right">
<button class="btn btn-info" ng-click="edit('1.2.6', 'UI.Codemirror', 'ui-codemirror')">
<i class="glyphicon glyphicon-edit"></i> Edit in plunker
</button>
</div>
<tabset>
<tab heading="Markup">
<div plunker-content="markup">
<pre class="prettyprint"><section ng-controller="CodemirrorCtrl">
<textarea ui-codemirror="cmOption" ng-model="cmModel"></textarea>
Mode : <select ng-model="mode" ng-options="m for m in modes" ng-change="modeChanged()"></select>
</section></pre>
<div style="margin-top: 450px;"></div>
</div>
</tab>
<tab heading="JavaScript">
<div plunker-content="javascript">
<pre class="prettyprint">app.controller('CodemirrorCtrl', ['$scope', function($scope) {
// The modes
$scope.modes = ['Scheme', 'XML', 'Javascript'];
$scope.mode = $scope.modes[0];
// The ui-codemirror option
$scope.cmOption = {
lineNumbers: true,
indentWithTabs: true,
onLoad : function(_cm){
// HACK to have the codemirror instance in the scope...
$scope.modeChanged = function(){
_cm.setOption("mode", $scope.mode.toLowerCase());
};
}
};
// Initial code content...
$scope.cmModel = ';; Scheme code in here.\n' +
'(define (double x)\n\t(* x x))\n\n\n' +
'<!-- XML code in here. -->\n' +
'<root>\n\t<foo>\n\t</foo>\n\t<bar/>\n</root>\n\n\n' +
'// Javascript code in here.\n' +
'function foo(msg) {\n\tvar r = Math.random();\n\treturn "" + r + " : " + msg;\n}';
}]);</pre>
</div>
</tab>
</tabset>
</div>
</div>
</section>