编辑器缩进, 图片拖动问题

https://github.com/leanote/desktop-app/issues/64
This commit is contained in:
life
2015-10-19 14:16:18 +08:00
parent ed35f95c05
commit a669f0750a
3 changed files with 24 additions and 8 deletions

View File

@@ -1719,13 +1719,13 @@ Note.deleteNoteTag = function(item, tag) {
}
};
Note.readOnly = true;
Note.readOnly = false; // 默认为false要好?
LEA.readOnly = false;
// 切换只读模式
Note.toggleReadOnly = function() {
var me = this;
var note = me.getCurNote();
// console.log('(((((((((((((((((((((((');
// tinymce
var $editor = $('#editor');
$editor.addClass('read-only').removeClass('all-tool'); // 不要全部的
@@ -1748,6 +1748,9 @@ Note.toggleReadOnly = function() {
$('#infoToolbar .created-time').html(goNowToDatetime(note.CreatedTime));
$('#infoToolbar .updated-time').html(goNowToDatetime(note.UpdatedTime));
}
Note.readOnly = true;
LEA.readOnly = true;
if(note.readOnly) {
return;
@@ -1761,11 +1764,10 @@ Note.toggleReadOnly = function() {
}
note.readOnly = true;
Note.readOnly = true;
};
// 切换到编辑模式
Note.toggleWriteable = function() {
var me = this;
LEA.toggleWriteable = Note.toggleWriteable = function() {
var me = Note;
// $('#infoToolbar').hide();
$('#editor').removeClass('read-only');
@@ -1779,6 +1781,9 @@ Note.toggleWriteable = function() {
return;
}
Note.readOnly = false;
LEA.readOnly = false;
if(!note.readOnly) {
return;
}
@@ -1794,9 +1799,7 @@ Note.toggleWriteable = function() {
MD.onResize();
}
}
note.readOnly = false;
Note.readOnly = false;
};
// 渲染列表

View File

@@ -22,4 +22,18 @@ tinymce.PluginManager.add('image', function(editor, url) {
onclick: showDialog,
stateSelector: 'img:not([data-mce-object])'
});
// 为解决在editor里拖动图片问题
var dragStart = false;
editor.on("dragstart", function(e) {
// 只读模式下不能拖动
if (LEA.readOnly) {
e.preventDefault();
e.stopPropagation();
}
});
editor.on("dragend", function(e) {
});
editor.on("dragover", function(e) {
});
});

View File

@@ -1 +0,0 @@
tinymce.PluginManager.add("image",function(i,t){function e(){win=i.windowManager.open({title:"Insert/edit image",file:t+"/dialog.htm",width:550,height:345})}i.addButton("image",{icon:"image",tooltip:"Insert/edit image",onclick:e,stateSelector:"img:not([data-mce-object])"})});