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

Commit 3df0ac6

Browse files
committed
Merge pull request #12072 from adobe/swmitra/BugFixesFor1.6Beta
Bug fixes for 1.6 release
2 parents db00c29 + d72753b commit 3df0ac6

File tree

8 files changed

+88
-32
lines changed

8 files changed

+88
-32
lines changed

src/document/DocumentCommandHandlers.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,8 @@ define(function (require, exports, module) {
291291
// TODO should be removed once bug is closed.
292292
// if we are already displaying a file do nothing but resolve immediately.
293293
// this fixes timing issues in test cases.
294-
if (MainViewManager.getCurrentlyViewedPath(MainViewManager.ACTIVE_PANE) === fullPath) {
295-
result.resolve(MainViewManager.getCurrentlyViewedFile(MainViewManager.ACTIVE_PANE));
294+
if (MainViewManager.getCurrentlyViewedPath(paneId || MainViewManager.ACTIVE_PANE) === fullPath) {
295+
result.resolve(MainViewManager.getCurrentlyViewedFile(paneId || MainViewManager.ACTIVE_PANE));
296296
return result.promise();
297297
}
298298

src/editor/Editor.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,9 @@ define(function (require, exports, module) {
331331

332332
// To track which pane the editor is being attached to if it's a full editor
333333
this._paneId = null;
334+
335+
// To track the parent editor ( host editor at that time of creation) of an inline editor
336+
this._hostEditor = null;
334337

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

984987
// Convert CodeMirror onFocus events to EditorManager activeEditorChanged
985988
this._codeMirror.on("focus", function () {
989+
if (self._hostEditor) {
990+
// Mark the host editor as the master editor for the hosting document
991+
self._hostEditor.document._toggleMasterEditor(self._hostEditor);
992+
} else {
993+
// Set this full editor as master editor for the document
994+
self.document._toggleMasterEditor(self);
995+
}
996+
986997
self._focused = true;
987998
self.trigger("focus", self);
988-
// Set this full editor as master editor for the document
989-
self.document._toggleMasterEditor(self);
999+
9901000
});
9911001

9921002
this._codeMirror.on("blur", function () {

src/editor/EditorManager.js

+1
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ define(function (require, exports, module) {
505505
// first and showing it after the visible range is set, we avoid that initial render.
506506
$(inlineContent).hide();
507507
var inlineEditor = _createEditorForDocument(doc, false, inlineContent, range);
508+
inlineEditor._hostEditor = getCurrentFullEditor();
508509
$(inlineContent).show();
509510

510511
return { content: inlineContent, editor: inlineEditor };

src/project/FileTreeView.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ define(function (require, exports, module) {
398398
return;
399399
}
400400

401-
if (this.props.entry.get("selected")) {
401+
if (this.props.entry.get("selected") && !e.ctrlKey) {
402402
if (this.state.clickTimer === null && !this.props.entry.get("rename")) {
403403
var timer = window.setTimeout(this.startRename, CLICK_RENAME_MINIMUM);
404404
this.setState({

src/project/WorkingSetView.js

+21-16
Original file line numberDiff line numberDiff line change
@@ -788,22 +788,27 @@ define(function (require, exports, module) {
788788
MainViewManager._moveWorkingSetItem(sourceView.paneId, startingIndex, $el.index());
789789
postDropCleanup();
790790
} else {
791-
// item was dragged to another working set
792-
MainViewManager._moveView(sourceView.paneId, currentView.paneId, sourceFile, $el.index())
793-
.always(function () {
794-
// if the current document was dragged to another working set
795-
// then reopen it to make it the currently selected file
796-
if (draggingCurrentFile) {
797-
CommandManager
798-
.execute(Commands.FILE_OPEN, {fullPath: sourceFile.fullPath,
799-
paneId: currentView.paneId})
800-
.always(function () {
801-
postDropCleanup();
802-
});
803-
} else {
804-
postDropCleanup();
805-
}
806-
});
791+
// If the same doc view is present in the destination pane prevent drop
792+
if (!MainViewManager._getPane(currentView.paneId).getViewForPath(sourceFile.fullPath)) {
793+
// item was dragged to another working set
794+
MainViewManager._moveView(sourceView.paneId, currentView.paneId, sourceFile, $el.index())
795+
.always(function () {
796+
// if the current document was dragged to another working set
797+
// then reopen it to make it the currently selected file
798+
if (draggingCurrentFile) {
799+
CommandManager
800+
.execute(Commands.FILE_OPEN, {fullPath: sourceFile.fullPath,
801+
paneId: currentView.paneId})
802+
.always(function () {
803+
postDropCleanup();
804+
});
805+
} else {
806+
postDropCleanup();
807+
}
808+
});
809+
} else {
810+
postDropCleanup();
811+
}
807812
}
808813
}
809814

src/utils/Resizer.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,8 @@ define(function (require, exports, module) {
225225
resizerCSSPosition = direction === DIRECTION_HORIZONTAL ? "left" : "top",
226226
contentSizeFunction = direction === DIRECTION_HORIZONTAL ? $resizableElement.width : $resizableElement.height;
227227

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

src/view/MainViewManager.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,8 @@ define(function (require, exports, module) {
830830

831831
sourcePane.moveView(file, destinationPane, destinationIndex)
832832
.done(function () {
833+
// remove existing entry from mrulist for the same document if present
834+
_removeFileFromMRU(destinationPane.id, file);
833835
// update the mru list
834836
_mruList.every(function (record) {
835837
if (record.file === file && record.paneId === sourcePane.id) {
@@ -838,7 +840,6 @@ define(function (require, exports, module) {
838840
}
839841
return true;
840842
});
841-
842843
exports.trigger("workingSetMove", file, sourcePane.id, destinationPane.id);
843844
result.resolve();
844845
});

src/view/Pane.js

+47-9
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@
5656
*
5757
* Pane Object Events:
5858
*
59-
* - viewListChange - Whenever there is a file change to a file in the working set. These 2 events: `DocumentManger.pathRemove`
60-
* and `DocumentManger.fileNameChange` will cause a `viewListChange` event so the WorkingSetView can update.
59+
* - viewListChange - Whenever there is a file change to a file in the working set. These 2 events: `DocumentManager.pathRemove`
60+
* and `DocumentManager.fileNameChange` will cause a `viewListChange` event so the WorkingSetView can update.
6161
*
6262
* - currentViewChange - Whenever the current view changes.
6363
* (e, newView:View, oldView:View)
@@ -245,12 +245,40 @@ define(function (require, exports, module) {
245245
var currentFile = self.getCurrentlyViewedFile();
246246
var otherPaneId = self.id === FIRST_PANE ? SECOND_PANE : FIRST_PANE;
247247
var otherPane = MainViewManager._getPane(otherPaneId);
248+
249+
// If the same doc view is present in the destination pane prevent flip
250+
if (otherPane.getViewForPath(currentFile.fullPath)) {
251+
return;
252+
}
253+
254+
// Currently active pane is not necessarily self.id as just clicking the button does not
255+
// give focus to the pane. This way it is possible to flip multiple panes to the active one
256+
// without losing focus.
257+
var activePaneIdBeforeFlip = MainViewManager.getActivePaneId();
258+
var currentFileOnOtherPaneIndex = otherPane.findInViewList(currentFile.fullPath);
248259

260+
// if the currentFile is already on other pane just close the current pane
261+
if (currentFileOnOtherPaneIndex !== -1) {
262+
CommandManager.execute(Commands.FILE_CLOSE, {File: currentFile, paneId: self.id});
263+
}
264+
249265
MainViewManager._moveView(self.id, otherPaneId, currentFile).always(function () {
250266
CommandManager.execute(Commands.FILE_OPEN, {fullPath: currentFile.fullPath,
251267
paneId: otherPaneId}).always(function () {
252-
otherPane.trigger("viewListChange");
268+
269+
var activePaneBeforeFlip = MainViewManager._getPane(activePaneIdBeforeFlip);
270+
271+
// Trigger view list changes for both panes
253272
self.trigger("viewListChange");
273+
otherPane.trigger("viewListChange");
274+
275+
// Defer the focusing until other focus events have occurred.
276+
setTimeout(function () {
277+
// Focus has most likely changed: give it back to the original pane.
278+
activePaneBeforeFlip.focus();
279+
self._lastFocusedElement = activePaneBeforeFlip.$el[0];
280+
MainViewManager.setActivePaneId(activePaneIdBeforeFlip);
281+
}, 1);
254282
});
255283
});
256284
});
@@ -558,23 +586,34 @@ define(function (require, exports, module) {
558586
// move the item in the working set and
559587
// open it in the destination pane
560588
openNextPromise.done(function () {
589+
var viewListIndex = self.findInViewList(file.fullPath);
590+
var shouldAddView = viewListIndex !== -1;
591+
var view = self._views[file.fullPath];
592+
593+
// If the file isn't in working set, destroy the view and delete it from
594+
// source pane's view map and return as solved
595+
if (!shouldAddView) {
596+
if (view) {
597+
self._doDestroyView(view);
598+
}
599+
return result.resolve();
600+
}
601+
561602
// Remove file from all 3 view lists
562-
self._viewList.splice(self.findInViewList(file.fullPath), 1);
603+
self._viewList.splice(viewListIndex, 1);
563604
self._viewListMRUOrder.splice(self.findInViewListMRUOrder(file.fullPath), 1);
564605
self._viewListAddedOrder.splice(self.findInViewListAddedOrder(file.fullPath), 1);
565606

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

569-
//move the view,
570-
var view = self._views[file.fullPath];
571-
572610
// if we had a view, it had previously been opened
573-
// otherwise, the file was in the working set unopened
611+
// otherwise, the file was in the working set unopened
574612
if (view) {
575613
// delete it from the source pane's view map and add it to the destination pane's view map
576614
delete self._views[file.fullPath];
577615
destinationPane.addView(view, !destinationPane.getCurrentlyViewedFile());
616+
578617
// we're done
579618
result.resolve();
580619
} else if (!destinationPane.getCurrentlyViewedFile()) {
@@ -813,7 +852,6 @@ define(function (require, exports, module) {
813852
*/
814853
Pane.prototype.addToViewList = function (file, index) {
815854
var indexRequested = (index !== undefined && index !== null && index >= 0 && index < this._viewList.length);
816-
817855
this._addToViewList(file, _makeIndexRequestObject(indexRequested, index));
818856

819857
if (!indexRequested) {

0 commit comments

Comments
 (0)