Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
Merge pull request #12072 from adobe/swmitra/BugFixesFor1.6Beta
Browse files Browse the repository at this point in the history
Bug fixes for 1.6 release
  • Loading branch information
nethip committed Jan 12, 2016
2 parents db00c29 + d72753b commit 3df0ac6
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 32 deletions.
4 changes: 2 additions & 2 deletions src/document/DocumentCommandHandlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,8 @@ define(function (require, exports, module) {
// TODO should be removed once bug is closed.
// if we are already displaying a file do nothing but resolve immediately.
// this fixes timing issues in test cases.
if (MainViewManager.getCurrentlyViewedPath(MainViewManager.ACTIVE_PANE) === fullPath) {
result.resolve(MainViewManager.getCurrentlyViewedFile(MainViewManager.ACTIVE_PANE));
if (MainViewManager.getCurrentlyViewedPath(paneId || MainViewManager.ACTIVE_PANE) === fullPath) {
result.resolve(MainViewManager.getCurrentlyViewedFile(paneId || MainViewManager.ACTIVE_PANE));
return result.promise();
}

Expand Down
14 changes: 12 additions & 2 deletions src/editor/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,9 @@ define(function (require, exports, module) {

// To track which pane the editor is being attached to if it's a full editor
this._paneId = null;

// To track the parent editor ( host editor at that time of creation) of an inline editor
this._hostEditor = null;

// Editor supplies some standard keyboard behavior extensions of its own
var codeMirrorKeyMap = {
Expand Down Expand Up @@ -983,10 +986,17 @@ define(function (require, exports, module) {

// Convert CodeMirror onFocus events to EditorManager activeEditorChanged
this._codeMirror.on("focus", function () {
if (self._hostEditor) {
// Mark the host editor as the master editor for the hosting document
self._hostEditor.document._toggleMasterEditor(self._hostEditor);
} else {
// Set this full editor as master editor for the document
self.document._toggleMasterEditor(self);
}

self._focused = true;
self.trigger("focus", self);
// Set this full editor as master editor for the document
self.document._toggleMasterEditor(self);

});

this._codeMirror.on("blur", function () {
Expand Down
1 change: 1 addition & 0 deletions src/editor/EditorManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ define(function (require, exports, module) {
// first and showing it after the visible range is set, we avoid that initial render.
$(inlineContent).hide();
var inlineEditor = _createEditorForDocument(doc, false, inlineContent, range);
inlineEditor._hostEditor = getCurrentFullEditor();
$(inlineContent).show();

return { content: inlineContent, editor: inlineEditor };
Expand Down
2 changes: 1 addition & 1 deletion src/project/FileTreeView.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ define(function (require, exports, module) {
return;
}

if (this.props.entry.get("selected")) {
if (this.props.entry.get("selected") && !e.ctrlKey) {
if (this.state.clickTimer === null && !this.props.entry.get("rename")) {
var timer = window.setTimeout(this.startRename, CLICK_RENAME_MINIMUM);
this.setState({
Expand Down
37 changes: 21 additions & 16 deletions src/project/WorkingSetView.js
Original file line number Diff line number Diff line change
Expand Up @@ -788,22 +788,27 @@ define(function (require, exports, module) {
MainViewManager._moveWorkingSetItem(sourceView.paneId, startingIndex, $el.index());
postDropCleanup();
} else {
// item was dragged to another working set
MainViewManager._moveView(sourceView.paneId, currentView.paneId, sourceFile, $el.index())
.always(function () {
// if the current document was dragged to another working set
// then reopen it to make it the currently selected file
if (draggingCurrentFile) {
CommandManager
.execute(Commands.FILE_OPEN, {fullPath: sourceFile.fullPath,
paneId: currentView.paneId})
.always(function () {
postDropCleanup();
});
} else {
postDropCleanup();
}
});
// If the same doc view is present in the destination pane prevent drop
if (!MainViewManager._getPane(currentView.paneId).getViewForPath(sourceFile.fullPath)) {
// item was dragged to another working set
MainViewManager._moveView(sourceView.paneId, currentView.paneId, sourceFile, $el.index())
.always(function () {
// if the current document was dragged to another working set
// then reopen it to make it the currently selected file
if (draggingCurrentFile) {
CommandManager
.execute(Commands.FILE_OPEN, {fullPath: sourceFile.fullPath,
paneId: currentView.paneId})
.always(function () {
postDropCleanup();
});
} else {
postDropCleanup();
}
});
} else {
postDropCleanup();
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/utils/Resizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ define(function (require, exports, module) {
resizerCSSPosition = direction === DIRECTION_HORIZONTAL ? "left" : "top",
contentSizeFunction = direction === DIRECTION_HORIZONTAL ? $resizableElement.width : $resizableElement.height;

if (PreferencesManager.get(PREFS_PURE_CODE)) {
if (PreferencesManager.get(PREFS_PURE_CODE) &&
($element.hasClass("bottom-panel") || $element.hasClass("sidebar"))) {
elementPrefs.visible = false;
}

Expand Down
3 changes: 2 additions & 1 deletion src/view/MainViewManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,8 @@ define(function (require, exports, module) {

sourcePane.moveView(file, destinationPane, destinationIndex)
.done(function () {
// remove existing entry from mrulist for the same document if present
_removeFileFromMRU(destinationPane.id, file);
// update the mru list
_mruList.every(function (record) {
if (record.file === file && record.paneId === sourcePane.id) {
Expand All @@ -838,7 +840,6 @@ define(function (require, exports, module) {
}
return true;
});

exports.trigger("workingSetMove", file, sourcePane.id, destinationPane.id);
result.resolve();
});
Expand Down
56 changes: 47 additions & 9 deletions src/view/Pane.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
*
* Pane Object Events:
*
* - viewListChange - Whenever there is a file change to a file in the working set. These 2 events: `DocumentManger.pathRemove`
* and `DocumentManger.fileNameChange` will cause a `viewListChange` event so the WorkingSetView can update.
* - viewListChange - Whenever there is a file change to a file in the working set. These 2 events: `DocumentManager.pathRemove`
* and `DocumentManager.fileNameChange` will cause a `viewListChange` event so the WorkingSetView can update.
*
* - currentViewChange - Whenever the current view changes.
* (e, newView:View, oldView:View)
Expand Down Expand Up @@ -245,12 +245,40 @@ define(function (require, exports, module) {
var currentFile = self.getCurrentlyViewedFile();
var otherPaneId = self.id === FIRST_PANE ? SECOND_PANE : FIRST_PANE;
var otherPane = MainViewManager._getPane(otherPaneId);

// If the same doc view is present in the destination pane prevent flip
if (otherPane.getViewForPath(currentFile.fullPath)) {
return;
}

// Currently active pane is not necessarily self.id as just clicking the button does not
// give focus to the pane. This way it is possible to flip multiple panes to the active one
// without losing focus.
var activePaneIdBeforeFlip = MainViewManager.getActivePaneId();
var currentFileOnOtherPaneIndex = otherPane.findInViewList(currentFile.fullPath);

// if the currentFile is already on other pane just close the current pane
if (currentFileOnOtherPaneIndex !== -1) {
CommandManager.execute(Commands.FILE_CLOSE, {File: currentFile, paneId: self.id});
}

MainViewManager._moveView(self.id, otherPaneId, currentFile).always(function () {
CommandManager.execute(Commands.FILE_OPEN, {fullPath: currentFile.fullPath,
paneId: otherPaneId}).always(function () {
otherPane.trigger("viewListChange");

var activePaneBeforeFlip = MainViewManager._getPane(activePaneIdBeforeFlip);

// Trigger view list changes for both panes
self.trigger("viewListChange");
otherPane.trigger("viewListChange");

// Defer the focusing until other focus events have occurred.
setTimeout(function () {
// Focus has most likely changed: give it back to the original pane.
activePaneBeforeFlip.focus();
self._lastFocusedElement = activePaneBeforeFlip.$el[0];
MainViewManager.setActivePaneId(activePaneIdBeforeFlip);
}, 1);
});
});
});
Expand Down Expand Up @@ -558,23 +586,34 @@ define(function (require, exports, module) {
// move the item in the working set and
// open it in the destination pane
openNextPromise.done(function () {
var viewListIndex = self.findInViewList(file.fullPath);
var shouldAddView = viewListIndex !== -1;
var view = self._views[file.fullPath];

// If the file isn't in working set, destroy the view and delete it from
// source pane's view map and return as solved
if (!shouldAddView) {
if (view) {
self._doDestroyView(view);
}
return result.resolve();
}

// Remove file from all 3 view lists
self._viewList.splice(self.findInViewList(file.fullPath), 1);
self._viewList.splice(viewListIndex, 1);
self._viewListMRUOrder.splice(self.findInViewListMRUOrder(file.fullPath), 1);
self._viewListAddedOrder.splice(self.findInViewListAddedOrder(file.fullPath), 1);

// insert the view into the working set
destinationPane._addToViewList(file, _makeIndexRequestObject(true, destinationIndex));

//move the view,
var view = self._views[file.fullPath];

// if we had a view, it had previously been opened
// otherwise, the file was in the working set unopened
// otherwise, the file was in the working set unopened
if (view) {
// delete it from the source pane's view map and add it to the destination pane's view map
delete self._views[file.fullPath];
destinationPane.addView(view, !destinationPane.getCurrentlyViewedFile());

// we're done
result.resolve();
} else if (!destinationPane.getCurrentlyViewedFile()) {
Expand Down Expand Up @@ -813,7 +852,6 @@ define(function (require, exports, module) {
*/
Pane.prototype.addToViewList = function (file, index) {
var indexRequested = (index !== undefined && index !== null && index >= 0 && index < this._viewList.length);

this._addToViewList(file, _makeIndexRequestObject(indexRequested, index));

if (!indexRequested) {
Expand Down

0 comments on commit 3df0ac6

Please sign in to comment.