OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 importScript("WikiParser.js"); | 5 importScript("WikiParser.js"); |
6 importScript("JSArticle.js"); | 6 importScript("JSArticle.js"); |
7 importScript("CSSArticle.js"); | 7 importScript("CSSArticle.js"); |
8 importScript("DocumentationURLProvider.js"); | 8 importScript("DocumentationURLProvider.js"); |
9 | |
10 /** | |
11 * @constructor | |
12 * @extends {WebInspector.VBox} | |
13 */ | |
14 WebInspector.DocumentationView = function() | |
15 { | |
16 WebInspector.VBox.call(this); | |
17 } | |
18 | |
19 /** | |
20 * @param {string} searchTerm | |
21 */ | |
22 WebInspector.DocumentationView.showSearchTerm = function(searchTerm) | |
23 { | |
24 if (!WebInspector.DocumentationView._view) | |
25 WebInspector.DocumentationView._view = new WebInspector.DocumentationVie w(); | |
26 var view = WebInspector.DocumentationView._view; | |
yurys
2014/08/08 13:07:47
Inline this.
| |
27 WebInspector.inspectorView.showCloseableViewInDrawer("documentation", WebIns pector.UIString("Documentation"), view); | |
28 } | |
29 | |
30 WebInspector.DocumentationView.prototype = { | |
31 __proto__: WebInspector.VBox.prototype | |
32 } | |
33 | |
34 /** | |
35 * @constructor | |
36 * @implements {WebInspector.ContextMenu.Provider} | |
37 */ | |
38 WebInspector.DocumentationView.ContextMenuProvider = function() | |
39 { | |
40 } | |
41 | |
42 WebInspector.DocumentationView.ContextMenuProvider.prototype = { | |
43 /** | |
44 * @param {!Event} event | |
45 * @param {!WebInspector.ContextMenu} contextMenu | |
46 * @param {!Object} target | |
47 */ | |
48 appendApplicableItems: function(event, contextMenu, target) | |
49 { | |
50 this._appendTextEditorItems(contextMenu, target); | |
51 }, | |
52 | |
53 /** | |
54 * @param {!WebInspector.ContextMenu} contextMenu | |
55 * @param {!Object} target | |
56 */ | |
57 _appendTextEditorItems: function(contextMenu, target) | |
apavlov
2014/08/08 13:13:52
This can be inlined, too
semeny
2014/08/08 14:54:44
Done.
| |
58 { | |
59 if (!(target instanceof WebInspector.CodeMirrorTextEditor)) | |
60 return; | |
61 var textEditor = /** @type {!WebInspector.CodeMirrorTextEditor} */ (targ et); | |
62 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMe nuTitles() ? "Show documentation" : "Show Documentation"), this._showDocumentati on.bind(this, textEditor)); | |
63 }, | |
64 | |
65 /** | |
66 * @param {!WebInspector.CodeMirrorTextEditor} textEditor | |
67 */ | |
68 _showDocumentation: function(textEditor) | |
69 { | |
70 var selection = textEditor.selection(); | |
71 if (!selection || selection.isEmpty()) | |
72 return; | |
73 var selectedText = textEditor.copyRange(selection); | |
74 WebInspector.DocumentationView.showSearchTerm(selectedText); | |
75 } | |
76 } | |
OLD | NEW |