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

Unified Diff: Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js

Issue 1264133002: Devtools: [WIP] Implement enhanced devtools extension language APIs Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Modify override dropdown to apply to console completions & transpile Created 5 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/source_frame/CodeMirrorTextEditor.js
diff --git a/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js b/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js
index a01ac5e079b1be234d130ac3d6b6208a6a4e499a..8d4213048193a9489f5a9386a0b62e48139cbcf5 100644
--- a/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js
+++ b/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js
@@ -956,6 +956,13 @@ WebInspector.CodeMirrorTextEditor.prototype = {
},
/**
+ * @return {string}
+ */
+ getMimeType: function() {
pfeldman 2015/08/13 21:15:47 no get prefixes in Blink please!
wes 2015/08/14 00:55:05 Understood! Is there a lint rule for this? :P
+ return this._mimeType;
+ },
+
+ /**
* @param {boolean} readOnly
*/
setReadOnly: function(readOnly)
@@ -1058,15 +1065,22 @@ WebInspector.CodeMirrorTextEditor.prototype = {
_contextMenu: function(event)
{
var contextMenu = new WebInspector.ContextMenu(event);
+ event.consume(true); //Consume event now to prevent document from handling the async menu
var target = event.target.enclosingNodeOrSelfWithClass("CodeMirror-gutter-elt");
+ var prom;
if (target)
- this._delegate.populateLineGutterContextMenu(contextMenu, parseInt(target.textContent, 10) - 1);
+ prom = this._delegate.populateLineGutterContextMenu(contextMenu, parseInt(target.textContent, 10) - 1);
else {
var textSelection = this.selection();
- this._delegate.populateTextAreaContextMenu(contextMenu, textSelection.startLine, textSelection.startColumn);
+ prom = this._delegate.populateTextAreaContextMenu(contextMenu, textSelection.startLine, textSelection.startColumn);
+ }
+
+ prom.then(showAsync, showAsync);
wes 2015/08/14 00:55:05 By the way - showing the context menu async seems
+ var _this = this;
+ function showAsync() {
+ contextMenu.appendApplicableItems(_this);
+ contextMenu.show();
}
- contextMenu.appendApplicableItems(this);
- contextMenu.show();
},
/**
@@ -1537,6 +1551,14 @@ WebInspector.CodeMirrorTextEditor.prototype = {
},
/**
+ * @return {?string}
+ */
+ get url()
+ {
+ return this._url;
+ },
+
+ /**
* @param {number} line
* @param {string} name
* @param {?Object} value
@@ -2164,6 +2186,7 @@ WebInspector.TextEditorDelegate.prototype = {
/**
* @param {!WebInspector.ContextMenu} contextMenu
* @param {number} lineNumber
+ * @return {!Promise}
*/
populateLineGutterContextMenu: function(contextMenu, lineNumber) { },
@@ -2171,6 +2194,7 @@ WebInspector.TextEditorDelegate.prototype = {
* @param {!WebInspector.ContextMenu} contextMenu
* @param {number} lineNumber
* @param {number} columnNumber
+ * @return {!Promise}
*/
populateTextAreaContextMenu: function(contextMenu, lineNumber, columnNumber) { },

Powered by Google App Engine
This is Rietveld 408576698