add attachment feature, 1) upload, delete, 2) link attach into content (include tinymce & markdown) markdown-editor.js add insertLink function to add link into markdown content, usage: MarkdownEditor.insertLink(link, title) paste plugin edit for safety image
This commit is contained in:
@ -1016,7 +1016,7 @@ initSlimScroll();
|
|||||||
<link href="/public/mdeditor/editor/editor.css" rel="stylesheet">
|
<link href="/public/mdeditor/editor/editor.css" rel="stylesheet">
|
||||||
<script src="/public/mdeditor/editor/pagedown/Markdown.Converter-min.js"></script>
|
<script src="/public/mdeditor/editor/pagedown/Markdown.Converter-min.js"></script>
|
||||||
<script src="/public/mdeditor/editor/pagedown/Markdown.Sanitizer-min.js"></script>
|
<script src="/public/mdeditor/editor/pagedown/Markdown.Sanitizer-min.js"></script>
|
||||||
<script src="/public/mdeditor/editor/pagedown/Markdown.Editor.js"></script>
|
<script src="/public/mdeditor/editor/pagedown/Markdown.Editor-min.js"></script>
|
||||||
<script src="/public/mdeditor/editor/pagedown/local/Markdown.local.zh-min.js"></script>
|
<script src="/public/mdeditor/editor/pagedown/local/Markdown.local.zh-min.js"></script>
|
||||||
<script src="/public/mdeditor/editor/Markdown.Extra-min.js"></script>
|
<script src="/public/mdeditor/editor/Markdown.Extra-min.js"></script>
|
||||||
<script src="/public/mdeditor/editor/underscore-min.js"></script>
|
<script src="/public/mdeditor/editor/underscore-min.js"></script>
|
||||||
|
@ -353,6 +353,7 @@ function log(o) {
|
|||||||
</i>Sort <i class="fa fa-angle-down"></i>
|
</i>Sort <i class="fa fa-angle-down"></i>
|
||||||
-->
|
-->
|
||||||
</a>
|
</a>
|
||||||
|
<!--
|
||||||
<ul class="dropdown-menu" role="menu"
|
<ul class="dropdown-menu" role="menu"
|
||||||
aria-labelledby="dropdownMenu1"
|
aria-labelledby="dropdownMenu1"
|
||||||
style="right: 3px; ! important; left: -100px; min-width: 100px;">
|
style="right: 3px; ! important; left: -100px; min-width: 100px;">
|
||||||
@ -366,6 +367,7 @@ function log(o) {
|
|||||||
<li role="presentation"><a role="menuitem" tabindex="-1"
|
<li role="presentation"><a role="menuitem" tabindex="-1"
|
||||||
href="#">Separated </a></li>
|
href="#">Separated </a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -466,6 +468,38 @@ function log(o) {
|
|||||||
<ul class="pull-right" id="editorTool">
|
<ul class="pull-right" id="editorTool">
|
||||||
<li><a class="ios7-a " id="saveBtn" title="ctrl+s"
|
<li><a class="ios7-a " id="saveBtn" title="ctrl+s"
|
||||||
data-toggle="dropdown">{{msg . "save"}}</a></li>
|
data-toggle="dropdown">{{msg . "save"}}</a></li>
|
||||||
|
|
||||||
|
<li class="dropdown" id="attachDropdown">
|
||||||
|
<a class="ios7-a dropdown-toggle" data-toggle="dropdown" id="showAttach">
|
||||||
|
<!--
|
||||||
|
<span class="fa fa-upload"></span>
|
||||||
|
-->
|
||||||
|
{{msg . "attachments"}}<span id="attachNum"></span>
|
||||||
|
</a>
|
||||||
|
<div class="dropdown-menu" id="attachMenu">
|
||||||
|
<ul id="attachList">
|
||||||
|
</ul>
|
||||||
|
<form id="uploadAttach" method="post" action="/attach/UploadAttach" enctype="multipart/form-data">
|
||||||
|
<div id="dropAttach">
|
||||||
|
<a class="btn btn-success btn-choose-file">
|
||||||
|
Choose File to Upload
|
||||||
|
</a>
|
||||||
|
<a class="btn btn-default" id="downloadAllBtn">
|
||||||
|
<i class="fa fa-download"></i>
|
||||||
|
Download All
|
||||||
|
</a>
|
||||||
|
<a class="btn btn-default" id="linkAllBtn">
|
||||||
|
<i class="fa fa-link"></i>
|
||||||
|
Link All
|
||||||
|
</a>
|
||||||
|
<input type="file" name="file" multiple/>
|
||||||
|
</div>
|
||||||
|
<div id="attachUploadMsg">
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
<li><a class="ios7-a " id="tipsBtn"
|
<li><a class="ios7-a " id="tipsBtn"
|
||||||
data-toggle="dropdown">{{msg . "editorTips"}}</a></li>
|
data-toggle="dropdown">{{msg . "editorTips"}}</a></li>
|
||||||
<li><a class="ios7-a " id="contentHistory"
|
<li><a class="ios7-a " id="contentHistory"
|
||||||
@ -498,7 +532,7 @@ function log(o) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- leaui image -->
|
<!-- leaui image drop image to editor-->
|
||||||
<form id="upload" method="post" action="/file/uploadImageLeaui" enctype="multipart/form-data" style="margin-top: 5px;">
|
<form id="upload" method="post" action="/file/uploadImageLeaui" enctype="multipart/form-data" style="margin-top: 5px;">
|
||||||
<div id="drop">
|
<div id="drop">
|
||||||
Drop images to here
|
Drop images to here
|
||||||
@ -982,7 +1016,7 @@ initSlimScroll();
|
|||||||
<link href="/public/mdeditor/editor/editor.css" rel="stylesheet">
|
<link href="/public/mdeditor/editor/editor.css" rel="stylesheet">
|
||||||
<script src="/public/mdeditor/editor/pagedown/Markdown.Converter-min.js"></script>
|
<script src="/public/mdeditor/editor/pagedown/Markdown.Converter-min.js"></script>
|
||||||
<script src="/public/mdeditor/editor/pagedown/Markdown.Sanitizer-min.js"></script>
|
<script src="/public/mdeditor/editor/pagedown/Markdown.Sanitizer-min.js"></script>
|
||||||
<script src="/public/mdeditor/editor/pagedown/Markdown.Editor-min.js"></script>
|
<script src="/public/mdeditor/editor/pagedown/Markdown.Editor.js"></script>
|
||||||
<script src="/public/mdeditor/editor/pagedown/local/Markdown.local.zh-min.js"></script>
|
<script src="/public/mdeditor/editor/pagedown/local/Markdown.local.zh-min.js"></script>
|
||||||
<script src="/public/mdeditor/editor/Markdown.Extra-min.js"></script>
|
<script src="/public/mdeditor/editor/Markdown.Extra-min.js"></script>
|
||||||
<script src="/public/mdeditor/editor/underscore-min.js"></script>
|
<script src="/public/mdeditor/editor/underscore-min.js"></script>
|
||||||
@ -1001,7 +1035,7 @@ initSlimScroll();
|
|||||||
<!-- context-menu -->
|
<!-- context-menu -->
|
||||||
<link rel="stylesheet" href="/js/contextmenu/css/contextmenu.css" type="text/css" />
|
<link rel="stylesheet" href="/js/contextmenu/css/contextmenu.css" type="text/css" />
|
||||||
|
|
||||||
<!-- version 2.0 -->
|
<!-- js version 2.0 use require.js -->
|
||||||
<script src="/js/require.js"></script>
|
<script src="/js/require.js"></script>
|
||||||
<script>
|
<script>
|
||||||
require.config({
|
require.config({
|
||||||
@ -1009,14 +1043,18 @@ require.config({
|
|||||||
paths: {
|
paths: {
|
||||||
// 'jquery': 'js/jquery-1.9.0.min',
|
// 'jquery': 'js/jquery-1.9.0.min',
|
||||||
'leaui_image': 'tinymce/plugins/leaui_image/public/js/for_editor',
|
'leaui_image': 'tinymce/plugins/leaui_image/public/js/for_editor',
|
||||||
|
'attachment_upload': 'js/app/attachment_upload',
|
||||||
'jquery.ui.widget': 'tinymce/plugins/leaui_image/public/js/jquery.ui.widget',
|
'jquery.ui.widget': 'tinymce/plugins/leaui_image/public/js/jquery.ui.widget',
|
||||||
'fileupload': '/tinymce/plugins/leaui_image/public/js/jquery.fileupload'
|
'fileupload': '/tinymce/plugins/leaui_image/public/js/jquery.fileupload'
|
||||||
},
|
},
|
||||||
shim: {
|
shim: {
|
||||||
|
'fileupload': {deps: ['jquery.ui.widget']}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
require(['leaui_image'], function(leaui_image) {
|
require(['leaui_image'], function(leaui_image) {
|
||||||
});
|
});
|
||||||
|
require(['attachment_upload'], function(attachment_upload) {
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
File diff suppressed because one or more lines are too long
2
public/js/app/note-min.js
vendored
2
public/js/app/note-min.js
vendored
File diff suppressed because one or more lines are too long
2
public/js/app/share-min.js
vendored
2
public/js/app/share-min.js
vendored
File diff suppressed because one or more lines are too long
2
public/js/common-min.js
vendored
2
public/js/common-min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
|||||||
var LEAUI_DATAS=[];tinymce.PluginManager.add("leaui_image",function(t,e){function i(t,e){function i(t,i){n.parentNode.removeChild(n),e({width:t,height:i})}var n=document.createElement("img");n.onload=function(){i(n.clientWidth,n.clientHeight)},n.onerror=function(){i()},n.src=t;var r=n.style;r.visibility="hidden",r.position="fixed",r.bottom=r.left=0,r.width=r.height="auto",document.body.appendChild(n)}function n(){function n(){var t='<iframe id="leauiIfr" src="'+e+"/index.html?"+(new Date).getTime()+'" frameborder="0"></iframe>';return t}var r=t.dom,a=t.selection.getContent(),o=/<img.*?\/>/g,d=a.match(o),c=document.createElement("p"),g=[];for(var h in d){c.innerHTML=d[h];var l=c.firstChild;if(l&&"IMG"==l.nodeName){var s={};s.src=r.getAttrib(l,"data-src")||r.getAttrib(l,"src"),s.width=r.getAttrib(l,"width"),s.height=r.getAttrib(l,"height"),s.title=r.getAttrib(l,"title"),g.push(s)}}LEAUI_DATAS=g,win=t.windowManager.open({title:"Manage Image",width:885,height:475,html:n(),buttons:[{text:"Insert Image",subtype:"primary",onclick:function(n){for(var a=document.getElementById("leauiIfr").contentWindow,o=a.document.getElementById("preview"),d=o.childNodes,c=[],g=0;g<d.length;++g){var n=d[g];if(n.firstChild&&"IMG"==n.firstChild.nodeName){var h=n.firstChild,l={};l.src=h.getAttribute("src"),l.width=h.getAttribute("data-width"),l.height=h.getAttribute("data-height"),l.title=h.getAttribute("data-title"),c.push(l)}}for(var g in c){var s,m=c[g],u=m.src;s=-1!=u.indexOf("http://")||-1!=u.indexOf("https://")?u:e+"/"+u,m.src=s;var f=function(e,i){var n,a={};return a.id="__mcenew"+i,a.src="http://leanote.com/images/loading-24.gif",n=r.createHTML("img",a),t.insertContent(n),n=r.get(a.id),log(n),function(t){t&&t.width&&(t.width>600&&(t.width=600),e.width=t.width),r.setAttrib(n,"src",e.src),r.setAttrib(n,"width",e.width),r.setAttrib(n,"title",e.title),r.setAttrib(n,"id",null)}}(m,g);i(m.src,f)}this.parent().parent().close()}},{text:"Cancel",onclick:function(){this.parent().parent().close()}}]})}t.addButton("leaui_image",{icon:"image",tooltip:"Insert/edit image",onclick:n,stateSelector:"img:not([data-mce-object])"}),t.addMenuItem("leaui_image",{icon:"image",text:"Insert image",onclick:n,context:"insert",prependToContext:!0});var r=!1;t.on("dragstart",function(){r=!0}),t.on("dragend",function(){r=!1}),t.on("dragover",function(){r||$("body").trigger("dragover")})});
|
var LEAUI_DATAS=[];tinymce.PluginManager.add("leaui_image",function(t,e){function i(t,e){function i(t,i){n.parentNode.removeChild(n),e({width:t,height:i})}var n=document.createElement("img");n.onload=function(){i(n.clientWidth,n.clientHeight)},n.onerror=function(){i()},n.src=t;var r=n.style;r.visibility="hidden",r.position="fixed",r.bottom=r.left=0,r.width=r.height="auto",document.body.appendChild(n)}function n(){function n(){var t='<iframe id="leauiIfr" src="'+e+"/index.html?"+(new Date).getTime()+'" frameborder="0"></iframe>';return t}var r=t.dom,o=t.selection.getContent(),a=/<img.*?\/>/g,d=o.match(a),c=document.createElement("p"),l=[];for(var s in d){c.innerHTML=d[s];var g=c.firstChild;if(g&&"IMG"==g.nodeName){var h={};h.src=r.getAttrib(g,"data-src")||r.getAttrib(g,"src"),h.width=r.getAttrib(g,"width"),h.height=r.getAttrib(g,"height"),h.title=r.getAttrib(g,"title"),l.push(h)}}LEAUI_DATAS=l,win=t.windowManager.open({title:"Manage Image",width:885,height:475,html:n(),buttons:[{text:"Insert Image",subtype:"primary",onclick:function(n){for(var o=document.getElementById("leauiIfr").contentWindow,a=o.document.getElementById("preview"),d=a.childNodes,c=[],l=0;l<d.length;++l){var n=d[l];if(n.firstChild&&"IMG"==n.firstChild.nodeName){var s=n.firstChild,g={};g.src=s.getAttribute("src"),g.width=s.getAttribute("data-width"),g.height=s.getAttribute("data-height"),g.title=s.getAttribute("data-title"),c.push(g)}}for(var l in c){var h,f=c[l],u=f.src;h=-1!=u.indexOf("http://")||-1!=u.indexOf("https://")?u:e+"/"+u,f.src=h;var m=function(e){var n=function(e,i){var n,o={};return o.id="__mcenew"+i,o.src="http://leanote.com/images/loading-24.gif",n=r.createHTML("img",o),t.insertContent(n),n=r.get(o.id),function(t){t&&t.width&&(t.width>600&&(t.width=600),e.width=t.width),r.setAttrib(n,"src",e.src),r.setAttrib(n,"width",e.width),r.setAttrib(n,"title",e.title),r.setAttrib(n,"id",null)}}(e,l);i(e.src,n)},I="";if(fileIds=h.split("fileId="),2==fileIds.length&&fileIds[1].length=="53aecf8a8a039a43c8036282".length&&(I=fileIds[1]),I){var p=Note.getCurNote();p&&p.UserId!=UserInfo.UserId?!function(t){ajaxPost("/file/copyImage",{userId:UserInfo.UserId,fileId:I,toUserId:p.UserId},function(e){if(reIsOk(e)&&e.Id){var i=window.location.protocol+"//"+window.location.host;t.src=i+"/file/outputImage?fileId="+e.Id}m(t)})}(f):m(f)}else m(f)}this.parent().parent().close()}},{text:"Cancel",onclick:function(){this.parent().parent().close()}}]})}t.addButton("leaui_image",{icon:"image",tooltip:"Insert/edit image",onclick:n,stateSelector:"img:not([data-mce-object])"}),t.addMenuItem("leaui_image",{icon:"image",text:"Insert image",onclick:n,context:"insert",prependToContext:!0});var r=!1;t.on("dragstart",function(){r=!0}),t.on("dragend",function(){r=!1}),t.on("dragover",function(){r||$("body").trigger("dragover")})});
|
@ -117,4 +117,4 @@
|
|||||||
writeScripts();
|
writeScripts();
|
||||||
})(this);
|
})(this);
|
||||||
|
|
||||||
// $hash: cbcf61872b3ecc41bd22dcf691e2e4dd
|
// $hash: 3d47d6168ca064ff0c3f626e575ff2e8
|
@ -472,7 +472,7 @@ define("tinymce/pasteplugin/Clipboard", [
|
|||||||
var c = new FormData;
|
var c = new FormData;
|
||||||
c.append("from", "pasteImage");
|
c.append("from", "pasteImage");
|
||||||
c.append("file", blob);
|
c.append("file", blob);
|
||||||
c.append("noteId", Note.curNoteId);
|
c.append("noteId", Note.curNoteId); // life
|
||||||
// var d;
|
// var d;
|
||||||
// d = $.ajaxSettings.xhr();
|
// d = $.ajaxSettings.xhr();
|
||||||
// d.withCredentials = i;var d = {};
|
// d.withCredentials = i;var d = {};
|
||||||
|
2
public/tinymce/plugins/paste/plugin.min.js
vendored
2
public/tinymce/plugins/paste/plugin.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user