diff --git a/src/editor/EditorManager.js b/src/editor/EditorManager.js index acca38a80dc..e4e8261f768 100644 --- a/src/editor/EditorManager.js +++ b/src/editor/EditorManager.js @@ -644,8 +644,10 @@ define(function (require, exports, module) { * @param {!string} fullPath path to the file displayed in the custom view */ function showCustomViewer(provider, fullPath) { - var $customView = provider.getCustomViewHolder(fullPath); - + if (_currentlyViewedPath === fullPath) { + return; + } + DocumentManager._clearCurrentDocument(); // Hide the not-editor @@ -654,7 +656,7 @@ define(function (require, exports, module) { _removeCustomViewer(); _nullifyEditor(); - _$currentCustomViewer = $customView; + _$currentCustomViewer = provider.getCustomViewHolder(fullPath); // place in window $("#editor-holder").append(_$currentCustomViewer);