Chromium Code Reviews| Index: Source/devtools/front_end/documentation/DocumentationView.js |
| diff --git a/Source/devtools/front_end/documentation/DocumentationView.js b/Source/devtools/front_end/documentation/DocumentationView.js |
| index ae798e3c0f9feba81659eb0a8650c8f634da279d..604f8dd65e5ec02a4bedcc0f8c930f3421db8c4c 100644 |
| --- a/Source/devtools/front_end/documentation/DocumentationView.js |
| +++ b/Source/devtools/front_end/documentation/DocumentationView.js |
| @@ -6,3 +6,71 @@ importScript("WikiParser.js"); |
| importScript("JSArticle.js"); |
| importScript("CSSArticle.js"); |
| importScript("DocumentationURLProvider.js"); |
| + |
| +/** |
| + * @constructor |
| + * @extends {WebInspector.VBox} |
| + */ |
| +WebInspector.DocumentationView = function() |
| +{ |
| + WebInspector.VBox.call(this); |
| +} |
| + |
| +/** |
| + * @param {string} searchTerm |
| + */ |
| +WebInspector.DocumentationView.showSearchTerm = function(searchTerm) |
| +{ |
| + if (!WebInspector.DocumentationView._view) |
| + WebInspector.DocumentationView._view = new WebInspector.DocumentationView(); |
| + var view = WebInspector.DocumentationView._view; |
|
yurys
2014/08/08 13:07:47
Inline this.
|
| + WebInspector.inspectorView.showCloseableViewInDrawer("documentation", WebInspector.UIString("Documentation"), view); |
| +} |
| + |
| +WebInspector.DocumentationView.prototype = { |
| + __proto__: WebInspector.VBox.prototype |
| +} |
| + |
| +/** |
| + * @constructor |
| + * @implements {WebInspector.ContextMenu.Provider} |
| + */ |
| +WebInspector.DocumentationView.ContextMenuProvider = function() |
| +{ |
| +} |
| + |
| +WebInspector.DocumentationView.ContextMenuProvider.prototype = { |
| + /** |
| + * @param {!Event} event |
| + * @param {!WebInspector.ContextMenu} contextMenu |
| + * @param {!Object} target |
| + */ |
| + appendApplicableItems: function(event, contextMenu, target) |
| + { |
| + this._appendTextEditorItems(contextMenu, target); |
| + }, |
| + |
| + /** |
| + * @param {!WebInspector.ContextMenu} contextMenu |
| + * @param {!Object} target |
| + */ |
| + _appendTextEditorItems: function(contextMenu, target) |
|
apavlov
2014/08/08 13:13:52
This can be inlined, too
semeny
2014/08/08 14:54:44
Done.
|
| + { |
| + if (!(target instanceof WebInspector.CodeMirrorTextEditor)) |
| + return; |
| + var textEditor = /** @type {!WebInspector.CodeMirrorTextEditor} */ (target); |
| + contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Show documentation" : "Show Documentation"), this._showDocumentation.bind(this, textEditor)); |
| + }, |
| + |
| + /** |
| + * @param {!WebInspector.CodeMirrorTextEditor} textEditor |
| + */ |
| + _showDocumentation: function(textEditor) |
| + { |
| + var selection = textEditor.selection(); |
| + if (!selection || selection.isEmpty()) |
| + return; |
| + var selectedText = textEditor.copyRange(selection); |
| + WebInspector.DocumentationView.showSearchTerm(selectedText); |
| + } |
| +} |