зеркало из https://github.com/mozilla/brackets.git
Correct showInlineEditor to toggleQuickEdit. Updated all references and ran unit tests.
This commit is contained in:
Родитель
23fd202c59
Коммит
6921fd5cb1
|
@ -73,7 +73,7 @@ define(function (require, exports, module) {
|
|||
exports.NAVIGATE_QUICK_OPEN = "navigate.quickOpen";
|
||||
exports.NAVIGATE_GOTO_DEFINITION = "navigate.gotoDefinition";
|
||||
exports.NAVIGATE_GOTO_LINE = "navigate.gotoLine";
|
||||
exports.SHOW_INLINE_EDITOR = "navigate.showInlineEditor";
|
||||
exports.TOGGLE_QUICK_EDIT = "navigate.togleQuickEdit";
|
||||
exports.QUICK_EDIT_NEXT_MATCH = "navigate.nextMatch";
|
||||
exports.QUICK_EDIT_PREV_MATCH = "navigate.previousMatch";
|
||||
|
||||
|
|
|
@ -802,7 +802,7 @@ define(function (require, exports, module) {
|
|||
|
||||
menu.addMenuItem(Commands.NAVIGATE_GOTO_DEFINITION, "Ctrl-T");
|
||||
menu.addMenuDivider();
|
||||
menu.addMenuItem(Commands.SHOW_INLINE_EDITOR, "Ctrl-E");
|
||||
menu.addMenuItem(Commands.TOGGLE_QUICK_EDIT, "Ctrl-E");
|
||||
menu.addMenuItem(Commands.QUICK_EDIT_PREV_MATCH, {key: "Alt-Up", displayKey: "Alt-\u2191"});
|
||||
menu.addMenuItem(Commands.QUICK_EDIT_NEXT_MATCH, {key: "Alt-Down", displayKey: "Alt-\u2193"});
|
||||
|
||||
|
@ -832,7 +832,7 @@ define(function (require, exports, module) {
|
|||
var project_cmenu = registerContextMenu(ContextMenuIds.PROJECT_MENU);
|
||||
|
||||
var editor_cmenu = registerContextMenu(ContextMenuIds.EDITOR_MENU);
|
||||
editor_cmenu.addMenuItem(Commands.SHOW_INLINE_EDITOR);
|
||||
editor_cmenu.addMenuItem(Commands.TOGGLE_QUICK_EDIT);
|
||||
editor_cmenu.addMenuItem(Commands.EDIT_SELECT_ALL);
|
||||
|
||||
/**
|
||||
|
|
|
@ -501,15 +501,20 @@ define(function (require, exports, module) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Show Inline Editor command handler
|
||||
* Toggle Quick Edit command handler
|
||||
* @return {!Promise} A promise resolved with true if an inline editor
|
||||
* is opened or false when closed. The promise is rejected if there
|
||||
* is no current editor or an inline editor is not created.
|
||||
*/
|
||||
function _showInlineEditor() {
|
||||
function _toggleQuickEdit() {
|
||||
var result = new $.Deferred();
|
||||
|
||||
if (_currentEditor) {
|
||||
var inlineWidget = null,
|
||||
result = getFocusedInlineWidget();
|
||||
focusedWidgetResult = getFocusedInlineWidget();
|
||||
|
||||
if (result) {
|
||||
inlineWidget = result.widget;
|
||||
if (focusedWidgetResult) {
|
||||
inlineWidget = focusedWidgetResult.widget;
|
||||
}
|
||||
|
||||
if (inlineWidget) {
|
||||
|
@ -519,18 +524,24 @@ define(function (require, exports, module) {
|
|||
PerfUtils.addMeasurement(PerfUtils.INLINE_EDITOR_CLOSE);
|
||||
|
||||
// return a resolved promise to CommandManager
|
||||
return new $.Deferred().resolve().promise();
|
||||
result.resolve(false);
|
||||
} else {
|
||||
// main editor has focus, so create an inline editor
|
||||
return _openInlineWidget(_currentEditor);
|
||||
_openInlineWidget(_currentEditor).done(function () {
|
||||
result.resolve(true);
|
||||
}).fail(function () {
|
||||
result.reject();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// Can not open an inline editor without a host editor
|
||||
result.reject();
|
||||
}
|
||||
|
||||
// Can not open an inline editor without a host editor
|
||||
return new $.Deferred().reject().promise();
|
||||
return result.promise();
|
||||
}
|
||||
|
||||
CommandManager.register(Strings.CMD_SHOW_INLINE_EDITOR, Commands.SHOW_INLINE_EDITOR, _showInlineEditor);
|
||||
CommandManager.register(Strings.CMD_TOGGLE_QUICK_EDIT, Commands.TOGGLE_QUICK_EDIT, _toggleQuickEdit);
|
||||
|
||||
// Initialize: register listeners
|
||||
$(DocumentManager).on("currentDocumentChange", _onCurrentDocumentChange);
|
||||
|
|
|
@ -111,10 +111,10 @@ define(function (require, exports, module) {
|
|||
if (openOffset !== undefined) {
|
||||
runs(function () {
|
||||
// open inline editor at specified offset index
|
||||
waitsForDone(SpecRunnerUtils.openInlineEditorAtOffset(
|
||||
waitsForDone(SpecRunnerUtils.toggleQuickEditAtOffset(
|
||||
EditorManager.getCurrentFullEditor(),
|
||||
spec.infos[openFile].offsets[openOffset]
|
||||
), "openInlineEditorAtOffset");
|
||||
), "toggleQuickEditAtOffset");
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
@ -137,7 +137,7 @@ define(function (require, exports, module) {
|
|||
exports.CMD_QUICK_OPEN = "Quick Open";
|
||||
exports.CMD_GOTO_LINE = "Go to Line";
|
||||
exports.CMD_GOTO_DEFINITION = "Go to Definition";
|
||||
exports.CMD_SHOW_INLINE_EDITOR = "Quick Edit";
|
||||
exports.CMD_TOGGLE_QUICK_EDIT = "Quick Edit";
|
||||
exports.CMD_QUICK_EDIT_PREV_MATCH = "Previous Match";
|
||||
exports.CMD_QUICK_EDIT_NEXT_MATCH = "Next Match";
|
||||
exports.CMD_NEXT_DOC = "Next Document";
|
||||
|
|
|
@ -80,7 +80,7 @@ define(function (require, exports, module) {
|
|||
});
|
||||
runs(function () {
|
||||
// Open inline editor onto test.css's ".testClass" rule
|
||||
promise = SpecRunnerUtils.openInlineEditorAtOffset(EditorManager.getCurrentFullEditor(), {line: 8, ch: 4});
|
||||
promise = SpecRunnerUtils.toggleQuickEditAtOffset(EditorManager.getCurrentFullEditor(), {line: 8, ch: 4});
|
||||
waitsForDone(promise, "Open inline editor");
|
||||
});
|
||||
runs(function () {
|
||||
|
|
|
@ -134,13 +134,13 @@ define(function (require, exports, module) {
|
|||
var editor = EditorManager.getCurrentFullEditor();
|
||||
|
||||
// open inline editor at specified offset index
|
||||
var inlineEditorResult = SpecRunnerUtils.openInlineEditorAtOffset(
|
||||
var inlineEditorResult = SpecRunnerUtils.toggleQuickEditAtOffset(
|
||||
editor,
|
||||
spec.infos[openFile].offsets[openOffset]
|
||||
);
|
||||
|
||||
inlineEditorResult.done(function () {
|
||||
inlineOpened = true;
|
||||
inlineEditorResult.done(function (isOpened) {
|
||||
inlineOpened = isOpened;
|
||||
}).fail(function () {
|
||||
inlineOpened = false;
|
||||
});
|
||||
|
|
|
@ -436,10 +436,10 @@ define(function (require, exports, module) {
|
|||
* @return {$.Promise} a promise that will be resolved when an inline
|
||||
* editor is created or rejected when no inline editors are available.
|
||||
*/
|
||||
function openInlineEditorAtOffset(editor, offset) {
|
||||
function toggleQuickEditAtOffset(editor, offset) {
|
||||
editor.setCursorPos(offset.line, offset.ch);
|
||||
|
||||
return testWindow.executeCommand(Commands.SHOW_INLINE_EDITOR);
|
||||
return testWindow.executeCommand(Commands.TOGGLE_QUICK_EDIT);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -474,7 +474,7 @@ define(function (require, exports, module) {
|
|||
exports.clickDialogButton = clickDialogButton;
|
||||
exports.loadProjectInTestWindow = loadProjectInTestWindow;
|
||||
exports.openProjectFiles = openProjectFiles;
|
||||
exports.openInlineEditorAtOffset = openInlineEditorAtOffset;
|
||||
exports.toggleQuickEditAtOffset = toggleQuickEditAtOffset;
|
||||
exports.saveFilesWithOffsets = saveFilesWithOffsets;
|
||||
exports.saveFilesWithoutOffsets = saveFilesWithoutOffsets;
|
||||
exports.saveFileWithoutOffsets = saveFileWithoutOffsets;
|
||||
|
|
Загрузка…
Ссылка в новой задаче