ace-rails-ap 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +1 -1
  3. data/lib/ace/rails/version.rb +1 -1
  4. data/vendor/assets/javascripts/ace/ace.js +6911 -5290
  5. data/vendor/assets/javascripts/ace/ext-chromevox.js +537 -0
  6. data/vendor/assets/javascripts/ace/ext-elastic_tabstops_lite.js +301 -0
  7. data/vendor/assets/javascripts/ace/ext-emmet.js +1109 -0
  8. data/vendor/assets/javascripts/ace/ext-keybinding_menu.js +207 -0
  9. data/vendor/assets/javascripts/ace/ext-language_tools.js +1665 -0
  10. data/vendor/assets/javascripts/ace/ext-modelist.js +168 -0
  11. data/vendor/assets/javascripts/ace/ext-old_ie.js +500 -0
  12. data/vendor/assets/javascripts/ace/ext-options.js +252 -0
  13. data/vendor/assets/javascripts/ace/ext-searchbox.js +421 -0
  14. data/vendor/assets/javascripts/ace/ext-settings_menu.js +632 -0
  15. data/vendor/assets/javascripts/ace/ext-spellcheck.js +68 -0
  16. data/vendor/assets/javascripts/ace/ext-split.js +271 -0
  17. data/vendor/assets/javascripts/ace/ext-static_highlight.js +178 -0
  18. data/vendor/assets/javascripts/ace/ext-statusbar.js +47 -0
  19. data/vendor/assets/javascripts/ace/ext-textarea.js +478 -0
  20. data/vendor/assets/javascripts/ace/ext-themelist.js +86 -0
  21. data/vendor/assets/javascripts/ace/ext-whitespace.js +206 -0
  22. data/vendor/assets/javascripts/ace/keybinding-emacs.js +822 -131
  23. data/vendor/assets/javascripts/ace/keybinding-vim.js +382 -258
  24. data/vendor/assets/javascripts/ace/mode-abap.js +261 -0
  25. data/vendor/assets/javascripts/ace/mode-actionscript.js +257 -0
  26. data/vendor/assets/javascripts/ace/mode-ada.js +118 -0
  27. data/vendor/assets/javascripts/ace/mode-asciidoc.js +373 -0
  28. data/vendor/assets/javascripts/ace/mode-assembly_x86.js +217 -0
  29. data/vendor/assets/javascripts/ace/mode-autohotkey.js +225 -0
  30. data/vendor/assets/javascripts/ace/mode-batchfile.js +213 -0
  31. data/vendor/assets/javascripts/ace/mode-c9search.js +144 -124
  32. data/vendor/assets/javascripts/ace/mode-c_cpp.js +296 -254
  33. data/vendor/assets/javascripts/ace/mode-clojure.js +113 -177
  34. data/vendor/assets/javascripts/ace/mode-cobol.js +125 -0
  35. data/vendor/assets/javascripts/ace/mode-coffee.js +152 -235
  36. data/vendor/assets/javascripts/ace/mode-coldfusion.js +823 -835
  37. data/vendor/assets/javascripts/ace/mode-csharp.js +325 -187
  38. data/vendor/assets/javascripts/ace/mode-css.js +583 -297
  39. data/vendor/assets/javascripts/ace/mode-curly.js +2423 -0
  40. data/vendor/assets/javascripts/ace/mode-d.js +492 -0
  41. data/vendor/assets/javascripts/ace/mode-dart.js +993 -0
  42. data/vendor/assets/javascripts/ace/mode-diff.js +124 -204
  43. data/vendor/assets/javascripts/ace/mode-django.js +2448 -0
  44. data/vendor/assets/javascripts/ace/mode-dot.js +361 -0
  45. data/vendor/assets/javascripts/ace/mode-ejs.js +2817 -0
  46. data/vendor/assets/javascripts/ace/mode-erlang.js +987 -0
  47. data/vendor/assets/javascripts/ace/mode-forth.js +280 -0
  48. data/vendor/assets/javascripts/ace/mode-ftl.js +1061 -0
  49. data/vendor/assets/javascripts/ace/mode-glsl.js +313 -275
  50. data/vendor/assets/javascripts/ace/mode-golang.js +268 -275
  51. data/vendor/assets/javascripts/ace/mode-groovy.js +347 -492
  52. data/vendor/assets/javascripts/ace/mode-haml.js +498 -0
  53. data/vendor/assets/javascripts/ace/mode-handlebars.js +2433 -0
  54. data/vendor/assets/javascripts/ace/mode-haskell.js +362 -0
  55. data/vendor/assets/javascripts/ace/mode-haxe.js +226 -202
  56. data/vendor/assets/javascripts/ace/mode-html.js +1099 -802
  57. data/vendor/assets/javascripts/ace/mode-html_completions.js +309 -0
  58. data/vendor/assets/javascripts/ace/mode-html_ruby.js +2822 -0
  59. data/vendor/assets/javascripts/ace/mode-ini.js +185 -0
  60. data/vendor/assets/javascripts/ace/mode-jack.js +653 -0
  61. data/vendor/assets/javascripts/ace/mode-jade.js +2081 -0
  62. data/vendor/assets/javascripts/ace/mode-java.js +339 -488
  63. data/vendor/assets/javascripts/ace/mode-javascript.js +342 -478
  64. data/vendor/assets/javascripts/ace/mode-json.js +215 -178
  65. data/vendor/assets/javascripts/ace/mode-jsoniq.js +2761 -0
  66. data/vendor/assets/javascripts/ace/mode-jsp.js +1553 -0
  67. data/vendor/assets/javascripts/ace/mode-jsx.js +325 -289
  68. data/vendor/assets/javascripts/ace/mode-julia.js +286 -0
  69. data/vendor/assets/javascripts/ace/mode-latex.js +141 -46
  70. data/vendor/assets/javascripts/ace/mode-less.js +493 -151
  71. data/vendor/assets/javascripts/ace/mode-liquid.js +594 -656
  72. data/vendor/assets/javascripts/ace/mode-lisp.js +137 -0
  73. data/vendor/assets/javascripts/ace/mode-livescript.js +288 -0
  74. data/vendor/assets/javascripts/ace/mode-logiql.js +669 -0
  75. data/vendor/assets/javascripts/ace/mode-lsl.js +890 -0
  76. data/vendor/assets/javascripts/ace/mode-lua.js +274 -368
  77. data/vendor/assets/javascripts/ace/mode-luapage.js +1331 -1107
  78. data/vendor/assets/javascripts/ace/mode-lucene.js +64 -0
  79. data/vendor/assets/javascripts/ace/mode-makefile.js +332 -0
  80. data/vendor/assets/javascripts/ace/mode-markdown.js +1303 -948
  81. data/vendor/assets/javascripts/ace/mode-matlab.js +230 -0
  82. data/vendor/assets/javascripts/ace/mode-mushcode.js +705 -0
  83. data/vendor/assets/javascripts/ace/mode-mushcode_high_rules.js +569 -0
  84. data/vendor/assets/javascripts/ace/mode-mysql.js +185 -0
  85. data/vendor/assets/javascripts/ace/mode-nix.js +935 -0
  86. data/vendor/assets/javascripts/ace/mode-objectivec.js +699 -0
  87. data/vendor/assets/javascripts/ace/mode-ocaml.js +44 -63
  88. data/vendor/assets/javascripts/ace/mode-pascal.js +233 -0
  89. data/vendor/assets/javascripts/ace/mode-perl.js +116 -189
  90. data/vendor/assets/javascripts/ace/mode-pgsql.js +886 -500
  91. data/vendor/assets/javascripts/ace/mode-php.js +1158 -380
  92. data/vendor/assets/javascripts/ace/mode-plain_text.js +56 -0
  93. data/vendor/assets/javascripts/ace/mode-powershell.js +222 -167
  94. data/vendor/assets/javascripts/ace/mode-prolog.js +354 -0
  95. data/vendor/assets/javascripts/ace/mode-properties.js +100 -0
  96. data/vendor/assets/javascripts/ace/mode-protobuf.js +885 -0
  97. data/vendor/assets/javascripts/ace/mode-python.js +99 -201
  98. data/vendor/assets/javascripts/ace/mode-r.js +337 -0
  99. data/vendor/assets/javascripts/ace/mode-rdoc.js +210 -0
  100. data/vendor/assets/javascripts/ace/mode-rhtml.js +2663 -0
  101. data/vendor/assets/javascripts/ace/mode-ruby.js +262 -136
  102. data/vendor/assets/javascripts/ace/mode-rust.js +245 -0
  103. data/vendor/assets/javascripts/ace/mode-sass.js +443 -0
  104. data/vendor/assets/javascripts/ace/mode-scad.js +225 -240
  105. data/vendor/assets/javascripts/ace/mode-scala.js +340 -494
  106. data/vendor/assets/javascripts/ace/mode-scheme.js +143 -0
  107. data/vendor/assets/javascripts/ace/mode-scss.js +499 -157
  108. data/vendor/assets/javascripts/ace/mode-sh.js +180 -110
  109. data/vendor/assets/javascripts/ace/mode-sjs.js +1154 -0
  110. data/vendor/assets/javascripts/ace/mode-snippets.js +198 -0
  111. data/vendor/assets/javascripts/ace/mode-soy_template.js +2707 -0
  112. data/vendor/assets/javascripts/ace/mode-space.js +160 -0
  113. data/vendor/assets/javascripts/ace/mode-sql.js +48 -69
  114. data/vendor/assets/javascripts/ace/mode-stylus.js +447 -0
  115. data/vendor/assets/javascripts/ace/mode-svg.js +552 -605
  116. data/vendor/assets/javascripts/ace/mode-tcl.js +139 -98
  117. data/vendor/assets/javascripts/ace/mode-tex.js +187 -0
  118. data/vendor/assets/javascripts/ace/mode-textile.js +29 -40
  119. data/vendor/assets/javascripts/ace/mode-tmsnippet.js +200 -0
  120. data/vendor/assets/javascripts/ace/mode-toml.js +177 -0
  121. data/vendor/assets/javascripts/ace/mode-twig.js +2228 -0
  122. data/vendor/assets/javascripts/ace/mode-typescript.js +1018 -0
  123. data/vendor/assets/javascripts/ace/mode-vbscript.js +250 -0
  124. data/vendor/assets/javascripts/ace/mode-velocity.js +1621 -0
  125. data/vendor/assets/javascripts/ace/mode-verilog.js +127 -0
  126. data/vendor/assets/javascripts/ace/mode-vhdl.js +139 -0
  127. data/vendor/assets/javascripts/ace/mode-xml.js +350 -242
  128. data/vendor/assets/javascripts/ace/mode-xquery.js +2490 -300
  129. data/vendor/assets/javascripts/ace/mode-yaml.js +146 -45
  130. data/vendor/assets/javascripts/ace/theme-ambiance.js +202 -0
  131. data/vendor/assets/javascripts/ace/theme-chaos.js +179 -0
  132. data/vendor/assets/javascripts/ace/theme-chrome.js +97 -153
  133. data/vendor/assets/javascripts/ace/theme-clouds.js +78 -119
  134. data/vendor/assets/javascripts/ace/theme-clouds_midnight.js +79 -120
  135. data/vendor/assets/javascripts/ace/theme-cobalt.js +89 -140
  136. data/vendor/assets/javascripts/ace/theme-crimson_editor.js +93 -145
  137. data/vendor/assets/javascripts/ace/theme-dawn.js +84 -143
  138. data/vendor/assets/javascripts/ace/theme-dreamweaver.js +99 -162
  139. data/vendor/assets/javascripts/ace/theme-eclipse.js +78 -111
  140. data/vendor/assets/javascripts/ace/theme-github.js +70 -121
  141. data/vendor/assets/javascripts/ace/theme-idle_fingers.js +75 -134
  142. data/vendor/assets/javascripts/ace/theme-kr.js +135 -0
  143. data/vendor/assets/javascripts/ace/theme-merbivore.js +80 -143
  144. data/vendor/assets/javascripts/ace/theme-merbivore_soft.js +81 -149
  145. data/vendor/assets/javascripts/ace/theme-mono_industrial.js +87 -146
  146. data/vendor/assets/javascripts/ace/theme-monokai.js +88 -146
  147. data/vendor/assets/javascripts/ace/theme-pastel_on_dark.js +82 -142
  148. data/vendor/assets/javascripts/ace/theme-solarized_dark.js +83 -144
  149. data/vendor/assets/javascripts/ace/theme-solarized_light.js +76 -133
  150. data/vendor/assets/javascripts/ace/theme-terminal.js +145 -0
  151. data/vendor/assets/javascripts/ace/theme-textmate.js +101 -158
  152. data/vendor/assets/javascripts/ace/theme-tomorrow.js +89 -163
  153. data/vendor/assets/javascripts/ace/theme-tomorrow_night.js +89 -163
  154. data/vendor/assets/javascripts/ace/theme-tomorrow_night_blue.js +89 -165
  155. data/vendor/assets/javascripts/ace/theme-tomorrow_night_bright.js +101 -162
  156. data/vendor/assets/javascripts/ace/theme-tomorrow_night_eighties.js +90 -160
  157. data/vendor/assets/javascripts/ace/theme-twilight.js +87 -158
  158. data/vendor/assets/javascripts/ace/theme-vibrant_ink.js +75 -140
  159. data/vendor/assets/javascripts/ace/theme-xcode.js +120 -0
  160. data/vendor/assets/javascripts/ace/worker-coffee.js +3049 -2665
  161. data/vendor/assets/javascripts/ace/worker-css.js +1779 -4376
  162. data/vendor/assets/javascripts/ace/worker-javascript.js +8701 -9008
  163. data/vendor/assets/javascripts/ace/worker-json.js +709 -1340
  164. data/vendor/assets/javascripts/ace/worker-lua.js +3525 -0
  165. data/vendor/assets/javascripts/ace/worker-php.js +6893 -0
  166. data/vendor/assets/javascripts/ace/worker-xquery.js +19924 -64507
  167. metadata +100 -17
