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 19 matching lines...) Expand all Loading... |
30 | 30 |
31 /** | 31 /** |
32 * @constructor | 32 * @constructor |
33 * @extends {WebInspector.InplaceEditor} | 33 * @extends {WebInspector.InplaceEditor} |
34 */ | 34 */ |
35 WebInspector.CodeMirrorUtils = function() | 35 WebInspector.CodeMirrorUtils = function() |
36 { | 36 { |
37 WebInspector.InplaceEditor.call(this); | 37 WebInspector.InplaceEditor.call(this); |
38 } | 38 } |
39 | 39 |
| 40 /** |
| 41 * @param {!WebInspector.TextRange} range |
| 42 * @return {!{start: !CodeMirror.Pos, end: !CodeMirror.Pos}} |
| 43 */ |
| 44 WebInspector.CodeMirrorUtils.toPos = function(range) |
| 45 { |
| 46 return { |
| 47 start: new CodeMirror.Pos(range.startLine, range.startColumn), |
| 48 end: new CodeMirror.Pos(range.endLine, range.endColumn) |
| 49 } |
| 50 }, |
| 51 |
| 52 /** |
| 53 * @param {!CodeMirror.Pos} start |
| 54 * @param {!CodeMirror.Pos} end |
| 55 * @return {!WebInspector.TextRange} |
| 56 */ |
| 57 WebInspector.CodeMirrorUtils.toRange = function(start, end) |
| 58 { |
| 59 return new WebInspector.TextRange(start.line, start.ch, end.line, end.ch); |
| 60 }, |
| 61 |
| 62 |
40 WebInspector.CodeMirrorUtils.prototype = { | 63 WebInspector.CodeMirrorUtils.prototype = { |
41 /** | 64 /** |
42 * @return {string} | 65 * @return {string} |
43 */ | 66 */ |
44 editorContent: function(editingContext) { | 67 editorContent: function(editingContext) { |
45 return editingContext.codeMirror.getValue(); | 68 return editingContext.codeMirror.getValue(); |
46 }, | 69 }, |
47 | 70 |
48 /** | 71 /** |
49 * @param {?Event} e | 72 * @param {?Event} e |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 { | 167 { |
145 WebInspector.VBox.call(this); | 168 WebInspector.VBox.call(this); |
146 this.element.classList.add("hidden"); | 169 this.element.classList.add("hidden"); |
147 this.registerRequiredCSS("cm/codemirror.css"); | 170 this.registerRequiredCSS("cm/codemirror.css"); |
148 this.registerRequiredCSS("cm/cmdevtools.css"); | 171 this.registerRequiredCSS("cm/cmdevtools.css"); |
149 } | 172 } |
150 | 173 |
151 WebInspector.CodeMirrorCSSLoadView.prototype = { | 174 WebInspector.CodeMirrorCSSLoadView.prototype = { |
152 __proto__: WebInspector.VBox.prototype | 175 __proto__: WebInspector.VBox.prototype |
153 } | 176 } |
OLD | NEW |