@ -174,7 +174,7 @@ function log(o) {
|
||||
|
||||
<li role="presentation" class="divider my-link writing-mobile-hide"></li>
|
||||
<li role="presentation" class="my-link toggle-editor-mode writing-mobile-hide" >
|
||||
<a href="#writing"><i class="fa fa-rocket"></i>
|
||||
<a href="#writing" title="{{msg . "writingMode"}} ctrl/cmd+e"><i class="fa fa-rocket"></i>
|
||||
{{msg . "writingMode"}}</a>
|
||||
</li>
|
||||
|
||||
@ -571,7 +571,7 @@ function log(o) {
|
||||
</div>
|
||||
<!-- 查看信息 -->
|
||||
<div id="infoToolbar" class="info-toolbar invisible">
|
||||
<a class="toolbar-update"><i class="fa fa-pencil"></i> <span class="lang">{{msg . "modify"}}</span></a>
|
||||
<a class="toolbar-update" title="{{msg . "modify"}} ctrl/cmd+e"><i class="fa fa-pencil"></i> <span class="lang">{{msg . "modify"}}</span></a>
|
||||
<span class="lang">{{msg . "created"}}</span>: <span class="created-time"></span>
|
||||
<span class="lang">{{msg . "updated"}}</span>: <span class="updated-time"></span>
|
||||
</div>
|
||||
@ -608,7 +608,7 @@ function log(o) {
|
||||
<div class="navbar navbar-default">
|
||||
<div class="navbar-inner" id="wmd-button-bar">
|
||||
<div id="mdInfoToolbar" class="info-toolbar invisible">
|
||||
<a class="toolbar-update"><i class="fa fa-pencil"></i> <span class="lang">{{msg . "modify"}}</span></a>
|
||||
<a class="toolbar-update" title="{{msg . "modify"}} ctrl/cmd+e"><i class="fa fa-pencil"></i> <span class="lang">{{msg . "modify"}}</span></a>
|
||||
<span class="lang">{{msg . "created"}}</span>: <span class="created-time"></span>
|
||||
<span class="lang">{{msg . "updated"}}</span>: <span class="updated-time"></span>
|
||||
</div>
|
||||
|
@ -1532,10 +1532,10 @@ Note.deleteNoteTag = function(item, tag) {
|
||||
};
|
||||
|
||||
// readonly
|
||||
Note.readOnly = false; // 默认为false要好?
|
||||
LEA.readOnly = false;
|
||||
Note.readOnly = true; // 默认为false要好?
|
||||
LEA.readOnly = true;
|
||||
// 切换只读模式
|
||||
Note.toggleReadOnly = function() {
|
||||
Note.toggleReadOnly = function(needSave) {
|
||||
if(LEA.em && LEA.em.isWriting()) { // 写作模式下
|
||||
return Note.toggleWriteable();
|
||||
}
|
||||
@ -1567,21 +1567,20 @@ Note.toggleReadOnly = function() {
|
||||
$('#infoToolbar .updated-time').html(goNowToDatetime(note.UpdatedTime));
|
||||
}
|
||||
|
||||
// 保存之
|
||||
if (needSave) {
|
||||
Note.curChangedSaveIt();
|
||||
}
|
||||
|
||||
Note.readOnly = true;
|
||||
LEA.readOnly = true;
|
||||
|
||||
if(note.readOnly) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!note.IsMarkdown) {
|
||||
// 里面的pre也设为不可写
|
||||
$('#editorContent pre').each(function() {
|
||||
LeaAce.setAceReadOnly($(this), true);
|
||||
});
|
||||
}
|
||||
|
||||
note.readOnly = true;
|
||||
};
|
||||
// 切换到编辑模式
|
||||
LEA.toggleWriteable = Note.toggleWriteable = function() {
|
||||
@ -1602,10 +1601,6 @@ LEA.toggleWriteable = Note.toggleWriteable = function() {
|
||||
Note.readOnly = false;
|
||||
LEA.readOnly = false;
|
||||
|
||||
if(!note.readOnly) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!note.IsMarkdown) {
|
||||
// 里面的pre也设为不可写
|
||||
$('#editorContent pre').each(function() {
|
||||
@ -1617,8 +1612,14 @@ LEA.toggleWriteable = Note.toggleWriteable = function() {
|
||||
MD.onResize();
|
||||
}
|
||||
}
|
||||
|
||||
note.readOnly = false;
|
||||
};
|
||||
Note.toggleWriteableAndReadOnly = function () {
|
||||
if (LEA.readOnly) {
|
||||
Note.toggleWriteable();
|
||||
}
|
||||
else {
|
||||
Note.toggleReadOnly(true);
|
||||
}
|
||||
};
|
||||
|
||||
Note.getPostUrl = function (note) {
|
||||
|
@ -487,8 +487,6 @@ function initEditor() {
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
// 这里就不要了, 避免两次updateNote
|
||||
// Note.saveNote(e);
|
||||
|
||||
// 当输入的时候, 把当前raw删除掉
|
||||
LeaAce.removeCurToggleRaw();
|
||||
@ -563,8 +561,26 @@ function initEditor() {
|
||||
Note.curChangedSaveIt();
|
||||
}
|
||||
|
||||
// 全局ctrl + s
|
||||
$("body").on('keydown', Note.saveNote);
|
||||
// 全局快捷键
|
||||
// ctrl + s 保存
|
||||
// ctrl+e 切换只读与可写
|
||||
$('body').on('keydown', function (e) {
|
||||
var num = e.which ? e.which : e.keyCode;
|
||||
var ctrlOrMetaKey = e.ctrlKey || e.metaKey;
|
||||
if(ctrlOrMetaKey) {
|
||||
// 保存
|
||||
if (num == 83 ) { // ctrl + s or command + s
|
||||
Note.curChangedSaveIt();
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
else if (num == 69) { // e
|
||||
Note.toggleWriteableAndReadOnly();
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//-----------------------
|
||||
|
Reference in New Issue
Block a user