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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 }, | 77 }, |
78 | 78 |
79 setUpEditor: function(editingContext) | 79 setUpEditor: function(editingContext) |
80 { | 80 { |
81 var element = editingContext.element; | 81 var element = editingContext.element; |
82 var config = editingContext.config; | 82 var config = editingContext.config; |
83 editingContext.cssLoadView = new WebInspector.CodeMirrorCSSLoadView(); | 83 editingContext.cssLoadView = new WebInspector.CodeMirrorCSSLoadView(); |
84 editingContext.cssLoadView.show(element); | 84 editingContext.cssLoadView.show(element); |
85 WebInspector.setCurrentFocusElement(element); | 85 WebInspector.setCurrentFocusElement(element); |
86 element.addEventListener("copy", this._consumeCopy, false); | 86 element.addEventListener("copy", this._consumeCopy, false); |
87 var codeMirror = window.CodeMirror(element, { | 87 var codeMirror = new window.CodeMirror(element, { |
88 mode: config.mode, | 88 mode: config.mode, |
89 lineWrapping: config.lineWrapping, | 89 lineWrapping: config.lineWrapping, |
90 smartIndent: config.smartIndent, | 90 smartIndent: config.smartIndent, |
91 autofocus: true, | 91 autofocus: true, |
92 theme: config.theme, | 92 theme: config.theme, |
93 value: config.initialValue | 93 value: config.initialValue |
94 }); | 94 }); |
95 codeMirror.getWrapperElement().classList.add("source-code"); | 95 codeMirror.getWrapperElement().classList.add("source-code"); |
96 codeMirror.on("cursorActivity", function(cm) { | 96 codeMirror.on("cursorActivity", function(cm) { |
97 cm.display.cursorDiv.scrollIntoViewIfNeeded(false); | 97 cm.display.cursorDiv.scrollIntoViewIfNeeded(false); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 { | 166 { |
167 WebInspector.VBox.call(this); | 167 WebInspector.VBox.call(this); |
168 this.element.classList.add("hidden"); | 168 this.element.classList.add("hidden"); |
169 this.registerRequiredCSS("cm/codemirror.css"); | 169 this.registerRequiredCSS("cm/codemirror.css"); |
170 this.registerRequiredCSS("cm/cmdevtools.css"); | 170 this.registerRequiredCSS("cm/cmdevtools.css"); |
171 } | 171 } |
172 | 172 |
173 WebInspector.CodeMirrorCSSLoadView.prototype = { | 173 WebInspector.CodeMirrorCSSLoadView.prototype = { |
174 __proto__: WebInspector.VBox.prototype | 174 __proto__: WebInspector.VBox.prototype |
175 } | 175 } |
OLD | NEW |