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

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

Issue 466743002: DevTools: Show doc context menu items for matching methods on all objects (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
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 b3a440902d32712909c36ec74fdc36366db13c0f..949260858ec94e037f1de81b6404eb536ff4f3b5 100644
--- a/Source/devtools/front_end/documentation/DocumentationView.js
+++ b/Source/devtools/front_end/documentation/DocumentationView.js
@@ -12,9 +12,9 @@ WebInspector.DocumentationView = function()
}
/**
- * @param {string} searchTerm
+ * @param {string} url
*/
-WebInspector.DocumentationView.showSearchTerm = function(searchTerm)
+WebInspector.DocumentationView.showDocumentationURL = function(url)
{
if (!WebInspector.DocumentationView._view)
WebInspector.DocumentationView._view = new WebInspector.DocumentationView();
@@ -50,9 +50,11 @@ WebInspector.DocumentationView.ContextMenuProvider.prototype = {
return;
var selectedText = textEditor.copyRange(selection);
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));
+ var possibleProperties = urlProvider.itemDescriptors(selectedText);
+ for (var i = 0; i < possibleProperties.length; ++i) {
+ var formatString = WebInspector.useLowerCaseMenuTitles() ? "Show documentation for '%s'" : "Show Documentation for '%s'";
lushnikov 2014/08/12 13:21:06 this should be moved out of for-loop
semeny 2014/08/12 14:27:59 Done.
+ var contextMenuItemTitle = WebInspector.UIString(formatString, possibleProperties[i].name);
+ contextMenu.appendItem(contextMenuItemTitle, WebInspector.DocumentationView.showDocumentationURL.bind(null, possibleProperties[i].url));
lushnikov 2014/08/12 13:21:06 this doesn't add into context menu submenu, does i
semeny 2014/08/12 14:27:59 Done.
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698