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

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

Issue 452083002: DevTools: Implement CSS/JS documentation context menu provider for CodeMirrorTextEditor (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@my-patch
Patch Set: Rebased master branch 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 | « Source/devtools/front_end/common/Settings.js ('k') | Source/devtools/front_end/documentation/module.json » ('j') | 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 ae798e3c0f9feba81659eb0a8650c8f634da279d..501a9d689c841e2ed282d32782d4a41c0edf822a 100644
--- a/Source/devtools/front_end/documentation/DocumentationView.js
+++ b/Source/devtools/front_end/documentation/DocumentationView.js
@@ -6,3 +6,62 @@ importScript("WikiParser.js");
importScript("JSArticle.js");
importScript("CSSArticle.js");
importScript("DocumentationURLProvider.js");
+
+/**
+ * @constructor
+ * @extends {WebInspector.VBox}
+ */
+WebInspector.DocumentationView = function()
+{
+ WebInspector.VBox.call(this);
+}
+
+/**
+ * @param {string} searchTerm
+ */
+WebInspector.DocumentationView.showSearchTerm = function(searchTerm)
+{
+ if (!WebInspector.DocumentationView._view)
+ WebInspector.DocumentationView._view = new WebInspector.DocumentationView();
+ var view = WebInspector.DocumentationView._view;
+ WebInspector.inspectorView.showCloseableViewInDrawer("documentation", WebInspector.UIString("Documentation"), view);
+}
+
+WebInspector.DocumentationView.prototype = {
+ __proto__: WebInspector.VBox.prototype
+}
+
+/**
+ * @constructor
+ * @implements {WebInspector.ContextMenu.Provider}
+ */
+WebInspector.DocumentationView.ContextMenuProvider = function()
+{
+}
+
+WebInspector.DocumentationView.ContextMenuProvider.prototype = {
+ /**
+ * @param {!Event} event
+ * @param {!WebInspector.ContextMenu} contextMenu
+ * @param {!Object} target
+ */
+ appendApplicableItems: function(event, contextMenu, target)
+ {
+ 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())
+ return;
+ var selectedText = textEditor.copyRange(selection);
+ WebInspector.DocumentationView.showSearchTerm(selectedText);
+ }
+}
« no previous file with comments | « Source/devtools/front_end/common/Settings.js ('k') | Source/devtools/front_end/documentation/module.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698