From 78accaa82e6e20dfe77b7eb3de895734a0603d51 Mon Sep 17 00:00:00 2001 From: Van Date: Thu, 4 Dec 2014 15:00:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BF=AB=E6=8D=B7=E9=94=AE=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E5=BD=93=E5=89=8D=E7=BC=96=E8=BE=91=E5=99=A8=20bug=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=20&=20=E5=85=B3=E9=97=AD=E7=BC=96=E8=BE=91=E5=99=A8?= =?UTF-8?q?=E5=90=8E=E7=84=A6=E7=82=B9=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/js/editors.js | 15 ++++++++++----- static/js/hotkeys.js | 5 +---- static/js/tabs.js | 6 +++++- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/static/js/editors.js b/static/js/editors.js index c275713..fc99b05 100644 --- a/static/js/editors.js +++ b/static/js/editors.js @@ -45,9 +45,12 @@ var editors = { $("#dialogCloseEditor").data("removeData", removeData); $(".edit-panel .tabs > div[data-index=" + removeIndex + "] .ico-close").click(); } + if (wide.curEditor) { + wide.curEditor.focus(); + } }, _initClose: function () { - new ZeroClipboard($("#copyFilePath")); + new ZeroClipboard($("#copyFilePath")); // 关闭、关闭其他、关闭所有 $(".edit-panel").on("mousedown", '.tabs > div', function (event) { @@ -90,7 +93,6 @@ var editors = { wide.fmt(tree.fileTree.getNodeByTId(editors.data[i].id).path, editors.data[i].editor); editors.tabs.del(editors.data[i].id); $("#dialogCloseEditor").dialog("close"); - editors._removeAllMarker(); }); @@ -98,13 +100,11 @@ var editors = { var i = $("#dialogCloseEditor").data("index"); editors.tabs.del(editors.data[i].id); $("#dialogCloseEditor").dialog("close"); - editors._removeAllMarker(); }); - $("#dialogCloseEditor button.cancel").click(function () { + $("#dialogCloseEditor button.cancel").click(function (event) { $("#dialogCloseEditor").dialog("close"); - editors._removeAllMarker(); }); } @@ -112,6 +112,11 @@ var editors = { editors.tabs = new Tabs({ id: ".edit-panel", + setAfter: function () { + if (wide.curEditor) { + wide.curEditor.focus(); + } + }, clickAfter: function (id) { if (id === 'startPage') { $(".footer .cursor").text(''); diff --git a/static/js/hotkeys.js b/static/js/hotkeys.js index 5ca0b59..9fea4d9 100644 --- a/static/js/hotkeys.js +++ b/static/js/hotkeys.js @@ -373,10 +373,7 @@ var hotkeys = { if (event.ctrlKey === hotKeys.closeCurEditor.ctrlKey && event.which === hotKeys.closeCurEditor.which) { // Ctrl+Q 关闭当前编辑器 - var currentId = editors.getCurrentId(); - if (currentId) { - editors.tabs.del(currentId); - } + $(".edit-panel .tabs > div.current").find(".ico-close").click(); event.preventDefault(); return; diff --git a/static/js/tabs.js b/static/js/tabs.js index ef04187..f5ff09c 100644 --- a/static/js/tabs.js +++ b/static/js/tabs.js @@ -12,7 +12,7 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ + */ var Tabs = function (obj) { obj._$tabsPanel = $(obj.id + " > .tabs-panel"); @@ -139,5 +139,9 @@ $.extend(Tabs.prototype, { $tabs.children("div[data-index='" + id + "']").addClass("current"); $tabsPanel.children("div[data-index='" + id + "']").show(); + + if (typeof this.obj.setAfter === 'function') { + this.obj.setAfter(); + } } }); \ No newline at end of file