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

Side by Side 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: Minor changes 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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)); 53 var selectedText = this._getSelection(textEditor);
apavlov 2014/08/11 15:04:14 Blink does not use "get" prefixes. This should be
54 if (!selectedText)
55 return;
56 var urlProvider = new WebInspector.DocumentationURLProvider();
apavlov 2014/08/11 15:04:14 Can we make it a singleton? It has no state
semeny 2014/08/11 15:34:28 Did not really understand what is wrong and what s
57 var itemPath = urlProvider.itemPath(selectedText);
58 if (!itemPath)
59 return;
60 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMe nuTitles() ? "Show documentation" : "Show Documentation"), WebInspector.Document ationView.showSearchTerm.bind(null, selectedText));
54 }, 61 },
55 62
56 /** 63 /**
57 * @param {!WebInspector.CodeMirrorTextEditor} textEditor 64 * @param {!WebInspector.CodeMirrorTextEditor} textEditor
65 * @return {?string}
58 */ 66 */
59 _showDocumentation: function(textEditor) 67 _getSelection: function(textEditor)
lushnikov 2014/08/11 14:59:47 no need for the separate function - please, inline
semeny 2014/08/11 15:34:28 Done.
60 { 68 {
61 var selection = textEditor.selection(); 69 var selection = textEditor.selection();
62 if (!selection || selection.isEmpty()) 70 if (!selection || selection.isEmpty() || selection.startLine !== selecti on.endLine)
apavlov 2014/08/11 15:04:14 Shouldn't this detect the word at cursor if the se
semeny 2014/08/11 15:34:28 No, only if property is selected.
63 return; 71 return null;
64 var selectedText = textEditor.copyRange(selection); 72 return textEditor.copyRange(selection);
65 WebInspector.DocumentationView.showSearchTerm(selectedText);
66 } 73 }
67 } 74 }
OLDNEW
« 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