| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 { | 125 { |
| 126 var element = editingContext.element; | 126 var element = editingContext.element; |
| 127 var config = editingContext.config; | 127 var config = editingContext.config; |
| 128 editingContext.cssLoadView = new WebInspector.CodeMirrorCSSLoadView(); | 128 editingContext.cssLoadView = new WebInspector.CodeMirrorCSSLoadView(); |
| 129 editingContext.cssLoadView.show(element); | 129 editingContext.cssLoadView.show(element); |
| 130 WebInspector.setCurrentFocusElement(element); | 130 WebInspector.setCurrentFocusElement(element); |
| 131 element.addEventListener("copy", this._consumeCopy, false); | 131 element.addEventListener("copy", this._consumeCopy, false); |
| 132 var codeMirror = new window.CodeMirror(element, { | 132 var codeMirror = new window.CodeMirror(element, { |
| 133 mode: config.mode, | 133 mode: config.mode, |
| 134 lineWrapping: config.lineWrapping, | 134 lineWrapping: config.lineWrapping, |
| 135 lineWiseCopyCut: false, |
| 135 smartIndent: config.smartIndent, | 136 smartIndent: config.smartIndent, |
| 136 autofocus: true, | 137 autofocus: true, |
| 137 theme: config.theme, | 138 theme: config.theme, |
| 138 value: config.initialValue | 139 value: config.initialValue |
| 139 }); | 140 }); |
| 140 codeMirror.getWrapperElement().classList.add("source-code"); | 141 codeMirror.getWrapperElement().classList.add("source-code"); |
| 141 codeMirror.on("cursorActivity", function(cm) { | 142 codeMirror.on("cursorActivity", function(cm) { |
| 142 cm.display.cursorDiv.scrollIntoViewIfNeeded(false); | 143 cm.display.cursorDiv.scrollIntoViewIfNeeded(false); |
| 143 }); | 144 }); |
| 144 editingContext.codeMirror = codeMirror; | 145 editingContext.codeMirror = codeMirror; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 return; | 232 return; |
| 232 var backgroundColor = InspectorFrontendHost.getSelectionBackgroundColor(); | 233 var backgroundColor = InspectorFrontendHost.getSelectionBackgroundColor(); |
| 233 var backgroundColorRule = backgroundColor ? ".CodeMirror .CodeMirror-selecte
d { background-color: " + backgroundColor + ";}" : ""; | 234 var backgroundColorRule = backgroundColor ? ".CodeMirror .CodeMirror-selecte
d { background-color: " + backgroundColor + ";}" : ""; |
| 234 var foregroundColor = InspectorFrontendHost.getSelectionForegroundColor(); | 235 var foregroundColor = InspectorFrontendHost.getSelectionForegroundColor(); |
| 235 var foregroundColorRule = foregroundColor ? ".CodeMirror .CodeMirror-selecte
dtext:not(.CodeMirror-persist-highlight) { color: " + foregroundColor + "!import
ant;}" : ""; | 236 var foregroundColorRule = foregroundColor ? ".CodeMirror .CodeMirror-selecte
dtext:not(.CodeMirror-persist-highlight) { color: " + foregroundColor + "!import
ant;}" : ""; |
| 236 var style = createElement("style"); | 237 var style = createElement("style"); |
| 237 if (foregroundColorRule || backgroundColorRule) | 238 if (foregroundColorRule || backgroundColorRule) |
| 238 style.textContent = backgroundColorRule + foregroundColorRule; | 239 style.textContent = backgroundColorRule + foregroundColorRule; |
| 239 element.appendChild(style); | 240 element.appendChild(style); |
| 240 } | 241 } |
| OLD | NEW |