@ -174,7 +174,7 @@ function log(o) {
|
|||||||
|
|
||||||
<li role="presentation" class="divider my-link writing-mobile-hide"></li>
|
<li role="presentation" class="divider my-link writing-mobile-hide"></li>
|
||||||
<li role="presentation" class="my-link toggle-editor-mode writing-mobile-hide" >
|
<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>
|
{{msg . "writingMode"}}</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
@ -571,7 +571,7 @@ function log(o) {
|
|||||||
</div>
|
</div>
|
||||||
<!-- 查看信息 -->
|
<!-- 查看信息 -->
|
||||||
<div id="infoToolbar" class="info-toolbar invisible">
|
<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 . "created"}}</span>: <span class="created-time"></span>
|
||||||
<span class="lang">{{msg . "updated"}}</span>: <span class="updated-time"></span>
|
<span class="lang">{{msg . "updated"}}</span>: <span class="updated-time"></span>
|
||||||
</div>
|
</div>
|
||||||
@ -608,7 +608,7 @@ function log(o) {
|
|||||||
<div class="navbar navbar-default">
|
<div class="navbar navbar-default">
|
||||||
<div class="navbar-inner" id="wmd-button-bar">
|
<div class="navbar-inner" id="wmd-button-bar">
|
||||||
<div id="mdInfoToolbar" class="info-toolbar invisible">
|
<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 . "created"}}</span>: <span class="created-time"></span>
|
||||||
<span class="lang">{{msg . "updated"}}</span>: <span class="updated-time"></span>
|
<span class="lang">{{msg . "updated"}}</span>: <span class="updated-time"></span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1532,14 +1532,14 @@ Note.deleteNoteTag = function(item, tag) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// readonly
|
// readonly
|
||||||
Note.readOnly = false; // 默认为false要好?
|
Note.readOnly = true; // 默认为false要好?
|
||||||
LEA.readOnly = false;
|
LEA.readOnly = true;
|
||||||
// 切换只读模式
|
// 切换只读模式
|
||||||
Note.toggleReadOnly = function() {
|
Note.toggleReadOnly = function(needSave) {
|
||||||
if(LEA.em && LEA.em.isWriting()) { // 写作模式下
|
if(LEA.em && LEA.em.isWriting()) { // 写作模式下
|
||||||
return Note.toggleWriteable();
|
return Note.toggleWriteable();
|
||||||
}
|
}
|
||||||
|
|
||||||
var me = this;
|
var me = this;
|
||||||
var note = me.getCurNote();
|
var note = me.getCurNote();
|
||||||
|
|
||||||
@ -1567,12 +1567,13 @@ Note.toggleReadOnly = function() {
|
|||||||
$('#infoToolbar .updated-time').html(goNowToDatetime(note.UpdatedTime));
|
$('#infoToolbar .updated-time').html(goNowToDatetime(note.UpdatedTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 保存之
|
||||||
|
if (needSave) {
|
||||||
|
Note.curChangedSaveIt();
|
||||||
|
}
|
||||||
|
|
||||||
Note.readOnly = true;
|
Note.readOnly = true;
|
||||||
LEA.readOnly = true;
|
LEA.readOnly = true;
|
||||||
|
|
||||||
if(note.readOnly) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!note.IsMarkdown) {
|
if(!note.IsMarkdown) {
|
||||||
// 里面的pre也设为不可写
|
// 里面的pre也设为不可写
|
||||||
@ -1580,8 +1581,6 @@ Note.toggleReadOnly = function() {
|
|||||||
LeaAce.setAceReadOnly($(this), true);
|
LeaAce.setAceReadOnly($(this), true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
note.readOnly = true;
|
|
||||||
};
|
};
|
||||||
// 切换到编辑模式
|
// 切换到编辑模式
|
||||||
LEA.toggleWriteable = Note.toggleWriteable = function() {
|
LEA.toggleWriteable = Note.toggleWriteable = function() {
|
||||||
@ -1601,10 +1600,6 @@ LEA.toggleWriteable = Note.toggleWriteable = function() {
|
|||||||
|
|
||||||
Note.readOnly = false;
|
Note.readOnly = false;
|
||||||
LEA.readOnly = false;
|
LEA.readOnly = false;
|
||||||
|
|
||||||
if(!note.readOnly) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!note.IsMarkdown) {
|
if(!note.IsMarkdown) {
|
||||||
// 里面的pre也设为不可写
|
// 里面的pre也设为不可写
|
||||||
@ -1617,8 +1612,14 @@ LEA.toggleWriteable = Note.toggleWriteable = function() {
|
|||||||
MD.onResize();
|
MD.onResize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
note.readOnly = false;
|
Note.toggleWriteableAndReadOnly = function () {
|
||||||
|
if (LEA.readOnly) {
|
||||||
|
Note.toggleWriteable();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Note.toggleReadOnly(true);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Note.getPostUrl = function (note) {
|
Note.getPostUrl = function (note) {
|
||||||
@ -2498,4 +2499,4 @@ $(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 定时器启动
|
// 定时器启动
|
||||||
Note.startInterval();
|
Note.startInterval();
|
||||||
|
@ -487,8 +487,6 @@ function initEditor() {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 这里就不要了, 避免两次updateNote
|
|
||||||
// Note.saveNote(e);
|
|
||||||
|
|
||||||
// 当输入的时候, 把当前raw删除掉
|
// 当输入的时候, 把当前raw删除掉
|
||||||
LeaAce.removeCurToggleRaw();
|
LeaAce.removeCurToggleRaw();
|
||||||
@ -563,8 +561,26 @@ function initEditor() {
|
|||||||
Note.curChangedSaveIt();
|
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