Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(907)

Unified Diff: Source/devtools/front_end/documentation/DocumentationView.js

Issue 458983002: DevTools: Omit the "Show documentation" context menu item creation for non-existent JS methods (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Comments addressed Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 501a9d689c841e2ed282d32782d4a41c0edf822a..dc7bf625b1969ab95943eaef10312af03c666ebd 100644
--- a/Source/devtools/front_end/documentation/DocumentationView.js
+++ b/Source/devtools/front_end/documentation/DocumentationView.js
@@ -50,18 +50,14 @@ WebInspector.DocumentationView.ContextMenuProvider.prototype = {
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())
+ if (!selection || selection.isEmpty() || selection.startLine !== selection.endLine)
return;
var selectedText = textEditor.copyRange(selection);
- WebInspector.DocumentationView.showSearchTerm(selectedText);
+ var urlProvider = new WebInspector.DocumentationURLProvider();
+ var itemPath = urlProvider.itemPath(selectedText);
+ if (!itemPath)
+ return;
+ contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Show documentation" : "Show Documentation"), WebInspector.DocumentationView.showSearchTerm.bind(null, selectedText));
}
-}
+}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698