OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 15 matching lines...) Expand all Loading... |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 importScript("cm/codemirror.js"); | 31 importScript("cm/codemirror.js"); |
32 importScript("cm/css.js"); | 32 importScript("cm/css.js"); |
33 importScript("cm/javascript.js"); | 33 importScript("cm/javascript.js"); |
34 importScript("cm/xml.js"); | 34 importScript("cm/xml.js"); |
35 importScript("cm/htmlmixed.js"); | 35 importScript("cm/htmlmixed.js"); |
| 36 |
36 importScript("cm/matchbrackets.js"); | 37 importScript("cm/matchbrackets.js"); |
37 importScript("cm/closebrackets.js"); | 38 importScript("cm/closebrackets.js"); |
38 importScript("cm/markselection.js"); | 39 importScript("cm/markselection.js"); |
39 importScript("cm/showhint.js"); | 40 importScript("cm/showhint.js"); |
40 importScript("cm/comment.js"); | 41 importScript("cm/comment.js"); |
41 importScript("cm/overlay.js"); | 42 importScript("cm/overlay.js"); |
42 | 43 |
| 44 importScript("cm/htmlembedded.js"); |
| 45 importScript("cm/clike.js"); |
| 46 importScript("cm/coffeescript.js"); |
| 47 importScript("cm/php.js"); |
| 48 importScript("cm/python.js"); |
| 49 importScript("cm/shell.js"); |
| 50 |
43 /** | 51 /** |
44 * @constructor | 52 * @constructor |
45 * @extends {WebInspector.View} | 53 * @extends {WebInspector.View} |
46 * @implements {WebInspector.TextEditor} | 54 * @implements {WebInspector.TextEditor} |
47 * @param {?string} url | 55 * @param {?string} url |
48 * @param {WebInspector.TextEditorDelegate} delegate | 56 * @param {WebInspector.TextEditorDelegate} delegate |
49 */ | 57 */ |
50 WebInspector.CodeMirrorTextEditor = function(url, delegate) | 58 WebInspector.CodeMirrorTextEditor = function(url, delegate) |
51 { | 59 { |
52 WebInspector.View.call(this); | 60 WebInspector.View.call(this); |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 * @param {string} mimeType | 556 * @param {string} mimeType |
549 */ | 557 */ |
550 set mimeType(mimeType) | 558 set mimeType(mimeType) |
551 { | 559 { |
552 if (this._hasLongLines()) | 560 if (this._hasLongLines()) |
553 this._enableLongLinesMode(); | 561 this._enableLongLinesMode(); |
554 else | 562 else |
555 this._disableLongLinesMode(); | 563 this._disableLongLinesMode(); |
556 var showWhitespaces = WebInspector.settings.showWhitespacesInEditor.get(
); | 564 var showWhitespaces = WebInspector.settings.showWhitespacesInEditor.get(
); |
557 this._codeMirror.setOption("mode", showWhitespaces ? this._whitespaceOve
rlayMode(mimeType) : mimeType); | 565 this._codeMirror.setOption("mode", showWhitespaces ? this._whitespaceOve
rlayMode(mimeType) : mimeType); |
558 switch (mimeType) { | |
559 case "text/html": this._codeMirror.setOption("theme", "web-inspector-htm
l"); break; | |
560 case "text/css": | |
561 case "text/x-scss": | |
562 this._codeMirror.setOption("theme", "web-inspector-css"); | |
563 break; | |
564 case "text/javascript": this._codeMirror.setOption("theme", "web-inspect
or-js"); break; | |
565 } | |
566 }, | 566 }, |
567 | 567 |
568 /** | 568 /** |
569 * @param {boolean} readOnly | 569 * @param {boolean} readOnly |
570 */ | 570 */ |
571 setReadOnly: function(readOnly) | 571 setReadOnly: function(readOnly) |
572 { | 572 { |
573 this._codeMirror.setOption("readOnly", readOnly ? "nocursor" : false); | 573 this._codeMirror.setOption("readOnly", readOnly ? "nocursor" : false); |
574 }, | 574 }, |
575 | 575 |
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1291 var modifierKey = WebInspector.isMac() ? "Alt" : "Ctrl"; | 1291 var modifierKey = WebInspector.isMac() ? "Alt" : "Ctrl"; |
1292 var leftKey = modifierKey + "-Left"; | 1292 var leftKey = modifierKey + "-Left"; |
1293 var rightKey = modifierKey + "-Right"; | 1293 var rightKey = modifierKey + "-Right"; |
1294 var keyMap = {}; | 1294 var keyMap = {}; |
1295 keyMap[leftKey] = moveLeft.bind(this, false); | 1295 keyMap[leftKey] = moveLeft.bind(this, false); |
1296 keyMap[rightKey] = moveRight.bind(this, false); | 1296 keyMap[rightKey] = moveRight.bind(this, false); |
1297 keyMap["Shift-" + leftKey] = moveLeft.bind(this, true); | 1297 keyMap["Shift-" + leftKey] = moveLeft.bind(this, true); |
1298 keyMap["Shift-" + rightKey] = moveRight.bind(this, true); | 1298 keyMap["Shift-" + rightKey] = moveRight.bind(this, true); |
1299 codeMirror.addKeyMap(keyMap); | 1299 codeMirror.addKeyMap(keyMap); |
1300 } | 1300 } |
OLD | NEW |