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 26 matching lines...) Expand all Loading... |
37 */ | 37 */ |
38 WebInspector.CodeMirrorTextEditor = function(url, delegate) | 38 WebInspector.CodeMirrorTextEditor = function(url, delegate) |
39 { | 39 { |
40 WebInspector.VBox.call(this); | 40 WebInspector.VBox.call(this); |
41 this._delegate = delegate; | 41 this._delegate = delegate; |
42 this._url = url; | 42 this._url = url; |
43 | 43 |
44 this.registerRequiredCSS("cm/codemirror.css"); | 44 this.registerRequiredCSS("cm/codemirror.css"); |
45 this.registerRequiredCSS("cm/cmdevtools.css"); | 45 this.registerRequiredCSS("cm/cmdevtools.css"); |
46 | 46 |
47 this._codeMirror = window.CodeMirror(this.element, { | 47 this._codeMirror = new window.CodeMirror(this.element, { |
48 lineNumbers: true, | 48 lineNumbers: true, |
49 gutters: ["CodeMirror-linenumbers"], | 49 gutters: ["CodeMirror-linenumbers"], |
50 matchBrackets: true, | 50 matchBrackets: true, |
51 smartIndent: false, | 51 smartIndent: false, |
52 styleSelectedText: true, | 52 styleSelectedText: true, |
53 electricChars: false, | 53 electricChars: false, |
54 }); | 54 }); |
55 this._codeMirror._codeMirrorTextEditor = this; | 55 this._codeMirror._codeMirrorTextEditor = this; |
56 | 56 |
57 CodeMirror.keyMap["devtools-common"] = { | 57 CodeMirror.keyMap["devtools-common"] = { |
(...skipping 2069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2127 var backgroundColorRule = backgroundColor ? ".CodeMirror .CodeMirror-selecte
d { background-color: " + backgroundColor + ";}" : ""; | 2127 var backgroundColorRule = backgroundColor ? ".CodeMirror .CodeMirror-selecte
d { background-color: " + backgroundColor + ";}" : ""; |
2128 var foregroundColor = InspectorFrontendHost.getSelectionForegroundColor(); | 2128 var foregroundColor = InspectorFrontendHost.getSelectionForegroundColor(); |
2129 var foregroundColorRule = foregroundColor ? ".CodeMirror .CodeMirror-selecte
dtext:not(.CodeMirror-persist-highlight) { color: " + foregroundColor + "!import
ant;}" : ""; | 2129 var foregroundColorRule = foregroundColor ? ".CodeMirror .CodeMirror-selecte
dtext:not(.CodeMirror-persist-highlight) { color: " + foregroundColor + "!import
ant;}" : ""; |
2130 if (!foregroundColorRule && !backgroundColorRule) | 2130 if (!foregroundColorRule && !backgroundColorRule) |
2131 return; | 2131 return; |
2132 | 2132 |
2133 var style = document.createElement("style"); | 2133 var style = document.createElement("style"); |
2134 style.textContent = backgroundColorRule + foregroundColorRule; | 2134 style.textContent = backgroundColorRule + foregroundColorRule; |
2135 document.head.appendChild(style); | 2135 document.head.appendChild(style); |
2136 })(); | 2136 })(); |
OLD | NEW |