Files
Testing/html5-chat1/chatadmin/editors/tinymce/plugins/autolink/plugin.min.min.js
sean 0e8a8b3028
Some checks failed
deploy-testing / deploy (push) Has been cancelled
Initial testing snapshot
2026-11-17 16:15:01 -05:00

1 line
1.7 KiB
JavaScript

tinymce.PluginManager.add("autolink",function(b){function c(e){d(e,-1,"(",!0)}function f(e){d(e,0,"",!0)}function a(e){d(e,-1,"",!1)}function d(A,v,j){var q,h,g,y,B,p,x,z,w;if(q=A.selection.getRng(!0).cloneRange(),q.startOffset<5){if(z=q.endContainer.previousSibling,!z){if(!q.endContainer.firstChild||!q.endContainer.firstChild.nextSibling){return}z=q.endContainer.firstChild.nextSibling}if(w=z.length,q.setStart(z,w),q.setEnd(z,w),q.endOffset<5){return}h=q.endOffset,y=z}else{if(y=q.endContainer,3!=y.nodeType&&y.firstChild){for(;3!=y.nodeType&&y.firstChild;){y=y.firstChild}3==y.nodeType&&(q.setStart(y,0),q.setEnd(y,y.nodeValue.length))}h=1==q.endOffset?2:q.endOffset-1-v}g=h;do{q.setStart(y,h>=2?h-2:0),q.setEnd(y,h>=1?h-1:0),h-=1}while(" "!=q.toString()&&""!==q.toString()&&160!=q.toString().charCodeAt(0)&&h-2>=0&&q.toString()!=j);if(q.toString()==j||160==q.toString().charCodeAt(0)?(q.setStart(y,h),q.setEnd(y,g),h+=1):0===q.startOffset?(q.setStart(y,0),q.setEnd(y,g)):(q.setStart(y,h),q.setEnd(y,g)),p=q.toString(),"."==p.charAt(p.length-1)&&q.setEnd(y,g-1),p=q.toString(),x=p.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+\-]+@)(.+)$/i),x&&("www."==x[1]?x[1]="http://www.":/@$/.test(x[1])&&!/^mailto:/.test(x[1])&&(x[1]="mailto:"+x[1]),B=A.selection.getBookmark(),A.selection.setRng(q),A.execCommand("createlink",!1,x[1]+x[2]),A.selection.moveToBookmark(B),A.nodeChanged(),tinymce.Env.webkit)){A.selection.collapse(!1);var k=Math.min(y.length,g+1);q.setStart(y,k),q.setEnd(y,k),A.selection.setRng(q)}}b.on("keydown",function(g){return 13==g.keyCode?a(b):void 0}),tinymce.Env.ie||(b.on("keypress",function(e){return 41==e.which?c(b):void 0}),b.on("keyup",function(g){return 32==g.keyCode?f(b):void 0}))});