fix 67
This commit is contained in:
parent
7cb70347bf
commit
9c1d5b09a0
|
@ -1,6 +1,6 @@
|
|||
/* start icon */
|
||||
|
||||
@font-face {
|
||||
1 @font-face {
|
||||
font-family: 'icomoon';
|
||||
src: url('fonts/icomoon.eot?35cb2z');
|
||||
src: url('fonts/icomoon.eot?#iefix35cb2z') format('embedded-opentype'), url('fonts/icomoon.woff?35cb2z') format('woff'), url('fonts/icomoon.ttf?35cb2z') format('truetype'), url('fonts/icomoon.svg?35cb2z#icomoon') format('svg');
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
"closeIconHover": "dialog-close-icon-hover",
|
||||
"title": "dialog-title"
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
$.extend(Dialog.prototype, {
|
||||
|
@ -174,6 +174,10 @@
|
|||
$.dialog._close(id, settings);
|
||||
}
|
||||
});
|
||||
|
||||
if (typeof settings.afterInit === "function") {
|
||||
settings.afterInit();
|
||||
}
|
||||
},
|
||||
_bindMove: function (id, className) {
|
||||
$("#" + id + "Dialog ." + className).mousedown(function (event) {
|
||||
|
|
|
@ -2,6 +2,32 @@ var editors = {
|
|||
data: [],
|
||||
tabs: {},
|
||||
init: function () {
|
||||
$("#dialogCloseEditor").dialog({
|
||||
"modal": true,
|
||||
"height": 26,
|
||||
"width": 260,
|
||||
"title": config.label.tip,
|
||||
"hideFooter": true,
|
||||
"afterInit": function () {
|
||||
$("#dialogCloseEditor button.save").click(function () {
|
||||
var i = $("#dialogCloseEditor").data("index");
|
||||
wide.fmt(tree.fileTree.getNodeByTId(editors.data[i].id).path, editors.data[i].editor);
|
||||
editors.tabs.del(editors.data[i].id);
|
||||
$("#dialogCloseEditor").dialog("close");
|
||||
});
|
||||
|
||||
$("#dialogCloseEditor button.discard").click(function () {
|
||||
$("#dialogCloseEditor").dialog("close");
|
||||
});
|
||||
|
||||
$("#dialogCloseEditor button.cancel").click(function () {
|
||||
var i = $("#dialogCloseEditor").data("index");
|
||||
editors.tabs.del(editors.data[i].id);
|
||||
$("#dialogCloseEditor").dialog("close");
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
editors.tabs = new Tabs({
|
||||
id: ".edit-panel",
|
||||
clickAfter: function (id) {
|
||||
|
@ -23,6 +49,26 @@ var editors = {
|
|||
|
||||
wide.curEditor.focus();
|
||||
},
|
||||
removeBefore: function (id) {
|
||||
if (id === 'startPage') { // 当前关闭的 tab 是起始页
|
||||
return false;
|
||||
}
|
||||
|
||||
// 移除编辑器
|
||||
for (var i = 0, ii = editors.data.length; i < ii; i++) {
|
||||
if (editors.data[i].id === id) {
|
||||
if (editors.data[i].editor.doc.isClean()) {
|
||||
return true;
|
||||
} else {
|
||||
$("#dialogCloseEditor").dialog("open");
|
||||
$("#dialogCloseEditor").data("index", i);
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
removeAfter: function (id, nextId) {
|
||||
if (id === 'startPage') { // 当前关闭的 tab 是起始页
|
||||
return false;
|
||||
|
@ -31,8 +77,6 @@ var editors = {
|
|||
// 移除编辑器
|
||||
for (var i = 0, ii = editors.data.length; i < ii; i++) {
|
||||
if (editors.data[i].id === id) {
|
||||
|
||||
wide.fmt(tree.fileTree.getNodeByTId(editors.data[i].id).path, editors.data[i].editor);
|
||||
editors.data.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
|
@ -81,7 +125,7 @@ var editors = {
|
|||
});
|
||||
|
||||
this._initCodeMirrorHotKeys();
|
||||
this.openStartPage()
|
||||
this.openStartPage();
|
||||
},
|
||||
openStartPage: function () {
|
||||
var dateFormat = function (time, fmt) {
|
||||
|
@ -136,7 +180,7 @@ var editors = {
|
|||
+ article.articlePermalink + "'>"
|
||||
+ article.articleTitle + "</a> <span class='date'>"
|
||||
+ dateFormat(article.articleCreateTime, 'yyyy-MM-dd hh:mm');
|
||||
+"</span></li>"
|
||||
+"</span></li>";
|
||||
}
|
||||
|
||||
$("#startPage .news").html(listHTML + "</ul>");
|
||||
|
|
|
@ -22,8 +22,16 @@ $.extend(Tabs.prototype, {
|
|||
});
|
||||
|
||||
obj._$tabs.on("click", ".ico-close", function (event) {
|
||||
var id = $(this).parent().data("index");
|
||||
_that.del(id);
|
||||
var id = $(this).parent().data("index"),
|
||||
isRemove = true;
|
||||
|
||||
if (typeof obj.removeBefore === 'function') {
|
||||
isRemove = obj.removeBefore(id);
|
||||
}
|
||||
|
||||
if (isRemove) {
|
||||
_that.del(id);
|
||||
}
|
||||
event.stopPropagation();
|
||||
});
|
||||
},
|
||||
|
@ -65,6 +73,7 @@ $.extend(Tabs.prototype, {
|
|||
$tabs = this.obj._$tabs,
|
||||
stack = this.obj._stack,
|
||||
prevId = null;
|
||||
|
||||
$tabs.children("div[data-index='" + id + "']").remove();
|
||||
$tabsPanel.children("div[data-index='" + id + "']").remove();
|
||||
|
||||
|
@ -74,7 +83,7 @@ $.extend(Tabs.prototype, {
|
|||
stack.splice(i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
prevId = stack[stack.length - 1];
|
||||
|
||||
if (typeof this.obj.removeAfter === 'function') {
|
||||
|
|
|
@ -222,50 +222,55 @@
|
|||
<input placeholder="{{.i18n.keyword}}" />
|
||||
<input placeholder="{{.i18n.file_format}}" />
|
||||
</div>
|
||||
<div id="dialogCloseEditor" class="dialog-form fn-none">
|
||||
<button class="save">save</button>
|
||||
<button class="discard">discard</button>
|
||||
<button class="cancel">cancel</button>
|
||||
</div>
|
||||
<script>
|
||||
var config = {
|
||||
"pathSeparator": {{.pathSeparator}},
|
||||
"latestSessionContent": {{.latestSessionContent}},
|
||||
"label": {
|
||||
"restore_editor": "{{.i18n.restore_editor}}",
|
||||
"max_editor": "{{.i18n.max_editor}}",
|
||||
"delete": "{{.i18n.delete}}",
|
||||
"cancel": "{{.i18n.cancel}}",
|
||||
"goto_line": "{{.i18n.goto_line}}",
|
||||
"go": "{{.i18n.go}}",
|
||||
"create": "{{.i18n.create}}",
|
||||
"create_file": "{{.i18n.create_file}}",
|
||||
"create_dir": "{{.i18n.create_dir}}",
|
||||
"tip": "{{.i18n.tip}}",
|
||||
"confirm": "{{.i18n.confirm}}",
|
||||
"build_n_run": "{{.i18n.build_n_run}}",
|
||||
"stop": "{{.i18n.stop}}",
|
||||
"find_usages": "{{.i18n.find_usages}}",
|
||||
"search_text": "{{.i18n.search_text}}",
|
||||
"search": "{{.i18n.search}}",
|
||||
"start_page": "{{.i18n.start_page}}",
|
||||
"confirm_save": "{{.i18n.confirm_save}}",
|
||||
"community": "{{.i18n.community}}",
|
||||
"about": "{{.i18n.about}}",
|
||||
"new_version_available": "{{.i18n.new_version_available}}",
|
||||
"colon": "{{.i18n.colon}}",
|
||||
"uptodate": "{{.i18n.uptodate}}"
|
||||
},
|
||||
"channel": {
|
||||
"editor": '{{.conf.EditorChannel}}',
|
||||
"shell": '{{.conf.ShellChannel}}',
|
||||
"output": '{{.conf.OutputChannel}}',
|
||||
"session": '{{.conf.SessionChannel}}'
|
||||
},
|
||||
"wideSessionId": '{{.session.Id}}'
|
||||
};
|
||||
// 发往 Wide 的所有 AJAX 请求需要使用该函数创建请求参数.
|
||||
function newWideRequest() {
|
||||
var ret = {
|
||||
sid: config.wideSessionId
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
var config = {
|
||||
"pathSeparator": '{{.pathSeparator}}',
|
||||
"latestSessionContent": '{{.latestSessionContent}}',
|
||||
"label": {
|
||||
"restore_editor": "{{.i18n.restore_editor}}",
|
||||
"max_editor": "{{.i18n.max_editor}}",
|
||||
"delete": "{{.i18n.delete}}",
|
||||
"cancel": "{{.i18n.cancel}}",
|
||||
"goto_line": "{{.i18n.goto_line}}",
|
||||
"go": "{{.i18n.go}}",
|
||||
"create": "{{.i18n.create}}",
|
||||
"create_file": "{{.i18n.create_file}}",
|
||||
"create_dir": "{{.i18n.create_dir}}",
|
||||
"tip": "{{.i18n.tip}}",
|
||||
"confirm": "{{.i18n.confirm}}",
|
||||
"build_n_run": "{{.i18n.build_n_run}}",
|
||||
"stop": "{{.i18n.stop}}",
|
||||
"find_usages": "{{.i18n.find_usages}}",
|
||||
"search_text": "{{.i18n.search_text}}",
|
||||
"search": "{{.i18n.search}}",
|
||||
"start_page": "{{.i18n.start_page}}",
|
||||
"confirm_save": "{{.i18n.confirm_save}}",
|
||||
"community": "{{.i18n.community}}",
|
||||
"about": "{{.i18n.about}}",
|
||||
"new_version_available": "{{.i18n.new_version_available}}",
|
||||
"colon": "{{.i18n.colon}}",
|
||||
"uptodate": "{{.i18n.uptodate}}"
|
||||
},
|
||||
"channel": {
|
||||
"editor": '{{.conf.EditorChannel}}',
|
||||
"shell": '{{.conf.ShellChannel}}',
|
||||
"output": '{{.conf.OutputChannel}}',
|
||||
"session": '{{.conf.SessionChannel}}'
|
||||
},
|
||||
"wideSessionId": '{{.session.Id}}'
|
||||
};
|
||||
// 发往 Wide 的所有 AJAX 请求需要使用该函数创建请求参数.
|
||||
function newWideRequest() {
|
||||
var ret = {
|
||||
sid: config.wideSessionId
|
||||
};
|
||||
return ret;
|
||||
}
|
||||
|
||||
</script>
|
||||
<script type="text/javascript" src="{{.conf.StaticServer}}/static/js/lib/jquery-2.1.1.min.js"></script>
|
||||
|
|
Loading…
Reference in New Issue