@@ -0,0 +1,68 @@
1
+ define('ace/ext/spellcheck', ['require', 'exports', 'module' , 'ace/lib/event', 'ace/editor', 'ace/config'], function(require, exports, module) {
2
+
3
+ var event = require("../lib/event");
4
+
5
+ exports.contextMenuHandler = function(e){
6
+ var host = e.target;
7
+ var text = host.textInput.getElement();
8
+ if (!host.selection.isEmpty())
9
+ return;
10
+ var c = host.getCursorPosition();
11
+ var r = host.session.getWordRange(c.row, c.column);
12
+ var w = host.session.getTextRange(r);
13
+
14
+ host.session.tokenRe.lastIndex = 0;
15
+ if (!host.session.tokenRe.test(w))
16
+ return;
17
+ var PLACEHOLDER = "\x01\x01";
18
+ var value = w + " " + PLACEHOLDER;
19
+ text.value = value;
20
+ text.setSelectionRange(w.length, w.length + 1);
21
+ text.setSelectionRange(0, 0);
22
+ text.setSelectionRange(0, w.length);
23
+
24
+ var afterKeydown = false;
25
+ event.addListener(text, "keydown", function onKeydown() {
26
+ event.removeListener(text, "keydown", onKeydown);
27
+ afterKeydown = true;
28
+ });
29
+
30
+ host.textInput.setInputHandler(function(newVal) {
31
+ console.log(newVal , value, text.selectionStart, text.selectionEnd)
32
+ if (newVal == value)
33
+ return '';
34
+ if (newVal.lastIndexOf(value, 0) === 0)
35
+ return newVal.slice(value.length);
36
+ if (newVal.substr(text.selectionEnd) == value)
37
+ return newVal.slice(0, -value.length);
38
+ if (newVal.slice(-2) == PLACEHOLDER) {
39
+ var val = newVal.slice(0, -2);
40
+ if (val.slice(-1) == " ") {
41
+ if (afterKeydown)
42
+ return val.substring(0, text.selectionEnd);
43
+ val = val.slice(0, -1);
44
+ host.session.replace(r, val);
45
+ return "";
46
+ }
47
+ }
48
+
49
+ return newVal;
50
+ });
51
+ };
52
+ var Editor = require("../editor").Editor;
53
+ require("../config").defineOptions(Editor.prototype, "editor", {
54
+ spellcheck: {
55
+ set: function(val) {
56
+ var text = this.textInput.getElement();
57
+ text.spellcheck = !!val;
58
+ if (!val)
59
+ this.removeListener("nativecontextmenu", exports.contextMenuHandler);
60
+ else
61
+ this.on("nativecontextmenu", exports.contextMenuHandler);
62
+ },
63
+ value: true
64
+ }
65
+ });
66
+
67
+ });
68
+
@@ -0,0 +1,271 @@
1
+ /* ***** BEGIN LICENSE BLOCK *****
2
+ * Distributed under the BSD license:
3
+ *
4
+ * Copyright (c) 2010, Ajax.org B.V.
5
+ * All rights reserved.
6
+ *
7
+ * Redistribution and use in source and binary forms, with or without
8
+ * modification, are permitted provided that the following conditions are met:
9
+ * * Redistributions of source code must retain the above copyright
10
+ * notice, this list of conditions and the following disclaimer.
11
+ * * Redistributions in binary form must reproduce the above copyright
12
+ * notice, this list of conditions and the following disclaimer in the
13
+ * documentation and/or other materials provided with the distribution.
14
+ * * Neither the name of Ajax.org B.V. nor the
15
+ * names of its contributors may be used to endorse or promote products
16
+ * derived from this software without specific prior written permission.
17
+ *
18
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
22
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
+ *
29
+ * ***** END LICENSE BLOCK ***** */
30
+
31
+ define('ace/ext/split', ['require', 'exports', 'module' , 'ace/split'], function(require, exports, module) {
32
+ module.exports = require("../split");
33
+
34
+ });
35
+
36
+ define('ace/split', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/lib/event_emitter', 'ace/editor', 'ace/virtual_renderer', 'ace/edit_session'], function(require, exports, module) {
37
+
38
+
39
+ var oop = require("./lib/oop");
40
+ var lang = require("./lib/lang");
41
+ var EventEmitter = require("./lib/event_emitter").EventEmitter;
42
+
43
+ var Editor = require("./editor").Editor;
44
+ var Renderer = require("./virtual_renderer").VirtualRenderer;
45
+ var EditSession = require("./edit_session").EditSession;
46
+
47
+
48
+ var Split = function(container, theme, splits) {
49
+ this.BELOW = 1;
50
+ this.BESIDE = 0;
51
+
52
+ this.$container = container;
53
+ this.$theme = theme;
54
+ this.$splits = 0;
55
+ this.$editorCSS = "";
56
+ this.$editors = [];
57
+ this.$orientation = this.BESIDE;
58
+
59
+ this.setSplits(splits || 1);
60
+ this.$cEditor = this.$editors[0];
61
+
62
+
63
+ this.on("focus", function(editor) {
64
+ this.$cEditor = editor;
65
+ }.bind(this));
66
+ };
67
+
68
+ (function(){
69
+
70
+ oop.implement(this, EventEmitter);
71
+
72
+ this.$createEditor = function() {
73
+ var el = document.createElement("div");
74
+ el.className = this.$editorCSS;
75
+ el.style.cssText = "position: absolute; top:0px; bottom:0px";
76
+ this.$container.appendChild(el);
77
+ var editor = new Editor(new Renderer(el, this.$theme));
78
+
79
+ editor.on("focus", function() {
80
+ this._emit("focus", editor);
81
+ }.bind(this));
82
+
83
+ this.$editors.push(editor);
84
+ editor.setFontSize(this.$fontSize);
85
+ return editor;
86
+ };
87
+
88
+ this.setSplits = function(splits) {
89
+ var editor;
90
+ if (splits < 1) {
91
+ throw "The number of splits have to be > 0!";
92
+ }
93
+
94
+ if (splits == this.$splits) {
95
+ return;
96
+ } else if (splits > this.$splits) {
97
+ while (this.$splits < this.$editors.length && this.$splits < splits) {
98
+ editor = this.$editors[this.$splits];
99
+ this.$container.appendChild(editor.container);
100
+ editor.setFontSize(this.$fontSize);
101
+ this.$splits ++;
102
+ }
103
+ while (this.$splits < splits) {
104
+ this.$createEditor();
105
+ this.$splits ++;
106
+ }
107
+ } else {
108
+ while (this.$splits > splits) {
109
+ editor = this.$editors[this.$splits - 1];
110
+ this.$container.removeChild(editor.container);
111
+ this.$splits --;
112
+ }
113
+ }
114
+ this.resize();
115
+ };
116
+ this.getSplits = function() {
117
+ return this.$splits;
118
+ };
119
+ this.getEditor = function(idx) {
120
+ return this.$editors[idx];
121
+ };
122
+ this.getCurrentEditor = function() {
123
+ return this.$cEditor;
124
+ };
125
+ this.focus = function() {
126
+ this.$cEditor.focus();
127
+ };
128
+ this.blur = function() {
129
+ this.$cEditor.blur();
130
+ };
131
+ this.setTheme = function(theme) {
132
+ this.$editors.forEach(function(editor) {
133
+ editor.setTheme(theme);
134
+ });
135
+ };
136
+ this.setKeyboardHandler = function(keybinding) {
137
+ this.$editors.forEach(function(editor) {
138
+ editor.setKeyboardHandler(keybinding);
139
+ });
140
+ };
141
+ this.forEach = function(callback, scope) {
142
+ this.$editors.forEach(callback, scope);
143
+ };
144
+
145
+
146
+ this.$fontSize = "";
147
+ this.setFontSize = function(size) {
148
+ this.$fontSize = size;
149
+ this.forEach(function(editor) {
150
+ editor.setFontSize(size);
151
+ });
152
+ };
153
+
154
+ this.$cloneSession = function(session) {
155
+ var s = new EditSession(session.getDocument(), session.getMode());
156
+
157
+ var undoManager = session.getUndoManager();
158
+ if (undoManager) {
159
+ var undoManagerProxy = new UndoManagerProxy(undoManager, s);
160
+ s.setUndoManager(undoManagerProxy);
161
+ }
162
+ s.$informUndoManager = lang.delayedCall(function() { s.$deltas = []; });
163
+ s.setTabSize(session.getTabSize());
164
+ s.setUseSoftTabs(session.getUseSoftTabs());
165
+ s.setOverwrite(session.getOverwrite());
166
+ s.setBreakpoints(session.getBreakpoints());
167
+ s.setUseWrapMode(session.getUseWrapMode());
168
+ s.setUseWorker(session.getUseWorker());
169
+ s.setWrapLimitRange(session.$wrapLimitRange.min,
170
+ session.$wrapLimitRange.max);
171
+ s.$foldData = session.$cloneFoldData();
172
+
173
+ return s;
174
+ };
175
+ this.setSession = function(session, idx) {
176
+ var editor;
177
+ if (idx == null) {
178
+ editor = this.$cEditor;
179
+ } else {
180
+ editor = this.$editors[idx];
181
+ }
182
+ var isUsed = this.$editors.some(function(editor) {
183
+ return editor.session === session;
184
+ });
185
+
186
+ if (isUsed) {
187
+ session = this.$cloneSession(session);
188
+ }
189
+ editor.setSession(session);
190
+ return session;
191
+ };
192
+ this.getOrientation = function() {
193
+ return this.$orientation;
194
+ };
195
+ this.setOrientation = function(orientation) {
196
+ if (this.$orientation == orientation) {
197
+ return;
198
+ }
199
+ this.$orientation = orientation;
200
+ this.resize();
201
+ };
202
+ this.resize = function() {
203
+ var width = this.$container.clientWidth;
204
+ var height = this.$container.clientHeight;
205
+ var editor;
206
+
207
+ if (this.$orientation == this.BESIDE) {
208
+ var editorWidth = width / this.$splits;
209
+ for (var i = 0; i < this.$splits; i++) {
210
+ editor = this.$editors[i];
211
+ editor.container.style.width = editorWidth + "px";
212
+ editor.container.style.top = "0px";
213
+ editor.container.style.left = i * editorWidth + "px";
214
+ editor.container.style.height = height + "px";
215
+ editor.resize();
216
+ }
217
+ } else {
218
+ var editorHeight = height / this.$splits;
219
+ for (var i = 0; i < this.$splits; i++) {
220
+ editor = this.$editors[i];
221
+ editor.container.style.width = width + "px";
222
+ editor.container.style.top = i * editorHeight + "px";
223
+ editor.container.style.left = "0px";
224
+ editor.container.style.height = editorHeight + "px";
225
+ editor.resize();
226
+ }
227
+ }
228
+ };
229
+
230
+ }).call(Split.prototype);
231
+
232
+
233
+ function UndoManagerProxy(undoManager, session) {
234
+ this.$u = undoManager;
235
+ this.$doc = session;
236
+ }
237
+
238
+ (function() {
239
+ this.execute = function(options) {
240
+ this.$u.execute(options);
241
+ };
242
+
243
+ this.undo = function() {
244
+ var selectionRange = this.$u.undo(true);
245
+ if (selectionRange) {
246
+ this.$doc.selection.setSelectionRange(selectionRange);
247
+ }
248
+ };
249
+
250
+ this.redo = function() {
251
+ var selectionRange = this.$u.redo(true);
252
+ if (selectionRange) {
253
+ this.$doc.selection.setSelectionRange(selectionRange);
254
+ }
255
+ };
256
+
257
+ this.reset = function() {
258
+ this.$u.reset();
259
+ };
260
+
261
+ this.hasUndo = function() {
262
+ return this.$u.hasUndo();
263
+ };
264
+
265
+ this.hasRedo = function() {
266
+ return this.$u.hasRedo();
267
+ };
268
+ }).call(UndoManagerProxy.prototype);
269
+
270
+ exports.Split = Split;
271
+ });
@@ -0,0 +1,178 @@
1
+ /* ***** BEGIN LICENSE BLOCK *****
2
+ * Distributed under the BSD license:
3
+ *
4
+ * Copyright (c) 2010, Ajax.org B.V.
5
+ * All rights reserved.
6
+ *
7
+ * Redistribution and use in source and binary forms, with or without
8
+ * modification, are permitted provided that the following conditions are met:
9
+ * * Redistributions of source code must retain the above copyright
10
+ * notice, this list of conditions and the following disclaimer.
11
+ * * Redistributions in binary form must reproduce the above copyright
12
+ * notice, this list of conditions and the following disclaimer in the
13
+ * documentation and/or other materials provided with the distribution.
14
+ * * Neither the name of Ajax.org B.V. nor the
15
+ * names of its contributors may be used to endorse or promote products
16
+ * derived from this software without specific prior written permission.
17
+ *
18
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
22
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
+ *
29
+ * ***** END LICENSE BLOCK ***** */
30
+
31
+ define('ace/ext/static_highlight', ['require', 'exports', 'module' , 'ace/edit_session', 'ace/layer/text', 'ace/config', 'ace/lib/dom'], function(require, exports, module) {
32
+
33
+
34
+ var EditSession = require("../edit_session").EditSession;
35
+ var TextLayer = require("../layer/text").Text;
36
+ var baseStyles = ".ace_static_highlight {\
37
+ font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', 'Droid Sans Mono', monospace;\
38
+ font-size: 12px;\
39
+ }\
40
+ .ace_static_highlight .ace_gutter {\
41
+ width: 25px !important;\
42
+ display: block;\
43
+ float: left;\
44
+ text-align: right;\
45
+ padding: 0 3px 0 0;\
46
+ margin-right: 3px;\
47
+ position: static !important;\
48
+ }\
49
+ .ace_static_highlight .ace_line { clear: both; }\
50
+ .ace_static_highlight .ace_gutter-cell {\
51
+ -moz-user-select: -moz-none;\
52
+ -khtml-user-select: none;\
53
+ -webkit-user-select: none;\
54
+ user-select: none;\
55
+ }\
56
+ .ace_static_highlight .ace_gutter-cell:before {\
57
+ content: counter(ace_line, decimal);\
58
+ counter-increment: ace_line;\
59
+ }\
60
+ .ace_static_highlight {\
61
+ counter-reset: ace_line;\
62
+ }\
63
+ ";
64
+ var config = require("../config");
65
+ var dom = require("../lib/dom");
66
+
67
+
68
+ var highlight = function(el, opts, callback) {
69
+ var m = el.className.match(/lang-(\w+)/);
70
+ var mode = opts.mode || m && ("ace/mode/" + m[1]);
71
+ if (!mode)
72
+ return false;
73
+ var theme = opts.theme || "ace/theme/textmate";
74
+
75
+ var data = "";
76
+ var nodes = [];
77
+
78
+ if (el.firstElementChild) {
79
+ var textLen = 0;
80
+ for (var i = 0; i < el.childNodes.length; i++) {
81
+ var ch = el.childNodes[i];
82
+ if (ch.nodeType == 3) {
83
+ textLen += ch.data.length;
84
+ data += ch.data;
85
+ } else {
86
+ nodes.push(textLen, ch);
87
+ }
88
+ }
89
+ } else {
90
+ data = dom.getInnerText(el);
91
+ if (opts.trim)
92
+ data = data.trim();
93
+ }
94
+
95
+ highlight.render(data, mode, theme, opts.firstLineNumber, !opts.showGutter, function (highlighted) {
96
+ dom.importCssString(highlighted.css, "ace_highlight");
97
+ el.innerHTML = highlighted.html;
98
+ var container = el.firstChild.firstChild;
99
+ for (var i = 0; i < nodes.length; i += 2) {
100
+ var pos = highlighted.session.doc.indexToPosition(nodes[i]);
101
+ var node = nodes[i + 1];
102
+ var lineEl = container.children[pos.row];
103
+ lineEl && lineEl.appendChild(node);
104
+ }
105
+ callback && callback();
106
+ });
107
+ };
108
+
109
+ highlight.render = function(input, mode, theme, lineStart, disableGutter, callback) {
110
+ var waiting = 0;
111
+ var modeCache = EditSession.prototype.$modes;
112
+ if (typeof theme == "string") {
113
+ waiting++;
114
+ config.loadModule(['theme', theme], function(m) {
115
+ theme = m;
116
+ --waiting || done();
117
+ });
118
+ }
119
+
120
+ if (typeof mode == "string") {
121
+ waiting++;
122
+ config.loadModule(['mode', mode], function(m) {
123
+ if (!modeCache[mode]) modeCache[mode] = new m.Mode();
124
+ mode = modeCache[mode];
125
+ --waiting || done();
126
+ });
127
+ }
128
+ function done() {
129
+ var result = highlight.renderSync(input, mode, theme, lineStart, disableGutter);
130
+ return callback ? callback(result) : result;
131
+ }
132
+ return waiting || done();
133
+ };
134
+
135
+ highlight.renderSync = function(input, mode, theme, lineStart, disableGutter) {
136
+ lineStart = parseInt(lineStart || 1, 10);
137
+
138
+ var session = new EditSession("");
139
+ session.setUseWorker(false);
140
+ session.setMode(mode);
141
+
142
+ var textLayer = new TextLayer(document.createElement("div"));
143
+ textLayer.setSession(session);
144
+ textLayer.config = {
145
+ characterWidth: 10,
146
+ lineHeight: 20
147
+ };
148
+
149
+ session.setValue(input);
150
+
151
+ var stringBuilder = [];
152
+ var length = session.getLength();
153
+
154
+ for(var ix = 0; ix < length; ix++) {
155
+ stringBuilder.push("<div class='ace_line'>");
156
+ if (!disableGutter)
157
+ stringBuilder.push("<span class='ace_gutter ace_gutter-cell' unselectable='on'>" + /*(ix + lineStart) + */ "</span>");
158
+ textLayer.$renderLine(stringBuilder, ix, true, false);
159
+ stringBuilder.push("\n</div>");
160
+ }
161
+ var html = "<div class='" + theme.cssClass + "'>" +
162
+ "<div class='ace_static_highlight' style='counter-reset:ace_line " + (lineStart - 1) + "'>" +
163
+ stringBuilder.join("") +
164
+ "</div>" +
165
+ "</div>";
166
+
167
+ textLayer.destroy();
168
+
169
+ return {
170
+ css: baseStyles + theme.cssText,
171
+ html: html,
172
+ session: session
173
+ };
174
+ };
175
+
176
+ module.exports = highlight;
177
+ module.exports.highlight =highlight;
178
+ });