This commit is contained in:
Liang Ding 2014-12-12 00:11:35 +08:00
parent 0a1e3eb9b8
commit f789742434
2 changed files with 27 additions and 18 deletions

View File

@ -22,7 +22,7 @@ var editors = {
if (editors.data[i].editor.options.path === path) { if (editors.data[i].editor.options.path === path) {
return editors.data[i].editor; return editors.data[i].editor;
} }
} }
}, },
close: function () { close: function () {
$(".edit-panel .tabs > div[data-index=" + $(".edit-panel .frame").data("index") + "]").find(".ico-close").click(); $(".edit-panel .tabs > div[data-index=" + $(".edit-panel .frame").data("index") + "]").find(".ico-close").click();
@ -613,6 +613,12 @@ var editors = {
} }
}); });
}; };
CodeMirror.commands.selectIdentifier = function (cm) {
var cur = cm.getCursor();
var word = cm.findWordAt(cur);
cm.extendSelection(word.anchor, word.head);
};
}, },
appendSearch: function (data, type, key) { appendSearch: function (data, type, key) {
var searcHTML = '<ul class="list">'; var searcHTML = '<ul class="list">';
@ -756,7 +762,8 @@ var editors = {
"Shift-Ctrl-Up": "copyLinesUp", "Shift-Ctrl-Up": "copyLinesUp",
"Shift-Ctrl-Down": "copyLinesDown", "Shift-Ctrl-Down": "copyLinesDown",
"Shift-Alt-Up": "moveLinesUp", "Shift-Alt-Up": "moveLinesUp",
"Shift-Alt-Down": "moveLinesDown" "Shift-Alt-Down": "moveLinesDown",
"Shift-Alt-J": "selectIdentifier"
} }
}); });

View File

@ -70,23 +70,15 @@
<span class="fn-right ft-small">Ctrl-Y</span> <span class="fn-right ft-small">Ctrl-Y</span>
</li> </li>
<li class="hr"></li> <li class="hr"></li>
<li class="edit disabled" onclick="alert('Dev In Progress')">
<span>{{.i18n.cut}}</span>
</li>
<li class="edit disabled" onclick="alert('Dev In Progress')">
<span>{{.i18n.copy}}</span>
</li>
<li class="edit disabled" onclick="alert('Dev In Progress')">
<span>{{.i18n.paste}}</span>
</li>
<li class="hr"></li>
<li class="edit disabled" <li class="edit disabled"
onclick="if (!$(this).hasClass('disabled')){wide.curEditor.execCommand('selectAll'); wide.curEditor.focus()}"> onclick="if (!$(this).hasClass('disabled')){wide.curEditor.execCommand('selectAll'); wide.curEditor.focus()}">
<span>{{.i18n.select_all}}</span> <span>{{.i18n.select_all}}</span>
<span class="fn-right ft-small">Ctrl-A</span> <span class="fn-right ft-small">Ctrl-A</span>
</li> </li>
<li class="edit disabled" onclick="alert('Dev In Progress')"> <li class="edit disabled"
onclick="if (!$(this).hasClass('disabled')){wide.curEditor.focus(); wide.curEditor.execCommand('selectIdentifier')}">
<span>{{.i18n.select_identifier}}</span> <span>{{.i18n.select_identifier}}</span>
<span class="fn-right ft-small">Shift-Alt-J</span>
</li> </li>
<li class="hr"></li> <li class="hr"></li>
<li class="edit disabled" <li class="edit disabled"
@ -176,20 +168,30 @@
<span class="fn-right ft-small">Ctrl-F</span> <span class="fn-right ft-small">Ctrl-F</span>
</li> </li>
<li class="hr"></li> <li class="hr"></li>
<li class="find disabled" onclick="alert('Dev In Progress')"> <li class="find disabled"
onclick="if (!$(this).hasClass('disabled')){wide.curEditor.execCommand('find');}">
<span>{{.i18n.find}}</span> <span>{{.i18n.find}}</span>
<span class="fn-right ft-small">Ctrl-F</span>
</li> </li>
<li class="find-next disabled" onclick="alert('Dev In Progress')"> <li class="find-next disabled"
onclick="if (!$(this).hasClass('disabled')){wide.curEditor.execCommand('findNext');}">
<span>{{.i18n.find_next}}</span> <span>{{.i18n.find_next}}</span>
<span class="fn-right ft-small">Ctrl-G</span>
</li> </li>
<li class="find-previous disabled" onclick="alert('Dev In Progress')"> <li class="find-previous disabled"
onclick="if (!$(this).hasClass('disabled')){wide.curEditor.execCommand('findPrev');}">
<span>{{.i18n.find_previous}}</span> <span>{{.i18n.find_previous}}</span>
<span class="fn-right ft-small">Shift-Ctrl-G</span>
</li> </li>
<li class="replace disabled" onclick="alert('Dev In Progress')"> <li class="replace disabled"
onclick="if (!$(this).hasClass('disabled')){wide.curEditor.execCommand('replace');}">
<span>{{.i18n.replace}}</span> <span>{{.i18n.replace}}</span>
<span class="fn-right ft-small">Shift-Ctrl-F</span>
</li> </li>
<li class="replace-all disabled" onclick="alert('Dev In Progress')"> <li class="replace-all disabled"
onclick="if (!$(this).hasClass('disabled')){wide.curEditor.execCommand('replaceAll');}">
<span>{{.i18n.replace_all}}</span> <span>{{.i18n.replace_all}}</span>
<span class="fn-right ft-small">Shift-Ctrl-R</span>
</li> </li>
</ul> </ul>
</div> </div>