| 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 | 9 |
| 10 /** | 10 /** |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 /** | 43 /** |
| 44 * @param {!Event} event | 44 * @param {!Event} event |
| 45 * @param {!WebInspector.ContextMenu} contextMenu | 45 * @param {!WebInspector.ContextMenu} contextMenu |
| 46 * @param {!Object} target | 46 * @param {!Object} target |
| 47 */ | 47 */ |
| 48 appendApplicableItems: function(event, contextMenu, target) | 48 appendApplicableItems: function(event, contextMenu, target) |
| 49 { | 49 { |
| 50 if (!(target instanceof WebInspector.CodeMirrorTextEditor)) | 50 if (!(target instanceof WebInspector.CodeMirrorTextEditor)) |
| 51 return; | 51 return; |
| 52 var textEditor = /** @type {!WebInspector.CodeMirrorTextEditor} */ (targ
et); | 52 var textEditor = /** @type {!WebInspector.CodeMirrorTextEditor} */ (targ
et); |
| 53 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMe
nuTitles() ? "Show documentation" : "Show Documentation"), this._showDocumentati
on.bind(this, textEditor)); | |
| 54 }, | |
| 55 | |
| 56 /** | |
| 57 * @param {!WebInspector.CodeMirrorTextEditor} textEditor | |
| 58 */ | |
| 59 _showDocumentation: function(textEditor) | |
| 60 { | |
| 61 var selection = textEditor.selection(); | 53 var selection = textEditor.selection(); |
| 62 if (!selection || selection.isEmpty()) | 54 if (!selection || selection.isEmpty() || selection.startLine !== selecti
on.endLine) |
| 63 return; | 55 return; |
| 64 var selectedText = textEditor.copyRange(selection); | 56 var selectedText = textEditor.copyRange(selection); |
| 65 WebInspector.DocumentationView.showSearchTerm(selectedText); | 57 var urlProvider = new WebInspector.DocumentationURLProvider(); |
| 58 var itemPath = urlProvider.itemPath(selectedText); |
| 59 if (!itemPath) |
| 60 return; |
| 61 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMe
nuTitles() ? "Show documentation" : "Show Documentation"), WebInspector.Document
ationView.showSearchTerm.bind(null, selectedText)); |
| 66 } | 62 } |
| 67 } | 63 } |
| OLD | NEW |