wax_theme 0.1.0.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +50 -0
- data/_includes/wax/collection/gallery.html +33 -0
- data/_includes/wax/collection/interactive_metadata.html +53 -0
- data/_includes/wax/footer.html +35 -0
- data/_includes/wax/head.html +16 -0
- data/_includes/wax/header.html +35 -0
- data/_includes/wax/image_viewer/leaflet.html +11 -0
- data/_includes/wax/image_viewer/mirador.html +8 -0
- data/_includes/wax/image_viewer/simple.html +5 -0
- data/_includes/wax/inline_image.html +12 -0
- data/_includes/wax/item/metadata.html +23 -0
- data/_includes/wax/item/pagination.html +23 -0
- data/_includes/wax/mirador_compare.html +11 -0
- data/_includes/wax/parallax.html +23 -0
- data/_includes/wax/search.html +12 -0
- data/_layouts/wax/collection_item.html +41 -0
- data/_layouts/wax/default.html +20 -0
- data/_layouts/wax/exhibit.html +15 -0
- data/_layouts/wax/page.html +13 -0
- data/_layouts/wax/reuse_page.html +7 -0
- data/_sass/_bootstrap.scss +9030 -0
- data/_sass/_syntax.scss +129 -0
- data/_sass/_wax.scss +482 -0
- data/assets/css/datatables.css +24 -0
- data/assets/css/leaflet.css +636 -0
- data/assets/js/bootstrap.min.js +7 -0
- data/assets/js/datatables.min.js +325 -0
- data/assets/js/elasticlunr.min.js +10 -0
- data/assets/js/jquery-3.2.1.min.js +4 -0
- data/assets/js/leaflet-iiif.min.js +8 -0
- data/assets/js/leaflet.js +5 -0
- data/assets/js/popper.min.js +5 -0
- data/assets/js/wax.js +91 -0
- data/assets/logo.png +0 -0
- data/assets/mirador/css/mirador-combined.css +4107 -0
- data/assets/mirador/fonts/FontAwesome.otf +0 -0
- data/assets/mirador/fonts/MaterialIcons-Regular.eot +0 -0
- data/assets/mirador/fonts/MaterialIcons-Regular.ijmap +1 -0
- data/assets/mirador/fonts/MaterialIcons-Regular.svg +2373 -0
- data/assets/mirador/fonts/MaterialIcons-Regular.ttf +0 -0
- data/assets/mirador/fonts/MaterialIcons-Regular.woff +0 -0
- data/assets/mirador/fonts/MaterialIcons-Regular.woff2 +0 -0
- data/assets/mirador/fonts/fontawesome-webfont.eot +0 -0
- data/assets/mirador/fonts/fontawesome-webfont.svg +2671 -0
- data/assets/mirador/fonts/fontawesome-webfont.ttf +0 -0
- data/assets/mirador/fonts/fontawesome-webfont.woff +0 -0
- data/assets/mirador/fonts/fontawesome-webfont.woff2 +0 -0
- data/assets/mirador/images/border_type_1.png +0 -0
- data/assets/mirador/images/border_type_2.png +0 -0
- data/assets/mirador/images/border_type_3.png +0 -0
- data/assets/mirador/images/border_type_4.png +0 -0
- data/assets/mirador/images/border_type_5.png +0 -0
- data/assets/mirador/images/debut_dark.png +0 -0
- data/assets/mirador/locales/ar/translation.json +42 -0
- data/assets/mirador/locales/de/translation.json +103 -0
- data/assets/mirador/locales/en/translation.json +106 -0
- data/assets/mirador/locales/es/translation.json +86 -0
- data/assets/mirador/locales/fr/translation.json +103 -0
- data/assets/mirador/locales/ga/translation.json +97 -0
- data/assets/mirador/locales/ja/translation.json +82 -0
- data/assets/mirador/locales/ko/translation.json +83 -0
- data/assets/mirador/locales/nl/translation.json +39 -0
- data/assets/mirador/locales/zh-CN/translation.json +76 -0
- data/assets/mirador/locales/zh-TW/translation.json +76 -0
- data/assets/mirador/locales/zh/translation.json +74 -0
- data/assets/mirador/mirador.js +49145 -0
- data/assets/mirador/plugins/advlist/index.js +7 -0
- data/assets/mirador/plugins/advlist/plugin.js +160 -0
- data/assets/mirador/plugins/advlist/plugin.min.js +1 -0
- data/assets/mirador/plugins/anchor/index.js +7 -0
- data/assets/mirador/plugins/anchor/plugin.js +118 -0
- data/assets/mirador/plugins/anchor/plugin.min.js +1 -0
- data/assets/mirador/plugins/autolink/index.js +7 -0
- data/assets/mirador/plugins/autolink/plugin.js +180 -0
- data/assets/mirador/plugins/autolink/plugin.min.js +1 -0
- data/assets/mirador/plugins/autoresize/index.js +7 -0
- data/assets/mirador/plugins/autoresize/plugin.js +169 -0
- data/assets/mirador/plugins/autoresize/plugin.min.js +1 -0
- data/assets/mirador/plugins/autosave/index.js +7 -0
- data/assets/mirador/plugins/autosave/plugin.js +226 -0
- data/assets/mirador/plugins/autosave/plugin.min.js +1 -0
- data/assets/mirador/plugins/bbcode/index.js +7 -0
- data/assets/mirador/plugins/bbcode/plugin.js +101 -0
- data/assets/mirador/plugins/bbcode/plugin.min.js +1 -0
- data/assets/mirador/plugins/charmap/index.js +7 -0
- data/assets/mirador/plugins/charmap/plugin.js +1275 -0
- data/assets/mirador/plugins/charmap/plugin.min.js +1 -0
- data/assets/mirador/plugins/code/index.js +7 -0
- data/assets/mirador/plugins/code/plugin.js +94 -0
- data/assets/mirador/plugins/code/plugin.min.js +1 -0
- data/assets/mirador/plugins/codesample/css/prism.css +138 -0
- data/assets/mirador/plugins/codesample/index.js +7 -0
- data/assets/mirador/plugins/codesample/plugin.js +967 -0
- data/assets/mirador/plugins/codesample/plugin.min.js +1 -0
- data/assets/mirador/plugins/colorpicker/index.js +7 -0
- data/assets/mirador/plugins/colorpicker/plugin.js +126 -0
- data/assets/mirador/plugins/colorpicker/plugin.min.js +1 -0
- data/assets/mirador/plugins/contextmenu/index.js +7 -0
- data/assets/mirador/plugins/contextmenu/plugin.js +168 -0
- data/assets/mirador/plugins/contextmenu/plugin.min.js +1 -0
- data/assets/mirador/plugins/directionality/index.js +7 -0
- data/assets/mirador/plugins/directionality/plugin.js +66 -0
- data/assets/mirador/plugins/directionality/plugin.min.js +1 -0
- data/assets/mirador/plugins/emoticons/img/smiley-cool.gif +0 -0
- data/assets/mirador/plugins/emoticons/img/smiley-cry.gif +0 -0
- data/assets/mirador/plugins/emoticons/img/smiley-embarassed.gif +0 -0
- data/assets/mirador/plugins/emoticons/img/smiley-foot-in-mouth.gif +0 -0
- data/assets/mirador/plugins/emoticons/img/smiley-frown.gif +0 -0
- data/assets/mirador/plugins/emoticons/img/smiley-innocent.gif +0 -0
- data/assets/mirador/plugins/emoticons/img/smiley-kiss.gif +0 -0
- data/assets/mirador/plugins/emoticons/img/smiley-laughing.gif +0 -0
- data/assets/mirador/plugins/emoticons/img/smiley-money-mouth.gif +0 -0
- data/assets/mirador/plugins/emoticons/img/smiley-sealed.gif +0 -0
- data/assets/mirador/plugins/emoticons/img/smiley-smile.gif +0 -0
- data/assets/mirador/plugins/emoticons/img/smiley-surprised.gif +0 -0
- data/assets/mirador/plugins/emoticons/img/smiley-tongue-out.gif +0 -0
- data/assets/mirador/plugins/emoticons/img/smiley-undecided.gif +0 -0
- data/assets/mirador/plugins/emoticons/img/smiley-wink.gif +0 -0
- data/assets/mirador/plugins/emoticons/img/smiley-yell.gif +0 -0
- data/assets/mirador/plugins/emoticons/index.js +7 -0
- data/assets/mirador/plugins/emoticons/plugin.js +87 -0
- data/assets/mirador/plugins/emoticons/plugin.min.js +1 -0
- data/assets/mirador/plugins/fullpage/index.js +7 -0
- data/assets/mirador/plugins/fullpage/plugin.js +519 -0
- data/assets/mirador/plugins/fullpage/plugin.min.js +1 -0
- data/assets/mirador/plugins/fullscreen/index.js +7 -0
- data/assets/mirador/plugins/fullscreen/plugin.js +177 -0
- data/assets/mirador/plugins/fullscreen/plugin.min.js +1 -0
- data/assets/mirador/plugins/help/img/logo.png +0 -0
- data/assets/mirador/plugins/help/index.js +7 -0
- data/assets/mirador/plugins/help/plugin.js +727 -0
- data/assets/mirador/plugins/help/plugin.min.js +1 -0
- data/assets/mirador/plugins/hr/index.js +7 -0
- data/assets/mirador/plugins/hr/plugin.js +39 -0
- data/assets/mirador/plugins/hr/plugin.min.js +1 -0
- data/assets/mirador/plugins/image/index.js +7 -0
- data/assets/mirador/plugins/image/plugin.js +1211 -0
- data/assets/mirador/plugins/image/plugin.min.js +1 -0
- data/assets/mirador/plugins/imagetools/index.js +7 -0
- data/assets/mirador/plugins/imagetools/plugin.js +3684 -0
- data/assets/mirador/plugins/imagetools/plugin.min.js +1 -0
- data/assets/mirador/plugins/importcss/index.js +7 -0
- data/assets/mirador/plugins/importcss/plugin.js +264 -0
- data/assets/mirador/plugins/importcss/plugin.min.js +1 -0
- data/assets/mirador/plugins/insertdatetime/index.js +7 -0
- data/assets/mirador/plugins/insertdatetime/plugin.js +173 -0
- data/assets/mirador/plugins/insertdatetime/plugin.min.js +1 -0
- data/assets/mirador/plugins/legacyoutput/index.js +7 -0
- data/assets/mirador/plugins/legacyoutput/plugin.js +220 -0
- data/assets/mirador/plugins/legacyoutput/plugin.min.js +1 -0
- data/assets/mirador/plugins/link/index.js +7 -0
- data/assets/mirador/plugins/link/plugin.js +713 -0
- data/assets/mirador/plugins/link/plugin.min.js +1 -0
- data/assets/mirador/plugins/lists/index.js +7 -0
- data/assets/mirador/plugins/lists/plugin.js +1115 -0
- data/assets/mirador/plugins/lists/plugin.min.js +1 -0
- data/assets/mirador/plugins/media/index.js +7 -0
- data/assets/mirador/plugins/media/plugin.js +1166 -0
- data/assets/mirador/plugins/media/plugin.min.js +1 -0
- data/assets/mirador/plugins/nonbreaking/index.js +7 -0
- data/assets/mirador/plugins/nonbreaking/plugin.js +85 -0
- data/assets/mirador/plugins/nonbreaking/plugin.min.js +1 -0
- data/assets/mirador/plugins/noneditable/index.js +7 -0
- data/assets/mirador/plugins/noneditable/plugin.js +118 -0
- data/assets/mirador/plugins/noneditable/plugin.min.js +1 -0
- data/assets/mirador/plugins/pagebreak/index.js +7 -0
- data/assets/mirador/plugins/pagebreak/plugin.js +109 -0
- data/assets/mirador/plugins/pagebreak/plugin.min.js +1 -0
- data/assets/mirador/plugins/paste/index.js +7 -0
- data/assets/mirador/plugins/paste/plugin.js +1497 -0
- data/assets/mirador/plugins/paste/plugin.min.js +1 -0
- data/assets/mirador/plugins/preview/index.js +7 -0
- data/assets/mirador/plugins/preview/plugin.js +123 -0
- data/assets/mirador/plugins/preview/plugin.min.js +1 -0
- data/assets/mirador/plugins/print/index.js +7 -0
- data/assets/mirador/plugins/print/plugin.js +38 -0
- data/assets/mirador/plugins/print/plugin.min.js +1 -0
- data/assets/mirador/plugins/save/index.js +7 -0
- data/assets/mirador/plugins/save/plugin.js +120 -0
- data/assets/mirador/plugins/save/plugin.min.js +1 -0
- data/assets/mirador/plugins/searchreplace/index.js +7 -0
- data/assets/mirador/plugins/searchreplace/plugin.js +603 -0
- data/assets/mirador/plugins/searchreplace/plugin.min.js +1 -0
- data/assets/mirador/plugins/spellchecker/index.js +7 -0
- data/assets/mirador/plugins/spellchecker/plugin.js +757 -0
- data/assets/mirador/plugins/spellchecker/plugin.min.js +1 -0
- data/assets/mirador/plugins/tabfocus/index.js +7 -0
- data/assets/mirador/plugins/tabfocus/plugin.js +124 -0
- data/assets/mirador/plugins/tabfocus/plugin.min.js +1 -0
- data/assets/mirador/plugins/table/index.js +7 -0
- data/assets/mirador/plugins/table/plugin.js +10144 -0
- data/assets/mirador/plugins/table/plugin.min.js +1 -0
- data/assets/mirador/plugins/template/index.js +7 -0
- data/assets/mirador/plugins/template/plugin.js +345 -0
- data/assets/mirador/plugins/template/plugin.min.js +1 -0
- data/assets/mirador/plugins/textcolor/index.js +7 -0
- data/assets/mirador/plugins/textcolor/plugin.js +346 -0
- data/assets/mirador/plugins/textcolor/plugin.min.js +1 -0
- data/assets/mirador/plugins/textpattern/index.js +7 -0
- data/assets/mirador/plugins/textpattern/plugin.js +370 -0
- data/assets/mirador/plugins/textpattern/plugin.min.js +1 -0
- data/assets/mirador/plugins/toc/index.js +7 -0
- data/assets/mirador/plugins/toc/plugin.js +228 -0
- data/assets/mirador/plugins/toc/plugin.min.js +1 -0
- data/assets/mirador/plugins/visualblocks/css/visualblocks.css +154 -0
- data/assets/mirador/plugins/visualblocks/index.js +7 -0
- data/assets/mirador/plugins/visualblocks/plugin.js +135 -0
- data/assets/mirador/plugins/visualblocks/plugin.min.js +1 -0
- data/assets/mirador/plugins/visualchars/index.js +7 -0
- data/assets/mirador/plugins/visualchars/plugin.js +505 -0
- data/assets/mirador/plugins/visualchars/plugin.min.js +1 -0
- data/assets/mirador/plugins/wordcount/index.js +7 -0
- data/assets/mirador/plugins/wordcount/plugin.js +343 -0
- data/assets/mirador/plugins/wordcount/plugin.min.js +1 -0
- data/assets/mirador/skins/lightgray/content.inline.min.css +1 -0
- data/assets/mirador/skins/lightgray/content.min.css +1 -0
- data/assets/mirador/skins/lightgray/content.mobile.min.css +1 -0
- data/assets/mirador/skins/lightgray/fonts/tinymce-mobile.woff +0 -0
- data/assets/mirador/skins/lightgray/fonts/tinymce-small.eot +0 -0
- data/assets/mirador/skins/lightgray/fonts/tinymce-small.svg +63 -0
- data/assets/mirador/skins/lightgray/fonts/tinymce-small.ttf +0 -0
- data/assets/mirador/skins/lightgray/fonts/tinymce-small.woff +0 -0
- data/assets/mirador/skins/lightgray/fonts/tinymce.eot +0 -0
- data/assets/mirador/skins/lightgray/fonts/tinymce.svg +131 -0
- data/assets/mirador/skins/lightgray/fonts/tinymce.ttf +0 -0
- data/assets/mirador/skins/lightgray/fonts/tinymce.woff +0 -0
- data/assets/mirador/skins/lightgray/img/anchor.gif +0 -0
- data/assets/mirador/skins/lightgray/img/loader.gif +0 -0
- data/assets/mirador/skins/lightgray/img/object.gif +0 -0
- data/assets/mirador/skins/lightgray/img/trans.gif +0 -0
- data/assets/mirador/skins/lightgray/skin.min.css +1 -0
- data/assets/mirador/skins/lightgray/skin.mobile.min.css +2 -0
- data/assets/mirador/themes/inlite/index.js +7 -0
- data/assets/mirador/themes/inlite/theme.js +10235 -0
- data/assets/mirador/themes/inlite/theme.min.js +1 -0
- data/assets/mirador/themes/mobile/index.js +7 -0
- data/assets/mirador/themes/mobile/theme.js +13546 -0
- data/assets/mirador/themes/mobile/theme.min.js +1 -0
- data/assets/mirador/themes/modern/index.js +7 -0
- data/assets/mirador/themes/modern/theme.js +10041 -0
- data/assets/mirador/themes/modern/theme.min.js +1 -0
- data/assets/styles.scss +51 -0
- metadata +343 -0
@@ -0,0 +1 @@
|
|
1
|
+
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),o=tinymce.util.Tools.resolve("tinymce.Env"),v=tinymce.util.Tools.resolve("tinymce.util.Tools"),w=function(e){return e.getParam("media_scripts")},b=function(e){return e.getParam("audio_template_callback")},y=function(e){return e.getParam("video_template_callback")},n=function(e){return e.getParam("media_live_embeds",!0)},t=function(e){return e.getParam("media_filter_html",!0)},s=function(e){return e.getParam("media_url_resolver")},m=function(e){return e.getParam("media_alt_source",!0)},d=function(e){return e.getParam("media_poster",!0)},h=function(e){return e.getParam("media_dimensions",!0)},p=tinymce.util.Tools.resolve("tinymce.html.SaxParser"),r=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),x=function(e,t){if(e)for(var r=0;r<e.length;r++)if(-1!==t.indexOf(e[r].filter))return e[r]},i=function(t){return function(e){return e?e.style[t].replace(/px$/,""):""}},a=function(i){return function(e,t){var r;e&&(e.style[i]=/^[0-9.]+$/.test(r=t)?r+"px":r)}},f={getMaxWidth:i("maxWidth"),getMaxHeight:i("maxHeight"),setMaxWidth:a("maxWidth"),setMaxHeight:a("maxHeight")},u=r.DOM,l=function(e){return u.getAttrib(e,"data-ephox-embed-iri")},j=function(e,t){return c=t,s=u.createFragment(c),""!==l(s.firstChild)?(o=t,n=u.createFragment(o).firstChild,{type:"ephox-embed-iri",source1:l(n),source2:"",poster:"",width:f.getMaxWidth(n),height:f.getMaxHeight(n)}):(i=e,r=t,p({validate:(a={},!1),allow_conditional_comments:!0,special:"script,noscript",start:function(e,t){if(a.source1||"param"!==e||(a.source1=t.map.movie),"iframe"!==e&&"object"!==e&&"embed"!==e&&"video"!==e&&"audio"!==e||(a.type||(a.type=e),a=v.extend(t.map,a)),"script"===e){var r=x(i,t.map.src);if(!r)return;a={type:"script",source1:t.map.src,width:r.width,height:r.height}}"source"===e&&(a.source1?a.source2||(a.source2=t.map.src):a.source1=t.map.src),"img"!==e||a.poster||(a.poster=t.map.src)}}).parse(r),a.source1=a.source1||a.src||a.data,a.source2=a.source2||"",a.poster=a.poster||"",a);var i,r,a,o,n,c,s},g=tinymce.util.Tools.resolve("tinymce.util.Promise"),M=function(e){var t={mp3:"audio/mpeg",wav:"audio/wav",mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",swf:"application/x-shockwave-flash"}[e.toLowerCase().split(".").pop()];return t||""},_=tinymce.util.Tools.resolve("tinymce.html.Writer"),C=tinymce.util.Tools.resolve("tinymce.html.Schema"),S=r.DOM,F=function(e,t){var r,i,a,o;for(r in t)if(a=""+t[r],e.map[r])for(i=e.length;i--;)(o=e[i]).name===r&&(a?(e.map[r]=a,o.value=a):(delete e.map[r],e.splice(i,1)));else a&&(e.push({name:r,value:a}),e.map[r]=a)},k=function(e,t){var r,i,a=S.createFragment(e).firstChild;return f.setMaxWidth(a,t.width),f.setMaxHeight(a,t.height),r=a.outerHTML,i=_(),p(i).parse(r),i.getContent()},A=function(e,t,r){return u=e,l=S.createFragment(u),""!==S.getAttrib(l.firstChild,"data-ephox-embed-iri")?k(e,t):(i=e,a=t,o=r,c=_(),p({validate:!1,allow_conditional_comments:!(s=0),special:"script,noscript",comment:function(e){c.comment(e)},cdata:function(e){c.cdata(e)},text:function(e,t){c.text(e,t)},start:function(e,t,r){switch(e){case"video":case"object":case"embed":case"img":case"iframe":a.height!==undefined&&a.width!==undefined&&F(t,{width:a.width,height:a.height})}if(o)switch(e){case"video":F(t,{poster:a.poster,src:""}),a.source2&&F(t,{src:""});break;case"iframe":F(t,{src:a.source1});break;case"source":if(++s<=2&&(F(t,{src:a["source"+s],type:a["source"+s+"mime"]}),!a["source"+s]))return;break;case"img":if(!a.poster)return;n=!0}c.start(e,t,r)},end:function(e){if("video"===e&&o)for(var t=1;t<=2;t++)if(a["source"+t]){var r=[];r.map={},s<t&&(F(r,{src:a["source"+t],type:a["source"+t+"mime"]}),c.start("source",r,!0))}if(a.poster&&"object"===e&&o&&!n){var i=[];i.map={},F(i,{src:a.poster,width:a.width,height:a.height}),c.start("img",i,!0)}c.end(e)}},C({})).parse(i),c.getContent());var i,a,o,n,c,s,u,l},N=[{regex:/youtu\.be\/([\w\-_\?&=.]+)/i,type:"iframe",w:560,h:314,url:"//www.youtube.com/embed/$1",allowFullscreen:!0},{regex:/youtube\.com(.+)v=([^&]+)(&([a-z0-9&=\-_]+))?/i,type:"iframe",w:560,h:314,url:"//www.youtube.com/embed/$2?$4",allowFullscreen:!0},{regex:/youtube.com\/embed\/([a-z0-9\?&=\-_]+)/i,type:"iframe",w:560,h:314,url:"//www.youtube.com/embed/$1",allowFullscreen:!0},{regex:/vimeo\.com\/([0-9]+)/,type:"iframe",w:425,h:350,url:"//player.vimeo.com/video/$1?title=0&byline=0&portrait=0&color=8dc7dc",allowFullscreen:!0},{regex:/vimeo\.com\/(.*)\/([0-9]+)/,type:"iframe",w:425,h:350,url:"//player.vimeo.com/video/$2?title=0&byline=0",allowFullscreen:!0},{regex:/maps\.google\.([a-z]{2,3})\/maps\/(.+)msid=(.+)/,type:"iframe",w:425,h:350,url:'//maps.google.com/maps/ms?msid=$2&output=embed"',allowFullscreen:!1},{regex:/dailymotion\.com\/video\/([^_]+)/,type:"iframe",w:480,h:270,url:"//www.dailymotion.com/embed/video/$1",allowFullscreen:!0},{regex:/dai\.ly\/([^_]+)/,type:"iframe",w:480,h:270,url:"//www.dailymotion.com/embed/video/$1",allowFullscreen:!0}],c=function(r,e){var i=v.extend({},e);if(!i.source1&&(v.extend(i,j(w(r),i.embed)),!i.source1))return"";i.source2||(i.source2=""),i.poster||(i.poster=""),i.source1=r.convertURL(i.source1,"source"),i.source2=r.convertURL(i.source2,"source"),i.source1mime=M(i.source1),i.source2mime=M(i.source2),i.poster=r.convertURL(i.poster,"poster");var t,a,o=(t=i.source1,0<(a=N.filter(function(e){return e.regex.test(t)})).length?v.extend({},a[0],{url:function(e,t){for(var r=e.regex.exec(t),i=e.url,a=function(e){i=i.replace("$"+e,function(){return r[e]?r[e]:""})},o=0;o<r.length;o++)a(o);return i.replace(/\?$/,"")}(a[0],t)}):null);if(o&&(i.source1=o.url,i.type=o.type,i.allowFullscreen=o.allowFullscreen,i.width=i.width||o.w,i.height=i.height||o.h),i.embed)return A(i.embed,i,!0);var n=x(w(r),i.source1);n&&(i.type="script",i.width=n.width,i.height=n.height);var c,s,u,l,m,d,h,p,f=b(r),g=y(r);return i.width=i.width||300,i.height=i.height||150,v.each(i,function(e,t){i[t]=r.dom.encode(e)}),"iframe"===i.type?(p=(h=i).allowFullscreen?' allowFullscreen="1"':"",'<iframe src="'+h.source1+'" width="'+h.width+'" height="'+h.height+'"'+p+"></iframe>"):"application/x-shockwave-flash"===i.source1mime?(d='<object data="'+(m=i).source1+'" width="'+m.width+'" height="'+m.height+'" type="application/x-shockwave-flash">',m.poster&&(d+='<img src="'+m.poster+'" width="'+m.width+'" height="'+m.height+'" />'),d+="</object>"):-1!==i.source1mime.indexOf("audio")?(u=i,(l=f)?l(u):'<audio controls="controls" src="'+u.source1+'">'+(u.source2?'\n<source src="'+u.source2+'"'+(u.source2mime?' type="'+u.source2mime+'"':"")+" />\n":"")+"</audio>"):"script"===i.type?'<script src="'+i.source1+'"><\/script>':(c=i,(s=g)?s(c):'<video width="'+c.width+'" height="'+c.height+'"'+(c.poster?' poster="'+c.poster+'"':"")+' controls="controls">\n<source src="'+c.source1+'"'+(c.source1mime?' type="'+c.source1mime+'"':"")+" />\n"+(c.source2?'<source src="'+c.source2+'"'+(c.source2mime?' type="'+c.source2mime+'"':"")+" />\n":"")+"</video>")},O={},P=function(t){return function(e){return c(t,e)}},T=function(e,t){var r,i,a,o,n,c=s(e);return c?(a=t,o=P(e),n=c,new g(function(t,e){var r=function(e){return e.html&&(O[a.source1]=e),t({url:a.source1,html:e.html?e.html:o(a)})};O[a.source1]?r(O[a.source1]):n({url:a.source1},r,e)})):(r=t,i=P(e),new g(function(e){e({html:i(r),url:r.source1})}))},$=function(e){return O.hasOwnProperty(e)},z=function(e,t){e.state.set("oldVal",e.value()),t.state.set("oldVal",t.value())},L=function(e,t){var r=e.find("#width")[0],i=e.find("#height")[0],a=e.find("#constrain")[0];r&&i&&a&&t(r,i,a.checked())},H=function(e,t,r){var i=e.state.get("oldVal"),a=t.state.get("oldVal"),o=e.value(),n=t.value();r&&i&&a&&o&&n&&(o!==i?(n=Math.round(o/i*n),isNaN(n)||t.value(n)):(o=Math.round(n/a*o),isNaN(o)||e.value(o))),z(e,t)},W=function(e){L(e,H)},J=function(e){var t=function(){e(function(e){W(e)})};return{type:"container",label:"Dimensions",layout:"flex",align:"center",spacing:5,items:[{name:"width",type:"textbox",maxLength:5,size:5,onchange:t,ariaLabel:"Width"},{type:"label",text:"x"},{name:"height",type:"textbox",maxLength:5,size:5,onchange:t,ariaLabel:"Height"},{name:"constrain",type:"checkbox",checked:!0,text:"Constrain proportions"}]}},R=function(e){L(e,z)},D=W,E=o.ie&&o.ie<=8?"onChange":"onInput",I=function(r){return function(e){var t=e&&e.msg?"Media embed handler error: "+e.msg:"Media embed handler threw unknown error.";r.notificationManager.open({type:"error",text:t})}},U=function(a,o){return function(e){var t=e.html,r=a.find("#embed")[0],i=v.extend(j(w(o),t),{source1:e.url});a.fromJSON(i),r&&(r.value(t),D(a))}},V=function(e,t){var r=e.dom.select("img[data-mce-object]");e.insertContent(t),function(e,t){var r,i,a=e.dom.select("img[data-mce-object]");for(r=0;r<t.length;r++)for(i=a.length-1;0<=i;i--)t[r]===a[i]&&a.splice(i,1);e.selection.select(a[0])}(e,r),e.nodeChanged()},B=function(i){var a,t,e,r,o,n=[{name:"source1",type:"filepicker",filetype:"media",size:40,autofocus:!0,label:"Source",onpaste:function(){setTimeout(function(){T(i,a.toJSON()).then(U(a,i))["catch"](I(i))},1)},onchange:function(e){var r,t;T(i,a.toJSON()).then(U(a,i))["catch"](I(i)),r=a,t=e.meta,v.each(t,function(e,t){r.find("#"+t).value(e)})},onbeforecall:function(e){e.meta=a.toJSON()}}],c=[];if(m(i)&&c.push({name:"source2",type:"filepicker",filetype:"media",size:40,label:"Alternative source"}),d(i)&&c.push({name:"poster",type:"filepicker",filetype:"image",size:40,label:"Poster"}),h(i)){var s=J(function(e){e(a),t=a.toJSON(),a.find("#embed").value(A(t.embed,t))});n.push(s)}r=(e=i).selection.getNode(),o=r.getAttribute("data-ephox-embed-iri"),t=o?{source1:o,"data-ephox-embed-iri":o,width:f.getMaxWidth(r),height:f.getMaxHeight(r)}:r.getAttribute("data-mce-object")?j(w(e),e.serializer.serialize(r,{selection:!0})):{};var u={id:"mcemediasource",type:"textbox",flex:1,name:"embed",value:function(e){var t=e.selection.getNode();if(t.getAttribute("data-mce-object")||t.getAttribute("data-ephox-embed-iri"))return e.selection.getContent()}(i),multiline:!0,rows:5,label:"Source"};u[E]=function(){t=v.extend({},j(w(i),this.value())),this.parent().parent().fromJSON(t)};var l=[{title:"General",type:"form",items:n},{title:"Embed",type:"container",layout:"flex",direction:"column",align:"stretch",padding:10,spacing:10,items:[{type:"label",text:"Paste your embed code below:",forId:"mcemediasource"},u]}];0<c.length&&l.push({title:"Advanced",type:"form",items:c}),a=i.windowManager.open({title:"Insert/edit media",data:t,bodyType:"tabpanel",body:l,onSubmit:function(){var t,e;D(a),t=i,(e=a.toJSON()).embed=A(e.embed,e),e.embed&&$(e.source1)?V(t,e.embed):T(t,e).then(function(e){V(t,e.html)})["catch"](I(t))}}),R(a)},G=function(e){return{showDialog:function(){B(e)}}},q=function(e){e.addCommand("mceMedia",function(){B(e)})},K=tinymce.util.Tools.resolve("tinymce.html.Node"),Q=function(a,e){if(!1===t(a))return e;var o,n=_();return p({validate:!1,allow_conditional_comments:!1,special:"script,noscript",comment:function(e){n.comment(e)},cdata:function(e){n.cdata(e)},text:function(e,t){n.text(e,t)},start:function(e,t,r){if(o=!0,"script"!==e&&"noscript"!==e){for(var i=0;i<t.length;i++){if(0===t[i].name.indexOf("on"))return;"style"===t[i].name&&(t[i].value=a.dom.serializeStyle(a.dom.parseStyle(t[i].value),e))}n.start(e,t,r),o=!1}},end:function(e){o||n.end(e)}},C({})).parse(e),n.getContent()},X=function(e,t){var r,i=t.name;return(r=new K("img",1)).shortEnded=!0,Z(e,t,r),r.attr({width:t.attr("width")||"300",height:t.attr("height")||("audio"===i?"30":"150"),style:t.attr("style"),src:o.transparentSrc,"data-mce-object":i,"class":"mce-object mce-object-"+i}),r},Y=function(e,t){var r,i,a,o=t.name;return(r=new K("span",1)).attr({contentEditable:"false",style:t.attr("style"),"data-mce-object":o,"class":"mce-preview-object mce-object-"+o}),Z(e,t,r),(i=new K(o,1)).attr({src:t.attr("src"),allowfullscreen:t.attr("allowfullscreen"),style:t.attr("style"),"class":t.attr("class"),width:t.attr("width"),height:t.attr("height"),frameborder:"0"}),(a=new K("span",1)).attr("class","mce-shim"),r.append(i),r.append(a),r},Z=function(e,t,r){var i,a,o,n,c;for(n=(o=t.attributes).length;n--;)i=o[n].name,a=o[n].value,"width"!==i&&"height"!==i&&"style"!==i&&("data"!==i&&"src"!==i||(a=e.convertURL(a,i)),r.attr("data-mce-p-"+i,a));(c=t.firstChild&&t.firstChild.value)&&(r.attr("data-mce-html",escape(Q(e,c))),r.firstChild=null)},ee=function(e){for(;e=e.parent;)if(e.attr("data-ephox-embed-iri"))return!0;return!1},te=function(a){return function(e){for(var t,r,i=e.length;i--;)(t=e[i]).parent&&(t.parent.attr("data-mce-object")||("script"!==t.name||(r=x(w(a),t.attr("src"))))&&(r&&(r.width&&t.attr("width",r.width.toString()),r.height&&t.attr("height",r.height.toString())),"iframe"===t.name&&n(a)&&o.ceFalse?ee(t)||t.replace(Y(a,t)):ee(t)||t.replace(X(a,t))))}},re=function(d){d.on("preInit",function(){var t=d.schema.getSpecialElements();v.each("video audio iframe object".split(" "),function(e){t[e]=new RegExp("</"+e+"[^>]*>","gi")});var r=d.schema.getBoolAttrs();v.each("webkitallowfullscreen mozallowfullscreen allowfullscreen".split(" "),function(e){r[e]={}}),d.parser.addNodeFilter("iframe,video,audio,object,embed,script",te(d)),d.serializer.addAttributeFilter("data-mce-object",function(e,t){for(var r,i,a,o,n,c,s,u,l=e.length;l--;)if((r=e[l]).parent){for(s=r.attr(t),i=new K(s,1),"audio"!==s&&"script"!==s&&((u=r.attr("class"))&&-1!==u.indexOf("mce-preview-object")?i.attr({width:r.firstChild.attr("width"),height:r.firstChild.attr("height")}):i.attr({width:r.attr("width"),height:r.attr("height")})),i.attr({style:r.attr("style")}),a=(o=r.attributes).length;a--;){var m=o[a].name;0===m.indexOf("data-mce-p-")&&i.attr(m.substr(11),o[a].value)}"script"===s&&i.attr("type","text/javascript"),(n=r.attr("data-mce-html"))&&((c=new K("#text",3)).raw=!0,c.value=Q(d,unescape(n)),i.append(c)),r.replace(i)}})}),d.on("setContent",function(){d.$("span.mce-preview-object").each(function(e,t){var r=d.$(t);0===r.find("span.mce-shim",t).length&&r.append('<span class="mce-shim"></span>')})})},ie=function(e){e.on("ResolveName",function(e){var t;1===e.target.nodeType&&(t=e.target.getAttribute("data-mce-object"))&&(e.name=t)})},ae=function(t){t.on("click keyup",function(){var e=t.selection.getNode();e&&t.dom.hasClass(e,"mce-preview-object")&&t.dom.getAttrib(e,"data-mce-selected")&&e.setAttribute("data-mce-selected","2")}),t.on("ObjectSelected",function(e){var t=e.target.getAttribute("data-mce-object");"audio"!==t&&"script"!==t||e.preventDefault()}),t.on("objectResized",function(e){var t,r=e.target;r.getAttribute("data-mce-object")&&(t=r.getAttribute("data-mce-html"))&&(t=unescape(t),r.setAttribute("data-mce-html",escape(A(t,{width:e.width,height:e.height}))))})},oe=function(e){e.addButton("media",{tooltip:"Insert/edit media",cmd:"mceMedia",stateSelector:["img[data-mce-object]","span[data-mce-object]","div[data-ephox-embed-iri]"]}),e.addMenuItem("media",{icon:"media",text:"Media",cmd:"mceMedia",context:"insert",prependToContext:!0})};e.add("media",function(e){return q(e),oe(e),ie(e),re(e),ae(e),G(e)})}();
|
@@ -0,0 +1,85 @@
|
|
1
|
+
(function () {
|
2
|
+
var nonbreaking = (function () {
|
3
|
+
'use strict';
|
4
|
+
|
5
|
+
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
6
|
+
|
7
|
+
var stringRepeat = function (string, repeats) {
|
8
|
+
var str = '';
|
9
|
+
for (var index = 0; index < repeats; index++) {
|
10
|
+
str += string;
|
11
|
+
}
|
12
|
+
return str;
|
13
|
+
};
|
14
|
+
var isVisualCharsEnabled = function (editor) {
|
15
|
+
return editor.plugins.visualchars ? editor.plugins.visualchars.isEnabled() : false;
|
16
|
+
};
|
17
|
+
var insertNbsp = function (editor, times) {
|
18
|
+
var nbsp = isVisualCharsEnabled(editor) ? '<span class="mce-nbsp"> </span>' : ' ';
|
19
|
+
editor.insertContent(stringRepeat(nbsp, times));
|
20
|
+
editor.dom.setAttrib(editor.dom.select('span.mce-nbsp'), 'data-mce-bogus', '1');
|
21
|
+
};
|
22
|
+
var $_enn3ghhsjm0ofzmp = { insertNbsp: insertNbsp };
|
23
|
+
|
24
|
+
var register = function (editor) {
|
25
|
+
editor.addCommand('mceNonBreaking', function () {
|
26
|
+
$_enn3ghhsjm0ofzmp.insertNbsp(editor, 1);
|
27
|
+
});
|
28
|
+
};
|
29
|
+
var $_f4n13bhrjm0ofzmn = { register: register };
|
30
|
+
|
31
|
+
var global$1 = tinymce.util.Tools.resolve('tinymce.util.VK');
|
32
|
+
|
33
|
+
var getKeyboardSpaces = function (editor) {
|
34
|
+
var spaces = editor.getParam('nonbreaking_force_tab', 0);
|
35
|
+
if (typeof spaces === 'boolean') {
|
36
|
+
return spaces === true ? 3 : 0;
|
37
|
+
} else {
|
38
|
+
return spaces;
|
39
|
+
}
|
40
|
+
};
|
41
|
+
var $_9hosb8hvjm0ofzms = { getKeyboardSpaces: getKeyboardSpaces };
|
42
|
+
|
43
|
+
var setup = function (editor) {
|
44
|
+
var spaces = $_9hosb8hvjm0ofzms.getKeyboardSpaces(editor);
|
45
|
+
if (spaces > 0) {
|
46
|
+
editor.on('keydown', function (e) {
|
47
|
+
if (e.keyCode === global$1.TAB && !e.isDefaultPrevented()) {
|
48
|
+
if (e.shiftKey) {
|
49
|
+
return;
|
50
|
+
}
|
51
|
+
e.preventDefault();
|
52
|
+
e.stopImmediatePropagation();
|
53
|
+
$_enn3ghhsjm0ofzmp.insertNbsp(editor, spaces);
|
54
|
+
}
|
55
|
+
});
|
56
|
+
}
|
57
|
+
};
|
58
|
+
var $_93cgphtjm0ofzmq = { setup: setup };
|
59
|
+
|
60
|
+
var register$1 = function (editor) {
|
61
|
+
editor.addButton('nonbreaking', {
|
62
|
+
title: 'Nonbreaking space',
|
63
|
+
cmd: 'mceNonBreaking'
|
64
|
+
});
|
65
|
+
editor.addMenuItem('nonbreaking', {
|
66
|
+
icon: 'nonbreaking',
|
67
|
+
text: 'Nonbreaking space',
|
68
|
+
cmd: 'mceNonBreaking',
|
69
|
+
context: 'insert'
|
70
|
+
});
|
71
|
+
};
|
72
|
+
var $_3pcs8hwjm0ofzmt = { register: register$1 };
|
73
|
+
|
74
|
+
global.add('nonbreaking', function (editor) {
|
75
|
+
$_f4n13bhrjm0ofzmn.register(editor);
|
76
|
+
$_3pcs8hwjm0ofzmt.register(editor);
|
77
|
+
$_93cgphtjm0ofzmq.setup(editor);
|
78
|
+
});
|
79
|
+
function Plugin () {
|
80
|
+
}
|
81
|
+
|
82
|
+
return Plugin;
|
83
|
+
|
84
|
+
}());
|
85
|
+
})();
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(){"use strict";var n=tinymce.util.Tools.resolve("tinymce.PluginManager"),i=function(n,e){var t,i=(t=n).plugins.visualchars&&t.plugins.visualchars.isEnabled()?'<span class="mce-nbsp"> </span>':" ";n.insertContent(function(n,e){for(var t="",i=0;i<e;i++)t+=n;return t}(i,e)),n.dom.setAttrib(n.dom.select("span.mce-nbsp"),"data-mce-bogus","1")},e=function(n){n.addCommand("mceNonBreaking",function(){i(n,1)})},o=tinymce.util.Tools.resolve("tinymce.util.VK"),a=function(n){var e=n.getParam("nonbreaking_force_tab",0);return"boolean"==typeof e?!0===e?3:0:e},t=function(e){var t=a(e);0<t&&e.on("keydown",function(n){if(n.keyCode===o.TAB&&!n.isDefaultPrevented()){if(n.shiftKey)return;n.preventDefault(),n.stopImmediatePropagation(),i(e,t)}})},r=function(n){n.addButton("nonbreaking",{title:"Nonbreaking space",cmd:"mceNonBreaking"}),n.addMenuItem("nonbreaking",{icon:"nonbreaking",text:"Nonbreaking space",cmd:"mceNonBreaking",context:"insert"})};n.add("nonbreaking",function(n){e(n),r(n),t(n)})}();
|
@@ -0,0 +1,118 @@
|
|
1
|
+
(function () {
|
2
|
+
var noneditable = (function () {
|
3
|
+
'use strict';
|
4
|
+
|
5
|
+
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
6
|
+
|
7
|
+
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
8
|
+
|
9
|
+
var getNonEditableClass = function (editor) {
|
10
|
+
return editor.getParam('noneditable_noneditable_class', 'mceNonEditable');
|
11
|
+
};
|
12
|
+
var getEditableClass = function (editor) {
|
13
|
+
return editor.getParam('noneditable_editable_class', 'mceEditable');
|
14
|
+
};
|
15
|
+
var getNonEditableRegExps = function (editor) {
|
16
|
+
var nonEditableRegExps = editor.getParam('noneditable_regexp', []);
|
17
|
+
if (nonEditableRegExps && nonEditableRegExps.constructor === RegExp) {
|
18
|
+
return [nonEditableRegExps];
|
19
|
+
} else {
|
20
|
+
return nonEditableRegExps;
|
21
|
+
}
|
22
|
+
};
|
23
|
+
var $_fh7o3ii1jm0ofzna = {
|
24
|
+
getNonEditableClass: getNonEditableClass,
|
25
|
+
getEditableClass: getEditableClass,
|
26
|
+
getNonEditableRegExps: getNonEditableRegExps
|
27
|
+
};
|
28
|
+
|
29
|
+
var hasClass = function (checkClassName) {
|
30
|
+
return function (node) {
|
31
|
+
return (' ' + node.attr('class') + ' ').indexOf(checkClassName) !== -1;
|
32
|
+
};
|
33
|
+
};
|
34
|
+
var replaceMatchWithSpan = function (editor, content, cls) {
|
35
|
+
return function (match) {
|
36
|
+
var args = arguments, index = args[args.length - 2];
|
37
|
+
var prevChar = index > 0 ? content.charAt(index - 1) : '';
|
38
|
+
if (prevChar === '"') {
|
39
|
+
return match;
|
40
|
+
}
|
41
|
+
if (prevChar === '>') {
|
42
|
+
var findStartTagIndex = content.lastIndexOf('<', index);
|
43
|
+
if (findStartTagIndex !== -1) {
|
44
|
+
var tagHtml = content.substring(findStartTagIndex, index);
|
45
|
+
if (tagHtml.indexOf('contenteditable="false"') !== -1) {
|
46
|
+
return match;
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
50
|
+
return '<span class="' + cls + '" data-mce-content="' + editor.dom.encode(args[0]) + '">' + editor.dom.encode(typeof args[1] === 'string' ? args[1] : args[0]) + '</span>';
|
51
|
+
};
|
52
|
+
};
|
53
|
+
var convertRegExpsToNonEditable = function (editor, nonEditableRegExps, e) {
|
54
|
+
var i = nonEditableRegExps.length, content = e.content;
|
55
|
+
if (e.format === 'raw') {
|
56
|
+
return;
|
57
|
+
}
|
58
|
+
while (i--) {
|
59
|
+
content = content.replace(nonEditableRegExps[i], replaceMatchWithSpan(editor, content, $_fh7o3ii1jm0ofzna.getNonEditableClass(editor)));
|
60
|
+
}
|
61
|
+
e.content = content;
|
62
|
+
};
|
63
|
+
var setup = function (editor) {
|
64
|
+
var editClass, nonEditClass;
|
65
|
+
var contentEditableAttrName = 'contenteditable';
|
66
|
+
editClass = ' ' + global$1.trim($_fh7o3ii1jm0ofzna.getEditableClass(editor)) + ' ';
|
67
|
+
nonEditClass = ' ' + global$1.trim($_fh7o3ii1jm0ofzna.getNonEditableClass(editor)) + ' ';
|
68
|
+
var hasEditClass = hasClass(editClass);
|
69
|
+
var hasNonEditClass = hasClass(nonEditClass);
|
70
|
+
var nonEditableRegExps = $_fh7o3ii1jm0ofzna.getNonEditableRegExps(editor);
|
71
|
+
editor.on('PreInit', function () {
|
72
|
+
if (nonEditableRegExps.length > 0) {
|
73
|
+
editor.on('BeforeSetContent', function (e) {
|
74
|
+
convertRegExpsToNonEditable(editor, nonEditableRegExps, e);
|
75
|
+
});
|
76
|
+
}
|
77
|
+
editor.parser.addAttributeFilter('class', function (nodes) {
|
78
|
+
var i = nodes.length, node;
|
79
|
+
while (i--) {
|
80
|
+
node = nodes[i];
|
81
|
+
if (hasEditClass(node)) {
|
82
|
+
node.attr(contentEditableAttrName, 'true');
|
83
|
+
} else if (hasNonEditClass(node)) {
|
84
|
+
node.attr(contentEditableAttrName, 'false');
|
85
|
+
}
|
86
|
+
}
|
87
|
+
});
|
88
|
+
editor.serializer.addAttributeFilter(contentEditableAttrName, function (nodes) {
|
89
|
+
var i = nodes.length, node;
|
90
|
+
while (i--) {
|
91
|
+
node = nodes[i];
|
92
|
+
if (!hasEditClass(node) && !hasNonEditClass(node)) {
|
93
|
+
continue;
|
94
|
+
}
|
95
|
+
if (nonEditableRegExps.length > 0 && node.attr('data-mce-content')) {
|
96
|
+
node.name = '#text';
|
97
|
+
node.type = 3;
|
98
|
+
node.raw = true;
|
99
|
+
node.value = node.attr('data-mce-content');
|
100
|
+
} else {
|
101
|
+
node.attr(contentEditableAttrName, null);
|
102
|
+
}
|
103
|
+
}
|
104
|
+
});
|
105
|
+
});
|
106
|
+
};
|
107
|
+
var $_6609e8hzjm0ofzn6 = { setup: setup };
|
108
|
+
|
109
|
+
global.add('noneditable', function (editor) {
|
110
|
+
$_6609e8hzjm0ofzn6.setup(editor);
|
111
|
+
});
|
112
|
+
function Plugin () {
|
113
|
+
}
|
114
|
+
|
115
|
+
return Plugin;
|
116
|
+
|
117
|
+
}());
|
118
|
+
})();
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),c=tinymce.util.Tools.resolve("tinymce.util.Tools"),l=function(t){return t.getParam("noneditable_noneditable_class","mceNonEditable")},u=function(t){return t.getParam("noneditable_editable_class","mceEditable")},f=function(t){var n=t.getParam("noneditable_regexp",[]);return n&&n.constructor===RegExp?[n]:n},s=function(n){return function(t){return-1!==(" "+t.attr("class")+" ").indexOf(n)}},d=function(i,o,c){return function(t){var n=arguments,e=n[n.length-2],r=0<e?o.charAt(e-1):"";if('"'===r)return t;if(">"===r){var a=o.lastIndexOf("<",e);if(-1!==a&&-1!==o.substring(a,e).indexOf('contenteditable="false"'))return t}return'<span class="'+c+'" data-mce-content="'+i.dom.encode(n[0])+'">'+i.dom.encode("string"==typeof n[1]?n[1]:n[0])+"</span>"}},n=function(n){var t,e,r="contenteditable";t=" "+c.trim(u(n))+" ",e=" "+c.trim(l(n))+" ";var a=s(t),i=s(e),o=f(n);n.on("PreInit",function(){0<o.length&&n.on("BeforeSetContent",function(t){!function(t,n,e){var r=n.length,a=e.content;if("raw"!==e.format){for(;r--;)a=a.replace(n[r],d(t,a,l(t)));e.content=a}}(n,o,t)}),n.parser.addAttributeFilter("class",function(t){for(var n,e=t.length;e--;)n=t[e],a(n)?n.attr(r,"true"):i(n)&&n.attr(r,"false")}),n.serializer.addAttributeFilter(r,function(t){for(var n,e=t.length;e--;)n=t[e],(a(n)||i(n))&&(0<o.length&&n.attr("data-mce-content")?(n.name="#text",n.type=3,n.raw=!0,n.value=n.attr("data-mce-content")):n.attr(r,null))})})};t.add("noneditable",function(t){n(t)})}();
|
@@ -0,0 +1,109 @@
|
|
1
|
+
(function () {
|
2
|
+
var pagebreak = (function () {
|
3
|
+
'use strict';
|
4
|
+
|
5
|
+
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
6
|
+
|
7
|
+
var global$1 = tinymce.util.Tools.resolve('tinymce.Env');
|
8
|
+
|
9
|
+
var getSeparatorHtml = function (editor) {
|
10
|
+
return editor.getParam('pagebreak_separator', '<!-- pagebreak -->');
|
11
|
+
};
|
12
|
+
var shouldSplitBlock = function (editor) {
|
13
|
+
return editor.getParam('pagebreak_split_block', false);
|
14
|
+
};
|
15
|
+
var $_d4wwd8i7jm0ofznq = {
|
16
|
+
getSeparatorHtml: getSeparatorHtml,
|
17
|
+
shouldSplitBlock: shouldSplitBlock
|
18
|
+
};
|
19
|
+
|
20
|
+
var getPageBreakClass = function () {
|
21
|
+
return 'mce-pagebreak';
|
22
|
+
};
|
23
|
+
var getPlaceholderHtml = function () {
|
24
|
+
return '<img src="' + global$1.transparentSrc + '" class="' + getPageBreakClass() + '" data-mce-resize="false" data-mce-placeholder />';
|
25
|
+
};
|
26
|
+
var setup = function (editor) {
|
27
|
+
var separatorHtml = $_d4wwd8i7jm0ofznq.getSeparatorHtml(editor);
|
28
|
+
var pageBreakSeparatorRegExp = new RegExp(separatorHtml.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g, function (a) {
|
29
|
+
return '\\' + a;
|
30
|
+
}), 'gi');
|
31
|
+
editor.on('BeforeSetContent', function (e) {
|
32
|
+
e.content = e.content.replace(pageBreakSeparatorRegExp, getPlaceholderHtml());
|
33
|
+
});
|
34
|
+
editor.on('PreInit', function () {
|
35
|
+
editor.serializer.addNodeFilter('img', function (nodes) {
|
36
|
+
var i = nodes.length, node, className;
|
37
|
+
while (i--) {
|
38
|
+
node = nodes[i];
|
39
|
+
className = node.attr('class');
|
40
|
+
if (className && className.indexOf('mce-pagebreak') !== -1) {
|
41
|
+
var parentNode = node.parent;
|
42
|
+
if (editor.schema.getBlockElements()[parentNode.name] && $_d4wwd8i7jm0ofznq.shouldSplitBlock(editor)) {
|
43
|
+
parentNode.type = 3;
|
44
|
+
parentNode.value = separatorHtml;
|
45
|
+
parentNode.raw = true;
|
46
|
+
node.remove();
|
47
|
+
continue;
|
48
|
+
}
|
49
|
+
node.type = 3;
|
50
|
+
node.value = separatorHtml;
|
51
|
+
node.raw = true;
|
52
|
+
}
|
53
|
+
}
|
54
|
+
});
|
55
|
+
});
|
56
|
+
};
|
57
|
+
var $_42qbtii5jm0ofznn = {
|
58
|
+
setup: setup,
|
59
|
+
getPlaceholderHtml: getPlaceholderHtml,
|
60
|
+
getPageBreakClass: getPageBreakClass
|
61
|
+
};
|
62
|
+
|
63
|
+
var register = function (editor) {
|
64
|
+
editor.addCommand('mcePageBreak', function () {
|
65
|
+
if (editor.settings.pagebreak_split_block) {
|
66
|
+
editor.insertContent('<p>' + $_42qbtii5jm0ofznn.getPlaceholderHtml() + '</p>');
|
67
|
+
} else {
|
68
|
+
editor.insertContent($_42qbtii5jm0ofznn.getPlaceholderHtml());
|
69
|
+
}
|
70
|
+
});
|
71
|
+
};
|
72
|
+
var $_g4v1pki4jm0ofznl = { register: register };
|
73
|
+
|
74
|
+
var setup$1 = function (editor) {
|
75
|
+
editor.on('ResolveName', function (e) {
|
76
|
+
if (e.target.nodeName === 'IMG' && editor.dom.hasClass(e.target, $_42qbtii5jm0ofznn.getPageBreakClass())) {
|
77
|
+
e.name = 'pagebreak';
|
78
|
+
}
|
79
|
+
});
|
80
|
+
};
|
81
|
+
var $_ntnjti8jm0ofznr = { setup: setup$1 };
|
82
|
+
|
83
|
+
var register$1 = function (editor) {
|
84
|
+
editor.addButton('pagebreak', {
|
85
|
+
title: 'Page break',
|
86
|
+
cmd: 'mcePageBreak'
|
87
|
+
});
|
88
|
+
editor.addMenuItem('pagebreak', {
|
89
|
+
text: 'Page break',
|
90
|
+
icon: 'pagebreak',
|
91
|
+
cmd: 'mcePageBreak',
|
92
|
+
context: 'insert'
|
93
|
+
});
|
94
|
+
};
|
95
|
+
var $_1lnivci9jm0ofzns = { register: register$1 };
|
96
|
+
|
97
|
+
global.add('pagebreak', function (editor) {
|
98
|
+
$_g4v1pki4jm0ofznl.register(editor);
|
99
|
+
$_1lnivci9jm0ofzns.register(editor);
|
100
|
+
$_42qbtii5jm0ofznn.setup(editor);
|
101
|
+
$_ntnjti8jm0ofznr.setup(editor);
|
102
|
+
});
|
103
|
+
function Plugin () {
|
104
|
+
}
|
105
|
+
|
106
|
+
return Plugin;
|
107
|
+
|
108
|
+
}());
|
109
|
+
})();
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),a=tinymce.util.Tools.resolve("tinymce.Env"),n=function(e){return e.getParam("pagebreak_separator","\x3c!-- pagebreak --\x3e")},i=function(e){return e.getParam("pagebreak_split_block",!1)},t=function(){return"mce-pagebreak"},r=function(){return'<img src="'+a.transparentSrc+'" class="mce-pagebreak" data-mce-resize="false" data-mce-placeholder />'},c=function(c){var o=n(c),a=new RegExp(o.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g,function(e){return"\\"+e}),"gi");c.on("BeforeSetContent",function(e){e.content=e.content.replace(a,r())}),c.on("PreInit",function(){c.serializer.addNodeFilter("img",function(e){for(var a,n,t=e.length;t--;)if((n=(a=e[t]).attr("class"))&&-1!==n.indexOf("mce-pagebreak")){var r=a.parent;if(c.schema.getBlockElements()[r.name]&&i(c)){r.type=3,r.value=o,r.raw=!0,a.remove();continue}a.type=3,a.value=o,a.raw=!0}})})},o=r,g=t,u=function(e){e.addCommand("mcePageBreak",function(){e.settings.pagebreak_split_block?e.insertContent("<p>"+o()+"</p>"):e.insertContent(o())})},m=function(a){a.on("ResolveName",function(e){"IMG"===e.target.nodeName&&a.dom.hasClass(e.target,g())&&(e.name="pagebreak")})},s=function(e){e.addButton("pagebreak",{title:"Page break",cmd:"mcePageBreak"}),e.addMenuItem("pagebreak",{text:"Page break",icon:"pagebreak",cmd:"mcePageBreak",context:"insert"})};e.add("pagebreak",function(e){u(e),s(e),c(e),m(e)})}();
|
@@ -0,0 +1,1497 @@
|
|
1
|
+
(function () {
|
2
|
+
var paste = (function () {
|
3
|
+
'use strict';
|
4
|
+
|
5
|
+
var Cell = function (initial) {
|
6
|
+
var value = initial;
|
7
|
+
var get = function () {
|
8
|
+
return value;
|
9
|
+
};
|
10
|
+
var set = function (v) {
|
11
|
+
value = v;
|
12
|
+
};
|
13
|
+
var clone = function () {
|
14
|
+
return Cell(get());
|
15
|
+
};
|
16
|
+
return {
|
17
|
+
get: get,
|
18
|
+
set: set,
|
19
|
+
clone: clone
|
20
|
+
};
|
21
|
+
};
|
22
|
+
|
23
|
+
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
24
|
+
|
25
|
+
var hasProPlugin = function (editor) {
|
26
|
+
if (/(^|[ ,])powerpaste([, ]|$)/.test(editor.settings.plugins) && global.get('powerpaste')) {
|
27
|
+
if (typeof window.console !== 'undefined' && window.console.log) {
|
28
|
+
window.console.log('PowerPaste is incompatible with Paste plugin! Remove \'paste\' from the \'plugins\' option.');
|
29
|
+
}
|
30
|
+
return true;
|
31
|
+
} else {
|
32
|
+
return false;
|
33
|
+
}
|
34
|
+
};
|
35
|
+
var $_1wddxcidjm0ofzo9 = { hasProPlugin: hasProPlugin };
|
36
|
+
|
37
|
+
var get = function (clipboard, quirks) {
|
38
|
+
return {
|
39
|
+
clipboard: clipboard,
|
40
|
+
quirks: quirks
|
41
|
+
};
|
42
|
+
};
|
43
|
+
var $_9cpx3tifjm0ofzos = { get: get };
|
44
|
+
|
45
|
+
var firePastePreProcess = function (editor, html, internal, isWordHtml) {
|
46
|
+
return editor.fire('PastePreProcess', {
|
47
|
+
content: html,
|
48
|
+
internal: internal,
|
49
|
+
wordContent: isWordHtml
|
50
|
+
});
|
51
|
+
};
|
52
|
+
var firePastePostProcess = function (editor, node, internal, isWordHtml) {
|
53
|
+
return editor.fire('PastePostProcess', {
|
54
|
+
node: node,
|
55
|
+
internal: internal,
|
56
|
+
wordContent: isWordHtml
|
57
|
+
});
|
58
|
+
};
|
59
|
+
var firePastePlainTextToggle = function (editor, state) {
|
60
|
+
return editor.fire('PastePlainTextToggle', { state: state });
|
61
|
+
};
|
62
|
+
var firePaste = function (editor, ieFake) {
|
63
|
+
return editor.fire('paste', { ieFake: ieFake });
|
64
|
+
};
|
65
|
+
var $_4gidzbiijm0ofzow = {
|
66
|
+
firePastePreProcess: firePastePreProcess,
|
67
|
+
firePastePostProcess: firePastePostProcess,
|
68
|
+
firePastePlainTextToggle: firePastePlainTextToggle,
|
69
|
+
firePaste: firePaste
|
70
|
+
};
|
71
|
+
|
72
|
+
var shouldPlainTextInform = function (editor) {
|
73
|
+
return editor.getParam('paste_plaintext_inform', true);
|
74
|
+
};
|
75
|
+
var shouldBlockDrop = function (editor) {
|
76
|
+
return editor.getParam('paste_block_drop', false);
|
77
|
+
};
|
78
|
+
var shouldPasteDataImages = function (editor) {
|
79
|
+
return editor.getParam('paste_data_images', false);
|
80
|
+
};
|
81
|
+
var shouldFilterDrop = function (editor) {
|
82
|
+
return editor.getParam('paste_filter_drop', true);
|
83
|
+
};
|
84
|
+
var getPreProcess = function (editor) {
|
85
|
+
return editor.getParam('paste_preprocess');
|
86
|
+
};
|
87
|
+
var getPostProcess = function (editor) {
|
88
|
+
return editor.getParam('paste_postprocess');
|
89
|
+
};
|
90
|
+
var getWebkitStyles = function (editor) {
|
91
|
+
return editor.getParam('paste_webkit_styles');
|
92
|
+
};
|
93
|
+
var shouldRemoveWebKitStyles = function (editor) {
|
94
|
+
return editor.getParam('paste_remove_styles_if_webkit', true);
|
95
|
+
};
|
96
|
+
var shouldMergeFormats = function (editor) {
|
97
|
+
return editor.getParam('paste_merge_formats', true);
|
98
|
+
};
|
99
|
+
var isSmartPasteEnabled = function (editor) {
|
100
|
+
return editor.getParam('smart_paste', true);
|
101
|
+
};
|
102
|
+
var isPasteAsTextEnabled = function (editor) {
|
103
|
+
return editor.getParam('paste_as_text', false);
|
104
|
+
};
|
105
|
+
var getRetainStyleProps = function (editor) {
|
106
|
+
return editor.getParam('paste_retain_style_properties');
|
107
|
+
};
|
108
|
+
var getWordValidElements = function (editor) {
|
109
|
+
var defaultValidElements = '-strong/b,-em/i,-u,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,' + '-p/div,-a[href|name],sub,sup,strike,br,del,table[width],tr,' + 'td[colspan|rowspan|width],th[colspan|rowspan|width],thead,tfoot,tbody';
|
110
|
+
return editor.getParam('paste_word_valid_elements', defaultValidElements);
|
111
|
+
};
|
112
|
+
var shouldConvertWordFakeLists = function (editor) {
|
113
|
+
return editor.getParam('paste_convert_word_fake_lists', true);
|
114
|
+
};
|
115
|
+
var shouldUseDefaultFilters = function (editor) {
|
116
|
+
return editor.getParam('paste_enable_default_filters', true);
|
117
|
+
};
|
118
|
+
var $_dbkrisijjm0ofzoy = {
|
119
|
+
shouldPlainTextInform: shouldPlainTextInform,
|
120
|
+
shouldBlockDrop: shouldBlockDrop,
|
121
|
+
shouldPasteDataImages: shouldPasteDataImages,
|
122
|
+
shouldFilterDrop: shouldFilterDrop,
|
123
|
+
getPreProcess: getPreProcess,
|
124
|
+
getPostProcess: getPostProcess,
|
125
|
+
getWebkitStyles: getWebkitStyles,
|
126
|
+
shouldRemoveWebKitStyles: shouldRemoveWebKitStyles,
|
127
|
+
shouldMergeFormats: shouldMergeFormats,
|
128
|
+
isSmartPasteEnabled: isSmartPasteEnabled,
|
129
|
+
isPasteAsTextEnabled: isPasteAsTextEnabled,
|
130
|
+
getRetainStyleProps: getRetainStyleProps,
|
131
|
+
getWordValidElements: getWordValidElements,
|
132
|
+
shouldConvertWordFakeLists: shouldConvertWordFakeLists,
|
133
|
+
shouldUseDefaultFilters: shouldUseDefaultFilters
|
134
|
+
};
|
135
|
+
|
136
|
+
var shouldInformUserAboutPlainText = function (editor, userIsInformedState) {
|
137
|
+
return userIsInformedState.get() === false && $_dbkrisijjm0ofzoy.shouldPlainTextInform(editor);
|
138
|
+
};
|
139
|
+
var displayNotification = function (editor, message) {
|
140
|
+
editor.notificationManager.open({
|
141
|
+
text: editor.translate(message),
|
142
|
+
type: 'info'
|
143
|
+
});
|
144
|
+
};
|
145
|
+
var togglePlainTextPaste = function (editor, clipboard, userIsInformedState) {
|
146
|
+
if (clipboard.pasteFormat.get() === 'text') {
|
147
|
+
clipboard.pasteFormat.set('html');
|
148
|
+
$_4gidzbiijm0ofzow.firePastePlainTextToggle(editor, false);
|
149
|
+
} else {
|
150
|
+
clipboard.pasteFormat.set('text');
|
151
|
+
$_4gidzbiijm0ofzow.firePastePlainTextToggle(editor, true);
|
152
|
+
if (shouldInformUserAboutPlainText(editor, userIsInformedState)) {
|
153
|
+
displayNotification(editor, 'Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.');
|
154
|
+
userIsInformedState.set(true);
|
155
|
+
}
|
156
|
+
}
|
157
|
+
editor.focus();
|
158
|
+
};
|
159
|
+
var $_7tierfihjm0ofzov = { togglePlainTextPaste: togglePlainTextPaste };
|
160
|
+
|
161
|
+
var register = function (editor, clipboard, userIsInformedState) {
|
162
|
+
editor.addCommand('mceTogglePlainTextPaste', function () {
|
163
|
+
$_7tierfihjm0ofzov.togglePlainTextPaste(editor, clipboard, userIsInformedState);
|
164
|
+
});
|
165
|
+
editor.addCommand('mceInsertClipboardContent', function (ui, value) {
|
166
|
+
if (value.content) {
|
167
|
+
clipboard.pasteHtml(value.content, value.internal);
|
168
|
+
}
|
169
|
+
if (value.text) {
|
170
|
+
clipboard.pasteText(value.text);
|
171
|
+
}
|
172
|
+
});
|
173
|
+
};
|
174
|
+
var $_4ny6o6igjm0ofzot = { register: register };
|
175
|
+
|
176
|
+
var global$1 = tinymce.util.Tools.resolve('tinymce.Env');
|
177
|
+
|
178
|
+
var global$2 = tinymce.util.Tools.resolve('tinymce.util.Delay');
|
179
|
+
|
180
|
+
var global$3 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
181
|
+
|
182
|
+
var global$4 = tinymce.util.Tools.resolve('tinymce.util.VK');
|
183
|
+
|
184
|
+
var internalMimeType = 'x-tinymce/html';
|
185
|
+
var internalMark = '<!-- ' + internalMimeType + ' -->';
|
186
|
+
var mark = function (html) {
|
187
|
+
return internalMark + html;
|
188
|
+
};
|
189
|
+
var unmark = function (html) {
|
190
|
+
return html.replace(internalMark, '');
|
191
|
+
};
|
192
|
+
var isMarked = function (html) {
|
193
|
+
return html.indexOf(internalMark) !== -1;
|
194
|
+
};
|
195
|
+
var $_21ba1xiqjm0ofzpc = {
|
196
|
+
mark: mark,
|
197
|
+
unmark: unmark,
|
198
|
+
isMarked: isMarked,
|
199
|
+
internalHtmlMime: function () {
|
200
|
+
return internalMimeType;
|
201
|
+
}
|
202
|
+
};
|
203
|
+
|
204
|
+
var global$5 = tinymce.util.Tools.resolve('tinymce.html.Entities');
|
205
|
+
|
206
|
+
var isPlainText = function (text) {
|
207
|
+
return !/<(?:\/?(?!(?:div|p|br|span)>)\w+|(?:(?!(?:span style="white-space:\s?pre;?">)|br\s?\/>))\w+\s[^>]+)>/i.test(text);
|
208
|
+
};
|
209
|
+
var toBRs = function (text) {
|
210
|
+
return text.replace(/\r?\n/g, '<br>');
|
211
|
+
};
|
212
|
+
var openContainer = function (rootTag, rootAttrs) {
|
213
|
+
var key;
|
214
|
+
var attrs = [];
|
215
|
+
var tag = '<' + rootTag;
|
216
|
+
if (typeof rootAttrs === 'object') {
|
217
|
+
for (key in rootAttrs) {
|
218
|
+
if (rootAttrs.hasOwnProperty(key)) {
|
219
|
+
attrs.push(key + '="' + global$5.encodeAllRaw(rootAttrs[key]) + '"');
|
220
|
+
}
|
221
|
+
}
|
222
|
+
if (attrs.length) {
|
223
|
+
tag += ' ' + attrs.join(' ');
|
224
|
+
}
|
225
|
+
}
|
226
|
+
return tag + '>';
|
227
|
+
};
|
228
|
+
var toBlockElements = function (text, rootTag, rootAttrs) {
|
229
|
+
var blocks = text.split(/\n\n/);
|
230
|
+
var tagOpen = openContainer(rootTag, rootAttrs);
|
231
|
+
var tagClose = '</' + rootTag + '>';
|
232
|
+
var paragraphs = global$3.map(blocks, function (p) {
|
233
|
+
return p.split(/\n/).join('<br />');
|
234
|
+
});
|
235
|
+
var stitch = function (p) {
|
236
|
+
return tagOpen + p + tagClose;
|
237
|
+
};
|
238
|
+
return paragraphs.length === 1 ? paragraphs[0] : global$3.map(paragraphs, stitch).join('');
|
239
|
+
};
|
240
|
+
var convert = function (text, rootTag, rootAttrs) {
|
241
|
+
return rootTag ? toBlockElements(text, rootTag, rootAttrs) : toBRs(text);
|
242
|
+
};
|
243
|
+
var $_67xxvyirjm0ofzpe = {
|
244
|
+
isPlainText: isPlainText,
|
245
|
+
convert: convert,
|
246
|
+
toBRs: toBRs,
|
247
|
+
toBlockElements: toBlockElements
|
248
|
+
};
|
249
|
+
|
250
|
+
var global$6 = tinymce.util.Tools.resolve('tinymce.html.DomParser');
|
251
|
+
|
252
|
+
var global$7 = tinymce.util.Tools.resolve('tinymce.html.Node');
|
253
|
+
|
254
|
+
var global$8 = tinymce.util.Tools.resolve('tinymce.html.Schema');
|
255
|
+
|
256
|
+
var global$9 = tinymce.util.Tools.resolve('tinymce.html.Serializer');
|
257
|
+
|
258
|
+
function filter(content, items) {
|
259
|
+
global$3.each(items, function (v) {
|
260
|
+
if (v.constructor === RegExp) {
|
261
|
+
content = content.replace(v, '');
|
262
|
+
} else {
|
263
|
+
content = content.replace(v[0], v[1]);
|
264
|
+
}
|
265
|
+
});
|
266
|
+
return content;
|
267
|
+
}
|
268
|
+
function innerText(html) {
|
269
|
+
var schema = global$8();
|
270
|
+
var domParser = global$6({}, schema);
|
271
|
+
var text = '';
|
272
|
+
var shortEndedElements = schema.getShortEndedElements();
|
273
|
+
var ignoreElements = global$3.makeMap('script noscript style textarea video audio iframe object', ' ');
|
274
|
+
var blockElements = schema.getBlockElements();
|
275
|
+
function walk(node) {
|
276
|
+
var name$$1 = node.name, currentNode = node;
|
277
|
+
if (name$$1 === 'br') {
|
278
|
+
text += '\n';
|
279
|
+
return;
|
280
|
+
}
|
281
|
+
if (shortEndedElements[name$$1]) {
|
282
|
+
text += ' ';
|
283
|
+
}
|
284
|
+
if (ignoreElements[name$$1]) {
|
285
|
+
text += ' ';
|
286
|
+
return;
|
287
|
+
}
|
288
|
+
if (node.type === 3) {
|
289
|
+
text += node.value;
|
290
|
+
}
|
291
|
+
if (!node.shortEnded) {
|
292
|
+
if (node = node.firstChild) {
|
293
|
+
do {
|
294
|
+
walk(node);
|
295
|
+
} while (node = node.next);
|
296
|
+
}
|
297
|
+
}
|
298
|
+
if (blockElements[name$$1] && currentNode.next) {
|
299
|
+
text += '\n';
|
300
|
+
if (name$$1 === 'p') {
|
301
|
+
text += '\n';
|
302
|
+
}
|
303
|
+
}
|
304
|
+
}
|
305
|
+
html = filter(html, [/<!\[[^\]]+\]>/g]);
|
306
|
+
walk(domParser.parse(html));
|
307
|
+
return text;
|
308
|
+
}
|
309
|
+
function trimHtml(html) {
|
310
|
+
function trimSpaces(all, s1, s2) {
|
311
|
+
if (!s1 && !s2) {
|
312
|
+
return ' ';
|
313
|
+
}
|
314
|
+
return '\xA0';
|
315
|
+
}
|
316
|
+
html = filter(html, [
|
317
|
+
/^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/ig,
|
318
|
+
/<!--StartFragment-->|<!--EndFragment-->/g,
|
319
|
+
[
|
320
|
+
/( ?)<span class="Apple-converted-space">\u00a0<\/span>( ?)/g,
|
321
|
+
trimSpaces
|
322
|
+
],
|
323
|
+
/<br class="Apple-interchange-newline">/g,
|
324
|
+
/<br>$/i
|
325
|
+
]);
|
326
|
+
return html;
|
327
|
+
}
|
328
|
+
function createIdGenerator(prefix) {
|
329
|
+
var count = 0;
|
330
|
+
return function () {
|
331
|
+
return prefix + count++;
|
332
|
+
};
|
333
|
+
}
|
334
|
+
var isMsEdge = function () {
|
335
|
+
return navigator.userAgent.indexOf(' Edge/') !== -1;
|
336
|
+
};
|
337
|
+
var $_1340csizjm0ofzpu = {
|
338
|
+
filter: filter,
|
339
|
+
innerText: innerText,
|
340
|
+
trimHtml: trimHtml,
|
341
|
+
createIdGenerator: createIdGenerator,
|
342
|
+
isMsEdge: isMsEdge
|
343
|
+
};
|
344
|
+
|
345
|
+
function isWordContent(content) {
|
346
|
+
return /<font face="Times New Roman"|class="?Mso|style="[^"]*\bmso-|style='[^'']*\bmso-|w:WordDocument/i.test(content) || /class="OutlineElement/.test(content) || /id="?docs\-internal\-guid\-/.test(content);
|
347
|
+
}
|
348
|
+
function isNumericList(text) {
|
349
|
+
var found, patterns;
|
350
|
+
patterns = [
|
351
|
+
/^[IVXLMCD]{1,2}\.[ \u00a0]/,
|
352
|
+
/^[ivxlmcd]{1,2}\.[ \u00a0]/,
|
353
|
+
/^[a-z]{1,2}[\.\)][ \u00a0]/,
|
354
|
+
/^[A-Z]{1,2}[\.\)][ \u00a0]/,
|
355
|
+
/^[0-9]+\.[ \u00a0]/,
|
356
|
+
/^[\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]+\.[ \u00a0]/,
|
357
|
+
/^[\u58f1\u5f10\u53c2\u56db\u4f0d\u516d\u4e03\u516b\u4e5d\u62fe]+\.[ \u00a0]/
|
358
|
+
];
|
359
|
+
text = text.replace(/^[\u00a0 ]+/, '');
|
360
|
+
global$3.each(patterns, function (pattern) {
|
361
|
+
if (pattern.test(text)) {
|
362
|
+
found = true;
|
363
|
+
return false;
|
364
|
+
}
|
365
|
+
});
|
366
|
+
return found;
|
367
|
+
}
|
368
|
+
function isBulletList(text) {
|
369
|
+
return /^[\s\u00a0]*[\u2022\u00b7\u00a7\u25CF]\s*/.test(text);
|
370
|
+
}
|
371
|
+
function convertFakeListsToProperLists(node) {
|
372
|
+
var currentListNode, prevListNode, lastLevel = 1;
|
373
|
+
function getText(node) {
|
374
|
+
var txt = '';
|
375
|
+
if (node.type === 3) {
|
376
|
+
return node.value;
|
377
|
+
}
|
378
|
+
if (node = node.firstChild) {
|
379
|
+
do {
|
380
|
+
txt += getText(node);
|
381
|
+
} while (node = node.next);
|
382
|
+
}
|
383
|
+
return txt;
|
384
|
+
}
|
385
|
+
function trimListStart(node, regExp) {
|
386
|
+
if (node.type === 3) {
|
387
|
+
if (regExp.test(node.value)) {
|
388
|
+
node.value = node.value.replace(regExp, '');
|
389
|
+
return false;
|
390
|
+
}
|
391
|
+
}
|
392
|
+
if (node = node.firstChild) {
|
393
|
+
do {
|
394
|
+
if (!trimListStart(node, regExp)) {
|
395
|
+
return false;
|
396
|
+
}
|
397
|
+
} while (node = node.next);
|
398
|
+
}
|
399
|
+
return true;
|
400
|
+
}
|
401
|
+
function removeIgnoredNodes(node) {
|
402
|
+
if (node._listIgnore) {
|
403
|
+
node.remove();
|
404
|
+
return;
|
405
|
+
}
|
406
|
+
if (node = node.firstChild) {
|
407
|
+
do {
|
408
|
+
removeIgnoredNodes(node);
|
409
|
+
} while (node = node.next);
|
410
|
+
}
|
411
|
+
}
|
412
|
+
function convertParagraphToLi(paragraphNode, listName, start) {
|
413
|
+
var level = paragraphNode._listLevel || lastLevel;
|
414
|
+
if (level !== lastLevel) {
|
415
|
+
if (level < lastLevel) {
|
416
|
+
if (currentListNode) {
|
417
|
+
currentListNode = currentListNode.parent.parent;
|
418
|
+
}
|
419
|
+
} else {
|
420
|
+
prevListNode = currentListNode;
|
421
|
+
currentListNode = null;
|
422
|
+
}
|
423
|
+
}
|
424
|
+
if (!currentListNode || currentListNode.name !== listName) {
|
425
|
+
prevListNode = prevListNode || currentListNode;
|
426
|
+
currentListNode = new global$7(listName, 1);
|
427
|
+
if (start > 1) {
|
428
|
+
currentListNode.attr('start', '' + start);
|
429
|
+
}
|
430
|
+
paragraphNode.wrap(currentListNode);
|
431
|
+
} else {
|
432
|
+
currentListNode.append(paragraphNode);
|
433
|
+
}
|
434
|
+
paragraphNode.name = 'li';
|
435
|
+
if (level > lastLevel && prevListNode) {
|
436
|
+
prevListNode.lastChild.append(currentListNode);
|
437
|
+
}
|
438
|
+
lastLevel = level;
|
439
|
+
removeIgnoredNodes(paragraphNode);
|
440
|
+
trimListStart(paragraphNode, /^\u00a0+/);
|
441
|
+
trimListStart(paragraphNode, /^\s*([\u2022\u00b7\u00a7\u25CF]|\w+\.)/);
|
442
|
+
trimListStart(paragraphNode, /^\u00a0+/);
|
443
|
+
}
|
444
|
+
var elements = [];
|
445
|
+
var child = node.firstChild;
|
446
|
+
while (typeof child !== 'undefined' && child !== null) {
|
447
|
+
elements.push(child);
|
448
|
+
child = child.walk();
|
449
|
+
if (child !== null) {
|
450
|
+
while (typeof child !== 'undefined' && child.parent !== node) {
|
451
|
+
child = child.walk();
|
452
|
+
}
|
453
|
+
}
|
454
|
+
}
|
455
|
+
for (var i = 0; i < elements.length; i++) {
|
456
|
+
node = elements[i];
|
457
|
+
if (node.name === 'p' && node.firstChild) {
|
458
|
+
var nodeText = getText(node);
|
459
|
+
if (isBulletList(nodeText)) {
|
460
|
+
convertParagraphToLi(node, 'ul');
|
461
|
+
continue;
|
462
|
+
}
|
463
|
+
if (isNumericList(nodeText)) {
|
464
|
+
var matches = /([0-9]+)\./.exec(nodeText);
|
465
|
+
var start = 1;
|
466
|
+
if (matches) {
|
467
|
+
start = parseInt(matches[1], 10);
|
468
|
+
}
|
469
|
+
convertParagraphToLi(node, 'ol', start);
|
470
|
+
continue;
|
471
|
+
}
|
472
|
+
if (node._listLevel) {
|
473
|
+
convertParagraphToLi(node, 'ul', 1);
|
474
|
+
continue;
|
475
|
+
}
|
476
|
+
currentListNode = null;
|
477
|
+
} else {
|
478
|
+
prevListNode = currentListNode;
|
479
|
+
currentListNode = null;
|
480
|
+
}
|
481
|
+
}
|
482
|
+
}
|
483
|
+
function filterStyles(editor, validStyles, node, styleValue) {
|
484
|
+
var outputStyles = {}, matches;
|
485
|
+
var styles = editor.dom.parseStyle(styleValue);
|
486
|
+
global$3.each(styles, function (value, name) {
|
487
|
+
switch (name) {
|
488
|
+
case 'mso-list':
|
489
|
+
matches = /\w+ \w+([0-9]+)/i.exec(styleValue);
|
490
|
+
if (matches) {
|
491
|
+
node._listLevel = parseInt(matches[1], 10);
|
492
|
+
}
|
493
|
+
if (/Ignore/i.test(value) && node.firstChild) {
|
494
|
+
node._listIgnore = true;
|
495
|
+
node.firstChild._listIgnore = true;
|
496
|
+
}
|
497
|
+
break;
|
498
|
+
case 'horiz-align':
|
499
|
+
name = 'text-align';
|
500
|
+
break;
|
501
|
+
case 'vert-align':
|
502
|
+
name = 'vertical-align';
|
503
|
+
break;
|
504
|
+
case 'font-color':
|
505
|
+
case 'mso-foreground':
|
506
|
+
name = 'color';
|
507
|
+
break;
|
508
|
+
case 'mso-background':
|
509
|
+
case 'mso-highlight':
|
510
|
+
name = 'background';
|
511
|
+
break;
|
512
|
+
case 'font-weight':
|
513
|
+
case 'font-style':
|
514
|
+
if (value !== 'normal') {
|
515
|
+
outputStyles[name] = value;
|
516
|
+
}
|
517
|
+
return;
|
518
|
+
case 'mso-element':
|
519
|
+
if (/^(comment|comment-list)$/i.test(value)) {
|
520
|
+
node.remove();
|
521
|
+
return;
|
522
|
+
}
|
523
|
+
break;
|
524
|
+
}
|
525
|
+
if (name.indexOf('mso-comment') === 0) {
|
526
|
+
node.remove();
|
527
|
+
return;
|
528
|
+
}
|
529
|
+
if (name.indexOf('mso-') === 0) {
|
530
|
+
return;
|
531
|
+
}
|
532
|
+
if ($_dbkrisijjm0ofzoy.getRetainStyleProps(editor) === 'all' || validStyles && validStyles[name]) {
|
533
|
+
outputStyles[name] = value;
|
534
|
+
}
|
535
|
+
});
|
536
|
+
if (/(bold)/i.test(outputStyles['font-weight'])) {
|
537
|
+
delete outputStyles['font-weight'];
|
538
|
+
node.wrap(new global$7('b', 1));
|
539
|
+
}
|
540
|
+
if (/(italic)/i.test(outputStyles['font-style'])) {
|
541
|
+
delete outputStyles['font-style'];
|
542
|
+
node.wrap(new global$7('i', 1));
|
543
|
+
}
|
544
|
+
outputStyles = editor.dom.serializeStyle(outputStyles, node.name);
|
545
|
+
if (outputStyles) {
|
546
|
+
return outputStyles;
|
547
|
+
}
|
548
|
+
return null;
|
549
|
+
}
|
550
|
+
var filterWordContent = function (editor, content) {
|
551
|
+
var retainStyleProperties, validStyles;
|
552
|
+
retainStyleProperties = $_dbkrisijjm0ofzoy.getRetainStyleProps(editor);
|
553
|
+
if (retainStyleProperties) {
|
554
|
+
validStyles = global$3.makeMap(retainStyleProperties.split(/[, ]/));
|
555
|
+
}
|
556
|
+
content = $_1340csizjm0ofzpu.filter(content, [
|
557
|
+
/<br class="?Apple-interchange-newline"?>/gi,
|
558
|
+
/<b[^>]+id="?docs-internal-[^>]*>/gi,
|
559
|
+
/<!--[\s\S]+?-->/gi,
|
560
|
+
/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,
|
561
|
+
[
|
562
|
+
/<(\/?)s>/gi,
|
563
|
+
'<$1strike>'
|
564
|
+
],
|
565
|
+
[
|
566
|
+
/ /gi,
|
567
|
+
'\xA0'
|
568
|
+
],
|
569
|
+
[
|
570
|
+
/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,
|
571
|
+
function (str, spaces) {
|
572
|
+
return spaces.length > 0 ? spaces.replace(/./, ' ').slice(Math.floor(spaces.length / 2)).split('').join('\xA0') : '';
|
573
|
+
}
|
574
|
+
]
|
575
|
+
]);
|
576
|
+
var validElements = $_dbkrisijjm0ofzoy.getWordValidElements(editor);
|
577
|
+
var schema = global$8({
|
578
|
+
valid_elements: validElements,
|
579
|
+
valid_children: '-li[p]'
|
580
|
+
});
|
581
|
+
global$3.each(schema.elements, function (rule) {
|
582
|
+
if (!rule.attributes.class) {
|
583
|
+
rule.attributes.class = {};
|
584
|
+
rule.attributesOrder.push('class');
|
585
|
+
}
|
586
|
+
if (!rule.attributes.style) {
|
587
|
+
rule.attributes.style = {};
|
588
|
+
rule.attributesOrder.push('style');
|
589
|
+
}
|
590
|
+
});
|
591
|
+
var domParser = global$6({}, schema);
|
592
|
+
domParser.addAttributeFilter('style', function (nodes) {
|
593
|
+
var i = nodes.length, node;
|
594
|
+
while (i--) {
|
595
|
+
node = nodes[i];
|
596
|
+
node.attr('style', filterStyles(editor, validStyles, node, node.attr('style')));
|
597
|
+
if (node.name === 'span' && node.parent && !node.attributes.length) {
|
598
|
+
node.unwrap();
|
599
|
+
}
|
600
|
+
}
|
601
|
+
});
|
602
|
+
domParser.addAttributeFilter('class', function (nodes) {
|
603
|
+
var i = nodes.length, node, className;
|
604
|
+
while (i--) {
|
605
|
+
node = nodes[i];
|
606
|
+
className = node.attr('class');
|
607
|
+
if (/^(MsoCommentReference|MsoCommentText|msoDel)$/i.test(className)) {
|
608
|
+
node.remove();
|
609
|
+
}
|
610
|
+
node.attr('class', null);
|
611
|
+
}
|
612
|
+
});
|
613
|
+
domParser.addNodeFilter('del', function (nodes) {
|
614
|
+
var i = nodes.length;
|
615
|
+
while (i--) {
|
616
|
+
nodes[i].remove();
|
617
|
+
}
|
618
|
+
});
|
619
|
+
domParser.addNodeFilter('a', function (nodes) {
|
620
|
+
var i = nodes.length, node, href, name;
|
621
|
+
while (i--) {
|
622
|
+
node = nodes[i];
|
623
|
+
href = node.attr('href');
|
624
|
+
name = node.attr('name');
|
625
|
+
if (href && href.indexOf('#_msocom_') !== -1) {
|
626
|
+
node.remove();
|
627
|
+
continue;
|
628
|
+
}
|
629
|
+
if (href && href.indexOf('file://') === 0) {
|
630
|
+
href = href.split('#')[1];
|
631
|
+
if (href) {
|
632
|
+
href = '#' + href;
|
633
|
+
}
|
634
|
+
}
|
635
|
+
if (!href && !name) {
|
636
|
+
node.unwrap();
|
637
|
+
} else {
|
638
|
+
if (name && !/^_?(?:toc|edn|ftn)/i.test(name)) {
|
639
|
+
node.unwrap();
|
640
|
+
continue;
|
641
|
+
}
|
642
|
+
node.attr({
|
643
|
+
href: href,
|
644
|
+
name: name
|
645
|
+
});
|
646
|
+
}
|
647
|
+
}
|
648
|
+
});
|
649
|
+
var rootNode = domParser.parse(content);
|
650
|
+
if ($_dbkrisijjm0ofzoy.shouldConvertWordFakeLists(editor)) {
|
651
|
+
convertFakeListsToProperLists(rootNode);
|
652
|
+
}
|
653
|
+
content = global$9({ validate: editor.settings.validate }, schema).serialize(rootNode);
|
654
|
+
return content;
|
655
|
+
};
|
656
|
+
var preProcess = function (editor, content) {
|
657
|
+
return $_dbkrisijjm0ofzoy.shouldUseDefaultFilters(editor) ? filterWordContent(editor, content) : content;
|
658
|
+
};
|
659
|
+
var $_52rjxviujm0ofzpl = {
|
660
|
+
preProcess: preProcess,
|
661
|
+
isWordContent: isWordContent
|
662
|
+
};
|
663
|
+
|
664
|
+
var processResult = function (content, cancelled) {
|
665
|
+
return {
|
666
|
+
content: content,
|
667
|
+
cancelled: cancelled
|
668
|
+
};
|
669
|
+
};
|
670
|
+
var postProcessFilter = function (editor, html, internal, isWordHtml) {
|
671
|
+
var tempBody = editor.dom.create('div', { style: 'display:none' }, html);
|
672
|
+
var postProcessArgs = $_4gidzbiijm0ofzow.firePastePostProcess(editor, tempBody, internal, isWordHtml);
|
673
|
+
return processResult(postProcessArgs.node.innerHTML, postProcessArgs.isDefaultPrevented());
|
674
|
+
};
|
675
|
+
var filterContent = function (editor, content, internal, isWordHtml) {
|
676
|
+
var preProcessArgs = $_4gidzbiijm0ofzow.firePastePreProcess(editor, content, internal, isWordHtml);
|
677
|
+
if (editor.hasEventListeners('PastePostProcess') && !preProcessArgs.isDefaultPrevented()) {
|
678
|
+
return postProcessFilter(editor, preProcessArgs.content, internal, isWordHtml);
|
679
|
+
} else {
|
680
|
+
return processResult(preProcessArgs.content, preProcessArgs.isDefaultPrevented());
|
681
|
+
}
|
682
|
+
};
|
683
|
+
var process = function (editor, html, internal) {
|
684
|
+
var isWordHtml = $_52rjxviujm0ofzpl.isWordContent(html);
|
685
|
+
var content = isWordHtml ? $_52rjxviujm0ofzpl.preProcess(editor, html) : html;
|
686
|
+
return filterContent(editor, content, internal, isWordHtml);
|
687
|
+
};
|
688
|
+
var $_432mgditjm0ofzph = { process: process };
|
689
|
+
|
690
|
+
var pasteHtml = function (editor, html) {
|
691
|
+
editor.insertContent(html, {
|
692
|
+
merge: $_dbkrisijjm0ofzoy.shouldMergeFormats(editor),
|
693
|
+
paste: true
|
694
|
+
});
|
695
|
+
return true;
|
696
|
+
};
|
697
|
+
var isAbsoluteUrl = function (url) {
|
698
|
+
return /^https?:\/\/[\w\?\-\/+=.&%@~#]+$/i.test(url);
|
699
|
+
};
|
700
|
+
var isImageUrl = function (url) {
|
701
|
+
return isAbsoluteUrl(url) && /.(gif|jpe?g|png)$/.test(url);
|
702
|
+
};
|
703
|
+
var createImage = function (editor, url, pasteHtmlFn) {
|
704
|
+
editor.undoManager.extra(function () {
|
705
|
+
pasteHtmlFn(editor, url);
|
706
|
+
}, function () {
|
707
|
+
editor.insertContent('<img src="' + url + '">');
|
708
|
+
});
|
709
|
+
return true;
|
710
|
+
};
|
711
|
+
var createLink = function (editor, url, pasteHtmlFn) {
|
712
|
+
editor.undoManager.extra(function () {
|
713
|
+
pasteHtmlFn(editor, url);
|
714
|
+
}, function () {
|
715
|
+
editor.execCommand('mceInsertLink', false, url);
|
716
|
+
});
|
717
|
+
return true;
|
718
|
+
};
|
719
|
+
var linkSelection = function (editor, html, pasteHtmlFn) {
|
720
|
+
return editor.selection.isCollapsed() === false && isAbsoluteUrl(html) ? createLink(editor, html, pasteHtmlFn) : false;
|
721
|
+
};
|
722
|
+
var insertImage = function (editor, html, pasteHtmlFn) {
|
723
|
+
return isImageUrl(html) ? createImage(editor, html, pasteHtmlFn) : false;
|
724
|
+
};
|
725
|
+
var smartInsertContent = function (editor, html) {
|
726
|
+
global$3.each([
|
727
|
+
linkSelection,
|
728
|
+
insertImage,
|
729
|
+
pasteHtml
|
730
|
+
], function (action) {
|
731
|
+
return action(editor, html, pasteHtml) !== true;
|
732
|
+
});
|
733
|
+
};
|
734
|
+
var insertContent = function (editor, html) {
|
735
|
+
if ($_dbkrisijjm0ofzoy.isSmartPasteEnabled(editor) === false) {
|
736
|
+
pasteHtml(editor, html);
|
737
|
+
} else {
|
738
|
+
smartInsertContent(editor, html);
|
739
|
+
}
|
740
|
+
};
|
741
|
+
var $_cazeczj0jm0ofzpz = {
|
742
|
+
isImageUrl: isImageUrl,
|
743
|
+
isAbsoluteUrl: isAbsoluteUrl,
|
744
|
+
insertContent: insertContent
|
745
|
+
};
|
746
|
+
|
747
|
+
var pasteHtml$1 = function (editor, html, internalFlag) {
|
748
|
+
var internal = internalFlag ? internalFlag : $_21ba1xiqjm0ofzpc.isMarked(html);
|
749
|
+
var args = $_432mgditjm0ofzph.process(editor, $_21ba1xiqjm0ofzpc.unmark(html), internal);
|
750
|
+
if (args.cancelled === false) {
|
751
|
+
$_cazeczj0jm0ofzpz.insertContent(editor, args.content);
|
752
|
+
}
|
753
|
+
};
|
754
|
+
var pasteText = function (editor, text) {
|
755
|
+
text = editor.dom.encode(text).replace(/\r\n/g, '\n');
|
756
|
+
text = $_67xxvyirjm0ofzpe.convert(text, editor.settings.forced_root_block, editor.settings.forced_root_block_attrs);
|
757
|
+
pasteHtml$1(editor, text, false);
|
758
|
+
};
|
759
|
+
var getDataTransferItems = function (dataTransfer) {
|
760
|
+
var items = {};
|
761
|
+
var mceInternalUrlPrefix = 'data:text/mce-internal,';
|
762
|
+
if (dataTransfer) {
|
763
|
+
if (dataTransfer.getData) {
|
764
|
+
var legacyText = dataTransfer.getData('Text');
|
765
|
+
if (legacyText && legacyText.length > 0) {
|
766
|
+
if (legacyText.indexOf(mceInternalUrlPrefix) === -1) {
|
767
|
+
items['text/plain'] = legacyText;
|
768
|
+
}
|
769
|
+
}
|
770
|
+
}
|
771
|
+
if (dataTransfer.types) {
|
772
|
+
for (var i = 0; i < dataTransfer.types.length; i++) {
|
773
|
+
var contentType = dataTransfer.types[i];
|
774
|
+
try {
|
775
|
+
items[contentType] = dataTransfer.getData(contentType);
|
776
|
+
} catch (ex) {
|
777
|
+
items[contentType] = '';
|
778
|
+
}
|
779
|
+
}
|
780
|
+
}
|
781
|
+
}
|
782
|
+
return items;
|
783
|
+
};
|
784
|
+
var getClipboardContent = function (editor, clipboardEvent) {
|
785
|
+
var content = getDataTransferItems(clipboardEvent.clipboardData || editor.getDoc().dataTransfer);
|
786
|
+
return $_1340csizjm0ofzpu.isMsEdge() ? global$3.extend(content, { 'text/html': '' }) : content;
|
787
|
+
};
|
788
|
+
var hasContentType = function (clipboardContent, mimeType) {
|
789
|
+
return mimeType in clipboardContent && clipboardContent[mimeType].length > 0;
|
790
|
+
};
|
791
|
+
var hasHtmlOrText = function (content) {
|
792
|
+
return hasContentType(content, 'text/html') || hasContentType(content, 'text/plain');
|
793
|
+
};
|
794
|
+
var getBase64FromUri = function (uri) {
|
795
|
+
var idx;
|
796
|
+
idx = uri.indexOf(',');
|
797
|
+
if (idx !== -1) {
|
798
|
+
return uri.substr(idx + 1);
|
799
|
+
}
|
800
|
+
return null;
|
801
|
+
};
|
802
|
+
var isValidDataUriImage = function (settings, imgElm) {
|
803
|
+
return settings.images_dataimg_filter ? settings.images_dataimg_filter(imgElm) : true;
|
804
|
+
};
|
805
|
+
var extractFilename = function (editor, str) {
|
806
|
+
var m = str.match(/([\s\S]+?)\.(?:jpeg|jpg|png|gif)$/i);
|
807
|
+
return m ? editor.dom.encode(m[1]) : null;
|
808
|
+
};
|
809
|
+
var uniqueId = $_1340csizjm0ofzpu.createIdGenerator('mceclip');
|
810
|
+
var pasteImage = function (editor, rng, reader, blob) {
|
811
|
+
if (rng) {
|
812
|
+
editor.selection.setRng(rng);
|
813
|
+
rng = null;
|
814
|
+
}
|
815
|
+
var dataUri = reader.result;
|
816
|
+
var base64 = getBase64FromUri(dataUri);
|
817
|
+
var id = uniqueId();
|
818
|
+
var name$$1 = editor.settings.images_reuse_filename && blob.name ? extractFilename(editor, blob.name) : id;
|
819
|
+
var img = new Image();
|
820
|
+
img.src = dataUri;
|
821
|
+
if (isValidDataUriImage(editor.settings, img)) {
|
822
|
+
var blobCache = editor.editorUpload.blobCache;
|
823
|
+
var blobInfo = void 0, existingBlobInfo = void 0;
|
824
|
+
existingBlobInfo = blobCache.findFirst(function (cachedBlobInfo) {
|
825
|
+
return cachedBlobInfo.base64() === base64;
|
826
|
+
});
|
827
|
+
if (!existingBlobInfo) {
|
828
|
+
blobInfo = blobCache.create(id, blob, base64, name$$1);
|
829
|
+
blobCache.add(blobInfo);
|
830
|
+
} else {
|
831
|
+
blobInfo = existingBlobInfo;
|
832
|
+
}
|
833
|
+
pasteHtml$1(editor, '<img src="' + blobInfo.blobUri() + '">', false);
|
834
|
+
} else {
|
835
|
+
pasteHtml$1(editor, '<img src="' + dataUri + '">', false);
|
836
|
+
}
|
837
|
+
};
|
838
|
+
var isClipboardEvent = function (event$$1) {
|
839
|
+
return event$$1.type === 'paste';
|
840
|
+
};
|
841
|
+
var pasteImageData = function (editor, e, rng) {
|
842
|
+
var dataTransfer = isClipboardEvent(e) ? e.clipboardData : e.dataTransfer;
|
843
|
+
function processItems(items) {
|
844
|
+
var i, item, reader, hadImage = false;
|
845
|
+
if (items) {
|
846
|
+
for (i = 0; i < items.length; i++) {
|
847
|
+
item = items[i];
|
848
|
+
if (/^image\/(jpeg|png|gif|bmp)$/.test(item.type)) {
|
849
|
+
var blob = item.getAsFile ? item.getAsFile() : item;
|
850
|
+
reader = new window.FileReader();
|
851
|
+
reader.onload = pasteImage.bind(null, editor, rng, reader, blob);
|
852
|
+
reader.readAsDataURL(blob);
|
853
|
+
e.preventDefault();
|
854
|
+
hadImage = true;
|
855
|
+
}
|
856
|
+
}
|
857
|
+
}
|
858
|
+
return hadImage;
|
859
|
+
}
|
860
|
+
if (editor.settings.paste_data_images && dataTransfer) {
|
861
|
+
return processItems(dataTransfer.items) || processItems(dataTransfer.files);
|
862
|
+
}
|
863
|
+
};
|
864
|
+
var isBrokenAndroidClipboardEvent = function (e) {
|
865
|
+
var clipboardData = e.clipboardData;
|
866
|
+
return navigator.userAgent.indexOf('Android') !== -1 && clipboardData && clipboardData.items && clipboardData.items.length === 0;
|
867
|
+
};
|
868
|
+
var isKeyboardPasteEvent = function (e) {
|
869
|
+
return global$4.metaKeyPressed(e) && e.keyCode === 86 || e.shiftKey && e.keyCode === 45;
|
870
|
+
};
|
871
|
+
var registerEventHandlers = function (editor, pasteBin, pasteFormat) {
|
872
|
+
var keyboardPasteTimeStamp = 0;
|
873
|
+
var keyboardPastePlainTextState;
|
874
|
+
editor.on('keydown', function (e) {
|
875
|
+
function removePasteBinOnKeyUp(e) {
|
876
|
+
if (isKeyboardPasteEvent(e) && !e.isDefaultPrevented()) {
|
877
|
+
pasteBin.remove();
|
878
|
+
}
|
879
|
+
}
|
880
|
+
if (isKeyboardPasteEvent(e) && !e.isDefaultPrevented()) {
|
881
|
+
keyboardPastePlainTextState = e.shiftKey && e.keyCode === 86;
|
882
|
+
if (keyboardPastePlainTextState && global$1.webkit && navigator.userAgent.indexOf('Version/') !== -1) {
|
883
|
+
return;
|
884
|
+
}
|
885
|
+
e.stopImmediatePropagation();
|
886
|
+
keyboardPasteTimeStamp = new Date().getTime();
|
887
|
+
if (global$1.ie && keyboardPastePlainTextState) {
|
888
|
+
e.preventDefault();
|
889
|
+
$_4gidzbiijm0ofzow.firePaste(editor, true);
|
890
|
+
return;
|
891
|
+
}
|
892
|
+
pasteBin.remove();
|
893
|
+
pasteBin.create();
|
894
|
+
editor.once('keyup', removePasteBinOnKeyUp);
|
895
|
+
editor.once('paste', function () {
|
896
|
+
editor.off('keyup', removePasteBinOnKeyUp);
|
897
|
+
});
|
898
|
+
}
|
899
|
+
});
|
900
|
+
function insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal) {
|
901
|
+
var content, isPlainTextHtml;
|
902
|
+
if (hasContentType(clipboardContent, 'text/html')) {
|
903
|
+
content = clipboardContent['text/html'];
|
904
|
+
} else {
|
905
|
+
content = pasteBin.getHtml();
|
906
|
+
internal = internal ? internal : $_21ba1xiqjm0ofzpc.isMarked(content);
|
907
|
+
if (pasteBin.isDefaultContent(content)) {
|
908
|
+
plainTextMode = true;
|
909
|
+
}
|
910
|
+
}
|
911
|
+
content = $_1340csizjm0ofzpu.trimHtml(content);
|
912
|
+
pasteBin.remove();
|
913
|
+
isPlainTextHtml = internal === false && $_67xxvyirjm0ofzpe.isPlainText(content);
|
914
|
+
if (!content.length || isPlainTextHtml) {
|
915
|
+
plainTextMode = true;
|
916
|
+
}
|
917
|
+
if (plainTextMode) {
|
918
|
+
if (hasContentType(clipboardContent, 'text/plain') && isPlainTextHtml) {
|
919
|
+
content = clipboardContent['text/plain'];
|
920
|
+
} else {
|
921
|
+
content = $_1340csizjm0ofzpu.innerText(content);
|
922
|
+
}
|
923
|
+
}
|
924
|
+
if (pasteBin.isDefaultContent(content)) {
|
925
|
+
if (!isKeyBoardPaste) {
|
926
|
+
editor.windowManager.alert('Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents.');
|
927
|
+
}
|
928
|
+
return;
|
929
|
+
}
|
930
|
+
if (plainTextMode) {
|
931
|
+
pasteText(editor, content);
|
932
|
+
} else {
|
933
|
+
pasteHtml$1(editor, content, internal);
|
934
|
+
}
|
935
|
+
}
|
936
|
+
var getLastRng = function () {
|
937
|
+
return pasteBin.getLastRng() || editor.selection.getRng();
|
938
|
+
};
|
939
|
+
editor.on('paste', function (e) {
|
940
|
+
var clipboardTimer = new Date().getTime();
|
941
|
+
var clipboardContent = getClipboardContent(editor, e);
|
942
|
+
var clipboardDelay = new Date().getTime() - clipboardTimer;
|
943
|
+
var isKeyBoardPaste = new Date().getTime() - keyboardPasteTimeStamp - clipboardDelay < 1000;
|
944
|
+
var plainTextMode = pasteFormat.get() === 'text' || keyboardPastePlainTextState;
|
945
|
+
var internal = hasContentType(clipboardContent, $_21ba1xiqjm0ofzpc.internalHtmlMime());
|
946
|
+
keyboardPastePlainTextState = false;
|
947
|
+
if (e.isDefaultPrevented() || isBrokenAndroidClipboardEvent(e)) {
|
948
|
+
pasteBin.remove();
|
949
|
+
return;
|
950
|
+
}
|
951
|
+
if (!hasHtmlOrText(clipboardContent) && pasteImageData(editor, e, getLastRng())) {
|
952
|
+
pasteBin.remove();
|
953
|
+
return;
|
954
|
+
}
|
955
|
+
if (!isKeyBoardPaste) {
|
956
|
+
e.preventDefault();
|
957
|
+
}
|
958
|
+
if (global$1.ie && (!isKeyBoardPaste || e.ieFake) && !hasContentType(clipboardContent, 'text/html')) {
|
959
|
+
pasteBin.create();
|
960
|
+
editor.dom.bind(pasteBin.getEl(), 'paste', function (e) {
|
961
|
+
e.stopPropagation();
|
962
|
+
});
|
963
|
+
editor.getDoc().execCommand('Paste', false, null);
|
964
|
+
clipboardContent['text/html'] = pasteBin.getHtml();
|
965
|
+
}
|
966
|
+
if (hasContentType(clipboardContent, 'text/html')) {
|
967
|
+
e.preventDefault();
|
968
|
+
if (!internal) {
|
969
|
+
internal = $_21ba1xiqjm0ofzpc.isMarked(clipboardContent['text/html']);
|
970
|
+
}
|
971
|
+
insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal);
|
972
|
+
} else {
|
973
|
+
global$2.setEditorTimeout(editor, function () {
|
974
|
+
insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal);
|
975
|
+
}, 0);
|
976
|
+
}
|
977
|
+
});
|
978
|
+
};
|
979
|
+
var registerEventsAndFilters = function (editor, pasteBin, pasteFormat) {
|
980
|
+
registerEventHandlers(editor, pasteBin, pasteFormat);
|
981
|
+
var src;
|
982
|
+
editor.parser.addNodeFilter('img', function (nodes, name$$1, args) {
|
983
|
+
var isPasteInsert = function (args) {
|
984
|
+
return args.data && args.data.paste === true;
|
985
|
+
};
|
986
|
+
var remove = function (node) {
|
987
|
+
if (!node.attr('data-mce-object') && src !== global$1.transparentSrc) {
|
988
|
+
node.remove();
|
989
|
+
}
|
990
|
+
};
|
991
|
+
var isWebKitFakeUrl = function (src) {
|
992
|
+
return src.indexOf('webkit-fake-url') === 0;
|
993
|
+
};
|
994
|
+
var isDataUri = function (src) {
|
995
|
+
return src.indexOf('data:') === 0;
|
996
|
+
};
|
997
|
+
if (!editor.settings.paste_data_images && isPasteInsert(args)) {
|
998
|
+
var i = nodes.length;
|
999
|
+
while (i--) {
|
1000
|
+
src = nodes[i].attributes.map.src;
|
1001
|
+
if (!src) {
|
1002
|
+
continue;
|
1003
|
+
}
|
1004
|
+
if (isWebKitFakeUrl(src)) {
|
1005
|
+
remove(nodes[i]);
|
1006
|
+
} else if (!editor.settings.allow_html_data_urls && isDataUri(src)) {
|
1007
|
+
remove(nodes[i]);
|
1008
|
+
}
|
1009
|
+
}
|
1010
|
+
}
|
1011
|
+
});
|
1012
|
+
};
|
1013
|
+
|
1014
|
+
var getPasteBinParent = function (editor) {
|
1015
|
+
return global$1.ie && editor.inline ? document.body : editor.getBody();
|
1016
|
+
};
|
1017
|
+
var isExternalPasteBin = function (editor) {
|
1018
|
+
return getPasteBinParent(editor) !== editor.getBody();
|
1019
|
+
};
|
1020
|
+
var delegatePasteEvents = function (editor, pasteBinElm, pasteBinDefaultContent) {
|
1021
|
+
if (isExternalPasteBin(editor)) {
|
1022
|
+
editor.dom.bind(pasteBinElm, 'paste keyup', function (e) {
|
1023
|
+
if (!isDefault(editor, pasteBinDefaultContent)) {
|
1024
|
+
editor.fire('paste');
|
1025
|
+
}
|
1026
|
+
});
|
1027
|
+
}
|
1028
|
+
};
|
1029
|
+
var create = function (editor, lastRngCell, pasteBinDefaultContent) {
|
1030
|
+
var dom = editor.dom, body = editor.getBody();
|
1031
|
+
var pasteBinElm;
|
1032
|
+
lastRngCell.set(editor.selection.getRng());
|
1033
|
+
pasteBinElm = editor.dom.add(getPasteBinParent(editor), 'div', {
|
1034
|
+
'id': 'mcepastebin',
|
1035
|
+
'class': 'mce-pastebin',
|
1036
|
+
'contentEditable': true,
|
1037
|
+
'data-mce-bogus': 'all',
|
1038
|
+
'style': 'position: fixed; top: 50%; width: 10px; height: 10px; overflow: hidden; opacity: 0'
|
1039
|
+
}, pasteBinDefaultContent);
|
1040
|
+
if (global$1.ie || global$1.gecko) {
|
1041
|
+
dom.setStyle(pasteBinElm, 'left', dom.getStyle(body, 'direction', true) === 'rtl' ? 65535 : -65535);
|
1042
|
+
}
|
1043
|
+
dom.bind(pasteBinElm, 'beforedeactivate focusin focusout', function (e) {
|
1044
|
+
e.stopPropagation();
|
1045
|
+
});
|
1046
|
+
delegatePasteEvents(editor, pasteBinElm, pasteBinDefaultContent);
|
1047
|
+
pasteBinElm.focus();
|
1048
|
+
editor.selection.select(pasteBinElm, true);
|
1049
|
+
};
|
1050
|
+
var remove = function (editor, lastRngCell) {
|
1051
|
+
if (getEl(editor)) {
|
1052
|
+
var pasteBinClone = void 0;
|
1053
|
+
var lastRng = lastRngCell.get();
|
1054
|
+
while (pasteBinClone = editor.dom.get('mcepastebin')) {
|
1055
|
+
editor.dom.remove(pasteBinClone);
|
1056
|
+
editor.dom.unbind(pasteBinClone);
|
1057
|
+
}
|
1058
|
+
if (lastRng) {
|
1059
|
+
editor.selection.setRng(lastRng);
|
1060
|
+
}
|
1061
|
+
}
|
1062
|
+
lastRngCell.set(null);
|
1063
|
+
};
|
1064
|
+
var getEl = function (editor) {
|
1065
|
+
return editor.dom.get('mcepastebin');
|
1066
|
+
};
|
1067
|
+
var getHtml = function (editor) {
|
1068
|
+
var pasteBinElm, pasteBinClones, i, dirtyWrappers, cleanWrapper;
|
1069
|
+
var copyAndRemove = function (toElm, fromElm) {
|
1070
|
+
toElm.appendChild(fromElm);
|
1071
|
+
editor.dom.remove(fromElm, true);
|
1072
|
+
};
|
1073
|
+
pasteBinClones = global$3.grep(getPasteBinParent(editor).childNodes, function (elm) {
|
1074
|
+
return elm.id === 'mcepastebin';
|
1075
|
+
});
|
1076
|
+
pasteBinElm = pasteBinClones.shift();
|
1077
|
+
global$3.each(pasteBinClones, function (pasteBinClone) {
|
1078
|
+
copyAndRemove(pasteBinElm, pasteBinClone);
|
1079
|
+
});
|
1080
|
+
dirtyWrappers = editor.dom.select('div[id=mcepastebin]', pasteBinElm);
|
1081
|
+
for (i = dirtyWrappers.length - 1; i >= 0; i--) {
|
1082
|
+
cleanWrapper = editor.dom.create('div');
|
1083
|
+
pasteBinElm.insertBefore(cleanWrapper, dirtyWrappers[i]);
|
1084
|
+
copyAndRemove(cleanWrapper, dirtyWrappers[i]);
|
1085
|
+
}
|
1086
|
+
return pasteBinElm ? pasteBinElm.innerHTML : '';
|
1087
|
+
};
|
1088
|
+
var getLastRng = function (lastRng) {
|
1089
|
+
return lastRng.get();
|
1090
|
+
};
|
1091
|
+
var isDefaultContent = function (pasteBinDefaultContent, content) {
|
1092
|
+
return content === pasteBinDefaultContent;
|
1093
|
+
};
|
1094
|
+
var isPasteBin = function (elm) {
|
1095
|
+
return elm && elm.id === 'mcepastebin';
|
1096
|
+
};
|
1097
|
+
var isDefault = function (editor, pasteBinDefaultContent) {
|
1098
|
+
var pasteBinElm = getEl(editor);
|
1099
|
+
return isPasteBin(pasteBinElm) && isDefaultContent(pasteBinDefaultContent, pasteBinElm.innerHTML);
|
1100
|
+
};
|
1101
|
+
var PasteBin = function (editor) {
|
1102
|
+
var lastRng = Cell(null);
|
1103
|
+
var pasteBinDefaultContent = '%MCEPASTEBIN%';
|
1104
|
+
return {
|
1105
|
+
create: function () {
|
1106
|
+
return create(editor, lastRng, pasteBinDefaultContent);
|
1107
|
+
},
|
1108
|
+
remove: function () {
|
1109
|
+
return remove(editor, lastRng);
|
1110
|
+
},
|
1111
|
+
getEl: function () {
|
1112
|
+
return getEl(editor);
|
1113
|
+
},
|
1114
|
+
getHtml: function () {
|
1115
|
+
return getHtml(editor);
|
1116
|
+
},
|
1117
|
+
getLastRng: function () {
|
1118
|
+
return getLastRng(lastRng);
|
1119
|
+
},
|
1120
|
+
isDefault: function () {
|
1121
|
+
return isDefault(editor, pasteBinDefaultContent);
|
1122
|
+
},
|
1123
|
+
isDefaultContent: function (content) {
|
1124
|
+
return isDefaultContent(pasteBinDefaultContent, content);
|
1125
|
+
}
|
1126
|
+
};
|
1127
|
+
};
|
1128
|
+
|
1129
|
+
var Clipboard = function (editor, pasteFormat) {
|
1130
|
+
var pasteBin = PasteBin(editor);
|
1131
|
+
editor.on('preInit', function () {
|
1132
|
+
return registerEventsAndFilters(editor, pasteBin, pasteFormat);
|
1133
|
+
});
|
1134
|
+
return {
|
1135
|
+
pasteFormat: pasteFormat,
|
1136
|
+
pasteHtml: function (html, internalFlag) {
|
1137
|
+
return pasteHtml$1(editor, html, internalFlag);
|
1138
|
+
},
|
1139
|
+
pasteText: function (text) {
|
1140
|
+
return pasteText(editor, text);
|
1141
|
+
},
|
1142
|
+
pasteImageData: function (e, rng) {
|
1143
|
+
return pasteImageData(editor, e, rng);
|
1144
|
+
},
|
1145
|
+
getDataTransferItems: getDataTransferItems,
|
1146
|
+
hasHtmlOrText: hasHtmlOrText,
|
1147
|
+
hasContentType: hasContentType
|
1148
|
+
};
|
1149
|
+
};
|
1150
|
+
|
1151
|
+
var noop = function () {
|
1152
|
+
};
|
1153
|
+
var hasWorkingClipboardApi = function (clipboardData) {
|
1154
|
+
return global$1.iOS === false && clipboardData !== undefined && typeof clipboardData.setData === 'function' && $_1340csizjm0ofzpu.isMsEdge() !== true;
|
1155
|
+
};
|
1156
|
+
var setHtml5Clipboard = function (clipboardData, html, text) {
|
1157
|
+
if (hasWorkingClipboardApi(clipboardData)) {
|
1158
|
+
try {
|
1159
|
+
clipboardData.clearData();
|
1160
|
+
clipboardData.setData('text/html', html);
|
1161
|
+
clipboardData.setData('text/plain', text);
|
1162
|
+
clipboardData.setData($_21ba1xiqjm0ofzpc.internalHtmlMime(), html);
|
1163
|
+
return true;
|
1164
|
+
} catch (e) {
|
1165
|
+
return false;
|
1166
|
+
}
|
1167
|
+
} else {
|
1168
|
+
return false;
|
1169
|
+
}
|
1170
|
+
};
|
1171
|
+
var setClipboardData = function (evt, data, fallback, done) {
|
1172
|
+
if (setHtml5Clipboard(evt.clipboardData, data.html, data.text)) {
|
1173
|
+
evt.preventDefault();
|
1174
|
+
done();
|
1175
|
+
} else {
|
1176
|
+
fallback(data.html, done);
|
1177
|
+
}
|
1178
|
+
};
|
1179
|
+
var fallback = function (editor) {
|
1180
|
+
return function (html, done) {
|
1181
|
+
var markedHtml = $_21ba1xiqjm0ofzpc.mark(html);
|
1182
|
+
var outer = editor.dom.create('div', {
|
1183
|
+
'contenteditable': 'false',
|
1184
|
+
'data-mce-bogus': 'all'
|
1185
|
+
});
|
1186
|
+
var inner = editor.dom.create('div', { contenteditable: 'true' }, markedHtml);
|
1187
|
+
editor.dom.setStyles(outer, {
|
1188
|
+
position: 'fixed',
|
1189
|
+
top: '0',
|
1190
|
+
left: '-3000px',
|
1191
|
+
width: '1000px',
|
1192
|
+
overflow: 'hidden'
|
1193
|
+
});
|
1194
|
+
outer.appendChild(inner);
|
1195
|
+
editor.dom.add(editor.getBody(), outer);
|
1196
|
+
var range = editor.selection.getRng();
|
1197
|
+
inner.focus();
|
1198
|
+
var offscreenRange = editor.dom.createRng();
|
1199
|
+
offscreenRange.selectNodeContents(inner);
|
1200
|
+
editor.selection.setRng(offscreenRange);
|
1201
|
+
setTimeout(function () {
|
1202
|
+
editor.selection.setRng(range);
|
1203
|
+
outer.parentNode.removeChild(outer);
|
1204
|
+
done();
|
1205
|
+
}, 0);
|
1206
|
+
};
|
1207
|
+
};
|
1208
|
+
var getData = function (editor) {
|
1209
|
+
return {
|
1210
|
+
html: editor.selection.getContent({ contextual: true }),
|
1211
|
+
text: editor.selection.getContent({ format: 'text' })
|
1212
|
+
};
|
1213
|
+
};
|
1214
|
+
var cut = function (editor) {
|
1215
|
+
return function (evt) {
|
1216
|
+
if (editor.selection.isCollapsed() === false) {
|
1217
|
+
setClipboardData(evt, getData(editor), fallback(editor), function () {
|
1218
|
+
setTimeout(function () {
|
1219
|
+
editor.execCommand('Delete');
|
1220
|
+
}, 0);
|
1221
|
+
});
|
1222
|
+
}
|
1223
|
+
};
|
1224
|
+
};
|
1225
|
+
var copy = function (editor) {
|
1226
|
+
return function (evt) {
|
1227
|
+
if (editor.selection.isCollapsed() === false) {
|
1228
|
+
setClipboardData(evt, getData(editor), fallback(editor), noop);
|
1229
|
+
}
|
1230
|
+
};
|
1231
|
+
};
|
1232
|
+
var register$1 = function (editor) {
|
1233
|
+
editor.on('cut', cut(editor));
|
1234
|
+
editor.on('copy', copy(editor));
|
1235
|
+
};
|
1236
|
+
var $_41rkuj2jm0ofzq9 = { register: register$1 };
|
1237
|
+
|
1238
|
+
var global$10 = tinymce.util.Tools.resolve('tinymce.dom.RangeUtils');
|
1239
|
+
|
1240
|
+
var getCaretRangeFromEvent = function (editor, e) {
|
1241
|
+
return global$10.getCaretRangeFromPoint(e.clientX, e.clientY, editor.getDoc());
|
1242
|
+
};
|
1243
|
+
var isPlainTextFileUrl = function (content) {
|
1244
|
+
var plainTextContent = content['text/plain'];
|
1245
|
+
return plainTextContent ? plainTextContent.indexOf('file://') === 0 : false;
|
1246
|
+
};
|
1247
|
+
var setFocusedRange = function (editor, rng) {
|
1248
|
+
editor.focus();
|
1249
|
+
editor.selection.setRng(rng);
|
1250
|
+
};
|
1251
|
+
var setup = function (editor, clipboard, draggingInternallyState) {
|
1252
|
+
if ($_dbkrisijjm0ofzoy.shouldBlockDrop(editor)) {
|
1253
|
+
editor.on('dragend dragover draggesture dragdrop drop drag', function (e) {
|
1254
|
+
e.preventDefault();
|
1255
|
+
e.stopPropagation();
|
1256
|
+
});
|
1257
|
+
}
|
1258
|
+
if (!$_dbkrisijjm0ofzoy.shouldPasteDataImages(editor)) {
|
1259
|
+
editor.on('drop', function (e) {
|
1260
|
+
var dataTransfer = e.dataTransfer;
|
1261
|
+
if (dataTransfer && dataTransfer.files && dataTransfer.files.length > 0) {
|
1262
|
+
e.preventDefault();
|
1263
|
+
}
|
1264
|
+
});
|
1265
|
+
}
|
1266
|
+
editor.on('drop', function (e) {
|
1267
|
+
var dropContent, rng;
|
1268
|
+
rng = getCaretRangeFromEvent(editor, e);
|
1269
|
+
if (e.isDefaultPrevented() || draggingInternallyState.get()) {
|
1270
|
+
return;
|
1271
|
+
}
|
1272
|
+
dropContent = clipboard.getDataTransferItems(e.dataTransfer);
|
1273
|
+
var internal = clipboard.hasContentType(dropContent, $_21ba1xiqjm0ofzpc.internalHtmlMime());
|
1274
|
+
if ((!clipboard.hasHtmlOrText(dropContent) || isPlainTextFileUrl(dropContent)) && clipboard.pasteImageData(e, rng)) {
|
1275
|
+
return;
|
1276
|
+
}
|
1277
|
+
if (rng && $_dbkrisijjm0ofzoy.shouldFilterDrop(editor)) {
|
1278
|
+
var content_1 = dropContent['mce-internal'] || dropContent['text/html'] || dropContent['text/plain'];
|
1279
|
+
if (content_1) {
|
1280
|
+
e.preventDefault();
|
1281
|
+
global$2.setEditorTimeout(editor, function () {
|
1282
|
+
editor.undoManager.transact(function () {
|
1283
|
+
if (dropContent['mce-internal']) {
|
1284
|
+
editor.execCommand('Delete');
|
1285
|
+
}
|
1286
|
+
setFocusedRange(editor, rng);
|
1287
|
+
content_1 = $_1340csizjm0ofzpu.trimHtml(content_1);
|
1288
|
+
if (!dropContent['text/html']) {
|
1289
|
+
clipboard.pasteText(content_1);
|
1290
|
+
} else {
|
1291
|
+
clipboard.pasteHtml(content_1, internal);
|
1292
|
+
}
|
1293
|
+
});
|
1294
|
+
});
|
1295
|
+
}
|
1296
|
+
}
|
1297
|
+
});
|
1298
|
+
editor.on('dragstart', function (e) {
|
1299
|
+
draggingInternallyState.set(true);
|
1300
|
+
});
|
1301
|
+
editor.on('dragover dragend', function (e) {
|
1302
|
+
if ($_dbkrisijjm0ofzoy.shouldPasteDataImages(editor) && draggingInternallyState.get() === false) {
|
1303
|
+
e.preventDefault();
|
1304
|
+
setFocusedRange(editor, getCaretRangeFromEvent(editor, e));
|
1305
|
+
}
|
1306
|
+
if (e.type === 'dragend') {
|
1307
|
+
draggingInternallyState.set(false);
|
1308
|
+
}
|
1309
|
+
});
|
1310
|
+
};
|
1311
|
+
var $_81gqfwj3jm0ofzqd = { setup: setup };
|
1312
|
+
|
1313
|
+
var setup$1 = function (editor) {
|
1314
|
+
var plugin = editor.plugins.paste;
|
1315
|
+
var preProcess = $_dbkrisijjm0ofzoy.getPreProcess(editor);
|
1316
|
+
if (preProcess) {
|
1317
|
+
editor.on('PastePreProcess', function (e) {
|
1318
|
+
preProcess.call(plugin, plugin, e);
|
1319
|
+
});
|
1320
|
+
}
|
1321
|
+
var postProcess = $_dbkrisijjm0ofzoy.getPostProcess(editor);
|
1322
|
+
if (postProcess) {
|
1323
|
+
editor.on('PastePostProcess', function (e) {
|
1324
|
+
postProcess.call(plugin, plugin, e);
|
1325
|
+
});
|
1326
|
+
}
|
1327
|
+
};
|
1328
|
+
var $_y4g1hj5jm0ofzqg = { setup: setup$1 };
|
1329
|
+
|
1330
|
+
function addPreProcessFilter(editor, filterFunc) {
|
1331
|
+
editor.on('PastePreProcess', function (e) {
|
1332
|
+
e.content = filterFunc(editor, e.content, e.internal, e.wordContent);
|
1333
|
+
});
|
1334
|
+
}
|
1335
|
+
function addPostProcessFilter(editor, filterFunc) {
|
1336
|
+
editor.on('PastePostProcess', function (e) {
|
1337
|
+
filterFunc(editor, e.node);
|
1338
|
+
});
|
1339
|
+
}
|
1340
|
+
function removeExplorerBrElementsAfterBlocks(editor, html) {
|
1341
|
+
if (!$_52rjxviujm0ofzpl.isWordContent(html)) {
|
1342
|
+
return html;
|
1343
|
+
}
|
1344
|
+
var blockElements = [];
|
1345
|
+
global$3.each(editor.schema.getBlockElements(), function (block, blockName) {
|
1346
|
+
blockElements.push(blockName);
|
1347
|
+
});
|
1348
|
+
var explorerBlocksRegExp = new RegExp('(?:<br> [\\s\\r\\n]+|<br>)*(<\\/?(' + blockElements.join('|') + ')[^>]*>)(?:<br> [\\s\\r\\n]+|<br>)*', 'g');
|
1349
|
+
html = $_1340csizjm0ofzpu.filter(html, [[
|
1350
|
+
explorerBlocksRegExp,
|
1351
|
+
'$1'
|
1352
|
+
]]);
|
1353
|
+
html = $_1340csizjm0ofzpu.filter(html, [
|
1354
|
+
[
|
1355
|
+
/<br><br>/g,
|
1356
|
+
'<BR><BR>'
|
1357
|
+
],
|
1358
|
+
[
|
1359
|
+
/<br>/g,
|
1360
|
+
' '
|
1361
|
+
],
|
1362
|
+
[
|
1363
|
+
/<BR><BR>/g,
|
1364
|
+
'<br>'
|
1365
|
+
]
|
1366
|
+
]);
|
1367
|
+
return html;
|
1368
|
+
}
|
1369
|
+
function removeWebKitStyles(editor, content, internal, isWordHtml) {
|
1370
|
+
if (isWordHtml || internal) {
|
1371
|
+
return content;
|
1372
|
+
}
|
1373
|
+
var webKitStylesSetting = $_dbkrisijjm0ofzoy.getWebkitStyles(editor);
|
1374
|
+
var webKitStyles;
|
1375
|
+
if ($_dbkrisijjm0ofzoy.shouldRemoveWebKitStyles(editor) === false || webKitStylesSetting === 'all') {
|
1376
|
+
return content;
|
1377
|
+
}
|
1378
|
+
if (webKitStylesSetting) {
|
1379
|
+
webKitStyles = webKitStylesSetting.split(/[, ]/);
|
1380
|
+
}
|
1381
|
+
if (webKitStyles) {
|
1382
|
+
var dom_1 = editor.dom, node_1 = editor.selection.getNode();
|
1383
|
+
content = content.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi, function (all, before, value, after) {
|
1384
|
+
var inputStyles = dom_1.parseStyle(dom_1.decode(value));
|
1385
|
+
var outputStyles = {};
|
1386
|
+
if (webKitStyles === 'none') {
|
1387
|
+
return before + after;
|
1388
|
+
}
|
1389
|
+
for (var i = 0; i < webKitStyles.length; i++) {
|
1390
|
+
var inputValue = inputStyles[webKitStyles[i]], currentValue = dom_1.getStyle(node_1, webKitStyles[i], true);
|
1391
|
+
if (/color/.test(webKitStyles[i])) {
|
1392
|
+
inputValue = dom_1.toHex(inputValue);
|
1393
|
+
currentValue = dom_1.toHex(currentValue);
|
1394
|
+
}
|
1395
|
+
if (currentValue !== inputValue) {
|
1396
|
+
outputStyles[webKitStyles[i]] = inputValue;
|
1397
|
+
}
|
1398
|
+
}
|
1399
|
+
outputStyles = dom_1.serializeStyle(outputStyles, 'span');
|
1400
|
+
if (outputStyles) {
|
1401
|
+
return before + ' style="' + outputStyles + '"' + after;
|
1402
|
+
}
|
1403
|
+
return before + after;
|
1404
|
+
});
|
1405
|
+
} else {
|
1406
|
+
content = content.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi, '$1$3');
|
1407
|
+
}
|
1408
|
+
content = content.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi, function (all, before, value, after) {
|
1409
|
+
return before + ' style="' + value + '"' + after;
|
1410
|
+
});
|
1411
|
+
return content;
|
1412
|
+
}
|
1413
|
+
function removeUnderlineAndFontInAnchor(editor, root) {
|
1414
|
+
editor.$('a', root).find('font,u').each(function (i, node) {
|
1415
|
+
editor.dom.remove(node, true);
|
1416
|
+
});
|
1417
|
+
}
|
1418
|
+
var setup$2 = function (editor) {
|
1419
|
+
if (global$1.webkit) {
|
1420
|
+
addPreProcessFilter(editor, removeWebKitStyles);
|
1421
|
+
}
|
1422
|
+
if (global$1.ie) {
|
1423
|
+
addPreProcessFilter(editor, removeExplorerBrElementsAfterBlocks);
|
1424
|
+
addPostProcessFilter(editor, removeUnderlineAndFontInAnchor);
|
1425
|
+
}
|
1426
|
+
};
|
1427
|
+
var $_7229ubj6jm0ofzqi = { setup: setup$2 };
|
1428
|
+
|
1429
|
+
var curry = function (f) {
|
1430
|
+
var x = [];
|
1431
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
1432
|
+
x[_i - 1] = arguments[_i];
|
1433
|
+
}
|
1434
|
+
var args = new Array(arguments.length - 1);
|
1435
|
+
for (var i = 1; i < arguments.length; i++)
|
1436
|
+
args[i - 1] = arguments[i];
|
1437
|
+
return function () {
|
1438
|
+
var x = [];
|
1439
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
1440
|
+
x[_i] = arguments[_i];
|
1441
|
+
}
|
1442
|
+
var newArgs = new Array(arguments.length);
|
1443
|
+
for (var j = 0; j < newArgs.length; j++)
|
1444
|
+
newArgs[j] = arguments[j];
|
1445
|
+
var all = args.concat(newArgs);
|
1446
|
+
return f.apply(null, all);
|
1447
|
+
};
|
1448
|
+
};
|
1449
|
+
|
1450
|
+
var stateChange = function (editor, clipboard, e) {
|
1451
|
+
var ctrl = e.control;
|
1452
|
+
ctrl.active(clipboard.pasteFormat.get() === 'text');
|
1453
|
+
editor.on('PastePlainTextToggle', function (e) {
|
1454
|
+
ctrl.active(e.state);
|
1455
|
+
});
|
1456
|
+
};
|
1457
|
+
var register$2 = function (editor, clipboard) {
|
1458
|
+
var postRender = curry(stateChange, editor, clipboard);
|
1459
|
+
editor.addButton('pastetext', {
|
1460
|
+
active: false,
|
1461
|
+
icon: 'pastetext',
|
1462
|
+
tooltip: 'Paste as text',
|
1463
|
+
cmd: 'mceTogglePlainTextPaste',
|
1464
|
+
onPostRender: postRender
|
1465
|
+
});
|
1466
|
+
editor.addMenuItem('pastetext', {
|
1467
|
+
text: 'Paste as text',
|
1468
|
+
selectable: true,
|
1469
|
+
active: clipboard.pasteFormat,
|
1470
|
+
cmd: 'mceTogglePlainTextPaste',
|
1471
|
+
onPostRender: postRender
|
1472
|
+
});
|
1473
|
+
};
|
1474
|
+
var $_8gccoyj7jm0ofzqu = { register: register$2 };
|
1475
|
+
|
1476
|
+
global.add('paste', function (editor) {
|
1477
|
+
if ($_1wddxcidjm0ofzo9.hasProPlugin(editor) === false) {
|
1478
|
+
var userIsInformedState = Cell(false);
|
1479
|
+
var draggingInternallyState = Cell(false);
|
1480
|
+
var pasteFormat = Cell($_dbkrisijjm0ofzoy.isPasteAsTextEnabled(editor) ? 'text' : 'html');
|
1481
|
+
var clipboard = Clipboard(editor, pasteFormat);
|
1482
|
+
var quirks = $_7229ubj6jm0ofzqi.setup(editor);
|
1483
|
+
$_8gccoyj7jm0ofzqu.register(editor, clipboard);
|
1484
|
+
$_4ny6o6igjm0ofzot.register(editor, clipboard, userIsInformedState);
|
1485
|
+
$_y4g1hj5jm0ofzqg.setup(editor);
|
1486
|
+
$_41rkuj2jm0ofzq9.register(editor);
|
1487
|
+
$_81gqfwj3jm0ofzqd.setup(editor, clipboard, draggingInternallyState);
|
1488
|
+
return $_9cpx3tifjm0ofzos.get(clipboard, quirks);
|
1489
|
+
}
|
1490
|
+
});
|
1491
|
+
function Plugin () {
|
1492
|
+
}
|
1493
|
+
|
1494
|
+
return Plugin;
|
1495
|
+
|
1496
|
+
}());
|
1497
|
+
})();
|