mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-23 04:29:21 +00:00
3 lines
8.5 KiB
JavaScript
3 lines
8.5 KiB
JavaScript
|
/* SCEditor v2.1.3 | (C) 2017, Sam Clarke | sceditor.com/license */
|
||
|
|
||
|
!function(y){"use strict";var t=y.ie,E=t&&t<11,C=y.dom,e=y.utils,S=C.css,n=C.attr,T=C.is,A=C.removeAttr,i=C.convertElement,r=e.extend,a=e.each,N=e.isEmptyObject,l=y.command.get,s={bold:{txtExec:["<strong>","</strong>"]},italic:{txtExec:["<em>","</em>"]},underline:{txtExec:['<span style="text-decoration:underline;">',"</span>"]},strike:{txtExec:['<span style="text-decoration:line-through;">',"</span>"]},subscript:{txtExec:["<sub>","</sub>"]},superscript:{txtExec:["<sup>","</sup>"]},left:{txtExec:['<div style="text-align:left;">',"</div>"]},center:{txtExec:['<div style="text-align:center;">',"</div>"]},right:{txtExec:['<div style="text-align:right;">',"</div>"]},justify:{txtExec:['<div style="text-align:justify;">',"</div>"]},font:{txtExec:function(t){var e=this;l("font")._dropDown(e,t,function(t){e.insertText('<span style="font-family:'+t+';">',"</span>")})}},size:{txtExec:function(t){var e=this;l("size")._dropDown(e,t,function(t){e.insertText('<span style="font-size:'+t+';">',"</span>")})}},color:{txtExec:function(t){var e=this;l("color")._dropDown(e,t,function(t){e.insertText('<span style="color:'+t+';">',"</span>")})}},bulletlist:{txtExec:["<ul><li>","</li></ul>"]},orderedlist:{txtExec:["<ol><li>","</li></ol>"]},table:{txtExec:["<table><tr><td>","</td></tr></table>"]},horizontalrule:{txtExec:["<hr />"]},code:{txtExec:["<code>","</code>"]},image:{txtExec:function(t,e){var o=this;l("image")._dropDown(o,t,e,function(t,e,n){var i="";e&&(i+=' width="'+e+'"'),n&&(i+=' height="'+n+'"'),o.insertText("<img"+i+' src="'+t+'" />')})}},email:{txtExec:function(t,n){var i=this;l("email")._dropDown(i,t,function(t,e){i.insertText('<a href="mailto:'+t+'">'+(e||n||t)+"</a>")})}},link:{txtExec:function(t,n){var i=this;l("link")._dropDown(i,t,function(t,e){i.insertText('<a href="'+t+'">'+(e||n||t)+"</a>")})}},quote:{txtExec:["<blockquote>","</blockquote>"]},youtube:{txtExec:function(t){var n=this;l("youtube")._dropDown(n,t,function(t,e){n.insertText('<iframe width="560" height="315" src="https://www.youtube.com/embed/{id}?wmode=opaque&start='+e+'" data-youtube-id="'+t+'" frameborder="0" allowfullscreen></iframe>')})}},rtl:{txtExec:['<div stlye="direction:rtl;">',"</div>"]},ltr:{txtExec:['<div stlye="direction:ltr;">',"</div>"]}};function z(){var o=this,n={},p={};function t(t,e,n){var i,o,h,r,a,l,s,c,u,d,f,g,v,x,m=n.createElement("div");return m.innerHTML=e,S(m,"visibility","hidden"),n.body.appendChild(m),o=m,C.traverse(o,function(t){var e=t.nodeName.toLowerCase();b("*",t),b(e,t)},!0),h=m,C.traverse(h,function(t){var e,n=t.nodeName.toLowerCase(),i=t.parentNode,o=t.nodeType,r=!C.isInline(t),a=t.previousSibling,l=t.nextSibling,s=i===h,c=!a&&!l,u="iframe"!==n&&function t(e,n){var i,o=e.childNodes,r=e.nodeName.toLowerCase(),a=e.nodeValue,l=o.length,s=z.allowedEmptyTags||[];if(n&&"br"===r)return!0;if(T(e,".sceditor-ignore"))return!0;if(-1<s.indexOf(r)||"td"===r||!C.canHaveChildren(e))return!1;if(a&&/\S|\u00A0/.test(a))return!1;for(;l--;)if(!t(o[l],n&&!e.previousSibling&&!e.nextSibling))return!1;return!e.getBoundingClientRect||!e.className&&!e.hasAttributes("style")||(!(i=e.getBoundingClientRect()).width||!i.height)}(t,s&&c&&"br"!==n),d=t.ownerDocument,f=z.allowedTags,g=t.firstChild,v=z.disallowedTags;if(3!==o&&(4===o?n="!cdata":"!"!==n&&8!==o||(n="!comment"),1===o&&T(t,".sceditor-nlf")&&(!g||!E&&1===t.childNodes.length&&/br/i.test(g.nodeName)?u=!0:(t.classList.remove("sceditor-nlf"),t.className||A(t,"class"))),u?e=!0:f&&f.length?e=f.indexOf(n)<0:v&&v.length&&(e=-1<v.indexOf(n)),e)){if(!u){for(r&&a&&C.isInline(a)&&i.insertBefore(d.createTextNode(" "),t);t.firstChild;)i.insertBefore(t.firstChild,l);r&&l&&C.isInline(l)&&i.insertBefore(d.createTextNode(" "),l)}i.removeChild(t)}},!0),r=m,g=(f=z.allowedAttribs)&&!N(f),x=(v=z.disallowedAttribs)&&!N(v),p={},C.traverse(r,function(t){if(t.attributes&&(a=t.nodeName.toLowerCase(),c=t.attributes.length))for(p[a]||(p[a]=g?w(f["*"],f[a]):w(v["*"],v[a]));c--;)l=t.attributes[c],s=l.name,u=p[a][s],d=!1,g?d=null!==u&&(!Array.isArray(u)||u.indexOf(l.value)<0):x&&(d=null===u||Array.isArray(u)&&-1<u.indexOf(l.value)
|