diff --git a/public/js/app/note.js b/public/js/app/note.js index b89f7395..d3d965c4 100644 --- a/public/js/app/note.js +++ b/public/js/app/note.js @@ -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; }; // 渲染列表 diff --git a/public/tinymce/plugins/image/plugin.js b/public/tinymce/plugins/image/plugin.js index d358cdce..df612f3d 100644 --- a/public/tinymce/plugins/image/plugin.js +++ b/public/tinymce/plugins/image/plugin.js @@ -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) { + }); }); \ No newline at end of file diff --git a/public/tinymce/plugins/image/plugin.min.js b/public/tinymce/plugins/image/plugin.min.js deleted file mode 100644 index 56eeb01c..00000000 --- a/public/tinymce/plugins/image/plugin.min.js +++ /dev/null @@ -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])"})}); \ No newline at end of file