Commit d789c8a2 authored by semeny@google.com's avatar semeny@google.com

Now context menu item for documentation is not created if...

Now context menu item for documentation is not created if WebInspector.DocumentationURLProvider cannot provide a URL for selected property.

BUG=391593

Review URL: https://codereview.chromium.org/458983002

git-svn-id: svn://svn.chromium.org/blink/trunk@180056 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 6a897207
......@@ -45,18 +45,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 newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment