editable_components 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +64 -0
- data/Rakefile +34 -0
- data/app/assets/config/editable_components_manifest.js +2 -0
- data/app/assets/fonts/editable_components/icomoon.eot +0 -0
- data/app/assets/fonts/editable_components/icomoon.svg +24 -0
- data/app/assets/fonts/editable_components/icomoon.ttf +0 -0
- data/app/assets/fonts/editable_components/icomoon.woff +0 -0
- data/app/assets/javascripts/editable_components/application.js +13 -0
- data/app/assets/javascripts/editable_components/dragula/dragula.css +22 -0
- data/app/assets/javascripts/editable_components/dragula/dragula.js +908 -0
- data/app/assets/javascripts/editable_components/dragula/dragula.min.css +1 -0
- data/app/assets/javascripts/editable_components/dragula/dragula.min.js +1 -0
- data/app/assets/javascripts/editable_components/dropzone/CONTRIBUTING.md +78 -0
- data/app/assets/javascripts/editable_components/dropzone/LICENSE +12 -0
- data/app/assets/javascripts/editable_components/dropzone/README.md +134 -0
- data/app/assets/javascripts/editable_components/dropzone/basic.css +39 -0
- data/app/assets/javascripts/editable_components/dropzone/dropzone-amd-module.js +1782 -0
- data/app/assets/javascripts/editable_components/dropzone/dropzone.css +388 -0
- data/app/assets/javascripts/editable_components/dropzone/dropzone.js +1767 -0
- data/app/assets/javascripts/editable_components/dropzone/min/basic.min.css +1 -0
- data/app/assets/javascripts/editable_components/dropzone/min/dropzone-amd-module.min.js +2 -0
- data/app/assets/javascripts/editable_components/dropzone/min/dropzone.min.css +1 -0
- data/app/assets/javascripts/editable_components/dropzone/min/dropzone.min.js +2 -0
- data/app/assets/javascripts/editable_components/main.js +280 -0
- data/app/assets/javascripts/editable_components/medium-editor/API.md +520 -0
- data/app/assets/javascripts/editable_components/medium-editor/CHANGES.md +1043 -0
- data/app/assets/javascripts/editable_components/medium-editor/CODE_OF_CONDUCT.md +13 -0
- data/app/assets/javascripts/editable_components/medium-editor/CONTRIBUTING.md +56 -0
- data/app/assets/javascripts/editable_components/medium-editor/CUSTOM-EVENTS.md +223 -0
- data/app/assets/javascripts/editable_components/medium-editor/LICENSE +36 -0
- data/app/assets/javascripts/editable_components/medium-editor/MAINTAINERS.md +33 -0
- data/app/assets/javascripts/editable_components/medium-editor/OPTIONS.md +663 -0
- data/app/assets/javascripts/editable_components/medium-editor/README.md +725 -0
- data/app/assets/javascripts/editable_components/medium-editor/UPGRADE-5.md +146 -0
- data/app/assets/javascripts/editable_components/medium-editor/medium-editor.css +230 -0
- data/app/assets/javascripts/editable_components/medium-editor/medium-editor.js +7876 -0
- data/app/assets/javascripts/editable_components/medium-editor/medium-editor.min.css +1 -0
- data/app/assets/javascripts/editable_components/medium-editor/medium-editor.min.js +4 -0
- data/app/assets/javascripts/editable_components/medium-editor/themes/beagle.css +78 -0
- data/app/assets/javascripts/editable_components/medium-editor/themes/beagle.min.css +1 -0
- data/app/assets/javascripts/editable_components/medium-editor/themes/bootstrap.css +67 -0
- data/app/assets/javascripts/editable_components/medium-editor/themes/bootstrap.min.css +1 -0
- data/app/assets/javascripts/editable_components/medium-editor/themes/default.css +63 -0
- data/app/assets/javascripts/editable_components/medium-editor/themes/default.min.css +1 -0
- data/app/assets/javascripts/editable_components/medium-editor/themes/flat.css +58 -0
- data/app/assets/javascripts/editable_components/medium-editor/themes/flat.min.css +1 -0
- data/app/assets/javascripts/editable_components/medium-editor/themes/mani.css +57 -0
- data/app/assets/javascripts/editable_components/medium-editor/themes/mani.min.css +1 -0
- data/app/assets/javascripts/editable_components/medium-editor/themes/roman.css +58 -0
- data/app/assets/javascripts/editable_components/medium-editor/themes/roman.min.css +1 -0
- data/app/assets/javascripts/editable_components/medium-editor/themes/tim.css +67 -0
- data/app/assets/javascripts/editable_components/medium-editor/themes/tim.min.css +1 -0
- data/app/assets/javascripts/editable_components/sizzle/sizzle.js +2272 -0
- data/app/assets/javascripts/editable_components/sizzle/sizzle.min.js +3 -0
- data/app/assets/javascripts/editable_components/sizzle/sizzle.min.map +1 -0
- data/app/assets/javascripts/editable_components/vue/README.md +124 -0
- data/app/assets/javascripts/editable_components/vue/vue.common.js +9320 -0
- data/app/assets/javascripts/editable_components/vue/vue.common.min.js +7 -0
- data/app/assets/javascripts/editable_components/vue/vue.esm.js +9318 -0
- data/app/assets/javascripts/editable_components/vue/vue.js +9316 -0
- data/app/assets/javascripts/editable_components/vue/vue.min.js +8 -0
- data/app/assets/javascripts/editable_components/vue/vue.runtime.common.js +6831 -0
- data/app/assets/javascripts/editable_components/vue/vue.runtime.esm.js +6829 -0
- data/app/assets/javascripts/editable_components/vue/vue.runtime.js +6827 -0
- data/app/assets/javascripts/editable_components/vue/vue.runtime.min.js +7 -0
- data/app/assets/stylesheets/editable_components/application.sass +65 -0
- data/app/assets/stylesheets/editable_components/blaze/blaze.colors.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/blaze.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/components.addresses.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/components.alerts.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/components.avatars.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/components.badges.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/components.breadcrumbs.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/components.bubbles.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/components.buttons.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/components.calendars.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/components.cards.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/components.headings.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/components.hints.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/components.input-groups.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/components.inputs.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/components.links.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/components.lists.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/components.navs.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/components.overlays.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/components.pagination.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/components.progress.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/components.ranges.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/components.tables.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/components.tabs.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/components.tags.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/components.toggles.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/components.tooltips.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/components.trees.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/components.typography.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/generics.global.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/objects.containers.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/objects.drawers.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/objects.forms.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/objects.grid.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/objects.grid.responsive.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/objects.images.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/objects.media.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/objects.modals.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/objects.panels.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/themes/blaze.example.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/utilities.alignment.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/utilities.boxing.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/utilities.elevation.min.css +1 -0
- data/app/assets/stylesheets/editable_components/blaze/utilities.sizes.min.css +1 -0
- data/app/assets/stylesheets/editable_components/dragula/dragula.css +22 -0
- data/app/assets/stylesheets/editable_components/dragula/dragula.js +908 -0
- data/app/assets/stylesheets/editable_components/dragula/dragula.min.css +1 -0
- data/app/assets/stylesheets/editable_components/dragula/dragula.min.js +1 -0
- data/app/assets/stylesheets/editable_components/main.sass +225 -0
- data/app/assets/stylesheets/editable_components/medium-editor/API.md +520 -0
- data/app/assets/stylesheets/editable_components/medium-editor/CHANGES.md +1043 -0
- data/app/assets/stylesheets/editable_components/medium-editor/CODE_OF_CONDUCT.md +13 -0
- data/app/assets/stylesheets/editable_components/medium-editor/CONTRIBUTING.md +56 -0
- data/app/assets/stylesheets/editable_components/medium-editor/CUSTOM-EVENTS.md +223 -0
- data/app/assets/stylesheets/editable_components/medium-editor/LICENSE +36 -0
- data/app/assets/stylesheets/editable_components/medium-editor/MAINTAINERS.md +33 -0
- data/app/assets/stylesheets/editable_components/medium-editor/OPTIONS.md +663 -0
- data/app/assets/stylesheets/editable_components/medium-editor/README.md +725 -0
- data/app/assets/stylesheets/editable_components/medium-editor/UPGRADE-5.md +146 -0
- data/app/assets/stylesheets/editable_components/medium-editor/medium-editor.css +230 -0
- data/app/assets/stylesheets/editable_components/medium-editor/medium-editor.js +7876 -0
- data/app/assets/stylesheets/editable_components/medium-editor/medium-editor.min.css +1 -0
- data/app/assets/stylesheets/editable_components/medium-editor/medium-editor.min.js +4 -0
- data/app/assets/stylesheets/editable_components/medium-editor/themes/beagle.css +78 -0
- data/app/assets/stylesheets/editable_components/medium-editor/themes/beagle.min.css +1 -0
- data/app/assets/stylesheets/editable_components/medium-editor/themes/bootstrap.css +67 -0
- data/app/assets/stylesheets/editable_components/medium-editor/themes/bootstrap.min.css +1 -0
- data/app/assets/stylesheets/editable_components/medium-editor/themes/default.css +63 -0
- data/app/assets/stylesheets/editable_components/medium-editor/themes/default.min.css +1 -0
- data/app/assets/stylesheets/editable_components/medium-editor/themes/flat.css +58 -0
- data/app/assets/stylesheets/editable_components/medium-editor/themes/flat.min.css +1 -0
- data/app/assets/stylesheets/editable_components/medium-editor/themes/mani.css +57 -0
- data/app/assets/stylesheets/editable_components/medium-editor/themes/mani.min.css +1 -0
- data/app/assets/stylesheets/editable_components/medium-editor/themes/roman.css +58 -0
- data/app/assets/stylesheets/editable_components/medium-editor/themes/roman.min.css +1 -0
- data/app/assets/stylesheets/editable_components/medium-editor/themes/tim.css +67 -0
- data/app/assets/stylesheets/editable_components/medium-editor/themes/tim.min.css +1 -0
- data/app/controllers/editable_components/blocks_controller.rb +36 -0
- data/app/helpers/editable_components/application_helper.rb +4 -0
- data/app/jobs/editable_components/application_job.rb +4 -0
- data/app/mailers/editable_components/application_mailer.rb +6 -0
- data/app/models/editable_components/application_record.rb +5 -0
- data/app/models/editable_components/block.rb +176 -0
- data/app/models/editable_components/concerns/editable.rb +34 -0
- data/app/models/editable_components/item.rb +50 -0
- data/app/models/editable_components/item_boolean.rb +23 -0
- data/app/models/editable_components/item_datetime.rb +14 -0
- data/app/models/editable_components/item_file.rb +46 -0
- data/app/models/editable_components/item_float.rb +23 -0
- data/app/models/editable_components/item_hash.rb +16 -0
- data/app/models/editable_components/item_integer.rb +23 -0
- data/app/models/editable_components/item_string.rb +29 -0
- data/app/models/editable_components/item_text.rb +19 -0
- data/app/views/editable_components/_admin_toolbar.html.erb +105 -0
- data/app/views/editable_components/_block.html.erb +6 -0
- data/app/views/editable_components/_block_image.html.erb +6 -0
- data/app/views/editable_components/_block_multi_text.html.erb +7 -0
- data/app/views/editable_components/_block_slide.html.erb +6 -0
- data/app/views/editable_components/_block_slider.html.erb +7 -0
- data/app/views/editable_components/_block_text.html.erb +5 -0
- data/app/views/editable_components/_block_text_with_image.html.erb +12 -0
- data/app/views/editable_components/_blocks.html.erb +12 -0
- data/config/initializers/editable_components.rb +72 -0
- data/config/routes.rb +4 -0
- data/db/migrate/20170414173603_create_editable_components_blocks.rb +18 -0
- data/db/migrate/20170414173610_create_editable_components_items.rb +11 -0
- data/db/migrate/20170414173611_add_items_booleans.rb +5 -0
- data/db/migrate/20170414173612_add_items_datetimes.rb +5 -0
- data/db/migrate/20170414173613_add_items_files.rb +5 -0
- data/db/migrate/20170414173614_add_items_floats.rb +5 -0
- data/db/migrate/20170414173615_add_items_hashes.rb +5 -0
- data/db/migrate/20170414173616_add_items_integers.rb +5 -0
- data/db/migrate/20170414173617_add_items_strings.rb +5 -0
- data/db/migrate/20170414173618_add_items_texts.rb +5 -0
- data/lib/data/img1.jpg +0 -0
- data/lib/editable_components.rb +87 -0
- data/lib/editable_components/engine.rb +21 -0
- data/lib/editable_components/version.rb +3 -0
- data/lib/tasks/editable_components_tasks.rake +4 -0
- metadata +264 -0
@@ -0,0 +1 @@
|
|
1
|
+
.dropzone,.dropzone *{box-sizing:border-box}.dropzone{position:relative}.dropzone .dz-preview{position:relative;display:inline-block;width:120px;margin:0.5em}.dropzone .dz-preview .dz-progress{display:block;height:15px;border:1px solid #aaa}.dropzone .dz-preview .dz-progress .dz-upload{display:block;height:100%;width:0;background:green}.dropzone .dz-preview .dz-error-message{color:red;display:none}.dropzone .dz-preview.dz-error .dz-error-message,.dropzone .dz-preview.dz-error .dz-error-mark{display:block}.dropzone .dz-preview.dz-success .dz-success-mark{display:block}.dropzone .dz-preview .dz-error-mark,.dropzone .dz-preview .dz-success-mark{position:absolute;display:none;left:30px;top:30px;width:54px;height:58px;left:50%;margin-left:-27px}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){var b={exports:{}};return function(){var c,d,e,f,g,h,i,j,k=[].slice,l={}.hasOwnProperty,m=function(a,b){function c(){this.constructor=a}for(var d in b)l.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};i=function(){},d=function(){function a(){}return a.prototype.addEventListener=a.prototype.on,a.prototype.on=function(a,b){return this._callbacks=this._callbacks||{},this._callbacks[a]||(this._callbacks[a]=[]),this._callbacks[a].push(b),this},a.prototype.emit=function(){var a,b,c,d,e,f;if(d=arguments[0],a=2<=arguments.length?k.call(arguments,1):[],this._callbacks=this._callbacks||{},c=this._callbacks[d])for(e=0,f=c.length;f>e;e++)b=c[e],b.apply(this,a);return this},a.prototype.removeListener=a.prototype.off,a.prototype.removeAllListeners=a.prototype.off,a.prototype.removeEventListener=a.prototype.off,a.prototype.off=function(a,b){var c,d,e,f,g;if(!this._callbacks||0===arguments.length)return this._callbacks={},this;if(d=this._callbacks[a],!d)return this;if(1===arguments.length)return delete this._callbacks[a],this;for(e=f=0,g=d.length;g>f;e=++f)if(c=d[e],c===b){d.splice(e,1);break}return this},a}(),c=function(a){function b(a,d){var e,f,g;if(this.element=a,this.version=b.version,this.defaultOptions.previewTemplate=this.defaultOptions.previewTemplate.replace(/\n*/g,""),this.clickableElements=[],this.listeners=[],this.files=[],"string"==typeof this.element&&(this.element=document.querySelector(this.element)),!this.element||null==this.element.nodeType)throw new Error("Invalid dropzone element.");if(this.element.dropzone)throw new Error("Dropzone already attached.");if(b.instances.push(this),this.element.dropzone=this,e=null!=(g=b.optionsForElement(this.element))?g:{},this.options=c({},this.defaultOptions,e,null!=d?d:{}),this.options.forceFallback||!b.isBrowserSupported())return this.options.fallback.call(this);if(null==this.options.url&&(this.options.url=this.element.getAttribute("action")),!this.options.url)throw new Error("No URL provided.");if(this.options.acceptedFiles&&this.options.acceptedMimeTypes)throw new Error("You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated.");this.options.acceptedMimeTypes&&(this.options.acceptedFiles=this.options.acceptedMimeTypes,delete this.options.acceptedMimeTypes),this.options.method=this.options.method.toUpperCase(),(f=this.getExistingFallback())&&f.parentNode&&f.parentNode.removeChild(f),this.options.previewsContainer!==!1&&(this.previewsContainer=this.options.previewsContainer?b.getElement(this.options.previewsContainer,"previewsContainer"):this.element),this.options.clickable&&(this.clickableElements=this.options.clickable===!0?[this.element]:b.getElements(this.options.clickable,"clickable")),this.init()}var c,e;return m(b,a),b.prototype.Emitter=d,b.prototype.events=["drop","dragstart","dragend","dragenter","dragover","dragleave","addedfile","addedfiles","removedfile","thumbnail","error","errormultiple","processing","processingmultiple","uploadprogress","totaluploadprogress","sending","sendingmultiple","success","successmultiple","canceled","canceledmultiple","complete","completemultiple","reset","maxfilesexceeded","maxfilesreached","queuecomplete"],b.prototype.defaultOptions={url:null,method:"post",withCredentials:!1,parallelUploads:2,uploadMultiple:!1,maxFilesize:256,paramName:"file",createImageThumbnails:!0,maxThumbnailFilesize:10,thumbnailWidth:120,thumbnailHeight:120,filesizeBase:1e3,maxFiles:null,params:{},clickable:!0,ignoreHiddenFiles:!0,acceptedFiles:null,acceptedMimeTypes:null,autoProcessQueue:!0,autoQueue:!0,addRemoveLinks:!1,previewsContainer:null,hiddenInputContainer:"body",capture:null,renameFilename:null,dictDefaultMessage:"Drop files here to upload",dictFallbackMessage:"Your browser does not support drag'n'drop file uploads.",dictFallbackText:"Please use the fallback form below to upload your files like in the olden days.",dictFileTooBig:"File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.",dictInvalidFileType:"You can't upload files of this type.",dictResponseError:"Server responded with {{statusCode}} code.",dictCancelUpload:"Cancel upload",dictCancelUploadConfirmation:"Are you sure you want to cancel this upload?",dictRemoveFile:"Remove file",dictRemoveFileConfirmation:null,dictMaxFilesExceeded:"You can not upload any more files.",accept:function(a,b){return b()},init:function(){return i},forceFallback:!1,fallback:function(){var a,c,d,e,f,g;for(this.element.className=""+this.element.className+" dz-browser-not-supported",g=this.element.getElementsByTagName("div"),e=0,f=g.length;f>e;e++)a=g[e],/(^| )dz-message($| )/.test(a.className)&&(c=a,a.className="dz-message");return c||(c=b.createElement('<div class="dz-message"><span></span></div>'),this.element.appendChild(c)),d=c.getElementsByTagName("span")[0],d&&(null!=d.textContent?d.textContent=this.options.dictFallbackMessage:null!=d.innerText&&(d.innerText=this.options.dictFallbackMessage)),this.element.appendChild(this.getFallbackForm())},resize:function(a){var b,c,d;return b={srcX:0,srcY:0,srcWidth:a.width,srcHeight:a.height},c=a.width/a.height,b.optWidth=this.options.thumbnailWidth,b.optHeight=this.options.thumbnailHeight,null==b.optWidth&&null==b.optHeight?(b.optWidth=b.srcWidth,b.optHeight=b.srcHeight):null==b.optWidth?b.optWidth=c*b.optHeight:null==b.optHeight&&(b.optHeight=1/c*b.optWidth),d=b.optWidth/b.optHeight,a.height<b.optHeight||a.width<b.optWidth?(b.trgHeight=b.srcHeight,b.trgWidth=b.srcWidth):c>d?(b.srcHeight=a.height,b.srcWidth=b.srcHeight*d):(b.srcWidth=a.width,b.srcHeight=b.srcWidth/d),b.srcX=(a.width-b.srcWidth)/2,b.srcY=(a.height-b.srcHeight)/2,b},drop:function(){return this.element.classList.remove("dz-drag-hover")},dragstart:i,dragend:function(){return this.element.classList.remove("dz-drag-hover")},dragenter:function(){return this.element.classList.add("dz-drag-hover")},dragover:function(){return this.element.classList.add("dz-drag-hover")},dragleave:function(){return this.element.classList.remove("dz-drag-hover")},paste:i,reset:function(){return this.element.classList.remove("dz-started")},addedfile:function(a){var c,d,e,f,g,h,i,j,k,l,m,n,o;if(this.element===this.previewsContainer&&this.element.classList.add("dz-started"),this.previewsContainer){for(a.previewElement=b.createElement(this.options.previewTemplate.trim()),a.previewTemplate=a.previewElement,this.previewsContainer.appendChild(a.previewElement),l=a.previewElement.querySelectorAll("[data-dz-name]"),f=0,i=l.length;i>f;f++)c=l[f],c.textContent=this._renameFilename(a.name);for(m=a.previewElement.querySelectorAll("[data-dz-size]"),g=0,j=m.length;j>g;g++)c=m[g],c.innerHTML=this.filesize(a.size);for(this.options.addRemoveLinks&&(a._removeLink=b.createElement('<a class="dz-remove" href="javascript:undefined;" data-dz-remove>'+this.options.dictRemoveFile+"</a>"),a.previewElement.appendChild(a._removeLink)),d=function(c){return function(d){return d.preventDefault(),d.stopPropagation(),a.status===b.UPLOADING?b.confirm(c.options.dictCancelUploadConfirmation,function(){return c.removeFile(a)}):c.options.dictRemoveFileConfirmation?b.confirm(c.options.dictRemoveFileConfirmation,function(){return c.removeFile(a)}):c.removeFile(a)}}(this),n=a.previewElement.querySelectorAll("[data-dz-remove]"),o=[],h=0,k=n.length;k>h;h++)e=n[h],o.push(e.addEventListener("click",d));return o}},removedfile:function(a){var b;return a.previewElement&&null!=(b=a.previewElement)&&b.parentNode.removeChild(a.previewElement),this._updateMaxFilesReachedClass()},thumbnail:function(a,b){var c,d,e,f;if(a.previewElement){for(a.previewElement.classList.remove("dz-file-preview"),f=a.previewElement.querySelectorAll("[data-dz-thumbnail]"),d=0,e=f.length;e>d;d++)c=f[d],c.alt=a.name,c.src=b;return setTimeout(function(){return function(){return a.previewElement.classList.add("dz-image-preview")}}(this),1)}},error:function(a,b){var c,d,e,f,g;if(a.previewElement){for(a.previewElement.classList.add("dz-error"),"String"!=typeof b&&b.error&&(b=b.error),f=a.previewElement.querySelectorAll("[data-dz-errormessage]"),g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(c.textContent=b);return g}},errormultiple:i,processing:function(a){return a.previewElement&&(a.previewElement.classList.add("dz-processing"),a._removeLink)?a._removeLink.textContent=this.options.dictCancelUpload:void 0},processingmultiple:i,uploadprogress:function(a,b){var c,d,e,f,g;if(a.previewElement){for(f=a.previewElement.querySelectorAll("[data-dz-uploadprogress]"),g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push("PROGRESS"===c.nodeName?c.value=b:c.style.width=""+b+"%");return g}},totaluploadprogress:i,sending:i,sendingmultiple:i,success:function(a){return a.previewElement?a.previewElement.classList.add("dz-success"):void 0},successmultiple:i,canceled:function(a){return this.emit("error",a,"Upload canceled.")},canceledmultiple:i,complete:function(a){return a._removeLink&&(a._removeLink.textContent=this.options.dictRemoveFile),a.previewElement?a.previewElement.classList.add("dz-complete"):void 0},completemultiple:i,maxfilesexceeded:i,maxfilesreached:i,queuecomplete:i,addedfiles:i,previewTemplate:'<div class="dz-preview dz-file-preview">\n <div class="dz-image"><img data-dz-thumbnail /></div>\n <div class="dz-details">\n <div class="dz-size"><span data-dz-size></span></div>\n <div class="dz-filename"><span data-dz-name></span></div>\n </div>\n <div class="dz-progress"><span class="dz-upload" data-dz-uploadprogress></span></div>\n <div class="dz-error-message"><span data-dz-errormessage></span></div>\n <div class="dz-success-mark">\n <svg width="54px" height="54px" viewBox="0 0 54 54" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">\n <title>Check</title>\n <defs></defs>\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">\n <path d="M23.5,31.8431458 L17.5852419,25.9283877 C16.0248253,24.3679711 13.4910294,24.366835 11.9289322,25.9289322 C10.3700136,27.4878508 10.3665912,30.0234455 11.9283877,31.5852419 L20.4147581,40.0716123 C20.5133999,40.1702541 20.6159315,40.2626649 20.7218615,40.3488435 C22.2835669,41.8725651 24.794234,41.8626202 26.3461564,40.3106978 L43.3106978,23.3461564 C44.8771021,21.7797521 44.8758057,19.2483887 43.3137085,17.6862915 C41.7547899,16.1273729 39.2176035,16.1255422 37.6538436,17.6893022 L23.5,31.8431458 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z" id="Oval-2" stroke-opacity="0.198794158" stroke="#747474" fill-opacity="0.816519475" fill="#FFFFFF" sketch:type="MSShapeGroup"></path>\n </g>\n </svg>\n </div>\n <div class="dz-error-mark">\n <svg width="54px" height="54px" viewBox="0 0 54 54" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">\n <title>Error</title>\n <defs></defs>\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">\n <g id="Check-+-Oval-2" sketch:type="MSLayerGroup" stroke="#747474" stroke-opacity="0.198794158" fill="#FFFFFF" fill-opacity="0.816519475">\n <path d="M32.6568542,29 L38.3106978,23.3461564 C39.8771021,21.7797521 39.8758057,19.2483887 38.3137085,17.6862915 C36.7547899,16.1273729 34.2176035,16.1255422 32.6538436,17.6893022 L27,23.3431458 L21.3461564,17.6893022 C19.7823965,16.1255422 17.2452101,16.1273729 15.6862915,17.6862915 C14.1241943,19.2483887 14.1228979,21.7797521 15.6893022,23.3461564 L21.3431458,29 L15.6893022,34.6538436 C14.1228979,36.2202479 14.1241943,38.7516113 15.6862915,40.3137085 C17.2452101,41.8726271 19.7823965,41.8744578 21.3461564,40.3106978 L27,34.6568542 L32.6538436,40.3106978 C34.2176035,41.8744578 36.7547899,41.8726271 38.3137085,40.3137085 C39.8758057,38.7516113 39.8771021,36.2202479 38.3106978,34.6538436 L32.6568542,29 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z" id="Oval-2" sketch:type="MSShapeGroup"></path>\n </g>\n </g>\n </svg>\n </div>\n</div>'},c=function(){var a,b,c,d,e,f,g;for(d=arguments[0],c=2<=arguments.length?k.call(arguments,1):[],f=0,g=c.length;g>f;f++){b=c[f];for(a in b)e=b[a],d[a]=e}return d},b.prototype.getAcceptedFiles=function(){var a,b,c,d,e;for(d=this.files,e=[],b=0,c=d.length;c>b;b++)a=d[b],a.accepted&&e.push(a);return e},b.prototype.getRejectedFiles=function(){var a,b,c,d,e;for(d=this.files,e=[],b=0,c=d.length;c>b;b++)a=d[b],a.accepted||e.push(a);return e},b.prototype.getFilesWithStatus=function(a){var b,c,d,e,f;for(e=this.files,f=[],c=0,d=e.length;d>c;c++)b=e[c],b.status===a&&f.push(b);return f},b.prototype.getQueuedFiles=function(){return this.getFilesWithStatus(b.QUEUED)},b.prototype.getUploadingFiles=function(){return this.getFilesWithStatus(b.UPLOADING)},b.prototype.getAddedFiles=function(){return this.getFilesWithStatus(b.ADDED)},b.prototype.getActiveFiles=function(){var a,c,d,e,f;for(e=this.files,f=[],c=0,d=e.length;d>c;c++)a=e[c],(a.status===b.UPLOADING||a.status===b.QUEUED)&&f.push(a);return f},b.prototype.init=function(){var a,c,d,e,f,g,h;for("form"===this.element.tagName&&this.element.setAttribute("enctype","multipart/form-data"),this.element.classList.contains("dropzone")&&!this.element.querySelector(".dz-message")&&this.element.appendChild(b.createElement('<div class="dz-default dz-message"><span>'+this.options.dictDefaultMessage+"</span></div>")),this.clickableElements.length&&(d=function(a){return function(){return a.hiddenFileInput&&a.hiddenFileInput.parentNode.removeChild(a.hiddenFileInput),a.hiddenFileInput=document.createElement("input"),a.hiddenFileInput.setAttribute("type","file"),(null==a.options.maxFiles||a.options.maxFiles>1)&&a.hiddenFileInput.setAttribute("multiple","multiple"),a.hiddenFileInput.className="dz-hidden-input",null!=a.options.acceptedFiles&&a.hiddenFileInput.setAttribute("accept",a.options.acceptedFiles),null!=a.options.capture&&a.hiddenFileInput.setAttribute("capture",a.options.capture),a.hiddenFileInput.style.visibility="hidden",a.hiddenFileInput.style.position="absolute",a.hiddenFileInput.style.top="0",a.hiddenFileInput.style.left="0",a.hiddenFileInput.style.height="0",a.hiddenFileInput.style.width="0",document.querySelector(a.options.hiddenInputContainer).appendChild(a.hiddenFileInput),a.hiddenFileInput.addEventListener("change",function(){var b,c,e,f;if(c=a.hiddenFileInput.files,c.length)for(e=0,f=c.length;f>e;e++)b=c[e],a.addFile(b);return a.emit("addedfiles",c),d()})}}(this))(),this.URL=null!=(g=window.URL)?g:window.webkitURL,h=this.events,e=0,f=h.length;f>e;e++)a=h[e],this.on(a,this.options[a]);return this.on("uploadprogress",function(a){return function(){return a.updateTotalUploadProgress()}}(this)),this.on("removedfile",function(a){return function(){return a.updateTotalUploadProgress()}}(this)),this.on("canceled",function(a){return function(b){return a.emit("complete",b)}}(this)),this.on("complete",function(a){return function(){return 0===a.getAddedFiles().length&&0===a.getUploadingFiles().length&&0===a.getQueuedFiles().length?setTimeout(function(){return a.emit("queuecomplete")},0):void 0}}(this)),c=function(a){return a.stopPropagation(),a.preventDefault?a.preventDefault():a.returnValue=!1},this.listeners=[{element:this.element,events:{dragstart:function(a){return function(b){return a.emit("dragstart",b)}}(this),dragenter:function(a){return function(b){return c(b),a.emit("dragenter",b)}}(this),dragover:function(a){return function(b){var d;try{d=b.dataTransfer.effectAllowed}catch(e){}return b.dataTransfer.dropEffect="move"===d||"linkMove"===d?"move":"copy",c(b),a.emit("dragover",b)}}(this),dragleave:function(a){return function(b){return a.emit("dragleave",b)}}(this),drop:function(a){return function(b){return c(b),a.drop(b)}}(this),dragend:function(a){return function(b){return a.emit("dragend",b)}}(this)}}],this.clickableElements.forEach(function(a){return function(c){return a.listeners.push({element:c,events:{click:function(d){return(c!==a.element||d.target===a.element||b.elementInside(d.target,a.element.querySelector(".dz-message")))&&a.hiddenFileInput.click(),!0}}})}}(this)),this.enable(),this.options.init.call(this)},b.prototype.destroy=function(){var a;return this.disable(),this.removeAllFiles(!0),(null!=(a=this.hiddenFileInput)?a.parentNode:void 0)&&(this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput),this.hiddenFileInput=null),delete this.element.dropzone,b.instances.splice(b.instances.indexOf(this),1)},b.prototype.updateTotalUploadProgress=function(){var a,b,c,d,e,f,g,h;if(d=0,c=0,a=this.getActiveFiles(),a.length){for(h=this.getActiveFiles(),f=0,g=h.length;g>f;f++)b=h[f],d+=b.upload.bytesSent,c+=b.upload.total;e=100*d/c}else e=100;return this.emit("totaluploadprogress",e,c,d)},b.prototype._getParamName=function(a){return"function"==typeof this.options.paramName?this.options.paramName(a):""+this.options.paramName+(this.options.uploadMultiple?"["+a+"]":"")},b.prototype._renameFilename=function(a){return"function"!=typeof this.options.renameFilename?a:this.options.renameFilename(a)},b.prototype.getFallbackForm=function(){var a,c,d,e;return(a=this.getExistingFallback())?a:(d='<div class="dz-fallback">',this.options.dictFallbackText&&(d+="<p>"+this.options.dictFallbackText+"</p>"),d+='<input type="file" name="'+this._getParamName(0)+'" '+(this.options.uploadMultiple?'multiple="multiple"':void 0)+' /><input type="submit" value="Upload!"></div>',c=b.createElement(d),"FORM"!==this.element.tagName?(e=b.createElement('<form action="'+this.options.url+'" enctype="multipart/form-data" method="'+this.options.method+'"></form>'),e.appendChild(c)):(this.element.setAttribute("enctype","multipart/form-data"),this.element.setAttribute("method",this.options.method)),null!=e?e:c)},b.prototype.getExistingFallback=function(){var a,b,c,d,e,f;for(b=function(a){var b,c,d;for(c=0,d=a.length;d>c;c++)if(b=a[c],/(^| )fallback($| )/.test(b.className))return b},f=["div","form"],d=0,e=f.length;e>d;d++)if(c=f[d],a=b(this.element.getElementsByTagName(c)))return a},b.prototype.setupEventListeners=function(){var a,b,c,d,e,f,g;for(f=this.listeners,g=[],d=0,e=f.length;e>d;d++)a=f[d],g.push(function(){var d,e;d=a.events,e=[];for(b in d)c=d[b],e.push(a.element.addEventListener(b,c,!1));return e}());return g},b.prototype.removeEventListeners=function(){var a,b,c,d,e,f,g;for(f=this.listeners,g=[],d=0,e=f.length;e>d;d++)a=f[d],g.push(function(){var d,e;d=a.events,e=[];for(b in d)c=d[b],e.push(a.element.removeEventListener(b,c,!1));return e}());return g},b.prototype.disable=function(){var a,b,c,d,e;for(this.clickableElements.forEach(function(a){return a.classList.remove("dz-clickable")}),this.removeEventListeners(),d=this.files,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(this.cancelUpload(a));return e},b.prototype.enable=function(){return this.clickableElements.forEach(function(a){return a.classList.add("dz-clickable")}),this.setupEventListeners()},b.prototype.filesize=function(a){var b,c,d,e,f,g,h,i;if(d=0,e="b",a>0){for(g=["TB","GB","MB","KB","b"],c=h=0,i=g.length;i>h;c=++h)if(f=g[c],b=Math.pow(this.options.filesizeBase,4-c)/10,a>=b){d=a/Math.pow(this.options.filesizeBase,4-c),e=f;break}d=Math.round(10*d)/10}return"<strong>"+d+"</strong> "+e},b.prototype._updateMaxFilesReachedClass=function(){return null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(this.getAcceptedFiles().length===this.options.maxFiles&&this.emit("maxfilesreached",this.files),this.element.classList.add("dz-max-files-reached")):this.element.classList.remove("dz-max-files-reached")},b.prototype.drop=function(a){var b,c;a.dataTransfer&&(this.emit("drop",a),b=a.dataTransfer.files,this.emit("addedfiles",b),b.length&&(c=a.dataTransfer.items,c&&c.length&&null!=c[0].webkitGetAsEntry?this._addFilesFromItems(c):this.handleFiles(b)))},b.prototype.paste=function(a){var b,c;if(null!=(null!=a&&null!=(c=a.clipboardData)?c.items:void 0))return this.emit("paste",a),b=a.clipboardData.items,b.length?this._addFilesFromItems(b):void 0},b.prototype.handleFiles=function(a){var b,c,d,e;for(e=[],c=0,d=a.length;d>c;c++)b=a[c],e.push(this.addFile(b));return e},b.prototype._addFilesFromItems=function(a){var b,c,d,e,f;for(f=[],d=0,e=a.length;e>d;d++)c=a[d],f.push(null!=c.webkitGetAsEntry&&(b=c.webkitGetAsEntry())?b.isFile?this.addFile(c.getAsFile()):b.isDirectory?this._addFilesFromDirectory(b,b.name):void 0:null!=c.getAsFile?null==c.kind||"file"===c.kind?this.addFile(c.getAsFile()):void 0:void 0);return f},b.prototype._addFilesFromDirectory=function(a,b){var c,d,e;return c=a.createReader(),d=function(a){return"undefined"!=typeof console&&null!==console&&"function"==typeof console.log?console.log(a):void 0},(e=function(a){return function(){return c.readEntries(function(c){var d,f,g;if(c.length>0){for(f=0,g=c.length;g>f;f++)d=c[f],d.isFile?d.file(function(c){return a.options.ignoreHiddenFiles&&"."===c.name.substring(0,1)?void 0:(c.fullPath=""+b+"/"+c.name,a.addFile(c))}):d.isDirectory&&a._addFilesFromDirectory(d,""+b+"/"+d.name);e()}return null},d)}}(this))()},b.prototype.accept=function(a,c){return a.size>1024*this.options.maxFilesize*1024?c(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(a.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize)):b.isValidFile(a,this.options.acceptedFiles)?null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(c(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles)),this.emit("maxfilesexceeded",a)):this.options.accept.call(this,a,c):c(this.options.dictInvalidFileType)},b.prototype.addFile=function(a){return a.upload={progress:0,total:a.size,bytesSent:0},this.files.push(a),a.status=b.ADDED,this.emit("addedfile",a),this._enqueueThumbnail(a),this.accept(a,function(b){return function(c){return c?(a.accepted=!1,b._errorProcessing([a],c)):(a.accepted=!0,b.options.autoQueue&&b.enqueueFile(a)),b._updateMaxFilesReachedClass()}}(this))},b.prototype.enqueueFiles=function(a){var b,c,d;for(c=0,d=a.length;d>c;c++)b=a[c],this.enqueueFile(b);return null},b.prototype.enqueueFile=function(a){if(a.status!==b.ADDED||a.accepted!==!0)throw new Error("This file can't be queued because it has already been processed or was rejected.");return a.status=b.QUEUED,this.options.autoProcessQueue?setTimeout(function(a){return function(){return a.processQueue()}}(this),0):void 0},b.prototype._thumbnailQueue=[],b.prototype._processingThumbnail=!1,b.prototype._enqueueThumbnail=function(a){return this.options.createImageThumbnails&&a.type.match(/image.*/)&&a.size<=1024*this.options.maxThumbnailFilesize*1024?(this._thumbnailQueue.push(a),setTimeout(function(a){return function(){return a._processThumbnailQueue()}}(this),0)):void 0},b.prototype._processThumbnailQueue=function(){return this._processingThumbnail||0===this._thumbnailQueue.length?void 0:(this._processingThumbnail=!0,this.createThumbnail(this._thumbnailQueue.shift(),function(a){return function(){return a._processingThumbnail=!1,a._processThumbnailQueue()}}(this)))},b.prototype.removeFile=function(a){return a.status===b.UPLOADING&&this.cancelUpload(a),this.files=j(this.files,a),this.emit("removedfile",a),0===this.files.length?this.emit("reset"):void 0},b.prototype.removeAllFiles=function(a){var c,d,e,f;for(null==a&&(a=!1),f=this.files.slice(),d=0,e=f.length;e>d;d++)c=f[d],(c.status!==b.UPLOADING||a)&&this.removeFile(c);return null},b.prototype.createThumbnail=function(a,b){var c;return c=new FileReader,c.onload=function(d){return function(){return"image/svg+xml"===a.type?(d.emit("thumbnail",a,c.result),void(null!=b&&b())):d.createThumbnailFromUrl(a,c.result,b)}}(this),c.readAsDataURL(a)},b.prototype.createThumbnailFromUrl=function(a,b,c,d){var e;return e=document.createElement("img"),d&&(e.crossOrigin=d),e.onload=function(b){return function(){var d,f,g,i,j,k,l,m;return a.width=e.width,a.height=e.height,g=b.options.resize.call(b,a),null==g.trgWidth&&(g.trgWidth=g.optWidth),null==g.trgHeight&&(g.trgHeight=g.optHeight),d=document.createElement("canvas"),f=d.getContext("2d"),d.width=g.trgWidth,d.height=g.trgHeight,h(f,e,null!=(j=g.srcX)?j:0,null!=(k=g.srcY)?k:0,g.srcWidth,g.srcHeight,null!=(l=g.trgX)?l:0,null!=(m=g.trgY)?m:0,g.trgWidth,g.trgHeight),i=d.toDataURL("image/png"),b.emit("thumbnail",a,i),null!=c?c():void 0}}(this),null!=c&&(e.onerror=c),e.src=b},b.prototype.processQueue=function(){var a,b,c,d;if(b=this.options.parallelUploads,c=this.getUploadingFiles().length,a=c,!(c>=b)&&(d=this.getQueuedFiles(),d.length>0)){if(this.options.uploadMultiple)return this.processFiles(d.slice(0,b-c));for(;b>a;){if(!d.length)return;this.processFile(d.shift()),a++}}},b.prototype.processFile=function(a){return this.processFiles([a])},b.prototype.processFiles=function(a){var c,d,e;for(d=0,e=a.length;e>d;d++)c=a[d],c.processing=!0,c.status=b.UPLOADING,this.emit("processing",c);return this.options.uploadMultiple&&this.emit("processingmultiple",a),this.uploadFiles(a)},b.prototype._getFilesWithXhr=function(a){var b,c;return c=function(){var c,d,e,f;for(e=this.files,f=[],c=0,d=e.length;d>c;c++)b=e[c],b.xhr===a&&f.push(b);return f}.call(this)},b.prototype.cancelUpload=function(a){var c,d,e,f,g,h,i;if(a.status===b.UPLOADING){for(d=this._getFilesWithXhr(a.xhr),e=0,g=d.length;g>e;e++)c=d[e],c.status=b.CANCELED;for(a.xhr.abort(),f=0,h=d.length;h>f;f++)c=d[f],this.emit("canceled",c);this.options.uploadMultiple&&this.emit("canceledmultiple",d)}else((i=a.status)===b.ADDED||i===b.QUEUED)&&(a.status=b.CANCELED,this.emit("canceled",a),this.options.uploadMultiple&&this.emit("canceledmultiple",[a]));return this.options.autoProcessQueue?this.processQueue():void 0},e=function(){var a,b;return b=arguments[0],a=2<=arguments.length?k.call(arguments,1):[],"function"==typeof b?b.apply(this,a):b},b.prototype.uploadFile=function(a){return this.uploadFiles([a])},b.prototype.uploadFiles=function(a){var d,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L;for(w=new XMLHttpRequest,x=0,B=a.length;B>x;x++)d=a[x],d.xhr=w;p=e(this.options.method,a),u=e(this.options.url,a),w.open(p,u,!0),w.withCredentials=!!this.options.withCredentials,s=null,g=function(b){return function(){var c,e,f;for(f=[],c=0,e=a.length;e>c;c++)d=a[c],f.push(b._errorProcessing(a,s||b.options.dictResponseError.replace("{{statusCode}}",w.status),w));return f}}(this),t=function(b){return function(c){var e,f,g,h,i,j,k,l,m;if(null!=c)for(f=100*c.loaded/c.total,g=0,j=a.length;j>g;g++)d=a[g],d.upload={progress:f,total:c.total,bytesSent:c.loaded};else{for(e=!0,f=100,h=0,k=a.length;k>h;h++)d=a[h],(100!==d.upload.progress||d.upload.bytesSent!==d.upload.total)&&(e=!1),d.upload.progress=f,d.upload.bytesSent=d.upload.total;if(e)return}for(m=[],i=0,l=a.length;l>i;i++)d=a[i],m.push(b.emit("uploadprogress",d,f,d.upload.bytesSent));return m}}(this),w.onload=function(c){return function(d){var e;if(a[0].status!==b.CANCELED&&4===w.readyState){if(s=w.responseText,w.getResponseHeader("content-type")&&~w.getResponseHeader("content-type").indexOf("application/json"))try{s=JSON.parse(s)}catch(f){d=f,s="Invalid JSON response from server."}return t(),200<=(e=w.status)&&300>e?c._finished(a,s,d):g()}}}(this),w.onerror=function(){return function(){return a[0].status!==b.CANCELED?g():void 0}}(this),r=null!=(G=w.upload)?G:w,r.onprogress=t,j={Accept:"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"},this.options.headers&&c(j,this.options.headers);for(h in j)i=j[h],i&&w.setRequestHeader(h,i);if(f=new FormData,this.options.params){H=this.options.params;for(o in H)v=H[o],f.append(o,v)}for(y=0,C=a.length;C>y;y++)d=a[y],this.emit("sending",d,w,f);if(this.options.uploadMultiple&&this.emit("sendingmultiple",a,w,f),"FORM"===this.element.tagName)for(I=this.element.querySelectorAll("input, textarea, select, button"),z=0,D=I.length;D>z;z++)if(l=I[z],m=l.getAttribute("name"),n=l.getAttribute("type"),"SELECT"===l.tagName&&l.hasAttribute("multiple"))for(J=l.options,A=0,E=J.length;E>A;A++)q=J[A],q.selected&&f.append(m,q.value);else(!n||"checkbox"!==(K=n.toLowerCase())&&"radio"!==K||l.checked)&&f.append(m,l.value);for(k=F=0,L=a.length-1;L>=0?L>=F:F>=L;k=L>=0?++F:--F)f.append(this._getParamName(k),a[k],this._renameFilename(a[k].name));return this.submitRequest(w,f,a)},b.prototype.submitRequest=function(a,b){return a.send(b)},b.prototype._finished=function(a,c,d){var e,f,g;for(f=0,g=a.length;g>f;f++)e=a[f],e.status=b.SUCCESS,this.emit("success",e,c,d),this.emit("complete",e);return this.options.uploadMultiple&&(this.emit("successmultiple",a,c,d),this.emit("completemultiple",a)),this.options.autoProcessQueue?this.processQueue():void 0},b.prototype._errorProcessing=function(a,c,d){var e,f,g;for(f=0,g=a.length;g>f;f++)e=a[f],e.status=b.ERROR,this.emit("error",e,c,d),this.emit("complete",e);return this.options.uploadMultiple&&(this.emit("errormultiple",a,c,d),this.emit("completemultiple",a)),this.options.autoProcessQueue?this.processQueue():void 0},b}(d),c.version="4.3.0",c.options={},c.optionsForElement=function(a){return a.getAttribute("id")?c.options[e(a.getAttribute("id"))]:void 0},c.instances=[],c.forElement=function(a){if("string"==typeof a&&(a=document.querySelector(a)),null==(null!=a?a.dropzone:void 0))throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone.");return a.dropzone},c.autoDiscover=!0,c.discover=function(){var a,b,d,e,f,g;for(document.querySelectorAll?d=document.querySelectorAll(".dropzone"):(d=[],a=function(a){var b,c,e,f;for(f=[],c=0,e=a.length;e>c;c++)b=a[c],f.push(/(^| )dropzone($| )/.test(b.className)?d.push(b):void 0);return f},a(document.getElementsByTagName("div")),a(document.getElementsByTagName("form"))),g=[],e=0,f=d.length;f>e;e++)b=d[e],g.push(c.optionsForElement(b)!==!1?new c(b):void 0);return g},c.blacklistedBrowsers=[/opera.*Macintosh.*version\/12/i],c.isBrowserSupported=function(){var a,b,d,e,f;if(a=!0,window.File&&window.FileReader&&window.FileList&&window.Blob&&window.FormData&&document.querySelector)if("classList"in document.createElement("a"))for(f=c.blacklistedBrowsers,d=0,e=f.length;e>d;d++)b=f[d],b.test(navigator.userAgent)&&(a=!1);else a=!1;else a=!1;return a},j=function(a,b){var c,d,e,f;for(f=[],d=0,e=a.length;e>d;d++)c=a[d],c!==b&&f.push(c);return f},e=function(a){return a.replace(/[\-_](\w)/g,function(a){return a.charAt(1).toUpperCase()})},c.createElement=function(a){var b;return b=document.createElement("div"),b.innerHTML=a,b.childNodes[0]},c.elementInside=function(a,b){if(a===b)return!0;for(;a=a.parentNode;)if(a===b)return!0;return!1},c.getElement=function(a,b){var c;if("string"==typeof a?c=document.querySelector(a):null!=a.nodeType&&(c=a),null==c)throw new Error("Invalid `"+b+"` option provided. Please provide a CSS selector or a plain HTML element.");return c},c.getElements=function(a,b){var c,d,e,f,g,h,i,j;if(a instanceof Array){e=[];try{for(f=0,h=a.length;h>f;f++)d=a[f],e.push(this.getElement(d,b))}catch(k){c=k,e=null}}else if("string"==typeof a)for(e=[],j=document.querySelectorAll(a),g=0,i=j.length;i>g;g++)d=j[g],e.push(d);else null!=a.nodeType&&(e=[a]);if(null==e||!e.length)throw new Error("Invalid `"+b+"` option provided. Please provide a CSS selector, a plain HTML element or a list of those.");return e},c.confirm=function(a,b,c){return window.confirm(a)?b():null!=c?c():void 0},c.isValidFile=function(a,b){var c,d,e,f,g;if(!b)return!0;for(b=b.split(","),d=a.type,c=d.replace(/\/.*$/,""),f=0,g=b.length;g>f;f++)if(e=b[f],e=e.trim(),"."===e.charAt(0)){if(-1!==a.name.toLowerCase().indexOf(e.toLowerCase(),a.name.length-e.length))return!0
|
2
|
+
}else if(/\/\*$/.test(e)){if(c===e.replace(/\/.*$/,""))return!0}else if(d===e)return!0;return!1},"undefined"!=typeof a&&null!==a&&(a.fn.dropzone=function(a){return this.each(function(){return new c(this,a)})}),"undefined"!=typeof b&&null!==b?b.exports=c:window.Dropzone=c,c.ADDED="added",c.QUEUED="queued",c.ACCEPTED=c.QUEUED,c.UPLOADING="uploading",c.PROCESSING=c.UPLOADING,c.CANCELED="canceled",c.ERROR="error",c.SUCCESS="success",g=function(a){var b,c,d,e,f,g,h,i,j,k;for(h=a.naturalWidth,g=a.naturalHeight,c=document.createElement("canvas"),c.width=1,c.height=g,d=c.getContext("2d"),d.drawImage(a,0,0),e=d.getImageData(0,0,1,g).data,k=0,f=g,i=g;i>k;)b=e[4*(i-1)+3],0===b?f=i:k=i,i=f+k>>1;return j=i/g,0===j?1:j},h=function(a,b,c,d,e,f,h,i,j,k){var l;return l=g(b),a.drawImage(b,c,d,e,f,h,i,j,k/l)},f=function(a,b){var c,d,e,f,g,h,i,j,k;if(e=!1,k=!0,d=a.document,j=d.documentElement,c=d.addEventListener?"addEventListener":"attachEvent",i=d.addEventListener?"removeEventListener":"detachEvent",h=d.addEventListener?"":"on",f=function(c){return"readystatechange"!==c.type||"complete"===d.readyState?(("load"===c.type?a:d)[i](h+c.type,f,!1),!e&&(e=!0)?b.call(a,c.type||c):void 0):void 0},g=function(){var a;try{j.doScroll("left")}catch(b){return a=b,void setTimeout(g,50)}return f("poll")},"complete"!==d.readyState){if(d.createEventObject&&j.doScroll){try{k=!a.frameElement}catch(l){}k&&g()}return d[c](h+"DOMContentLoaded",f,!1),d[c](h+"readystatechange",f,!1),a[c](h+"load",f,!1)}},c._autoDiscoverFunction=function(){return c.autoDiscover?c.discover():void 0},f(window,c._autoDiscoverFunction)}.call(this),b.exports});
|
@@ -0,0 +1 @@
|
|
1
|
+
@-webkit-keyframes passing-through{0%{opacity:0;-webkit-transform:translateY(40px);-moz-transform:translateY(40px);-ms-transform:translateY(40px);-o-transform:translateY(40px);transform:translateY(40px)}30%, 70%{opacity:1;-webkit-transform:translateY(0px);-moz-transform:translateY(0px);-ms-transform:translateY(0px);-o-transform:translateY(0px);transform:translateY(0px)}100%{opacity:0;-webkit-transform:translateY(-40px);-moz-transform:translateY(-40px);-ms-transform:translateY(-40px);-o-transform:translateY(-40px);transform:translateY(-40px)}}@-moz-keyframes passing-through{0%{opacity:0;-webkit-transform:translateY(40px);-moz-transform:translateY(40px);-ms-transform:translateY(40px);-o-transform:translateY(40px);transform:translateY(40px)}30%, 70%{opacity:1;-webkit-transform:translateY(0px);-moz-transform:translateY(0px);-ms-transform:translateY(0px);-o-transform:translateY(0px);transform:translateY(0px)}100%{opacity:0;-webkit-transform:translateY(-40px);-moz-transform:translateY(-40px);-ms-transform:translateY(-40px);-o-transform:translateY(-40px);transform:translateY(-40px)}}@keyframes passing-through{0%{opacity:0;-webkit-transform:translateY(40px);-moz-transform:translateY(40px);-ms-transform:translateY(40px);-o-transform:translateY(40px);transform:translateY(40px)}30%, 70%{opacity:1;-webkit-transform:translateY(0px);-moz-transform:translateY(0px);-ms-transform:translateY(0px);-o-transform:translateY(0px);transform:translateY(0px)}100%{opacity:0;-webkit-transform:translateY(-40px);-moz-transform:translateY(-40px);-ms-transform:translateY(-40px);-o-transform:translateY(-40px);transform:translateY(-40px)}}@-webkit-keyframes slide-in{0%{opacity:0;-webkit-transform:translateY(40px);-moz-transform:translateY(40px);-ms-transform:translateY(40px);-o-transform:translateY(40px);transform:translateY(40px)}30%{opacity:1;-webkit-transform:translateY(0px);-moz-transform:translateY(0px);-ms-transform:translateY(0px);-o-transform:translateY(0px);transform:translateY(0px)}}@-moz-keyframes slide-in{0%{opacity:0;-webkit-transform:translateY(40px);-moz-transform:translateY(40px);-ms-transform:translateY(40px);-o-transform:translateY(40px);transform:translateY(40px)}30%{opacity:1;-webkit-transform:translateY(0px);-moz-transform:translateY(0px);-ms-transform:translateY(0px);-o-transform:translateY(0px);transform:translateY(0px)}}@keyframes slide-in{0%{opacity:0;-webkit-transform:translateY(40px);-moz-transform:translateY(40px);-ms-transform:translateY(40px);-o-transform:translateY(40px);transform:translateY(40px)}30%{opacity:1;-webkit-transform:translateY(0px);-moz-transform:translateY(0px);-ms-transform:translateY(0px);-o-transform:translateY(0px);transform:translateY(0px)}}@-webkit-keyframes pulse{0%{-webkit-transform:scale(1);-moz-transform:scale(1);-ms-transform:scale(1);-o-transform:scale(1);transform:scale(1)}10%{-webkit-transform:scale(1.1);-moz-transform:scale(1.1);-ms-transform:scale(1.1);-o-transform:scale(1.1);transform:scale(1.1)}20%{-webkit-transform:scale(1);-moz-transform:scale(1);-ms-transform:scale(1);-o-transform:scale(1);transform:scale(1)}}@-moz-keyframes pulse{0%{-webkit-transform:scale(1);-moz-transform:scale(1);-ms-transform:scale(1);-o-transform:scale(1);transform:scale(1)}10%{-webkit-transform:scale(1.1);-moz-transform:scale(1.1);-ms-transform:scale(1.1);-o-transform:scale(1.1);transform:scale(1.1)}20%{-webkit-transform:scale(1);-moz-transform:scale(1);-ms-transform:scale(1);-o-transform:scale(1);transform:scale(1)}}@keyframes pulse{0%{-webkit-transform:scale(1);-moz-transform:scale(1);-ms-transform:scale(1);-o-transform:scale(1);transform:scale(1)}10%{-webkit-transform:scale(1.1);-moz-transform:scale(1.1);-ms-transform:scale(1.1);-o-transform:scale(1.1);transform:scale(1.1)}20%{-webkit-transform:scale(1);-moz-transform:scale(1);-ms-transform:scale(1);-o-transform:scale(1);transform:scale(1)}}.dropzone,.dropzone *{box-sizing:border-box}.dropzone{min-height:150px;border:2px solid rgba(0,0,0,0.3);background:white;padding:20px 20px}.dropzone.dz-clickable{cursor:pointer}.dropzone.dz-clickable *{cursor:default}.dropzone.dz-clickable .dz-message,.dropzone.dz-clickable .dz-message *{cursor:pointer}.dropzone.dz-started .dz-message{display:none}.dropzone.dz-drag-hover{border-style:solid}.dropzone.dz-drag-hover .dz-message{opacity:0.5}.dropzone .dz-message{text-align:center;margin:2em 0}.dropzone .dz-preview{position:relative;display:inline-block;vertical-align:top;margin:16px;min-height:100px}.dropzone .dz-preview:hover{z-index:1000}.dropzone .dz-preview:hover .dz-details{opacity:1}.dropzone .dz-preview.dz-file-preview .dz-image{border-radius:20px;background:#999;background:linear-gradient(to bottom, #eee, #ddd)}.dropzone .dz-preview.dz-file-preview .dz-details{opacity:1}.dropzone .dz-preview.dz-image-preview{background:white}.dropzone .dz-preview.dz-image-preview .dz-details{-webkit-transition:opacity 0.2s linear;-moz-transition:opacity 0.2s linear;-ms-transition:opacity 0.2s linear;-o-transition:opacity 0.2s linear;transition:opacity 0.2s linear}.dropzone .dz-preview .dz-remove{font-size:14px;text-align:center;display:block;cursor:pointer;border:none}.dropzone .dz-preview .dz-remove:hover{text-decoration:underline}.dropzone .dz-preview:hover .dz-details{opacity:1}.dropzone .dz-preview .dz-details{z-index:20;position:absolute;top:0;left:0;opacity:0;font-size:13px;min-width:100%;max-width:100%;padding:2em 1em;text-align:center;color:rgba(0,0,0,0.9);line-height:150%}.dropzone .dz-preview .dz-details .dz-size{margin-bottom:1em;font-size:16px}.dropzone .dz-preview .dz-details .dz-filename{white-space:nowrap}.dropzone .dz-preview .dz-details .dz-filename:hover span{border:1px solid rgba(200,200,200,0.8);background-color:rgba(255,255,255,0.8)}.dropzone .dz-preview .dz-details .dz-filename:not(:hover){overflow:hidden;text-overflow:ellipsis}.dropzone .dz-preview .dz-details .dz-filename:not(:hover) span{border:1px solid transparent}.dropzone .dz-preview .dz-details .dz-filename span,.dropzone .dz-preview .dz-details .dz-size span{background-color:rgba(255,255,255,0.4);padding:0 0.4em;border-radius:3px}.dropzone .dz-preview:hover .dz-image img{-webkit-transform:scale(1.05, 1.05);-moz-transform:scale(1.05, 1.05);-ms-transform:scale(1.05, 1.05);-o-transform:scale(1.05, 1.05);transform:scale(1.05, 1.05);-webkit-filter:blur(8px);filter:blur(8px)}.dropzone .dz-preview .dz-image{border-radius:20px;overflow:hidden;width:120px;height:120px;position:relative;display:block;z-index:10}.dropzone .dz-preview .dz-image img{display:block}.dropzone .dz-preview.dz-success .dz-success-mark{-webkit-animation:passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);-moz-animation:passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);-ms-animation:passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);-o-animation:passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);animation:passing-through 3s cubic-bezier(0.77, 0, 0.175, 1)}.dropzone .dz-preview.dz-error .dz-error-mark{opacity:1;-webkit-animation:slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);-moz-animation:slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);-ms-animation:slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);-o-animation:slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);animation:slide-in 3s cubic-bezier(0.77, 0, 0.175, 1)}.dropzone .dz-preview .dz-success-mark,.dropzone .dz-preview .dz-error-mark{pointer-events:none;opacity:0;z-index:500;position:absolute;display:block;top:50%;left:50%;margin-left:-27px;margin-top:-27px}.dropzone .dz-preview .dz-success-mark svg,.dropzone .dz-preview .dz-error-mark svg{display:block;width:54px;height:54px}.dropzone .dz-preview.dz-processing .dz-progress{opacity:1;-webkit-transition:all 0.2s linear;-moz-transition:all 0.2s linear;-ms-transition:all 0.2s linear;-o-transition:all 0.2s linear;transition:all 0.2s linear}.dropzone .dz-preview.dz-complete .dz-progress{opacity:0;-webkit-transition:opacity 0.4s ease-in;-moz-transition:opacity 0.4s ease-in;-ms-transition:opacity 0.4s ease-in;-o-transition:opacity 0.4s ease-in;transition:opacity 0.4s ease-in}.dropzone .dz-preview:not(.dz-processing) .dz-progress{-webkit-animation:pulse 6s ease infinite;-moz-animation:pulse 6s ease infinite;-ms-animation:pulse 6s ease infinite;-o-animation:pulse 6s ease infinite;animation:pulse 6s ease infinite}.dropzone .dz-preview .dz-progress{opacity:1;z-index:1000;pointer-events:none;position:absolute;height:16px;left:50%;top:50%;margin-top:-8px;width:80px;margin-left:-40px;background:rgba(255,255,255,0.9);-webkit-transform:scale(1);border-radius:8px;overflow:hidden}.dropzone .dz-preview .dz-progress .dz-upload{background:#333;background:linear-gradient(to bottom, #666, #444);position:absolute;top:0;left:0;bottom:0;width:0;-webkit-transition:width 300ms ease-in-out;-moz-transition:width 300ms ease-in-out;-ms-transition:width 300ms ease-in-out;-o-transition:width 300ms ease-in-out;transition:width 300ms ease-in-out}.dropzone .dz-preview.dz-error .dz-error-message{display:block}.dropzone .dz-preview.dz-error:hover .dz-error-message{opacity:1;pointer-events:auto}.dropzone .dz-preview .dz-error-message{pointer-events:none;z-index:1000;position:absolute;display:block;display:none;opacity:0;-webkit-transition:opacity 0.3s ease;-moz-transition:opacity 0.3s ease;-ms-transition:opacity 0.3s ease;-o-transition:opacity 0.3s ease;transition:opacity 0.3s ease;border-radius:8px;font-size:13px;top:130px;left:-10px;width:140px;background:#be2626;background:linear-gradient(to bottom, #be2626, #a92222);padding:0.5em 1.2em;color:white}.dropzone .dz-preview .dz-error-message:after{content:'';position:absolute;top:-6px;left:64px;width:0;height:0;border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #be2626}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
(function(){var a,b,c,d,e,f,g,h,i=[].slice,j={}.hasOwnProperty,k=function(a,b){function c(){this.constructor=a}for(var d in b)j.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};g=function(){},b=function(){function a(){}return a.prototype.addEventListener=a.prototype.on,a.prototype.on=function(a,b){return this._callbacks=this._callbacks||{},this._callbacks[a]||(this._callbacks[a]=[]),this._callbacks[a].push(b),this},a.prototype.emit=function(){var a,b,c,d,e,f;if(d=arguments[0],a=2<=arguments.length?i.call(arguments,1):[],this._callbacks=this._callbacks||{},c=this._callbacks[d])for(e=0,f=c.length;f>e;e++)b=c[e],b.apply(this,a);return this},a.prototype.removeListener=a.prototype.off,a.prototype.removeAllListeners=a.prototype.off,a.prototype.removeEventListener=a.prototype.off,a.prototype.off=function(a,b){var c,d,e,f,g;if(!this._callbacks||0===arguments.length)return this._callbacks={},this;if(d=this._callbacks[a],!d)return this;if(1===arguments.length)return delete this._callbacks[a],this;for(e=f=0,g=d.length;g>f;e=++f)if(c=d[e],c===b){d.splice(e,1);break}return this},a}(),a=function(a){function c(a,b){var e,f,g;if(this.element=a,this.version=c.version,this.defaultOptions.previewTemplate=this.defaultOptions.previewTemplate.replace(/\n*/g,""),this.clickableElements=[],this.listeners=[],this.files=[],"string"==typeof this.element&&(this.element=document.querySelector(this.element)),!this.element||null==this.element.nodeType)throw new Error("Invalid dropzone element.");if(this.element.dropzone)throw new Error("Dropzone already attached.");if(c.instances.push(this),this.element.dropzone=this,e=null!=(g=c.optionsForElement(this.element))?g:{},this.options=d({},this.defaultOptions,e,null!=b?b:{}),this.options.forceFallback||!c.isBrowserSupported())return this.options.fallback.call(this);if(null==this.options.url&&(this.options.url=this.element.getAttribute("action")),!this.options.url)throw new Error("No URL provided.");if(this.options.acceptedFiles&&this.options.acceptedMimeTypes)throw new Error("You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated.");this.options.acceptedMimeTypes&&(this.options.acceptedFiles=this.options.acceptedMimeTypes,delete this.options.acceptedMimeTypes),this.options.method=this.options.method.toUpperCase(),(f=this.getExistingFallback())&&f.parentNode&&f.parentNode.removeChild(f),this.options.previewsContainer!==!1&&(this.previewsContainer=this.options.previewsContainer?c.getElement(this.options.previewsContainer,"previewsContainer"):this.element),this.options.clickable&&(this.clickableElements=this.options.clickable===!0?[this.element]:c.getElements(this.options.clickable,"clickable")),this.init()}var d,e;return k(c,a),c.prototype.Emitter=b,c.prototype.events=["drop","dragstart","dragend","dragenter","dragover","dragleave","addedfile","addedfiles","removedfile","thumbnail","error","errormultiple","processing","processingmultiple","uploadprogress","totaluploadprogress","sending","sendingmultiple","success","successmultiple","canceled","canceledmultiple","complete","completemultiple","reset","maxfilesexceeded","maxfilesreached","queuecomplete"],c.prototype.defaultOptions={url:null,method:"post",withCredentials:!1,parallelUploads:2,uploadMultiple:!1,maxFilesize:256,paramName:"file",createImageThumbnails:!0,maxThumbnailFilesize:10,thumbnailWidth:120,thumbnailHeight:120,filesizeBase:1e3,maxFiles:null,params:{},clickable:!0,ignoreHiddenFiles:!0,acceptedFiles:null,acceptedMimeTypes:null,autoProcessQueue:!0,autoQueue:!0,addRemoveLinks:!1,previewsContainer:null,hiddenInputContainer:"body",capture:null,renameFilename:null,dictDefaultMessage:"Drop files here to upload",dictFallbackMessage:"Your browser does not support drag'n'drop file uploads.",dictFallbackText:"Please use the fallback form below to upload your files like in the olden days.",dictFileTooBig:"File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.",dictInvalidFileType:"You can't upload files of this type.",dictResponseError:"Server responded with {{statusCode}} code.",dictCancelUpload:"Cancel upload",dictCancelUploadConfirmation:"Are you sure you want to cancel this upload?",dictRemoveFile:"Remove file",dictRemoveFileConfirmation:null,dictMaxFilesExceeded:"You can not upload any more files.",accept:function(a,b){return b()},init:function(){return g},forceFallback:!1,fallback:function(){var a,b,d,e,f,g;for(this.element.className=""+this.element.className+" dz-browser-not-supported",g=this.element.getElementsByTagName("div"),e=0,f=g.length;f>e;e++)a=g[e],/(^| )dz-message($| )/.test(a.className)&&(b=a,a.className="dz-message");return b||(b=c.createElement('<div class="dz-message"><span></span></div>'),this.element.appendChild(b)),d=b.getElementsByTagName("span")[0],d&&(null!=d.textContent?d.textContent=this.options.dictFallbackMessage:null!=d.innerText&&(d.innerText=this.options.dictFallbackMessage)),this.element.appendChild(this.getFallbackForm())},resize:function(a){var b,c,d;return b={srcX:0,srcY:0,srcWidth:a.width,srcHeight:a.height},c=a.width/a.height,b.optWidth=this.options.thumbnailWidth,b.optHeight=this.options.thumbnailHeight,null==b.optWidth&&null==b.optHeight?(b.optWidth=b.srcWidth,b.optHeight=b.srcHeight):null==b.optWidth?b.optWidth=c*b.optHeight:null==b.optHeight&&(b.optHeight=1/c*b.optWidth),d=b.optWidth/b.optHeight,a.height<b.optHeight||a.width<b.optWidth?(b.trgHeight=b.srcHeight,b.trgWidth=b.srcWidth):c>d?(b.srcHeight=a.height,b.srcWidth=b.srcHeight*d):(b.srcWidth=a.width,b.srcHeight=b.srcWidth/d),b.srcX=(a.width-b.srcWidth)/2,b.srcY=(a.height-b.srcHeight)/2,b},drop:function(){return this.element.classList.remove("dz-drag-hover")},dragstart:g,dragend:function(){return this.element.classList.remove("dz-drag-hover")},dragenter:function(){return this.element.classList.add("dz-drag-hover")},dragover:function(){return this.element.classList.add("dz-drag-hover")},dragleave:function(){return this.element.classList.remove("dz-drag-hover")},paste:g,reset:function(){return this.element.classList.remove("dz-started")},addedfile:function(a){var b,d,e,f,g,h,i,j,k,l,m,n,o;if(this.element===this.previewsContainer&&this.element.classList.add("dz-started"),this.previewsContainer){for(a.previewElement=c.createElement(this.options.previewTemplate.trim()),a.previewTemplate=a.previewElement,this.previewsContainer.appendChild(a.previewElement),l=a.previewElement.querySelectorAll("[data-dz-name]"),f=0,i=l.length;i>f;f++)b=l[f],b.textContent=this._renameFilename(a.name);for(m=a.previewElement.querySelectorAll("[data-dz-size]"),g=0,j=m.length;j>g;g++)b=m[g],b.innerHTML=this.filesize(a.size);for(this.options.addRemoveLinks&&(a._removeLink=c.createElement('<a class="dz-remove" href="javascript:undefined;" data-dz-remove>'+this.options.dictRemoveFile+"</a>"),a.previewElement.appendChild(a._removeLink)),d=function(b){return function(d){return d.preventDefault(),d.stopPropagation(),a.status===c.UPLOADING?c.confirm(b.options.dictCancelUploadConfirmation,function(){return b.removeFile(a)}):b.options.dictRemoveFileConfirmation?c.confirm(b.options.dictRemoveFileConfirmation,function(){return b.removeFile(a)}):b.removeFile(a)}}(this),n=a.previewElement.querySelectorAll("[data-dz-remove]"),o=[],h=0,k=n.length;k>h;h++)e=n[h],o.push(e.addEventListener("click",d));return o}},removedfile:function(a){var b;return a.previewElement&&null!=(b=a.previewElement)&&b.parentNode.removeChild(a.previewElement),this._updateMaxFilesReachedClass()},thumbnail:function(a,b){var c,d,e,f;if(a.previewElement){for(a.previewElement.classList.remove("dz-file-preview"),f=a.previewElement.querySelectorAll("[data-dz-thumbnail]"),d=0,e=f.length;e>d;d++)c=f[d],c.alt=a.name,c.src=b;return setTimeout(function(){return function(){return a.previewElement.classList.add("dz-image-preview")}}(this),1)}},error:function(a,b){var c,d,e,f,g;if(a.previewElement){for(a.previewElement.classList.add("dz-error"),"String"!=typeof b&&b.error&&(b=b.error),f=a.previewElement.querySelectorAll("[data-dz-errormessage]"),g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(c.textContent=b);return g}},errormultiple:g,processing:function(a){return a.previewElement&&(a.previewElement.classList.add("dz-processing"),a._removeLink)?a._removeLink.textContent=this.options.dictCancelUpload:void 0},processingmultiple:g,uploadprogress:function(a,b){var c,d,e,f,g;if(a.previewElement){for(f=a.previewElement.querySelectorAll("[data-dz-uploadprogress]"),g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push("PROGRESS"===c.nodeName?c.value=b:c.style.width=""+b+"%");return g}},totaluploadprogress:g,sending:g,sendingmultiple:g,success:function(a){return a.previewElement?a.previewElement.classList.add("dz-success"):void 0},successmultiple:g,canceled:function(a){return this.emit("error",a,"Upload canceled.")},canceledmultiple:g,complete:function(a){return a._removeLink&&(a._removeLink.textContent=this.options.dictRemoveFile),a.previewElement?a.previewElement.classList.add("dz-complete"):void 0},completemultiple:g,maxfilesexceeded:g,maxfilesreached:g,queuecomplete:g,addedfiles:g,previewTemplate:'<div class="dz-preview dz-file-preview">\n <div class="dz-image"><img data-dz-thumbnail /></div>\n <div class="dz-details">\n <div class="dz-size"><span data-dz-size></span></div>\n <div class="dz-filename"><span data-dz-name></span></div>\n </div>\n <div class="dz-progress"><span class="dz-upload" data-dz-uploadprogress></span></div>\n <div class="dz-error-message"><span data-dz-errormessage></span></div>\n <div class="dz-success-mark">\n <svg width="54px" height="54px" viewBox="0 0 54 54" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">\n <title>Check</title>\n <defs></defs>\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">\n <path d="M23.5,31.8431458 L17.5852419,25.9283877 C16.0248253,24.3679711 13.4910294,24.366835 11.9289322,25.9289322 C10.3700136,27.4878508 10.3665912,30.0234455 11.9283877,31.5852419 L20.4147581,40.0716123 C20.5133999,40.1702541 20.6159315,40.2626649 20.7218615,40.3488435 C22.2835669,41.8725651 24.794234,41.8626202 26.3461564,40.3106978 L43.3106978,23.3461564 C44.8771021,21.7797521 44.8758057,19.2483887 43.3137085,17.6862915 C41.7547899,16.1273729 39.2176035,16.1255422 37.6538436,17.6893022 L23.5,31.8431458 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z" id="Oval-2" stroke-opacity="0.198794158" stroke="#747474" fill-opacity="0.816519475" fill="#FFFFFF" sketch:type="MSShapeGroup"></path>\n </g>\n </svg>\n </div>\n <div class="dz-error-mark">\n <svg width="54px" height="54px" viewBox="0 0 54 54" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">\n <title>Error</title>\n <defs></defs>\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">\n <g id="Check-+-Oval-2" sketch:type="MSLayerGroup" stroke="#747474" stroke-opacity="0.198794158" fill="#FFFFFF" fill-opacity="0.816519475">\n <path d="M32.6568542,29 L38.3106978,23.3461564 C39.8771021,21.7797521 39.8758057,19.2483887 38.3137085,17.6862915 C36.7547899,16.1273729 34.2176035,16.1255422 32.6538436,17.6893022 L27,23.3431458 L21.3461564,17.6893022 C19.7823965,16.1255422 17.2452101,16.1273729 15.6862915,17.6862915 C14.1241943,19.2483887 14.1228979,21.7797521 15.6893022,23.3461564 L21.3431458,29 L15.6893022,34.6538436 C14.1228979,36.2202479 14.1241943,38.7516113 15.6862915,40.3137085 C17.2452101,41.8726271 19.7823965,41.8744578 21.3461564,40.3106978 L27,34.6568542 L32.6538436,40.3106978 C34.2176035,41.8744578 36.7547899,41.8726271 38.3137085,40.3137085 C39.8758057,38.7516113 39.8771021,36.2202479 38.3106978,34.6538436 L32.6568542,29 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z" id="Oval-2" sketch:type="MSShapeGroup"></path>\n </g>\n </g>\n </svg>\n </div>\n</div>'},d=function(){var a,b,c,d,e,f,g;for(d=arguments[0],c=2<=arguments.length?i.call(arguments,1):[],f=0,g=c.length;g>f;f++){b=c[f];for(a in b)e=b[a],d[a]=e}return d},c.prototype.getAcceptedFiles=function(){var a,b,c,d,e;for(d=this.files,e=[],b=0,c=d.length;c>b;b++)a=d[b],a.accepted&&e.push(a);return e},c.prototype.getRejectedFiles=function(){var a,b,c,d,e;for(d=this.files,e=[],b=0,c=d.length;c>b;b++)a=d[b],a.accepted||e.push(a);return e},c.prototype.getFilesWithStatus=function(a){var b,c,d,e,f;for(e=this.files,f=[],c=0,d=e.length;d>c;c++)b=e[c],b.status===a&&f.push(b);return f},c.prototype.getQueuedFiles=function(){return this.getFilesWithStatus(c.QUEUED)},c.prototype.getUploadingFiles=function(){return this.getFilesWithStatus(c.UPLOADING)},c.prototype.getAddedFiles=function(){return this.getFilesWithStatus(c.ADDED)},c.prototype.getActiveFiles=function(){var a,b,d,e,f;for(e=this.files,f=[],b=0,d=e.length;d>b;b++)a=e[b],(a.status===c.UPLOADING||a.status===c.QUEUED)&&f.push(a);return f},c.prototype.init=function(){var a,b,d,e,f,g,h;for("form"===this.element.tagName&&this.element.setAttribute("enctype","multipart/form-data"),this.element.classList.contains("dropzone")&&!this.element.querySelector(".dz-message")&&this.element.appendChild(c.createElement('<div class="dz-default dz-message"><span>'+this.options.dictDefaultMessage+"</span></div>")),this.clickableElements.length&&(d=function(a){return function(){return a.hiddenFileInput&&a.hiddenFileInput.parentNode.removeChild(a.hiddenFileInput),a.hiddenFileInput=document.createElement("input"),a.hiddenFileInput.setAttribute("type","file"),(null==a.options.maxFiles||a.options.maxFiles>1)&&a.hiddenFileInput.setAttribute("multiple","multiple"),a.hiddenFileInput.className="dz-hidden-input",null!=a.options.acceptedFiles&&a.hiddenFileInput.setAttribute("accept",a.options.acceptedFiles),null!=a.options.capture&&a.hiddenFileInput.setAttribute("capture",a.options.capture),a.hiddenFileInput.style.visibility="hidden",a.hiddenFileInput.style.position="absolute",a.hiddenFileInput.style.top="0",a.hiddenFileInput.style.left="0",a.hiddenFileInput.style.height="0",a.hiddenFileInput.style.width="0",document.querySelector(a.options.hiddenInputContainer).appendChild(a.hiddenFileInput),a.hiddenFileInput.addEventListener("change",function(){var b,c,e,f;if(c=a.hiddenFileInput.files,c.length)for(e=0,f=c.length;f>e;e++)b=c[e],a.addFile(b);return a.emit("addedfiles",c),d()})}}(this))(),this.URL=null!=(g=window.URL)?g:window.webkitURL,h=this.events,e=0,f=h.length;f>e;e++)a=h[e],this.on(a,this.options[a]);return this.on("uploadprogress",function(a){return function(){return a.updateTotalUploadProgress()}}(this)),this.on("removedfile",function(a){return function(){return a.updateTotalUploadProgress()}}(this)),this.on("canceled",function(a){return function(b){return a.emit("complete",b)}}(this)),this.on("complete",function(a){return function(){return 0===a.getAddedFiles().length&&0===a.getUploadingFiles().length&&0===a.getQueuedFiles().length?setTimeout(function(){return a.emit("queuecomplete")},0):void 0}}(this)),b=function(a){return a.stopPropagation(),a.preventDefault?a.preventDefault():a.returnValue=!1},this.listeners=[{element:this.element,events:{dragstart:function(a){return function(b){return a.emit("dragstart",b)}}(this),dragenter:function(a){return function(c){return b(c),a.emit("dragenter",c)}}(this),dragover:function(a){return function(c){var d;try{d=c.dataTransfer.effectAllowed}catch(e){}return c.dataTransfer.dropEffect="move"===d||"linkMove"===d?"move":"copy",b(c),a.emit("dragover",c)}}(this),dragleave:function(a){return function(b){return a.emit("dragleave",b)}}(this),drop:function(a){return function(c){return b(c),a.drop(c)}}(this),dragend:function(a){return function(b){return a.emit("dragend",b)}}(this)}}],this.clickableElements.forEach(function(a){return function(b){return a.listeners.push({element:b,events:{click:function(d){return(b!==a.element||d.target===a.element||c.elementInside(d.target,a.element.querySelector(".dz-message")))&&a.hiddenFileInput.click(),!0}}})}}(this)),this.enable(),this.options.init.call(this)},c.prototype.destroy=function(){var a;return this.disable(),this.removeAllFiles(!0),(null!=(a=this.hiddenFileInput)?a.parentNode:void 0)&&(this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput),this.hiddenFileInput=null),delete this.element.dropzone,c.instances.splice(c.instances.indexOf(this),1)},c.prototype.updateTotalUploadProgress=function(){var a,b,c,d,e,f,g,h;if(d=0,c=0,a=this.getActiveFiles(),a.length){for(h=this.getActiveFiles(),f=0,g=h.length;g>f;f++)b=h[f],d+=b.upload.bytesSent,c+=b.upload.total;e=100*d/c}else e=100;return this.emit("totaluploadprogress",e,c,d)},c.prototype._getParamName=function(a){return"function"==typeof this.options.paramName?this.options.paramName(a):""+this.options.paramName+(this.options.uploadMultiple?"["+a+"]":"")},c.prototype._renameFilename=function(a){return"function"!=typeof this.options.renameFilename?a:this.options.renameFilename(a)},c.prototype.getFallbackForm=function(){var a,b,d,e;return(a=this.getExistingFallback())?a:(d='<div class="dz-fallback">',this.options.dictFallbackText&&(d+="<p>"+this.options.dictFallbackText+"</p>"),d+='<input type="file" name="'+this._getParamName(0)+'" '+(this.options.uploadMultiple?'multiple="multiple"':void 0)+' /><input type="submit" value="Upload!"></div>',b=c.createElement(d),"FORM"!==this.element.tagName?(e=c.createElement('<form action="'+this.options.url+'" enctype="multipart/form-data" method="'+this.options.method+'"></form>'),e.appendChild(b)):(this.element.setAttribute("enctype","multipart/form-data"),this.element.setAttribute("method",this.options.method)),null!=e?e:b)},c.prototype.getExistingFallback=function(){var a,b,c,d,e,f;for(b=function(a){var b,c,d;for(c=0,d=a.length;d>c;c++)if(b=a[c],/(^| )fallback($| )/.test(b.className))return b},f=["div","form"],d=0,e=f.length;e>d;d++)if(c=f[d],a=b(this.element.getElementsByTagName(c)))return a},c.prototype.setupEventListeners=function(){var a,b,c,d,e,f,g;for(f=this.listeners,g=[],d=0,e=f.length;e>d;d++)a=f[d],g.push(function(){var d,e;d=a.events,e=[];for(b in d)c=d[b],e.push(a.element.addEventListener(b,c,!1));return e}());return g},c.prototype.removeEventListeners=function(){var a,b,c,d,e,f,g;for(f=this.listeners,g=[],d=0,e=f.length;e>d;d++)a=f[d],g.push(function(){var d,e;d=a.events,e=[];for(b in d)c=d[b],e.push(a.element.removeEventListener(b,c,!1));return e}());return g},c.prototype.disable=function(){var a,b,c,d,e;for(this.clickableElements.forEach(function(a){return a.classList.remove("dz-clickable")}),this.removeEventListeners(),d=this.files,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(this.cancelUpload(a));return e},c.prototype.enable=function(){return this.clickableElements.forEach(function(a){return a.classList.add("dz-clickable")}),this.setupEventListeners()},c.prototype.filesize=function(a){var b,c,d,e,f,g,h,i;if(d=0,e="b",a>0){for(g=["TB","GB","MB","KB","b"],c=h=0,i=g.length;i>h;c=++h)if(f=g[c],b=Math.pow(this.options.filesizeBase,4-c)/10,a>=b){d=a/Math.pow(this.options.filesizeBase,4-c),e=f;break}d=Math.round(10*d)/10}return"<strong>"+d+"</strong> "+e},c.prototype._updateMaxFilesReachedClass=function(){return null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(this.getAcceptedFiles().length===this.options.maxFiles&&this.emit("maxfilesreached",this.files),this.element.classList.add("dz-max-files-reached")):this.element.classList.remove("dz-max-files-reached")},c.prototype.drop=function(a){var b,c;a.dataTransfer&&(this.emit("drop",a),b=a.dataTransfer.files,this.emit("addedfiles",b),b.length&&(c=a.dataTransfer.items,c&&c.length&&null!=c[0].webkitGetAsEntry?this._addFilesFromItems(c):this.handleFiles(b)))},c.prototype.paste=function(a){var b,c;if(null!=(null!=a&&null!=(c=a.clipboardData)?c.items:void 0))return this.emit("paste",a),b=a.clipboardData.items,b.length?this._addFilesFromItems(b):void 0},c.prototype.handleFiles=function(a){var b,c,d,e;for(e=[],c=0,d=a.length;d>c;c++)b=a[c],e.push(this.addFile(b));return e},c.prototype._addFilesFromItems=function(a){var b,c,d,e,f;for(f=[],d=0,e=a.length;e>d;d++)c=a[d],f.push(null!=c.webkitGetAsEntry&&(b=c.webkitGetAsEntry())?b.isFile?this.addFile(c.getAsFile()):b.isDirectory?this._addFilesFromDirectory(b,b.name):void 0:null!=c.getAsFile?null==c.kind||"file"===c.kind?this.addFile(c.getAsFile()):void 0:void 0);return f},c.prototype._addFilesFromDirectory=function(a,b){var c,d,e;return c=a.createReader(),d=function(a){return"undefined"!=typeof console&&null!==console&&"function"==typeof console.log?console.log(a):void 0},(e=function(a){return function(){return c.readEntries(function(c){var d,f,g;if(c.length>0){for(f=0,g=c.length;g>f;f++)d=c[f],d.isFile?d.file(function(c){return a.options.ignoreHiddenFiles&&"."===c.name.substring(0,1)?void 0:(c.fullPath=""+b+"/"+c.name,a.addFile(c))}):d.isDirectory&&a._addFilesFromDirectory(d,""+b+"/"+d.name);e()}return null},d)}}(this))()},c.prototype.accept=function(a,b){return a.size>1024*this.options.maxFilesize*1024?b(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(a.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize)):c.isValidFile(a,this.options.acceptedFiles)?null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(b(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles)),this.emit("maxfilesexceeded",a)):this.options.accept.call(this,a,b):b(this.options.dictInvalidFileType)},c.prototype.addFile=function(a){return a.upload={progress:0,total:a.size,bytesSent:0},this.files.push(a),a.status=c.ADDED,this.emit("addedfile",a),this._enqueueThumbnail(a),this.accept(a,function(b){return function(c){return c?(a.accepted=!1,b._errorProcessing([a],c)):(a.accepted=!0,b.options.autoQueue&&b.enqueueFile(a)),b._updateMaxFilesReachedClass()}}(this))},c.prototype.enqueueFiles=function(a){var b,c,d;for(c=0,d=a.length;d>c;c++)b=a[c],this.enqueueFile(b);return null},c.prototype.enqueueFile=function(a){if(a.status!==c.ADDED||a.accepted!==!0)throw new Error("This file can't be queued because it has already been processed or was rejected.");return a.status=c.QUEUED,this.options.autoProcessQueue?setTimeout(function(a){return function(){return a.processQueue()}}(this),0):void 0},c.prototype._thumbnailQueue=[],c.prototype._processingThumbnail=!1,c.prototype._enqueueThumbnail=function(a){return this.options.createImageThumbnails&&a.type.match(/image.*/)&&a.size<=1024*this.options.maxThumbnailFilesize*1024?(this._thumbnailQueue.push(a),setTimeout(function(a){return function(){return a._processThumbnailQueue()}}(this),0)):void 0},c.prototype._processThumbnailQueue=function(){return this._processingThumbnail||0===this._thumbnailQueue.length?void 0:(this._processingThumbnail=!0,this.createThumbnail(this._thumbnailQueue.shift(),function(a){return function(){return a._processingThumbnail=!1,a._processThumbnailQueue()}}(this)))},c.prototype.removeFile=function(a){return a.status===c.UPLOADING&&this.cancelUpload(a),this.files=h(this.files,a),this.emit("removedfile",a),0===this.files.length?this.emit("reset"):void 0},c.prototype.removeAllFiles=function(a){var b,d,e,f;for(null==a&&(a=!1),f=this.files.slice(),d=0,e=f.length;e>d;d++)b=f[d],(b.status!==c.UPLOADING||a)&&this.removeFile(b);return null},c.prototype.createThumbnail=function(a,b){var c;return c=new FileReader,c.onload=function(d){return function(){return"image/svg+xml"===a.type?(d.emit("thumbnail",a,c.result),void(null!=b&&b())):d.createThumbnailFromUrl(a,c.result,b)}}(this),c.readAsDataURL(a)},c.prototype.createThumbnailFromUrl=function(a,b,c,d){var e;return e=document.createElement("img"),d&&(e.crossOrigin=d),e.onload=function(b){return function(){var d,g,h,i,j,k,l,m;return a.width=e.width,a.height=e.height,h=b.options.resize.call(b,a),null==h.trgWidth&&(h.trgWidth=h.optWidth),null==h.trgHeight&&(h.trgHeight=h.optHeight),d=document.createElement("canvas"),g=d.getContext("2d"),d.width=h.trgWidth,d.height=h.trgHeight,f(g,e,null!=(j=h.srcX)?j:0,null!=(k=h.srcY)?k:0,h.srcWidth,h.srcHeight,null!=(l=h.trgX)?l:0,null!=(m=h.trgY)?m:0,h.trgWidth,h.trgHeight),i=d.toDataURL("image/png"),b.emit("thumbnail",a,i),null!=c?c():void 0}}(this),null!=c&&(e.onerror=c),e.src=b},c.prototype.processQueue=function(){var a,b,c,d;if(b=this.options.parallelUploads,c=this.getUploadingFiles().length,a=c,!(c>=b)&&(d=this.getQueuedFiles(),d.length>0)){if(this.options.uploadMultiple)return this.processFiles(d.slice(0,b-c));for(;b>a;){if(!d.length)return;this.processFile(d.shift()),a++}}},c.prototype.processFile=function(a){return this.processFiles([a])},c.prototype.processFiles=function(a){var b,d,e;for(d=0,e=a.length;e>d;d++)b=a[d],b.processing=!0,b.status=c.UPLOADING,this.emit("processing",b);return this.options.uploadMultiple&&this.emit("processingmultiple",a),this.uploadFiles(a)},c.prototype._getFilesWithXhr=function(a){var b,c;return c=function(){var c,d,e,f;for(e=this.files,f=[],c=0,d=e.length;d>c;c++)b=e[c],b.xhr===a&&f.push(b);return f}.call(this)},c.prototype.cancelUpload=function(a){var b,d,e,f,g,h,i;if(a.status===c.UPLOADING){for(d=this._getFilesWithXhr(a.xhr),e=0,g=d.length;g>e;e++)b=d[e],b.status=c.CANCELED;for(a.xhr.abort(),f=0,h=d.length;h>f;f++)b=d[f],this.emit("canceled",b);this.options.uploadMultiple&&this.emit("canceledmultiple",d)}else((i=a.status)===c.ADDED||i===c.QUEUED)&&(a.status=c.CANCELED,this.emit("canceled",a),this.options.uploadMultiple&&this.emit("canceledmultiple",[a]));return this.options.autoProcessQueue?this.processQueue():void 0},e=function(){var a,b;return b=arguments[0],a=2<=arguments.length?i.call(arguments,1):[],"function"==typeof b?b.apply(this,a):b},c.prototype.uploadFile=function(a){return this.uploadFiles([a])},c.prototype.uploadFiles=function(a){var b,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L;for(w=new XMLHttpRequest,x=0,B=a.length;B>x;x++)b=a[x],b.xhr=w;p=e(this.options.method,a),u=e(this.options.url,a),w.open(p,u,!0),w.withCredentials=!!this.options.withCredentials,s=null,g=function(c){return function(){var d,e,f;for(f=[],d=0,e=a.length;e>d;d++)b=a[d],f.push(c._errorProcessing(a,s||c.options.dictResponseError.replace("{{statusCode}}",w.status),w));return f}}(this),t=function(c){return function(d){var e,f,g,h,i,j,k,l,m;if(null!=d)for(f=100*d.loaded/d.total,g=0,j=a.length;j>g;g++)b=a[g],b.upload={progress:f,total:d.total,bytesSent:d.loaded};else{for(e=!0,f=100,h=0,k=a.length;k>h;h++)b=a[h],(100!==b.upload.progress||b.upload.bytesSent!==b.upload.total)&&(e=!1),b.upload.progress=f,b.upload.bytesSent=b.upload.total;if(e)return}for(m=[],i=0,l=a.length;l>i;i++)b=a[i],m.push(c.emit("uploadprogress",b,f,b.upload.bytesSent));return m}}(this),w.onload=function(b){return function(d){var e;if(a[0].status!==c.CANCELED&&4===w.readyState){if(s=w.responseText,w.getResponseHeader("content-type")&&~w.getResponseHeader("content-type").indexOf("application/json"))try{s=JSON.parse(s)}catch(f){d=f,s="Invalid JSON response from server."}return t(),200<=(e=w.status)&&300>e?b._finished(a,s,d):g()}}}(this),w.onerror=function(){return function(){return a[0].status!==c.CANCELED?g():void 0}}(this),r=null!=(G=w.upload)?G:w,r.onprogress=t,j={Accept:"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"},this.options.headers&&d(j,this.options.headers);for(h in j)i=j[h],i&&w.setRequestHeader(h,i);if(f=new FormData,this.options.params){H=this.options.params;for(o in H)v=H[o],f.append(o,v)}for(y=0,C=a.length;C>y;y++)b=a[y],this.emit("sending",b,w,f);if(this.options.uploadMultiple&&this.emit("sendingmultiple",a,w,f),"FORM"===this.element.tagName)for(I=this.element.querySelectorAll("input, textarea, select, button"),z=0,D=I.length;D>z;z++)if(l=I[z],m=l.getAttribute("name"),n=l.getAttribute("type"),"SELECT"===l.tagName&&l.hasAttribute("multiple"))for(J=l.options,A=0,E=J.length;E>A;A++)q=J[A],q.selected&&f.append(m,q.value);else(!n||"checkbox"!==(K=n.toLowerCase())&&"radio"!==K||l.checked)&&f.append(m,l.value);for(k=F=0,L=a.length-1;L>=0?L>=F:F>=L;k=L>=0?++F:--F)f.append(this._getParamName(k),a[k],this._renameFilename(a[k].name));return this.submitRequest(w,f,a)},c.prototype.submitRequest=function(a,b){return a.send(b)},c.prototype._finished=function(a,b,d){var e,f,g;for(f=0,g=a.length;g>f;f++)e=a[f],e.status=c.SUCCESS,this.emit("success",e,b,d),this.emit("complete",e);return this.options.uploadMultiple&&(this.emit("successmultiple",a,b,d),this.emit("completemultiple",a)),this.options.autoProcessQueue?this.processQueue():void 0},c.prototype._errorProcessing=function(a,b,d){var e,f,g;for(f=0,g=a.length;g>f;f++)e=a[f],e.status=c.ERROR,this.emit("error",e,b,d),this.emit("complete",e);return this.options.uploadMultiple&&(this.emit("errormultiple",a,b,d),this.emit("completemultiple",a)),this.options.autoProcessQueue?this.processQueue():void 0},c}(b),a.version="4.3.0",a.options={},a.optionsForElement=function(b){return b.getAttribute("id")?a.options[c(b.getAttribute("id"))]:void 0},a.instances=[],a.forElement=function(a){if("string"==typeof a&&(a=document.querySelector(a)),null==(null!=a?a.dropzone:void 0))throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone.");return a.dropzone},a.autoDiscover=!0,a.discover=function(){var b,c,d,e,f,g;for(document.querySelectorAll?d=document.querySelectorAll(".dropzone"):(d=[],b=function(a){var b,c,e,f;for(f=[],c=0,e=a.length;e>c;c++)b=a[c],f.push(/(^| )dropzone($| )/.test(b.className)?d.push(b):void 0);return f},b(document.getElementsByTagName("div")),b(document.getElementsByTagName("form"))),g=[],e=0,f=d.length;f>e;e++)c=d[e],g.push(a.optionsForElement(c)!==!1?new a(c):void 0);return g},a.blacklistedBrowsers=[/opera.*Macintosh.*version\/12/i],a.isBrowserSupported=function(){var b,c,d,e,f;if(b=!0,window.File&&window.FileReader&&window.FileList&&window.Blob&&window.FormData&&document.querySelector)if("classList"in document.createElement("a"))for(f=a.blacklistedBrowsers,d=0,e=f.length;e>d;d++)c=f[d],c.test(navigator.userAgent)&&(b=!1);else b=!1;else b=!1;return b},h=function(a,b){var c,d,e,f;for(f=[],d=0,e=a.length;e>d;d++)c=a[d],c!==b&&f.push(c);return f},c=function(a){return a.replace(/[\-_](\w)/g,function(a){return a.charAt(1).toUpperCase()})},a.createElement=function(a){var b;return b=document.createElement("div"),b.innerHTML=a,b.childNodes[0]},a.elementInside=function(a,b){if(a===b)return!0;for(;a=a.parentNode;)if(a===b)return!0;return!1},a.getElement=function(a,b){var c;if("string"==typeof a?c=document.querySelector(a):null!=a.nodeType&&(c=a),null==c)throw new Error("Invalid `"+b+"` option provided. Please provide a CSS selector or a plain HTML element.");return c},a.getElements=function(a,b){var c,d,e,f,g,h,i,j;if(a instanceof Array){e=[];try{for(f=0,h=a.length;h>f;f++)d=a[f],e.push(this.getElement(d,b))}catch(k){c=k,e=null}}else if("string"==typeof a)for(e=[],j=document.querySelectorAll(a),g=0,i=j.length;i>g;g++)d=j[g],e.push(d);else null!=a.nodeType&&(e=[a]);if(null==e||!e.length)throw new Error("Invalid `"+b+"` option provided. Please provide a CSS selector, a plain HTML element or a list of those.");return e},a.confirm=function(a,b,c){return window.confirm(a)?b():null!=c?c():void 0},a.isValidFile=function(a,b){var c,d,e,f,g;if(!b)return!0;for(b=b.split(","),d=a.type,c=d.replace(/\/.*$/,""),f=0,g=b.length;g>f;f++)if(e=b[f],e=e.trim(),"."===e.charAt(0)){if(-1!==a.name.toLowerCase().indexOf(e.toLowerCase(),a.name.length-e.length))return!0}else if(/\/\*$/.test(e)){if(c===e.replace(/\/.*$/,""))return!0
|
2
|
+
}else if(d===e)return!0;return!1},"undefined"!=typeof jQuery&&null!==jQuery&&(jQuery.fn.dropzone=function(b){return this.each(function(){return new a(this,b)})}),"undefined"!=typeof module&&null!==module?module.exports=a:window.Dropzone=a,a.ADDED="added",a.QUEUED="queued",a.ACCEPTED=a.QUEUED,a.UPLOADING="uploading",a.PROCESSING=a.UPLOADING,a.CANCELED="canceled",a.ERROR="error",a.SUCCESS="success",e=function(a){var b,c,d,e,f,g,h,i,j,k;for(h=a.naturalWidth,g=a.naturalHeight,c=document.createElement("canvas"),c.width=1,c.height=g,d=c.getContext("2d"),d.drawImage(a,0,0),e=d.getImageData(0,0,1,g).data,k=0,f=g,i=g;i>k;)b=e[4*(i-1)+3],0===b?f=i:k=i,i=f+k>>1;return j=i/g,0===j?1:j},f=function(a,b,c,d,f,g,h,i,j,k){var l;return l=e(b),a.drawImage(b,c,d,f,g,h,i,j,k/l)},d=function(a,b){var c,d,e,f,g,h,i,j,k;if(e=!1,k=!0,d=a.document,j=d.documentElement,c=d.addEventListener?"addEventListener":"attachEvent",i=d.addEventListener?"removeEventListener":"detachEvent",h=d.addEventListener?"":"on",f=function(c){return"readystatechange"!==c.type||"complete"===d.readyState?(("load"===c.type?a:d)[i](h+c.type,f,!1),!e&&(e=!0)?b.call(a,c.type||c):void 0):void 0},g=function(){var a;try{j.doScroll("left")}catch(b){return a=b,void setTimeout(g,50)}return f("poll")},"complete"!==d.readyState){if(d.createEventObject&&j.doScroll){try{k=!a.frameElement}catch(l){}k&&g()}return d[c](h+"DOMContentLoaded",f,!1),d[c](h+"readystatechange",f,!1),a[c](h+"load",f,!1)}},a._autoDiscoverFunction=function(){return a.autoDiscover?a.discover():void 0},d(window,a._autoDiscoverFunction)}).call(this);
|
@@ -0,0 +1,280 @@
|
|
1
|
+
// --- Global instance ---------------------------------------------------------
|
2
|
+
var ecMain = (function() {
|
3
|
+
this.editing = false;
|
4
|
+
return {
|
5
|
+
dlgPreviewClose: function() {
|
6
|
+
Sizzle( '[data-ec-toolbar]' )[0].style.display = 'block';
|
7
|
+
Sizzle( '[data-ec-dlg="preview"]' )[0].style.display = 'none';
|
8
|
+
Sizzle( '[data-ec-dlg="preview"] .c-card__body' )[0].innerHTML = '';
|
9
|
+
},
|
10
|
+
dlgPreviewOpen: function( target ) {
|
11
|
+
var url = window.location.href + '?preview=1';
|
12
|
+
Sizzle( '[data-ec-dlg="preview"] .o-modal' )[0].setAttribute( 'data-ec-target', target );
|
13
|
+
Sizzle( '[data-ec-dlg="preview"] .c-card__body' )[0].innerHTML = '<iframe src="' + url + '"></iframe>';
|
14
|
+
Sizzle( '[data-ec-toolbar]' )[0].style.display = 'none';
|
15
|
+
Sizzle( '[data-ec-dlg="preview"]' )[0].style.display = 'block';
|
16
|
+
},
|
17
|
+
init: function() {
|
18
|
+
Sizzle( '[data-ec-block][data-ec-container=""]' ).forEach( function( el ) {
|
19
|
+
el.setAttribute( 'is', 'edit-block' );
|
20
|
+
});
|
21
|
+
},
|
22
|
+
onPaste: function( event ) {
|
23
|
+
event.preventDefault();
|
24
|
+
// prevent paste HTML in contenteditable divs
|
25
|
+
document.execCommand( 'insertText', false, ( event.originalEvent || event ).clipboardData.getData( 'text' ) );
|
26
|
+
},
|
27
|
+
setEditMode: function() {
|
28
|
+
if( !this.editing ) {
|
29
|
+
this.editing = true;
|
30
|
+
ecVue.$mount( '[data-ec]' );
|
31
|
+
// Drag & drop sorting
|
32
|
+
dragula( [ Sizzle( '[data-ec-blocks]' )[0], Sizzle( '[data-ec-dlg="options"] .c-card__body' )[0] ], {
|
33
|
+
moves: function( el, container, handle ) {
|
34
|
+
return handle.classList.contains( 'sortable' );
|
35
|
+
}
|
36
|
+
});
|
37
|
+
Sizzle( '.item-menu-add' )[0].style.display = 'inline-block';
|
38
|
+
Sizzle( 'body' )[0].setAttribute( 'data-ec-editing', '1' );
|
39
|
+
}
|
40
|
+
},
|
41
|
+
showMenu: function( menu ) {
|
42
|
+
if( Sizzle( '[data-ec-menu-dropup="' + menu + '"]' )[0].style.display != 'block' ) {
|
43
|
+
Sizzle( '[data-ec-dlg="menu"]' )[0].style.display = 'block';
|
44
|
+
Sizzle( '[data-ec-menu-dropup="' + menu + '"]' )[0].style.display = 'block';
|
45
|
+
}
|
46
|
+
else {
|
47
|
+
Sizzle( '[data-ec-menu-dropup="' + menu + '"]' )[0].style.display = 'none';
|
48
|
+
Sizzle( '[data-ec-dlg="menu"]' )[0].style.display = 'none';
|
49
|
+
}
|
50
|
+
},
|
51
|
+
toggleAttr: function( el, attr ) {
|
52
|
+
var val = el.getAttribute( attr );
|
53
|
+
el.setAttribute( attr, val ? '' : '1' );
|
54
|
+
return !val;
|
55
|
+
}
|
56
|
+
}
|
57
|
+
}());
|
58
|
+
|
59
|
+
window.onload = ecMain.init();
|
60
|
+
|
61
|
+
// --- Component: edit block ---------------------------------------------------
|
62
|
+
Vue.component( 'edit-block', {
|
63
|
+
// beforeCreate: function() { },
|
64
|
+
mounted: function() {
|
65
|
+
Sizzle( '[data-ec-item]', this.$el ).forEach( function( el ) {
|
66
|
+
var input = el.getAttribute( 'data-ec-input' );
|
67
|
+
if( input == 'html' ) {
|
68
|
+
new MediumEditor( el, {
|
69
|
+
toolbar: {
|
70
|
+
buttons: [ 'bold', 'italic', 'anchor', 'h2', 'h3', 'h4', 'quote' ],
|
71
|
+
disableEditing: true,
|
72
|
+
spellcheck: false
|
73
|
+
}
|
74
|
+
});
|
75
|
+
}
|
76
|
+
else if( input == 'file_image' ) {
|
77
|
+
var options = {
|
78
|
+
headers: { 'X-CSRF-Token': Sizzle( 'meta[name="csrf-token"]' )[0].getAttribute( 'content' ) },
|
79
|
+
method: 'patch',
|
80
|
+
paramName: 'ec_cmp[' + el.getAttribute( 'data-ec-type' ) + '][' + el.getAttribute( 'data-ec-item' ) + ']',
|
81
|
+
params: {},
|
82
|
+
thumbnailWidth: null,
|
83
|
+
url: Sizzle( '[data-ec-form]' )[0].getAttribute( 'action' ),
|
84
|
+
init: function() {
|
85
|
+
// this.on( 'addedfile', function( file ) { });
|
86
|
+
this.on( 'thumbnail', function( thumbnail, dataUrl ) {
|
87
|
+
this.element.setAttribute( 'src', dataUrl );
|
88
|
+
});
|
89
|
+
}
|
90
|
+
};
|
91
|
+
new Dropzone( el, options );
|
92
|
+
}
|
93
|
+
else {
|
94
|
+
el.setAttribute( 'contenteditable', 'true' );
|
95
|
+
el.setAttribute( 'onpaste', 'ecMain.onPaste(event)' );
|
96
|
+
}
|
97
|
+
});
|
98
|
+
},
|
99
|
+
template: '<div><slot></slot></div>'
|
100
|
+
});
|
101
|
+
|
102
|
+
// --- Component: block buttons ------------------------------------------------
|
103
|
+
Vue.component( 'block-buttons', {
|
104
|
+
methods: {
|
105
|
+
openDialogOptions: function() {
|
106
|
+
this.$emit( 'open_dialog_options', this.block_id );
|
107
|
+
}
|
108
|
+
},
|
109
|
+
props: [ 'block_id' ],
|
110
|
+
template: '#ec-block-buttons-template'
|
111
|
+
});
|
112
|
+
|
113
|
+
// --- Component: new blocks ---------------------------------------------------
|
114
|
+
var ecNewBlocks = Vue.extend({
|
115
|
+
data: function() {
|
116
|
+
return {
|
117
|
+
new_blocks: []
|
118
|
+
}
|
119
|
+
},
|
120
|
+
methods: {
|
121
|
+
add: function( type ) {
|
122
|
+
this.new_blocks.push( { type: type, name: 'New ' + type.replace( /_/g, ' ' ) + ' block' } );
|
123
|
+
},
|
124
|
+
cancel: function( index ) {
|
125
|
+
this.new_blocks.splice( index, 1 );
|
126
|
+
}
|
127
|
+
},
|
128
|
+
template: '<div><div v-for="(block, index) in new_blocks" data-ec-new-block :data-ec-type="block.type">{{ block.name }}<button type="button" class="c-button c-button--error" v-on:click="cancel(index)"><i data-ec-icon="icon-bin"></i></button></div></div>'
|
129
|
+
});
|
130
|
+
|
131
|
+
// --- Vue entry point ---------------------------------------------------------
|
132
|
+
var ecVue = new Vue({
|
133
|
+
// el: '[data-ec]',
|
134
|
+
data: {
|
135
|
+
dlg_block: 0,
|
136
|
+
dlg_block_container: '',
|
137
|
+
dlg_block_type: '',
|
138
|
+
inputs: [],
|
139
|
+
items: [],
|
140
|
+
new_blocks: false,
|
141
|
+
new_sub_blocks: [],
|
142
|
+
sub_blocks: []
|
143
|
+
},
|
144
|
+
beforeCreate: function() {
|
145
|
+
Sizzle( '[data-ec-block]' ).forEach( function( el ) {
|
146
|
+
var div = document.createElement( 'div' );
|
147
|
+
div.setAttribute( 'is', 'block-buttons' );
|
148
|
+
div.setAttribute( 'v-on:open_dialog_options', 'dlgOptionsOpen' );
|
149
|
+
div.setAttribute( 'block_id', el.getAttribute( 'data-ec-block' ) );
|
150
|
+
el.appendChild( div );
|
151
|
+
});
|
152
|
+
},
|
153
|
+
mounted: function() {
|
154
|
+
this.new_blocks = new ecNewBlocks( { el: '[data-ec-new-blocks]' } );
|
155
|
+
},
|
156
|
+
methods: {
|
157
|
+
addBlock: function( type ) {
|
158
|
+
this.new_blocks.add( type )
|
159
|
+
},
|
160
|
+
addSubBlock: function() {
|
161
|
+
var el = Sizzle( '[data-ec-block="' + this.dlg_block + '"]' )[0];
|
162
|
+
var cnt = el.getAttribute( 'data-ec-new-blocks' ) ? parseInt( el.getAttribute( 'data-ec-new-blocks' ) ) : 0;
|
163
|
+
el.setAttribute( 'data-ec-new-blocks', cnt + 1 );
|
164
|
+
this.new_sub_blocks.push( cnt + 1 );
|
165
|
+
},
|
166
|
+
cancelNewSubBlock: function( index ) {
|
167
|
+
var el = Sizzle( '[data-ec-block="' + this.dlg_block + '"]' )[0];
|
168
|
+
var cnt = el.getAttribute( 'data-ec-new-blocks' ) ? parseInt( el.getAttribute( 'data-ec-new-blocks' ) ) : 0;
|
169
|
+
el.setAttribute( 'data-ec-new-blocks', ( cnt > 0 ) ? ( cnt - 1 ) : 0 );
|
170
|
+
this.new_sub_blocks.splice( index, 1 );
|
171
|
+
},
|
172
|
+
dlgOptionsOpen: function( blk ) {
|
173
|
+
this.dlg_block = blk;
|
174
|
+
var _this = this;
|
175
|
+
var blk_el = Sizzle( '[data-ec-block="' + blk + '"]' )[0];
|
176
|
+
Sizzle( '[data-ec-dlg="options"]' )[0].style.display = 'block';
|
177
|
+
Sizzle( '[data-ec-toolbar]' )[0].style.display = 'none';
|
178
|
+
this.sub_blocks = [];
|
179
|
+
this.new_sub_blocks = [];
|
180
|
+
this.dlg_block_container = blk_el.getAttribute( 'data-ec-container' );
|
181
|
+
this.dlg_block_type = blk_el.getAttribute( 'data-ec-ct' ).replace( /_/g, ' ' );
|
182
|
+
var cnt = blk_el.getAttribute( 'data-ec-new-blocks' );
|
183
|
+
for( var i = 0; i < cnt; i++ ) this.new_sub_blocks.push( i );
|
184
|
+
// Copy values from container to dialog
|
185
|
+
Sizzle( '[data-ec-sub-block]', blk_el ).forEach( function( el ) {
|
186
|
+
var items = [];
|
187
|
+
Sizzle( '[data-ec-item]', el ).forEach( function( el2 ) {
|
188
|
+
items.push( { type: el2.getAttribute( 'data-ec-type' ), input: el2.getAttribute( 'data-ec-input' ), item: el2.getAttribute( 'data-ec-item' ), src: el2.getAttribute( 'src' ), value: el2.innerHTML } );
|
189
|
+
});
|
190
|
+
_this.sub_blocks.push( { parent: blk, block: el.getAttribute( 'data-ec-sub-block' ), destroy: el.getAttribute( 'data-ec-destroy' ), items: items } );
|
191
|
+
});
|
192
|
+
},
|
193
|
+
dlgOptionsClose: function() {
|
194
|
+
// Sync changes
|
195
|
+
var cnt = 0;
|
196
|
+
Sizzle( '[data-ec-dlg="options"] [data-ec-sub-block]' ).forEach( function( el ) {
|
197
|
+
Sizzle( '[data-ec-sub-block="' + el.getAttribute( 'data-ec-sub-block' ) + '"]' )[0].setAttribute( 'data-ec-position', cnt++ );
|
198
|
+
});
|
199
|
+
Sizzle( '[data-ec-dlg="options"] [data-ec-item]' ).forEach( function( el ) {
|
200
|
+
if( el.getAttribute( 'data-ec-input' ) != 'file_image' ) {
|
201
|
+
Sizzle( '[data-ec-block] [data-ec-item="' + el.getAttribute( 'data-ec-item' ) + '"]' )[0].innerHTML = el.innerHTML;
|
202
|
+
}
|
203
|
+
else {
|
204
|
+
Sizzle( '[data-ec-block] [data-ec-item="' + el.getAttribute( 'data-ec-item' ) + '"]' )[0].setAttribute( 'src', el.getAttribute( 'src' ) );
|
205
|
+
}
|
206
|
+
});
|
207
|
+
// Reorder nodes in-place
|
208
|
+
var new_node = document.createElement( 'div' );
|
209
|
+
new_node.setAttribute( 'data-ec-sort', '' );
|
210
|
+
var node = Sizzle( '[data-ec-block="' + this.dlg_block + '"] [data-ec-sub-block]' )[0];
|
211
|
+
if( node ) {
|
212
|
+
var parent = node.parentNode;
|
213
|
+
parent.insertBefore( new_node, node ); // Create a temp node as base
|
214
|
+
var nodes = Array.prototype.slice.call( Sizzle( '[data-ec-block="' + this.dlg_block + '"] [data-ec-sub-block]' ) );
|
215
|
+
var nodes2 = nodes.sort( function( a, b ) {
|
216
|
+
return a.getAttribute( 'data-ec-position' ) >= b.getAttribute( 'data-ec-position' );
|
217
|
+
});
|
218
|
+
nodes2.forEach( function( el ) {
|
219
|
+
parent.insertBefore( el, new_node );
|
220
|
+
});
|
221
|
+
parent.removeChild( new_node );
|
222
|
+
}
|
223
|
+
//
|
224
|
+
Sizzle( '[data-ec-toolbar]' )[0].style.display = 'block';
|
225
|
+
Sizzle( '[data-ec-dlg="options"]' )[0].style.display = 'none';
|
226
|
+
this.dlg_block = 0;
|
227
|
+
},
|
228
|
+
onSubmit: function( event ) {
|
229
|
+
// event.preventDefault();
|
230
|
+
|
231
|
+
var cmp = this;
|
232
|
+
this.inputs = [];
|
233
|
+
// Update items
|
234
|
+
Sizzle( '[data-ec-item]' ).forEach( function( el ) {
|
235
|
+
var input = el.getAttribute( 'data-ec-input' );
|
236
|
+
if( input != 'file' && input != 'file_image' ) {
|
237
|
+
cmp.inputs.push( { name: 'ec_cmp[' + el.getAttribute( 'data-ec-type' ) + '][' + el.attributes['data-ec-item'].value + ']', value: el.innerHTML } );
|
238
|
+
}
|
239
|
+
});
|
240
|
+
// Update positions
|
241
|
+
var last = Sizzle( '[data-ec-block]' ).length;
|
242
|
+
Sizzle( '[data-ec-block]' ).forEach( function( el ) {
|
243
|
+
cmp.inputs.push( { name: 'ec_cmp[Block][' + el.attributes['data-ec-block'].value + '][position]', value: last-- } );
|
244
|
+
var last2 = Sizzle( '[data-ec-sub-block]', el ).length;
|
245
|
+
if( last2 ) {
|
246
|
+
Sizzle( '[data-ec-sub-block]', el ).forEach( function( el2 ) {
|
247
|
+
var sid = el2.getAttribute( 'data-ec-sub-block' );
|
248
|
+
cmp.inputs.push( { name: 'ec_cmp[Block][' + sid + '][position]', value: last2-- } );
|
249
|
+
});
|
250
|
+
}
|
251
|
+
});
|
252
|
+
// New blocks
|
253
|
+
var cnt = 0;
|
254
|
+
Sizzle( '[data-ec-new-block]' ).forEach( function( el ) {
|
255
|
+
cmp.inputs.push( { name: 'ec_cmp[Block][0][_add][' + ( cnt++ ) + ']', value: el.getAttribute( 'data-ec-type' ) } );
|
256
|
+
});
|
257
|
+
// New sub blocks
|
258
|
+
Sizzle( '[data-ec-block][data-ec-new-blocks]' ).forEach( function( el ) {
|
259
|
+
cnt = parseInt( el.getAttribute( 'data-ec-new-blocks' ) );
|
260
|
+
for( var i = 0; i < cnt; i++ ) {
|
261
|
+
cmp.inputs.push( { name: 'ec_cmp[Block][' + el.getAttribute( 'data-ec-block' ) + '][_add][' + i + ']', value: el.getAttribute( 'data-ec-container' ) } );
|
262
|
+
}
|
263
|
+
});
|
264
|
+
// Remove blocks
|
265
|
+
Sizzle( '[data-ec-block][data-ec-destroy="1"]' ).forEach( function( el ) {
|
266
|
+
cmp.inputs.push( { name: 'ec_cmp[Block][' + el.attributes['data-ec-block'].value + '][_destroy]', value: '1' } );
|
267
|
+
});
|
268
|
+
Sizzle( '[data-ec-sub-block][data-ec-destroy="1"]' ).forEach( function( el ) {
|
269
|
+
cmp.inputs.push( { name: 'ec_cmp[Block][' + el.attributes['data-ec-sub-block'].value + '][_destroy]', value: '1' } );
|
270
|
+
});
|
271
|
+
},
|
272
|
+
removeBlock: function() {
|
273
|
+
ecMain.toggleAttr( Sizzle( '[data-ec-block="' + this.dlg_block + '"]' )[0], 'data-ec-destroy' );
|
274
|
+
},
|
275
|
+
removeSubBlock: function( block ) {
|
276
|
+
var val = ecMain.toggleAttr( Sizzle( '[data-ec-block="' + this.dlg_block + '"] [data-ec-sub-block="' + block + '"]' )[0], 'data-ec-destroy' );
|
277
|
+
Sizzle( '[data-ec-dlg="options"] [data-ec-sub-block="' + block + '"]' )[0].setAttribute( 'data-ec-destroy', val ? '1' : '' );
|
278
|
+
}
|
279
|
+
}
|
280
|
+
});
|
@@ -0,0 +1,520 @@
|
|
1
|
+
# MediumEditor Object API (v5.0.0)
|
2
|
+
|
3
|
+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
4
|
+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
5
|
+
|
6
|
+
|
7
|
+
- [Initialization Functions](#initialization-functions)
|
8
|
+
- [`MediumEditor(elements, options)`](#mediumeditorelements-options)
|
9
|
+
- [`destroy()`](#destroy)
|
10
|
+
- [`setup()`](#setup)
|
11
|
+
- [`addElements()`](#addelementselements)
|
12
|
+
- [`removeElements()`](#removeelementselements)
|
13
|
+
- [Event Functions](#event-functions)
|
14
|
+
- [`on(targets, event, listener, useCapture)`](#ontargets-event-listener-usecapture)
|
15
|
+
- [`off(targets, event, listener, useCapture)`](#offtargets-event-listener-usecapture)
|
16
|
+
- [`subscribe(name, listener)`](#subscribename-listener)
|
17
|
+
- [`unsubscribe(name, listener)`](#unsubscribename-listener)
|
18
|
+
- [`trigger(name, data, editable)`](#triggername-data-editable)
|
19
|
+
- [Selection Functions](#selection-functions)
|
20
|
+
- [`checkSelection()`](#checkselection)
|
21
|
+
- [`exportSelection()`](#exportselection)
|
22
|
+
- [`importSelection(selectionState, favorLaterSelectionAnchor)`](#importselectionselectionstate-favorlaterselectionanchor)
|
23
|
+
- [`getFocusedElement()`](#getfocusedelement)
|
24
|
+
- [`getSelectedParentElement(range)`](#getselectedparentelementrange)
|
25
|
+
- [`restoreSelection()`](#restoreselection)
|
26
|
+
- [`saveSelection()`](#saveselection)
|
27
|
+
- [`selectAllContents()`](#selectallcontents)
|
28
|
+
- [`selectElement(element)`](#selectelementelement)
|
29
|
+
- [`stopSelectionUpdates()`](#stopselectionupdates)
|
30
|
+
- [`startSelectionUpdates()`](#startselectionupdates)
|
31
|
+
- [Editor Action Functions](#editor-action-functions)
|
32
|
+
- [`cleanPaste(text)`](#cleanpastetext)
|
33
|
+
- [`createLink(opts)`](#createlinkopts)
|
34
|
+
- [`execAction(action, opts)`](#execactionaction-opts)
|
35
|
+
- [`pasteHTML(html, options)`](#pastehtmlhtml-options)
|
36
|
+
- [`queryCommandState(action)`](#querycommandstateaction)
|
37
|
+
- [Helper Functions](#helper-functions)
|
38
|
+
- [`checkContentChanged(editable)`](#checkContentChangededitable)
|
39
|
+
- [`delay(fn)`](#delayfn)
|
40
|
+
- [`getContent(index)`](#getcontentindex)
|
41
|
+
- [`getExtensionByName(name)`](#getextensionbynamename)
|
42
|
+
- [`resetContent(element)`](#resetcontentelement)
|
43
|
+
- [`serialize()`](#serialize)
|
44
|
+
- [`setContent(html, index)`](#setcontenthtml-index)
|
45
|
+
- [Static Functions/Properties](#static-functionsproperties)
|
46
|
+
- [`getEditorFromElement(element)`](#geteditorfromelementelement)
|
47
|
+
- [`version`](#version)
|
48
|
+
|
49
|
+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
50
|
+
|
51
|
+
## Initialization Functions
|
52
|
+
|
53
|
+
### `MediumEditor(elements, options)`
|
54
|
+
|
55
|
+
Creating an instance of MediumEditor will:
|
56
|
+
* Convert all passed in elements into `contenteditable` elements.
|
57
|
+
* For any `<textarea>` elements:
|
58
|
+
* Hide the `<textarea>`
|
59
|
+
* Create a new `<div contenteditable=true>` element and add it to the elements array.
|
60
|
+
* Ensure the 2 elements remain sync'd.
|
61
|
+
* Initialize any custom extensions or buttons passed in.
|
62
|
+
* Create any additional elements needed.
|
63
|
+
* Setup all event handling needed to monitor the editable elements.
|
64
|
+
|
65
|
+
**Arguments**
|
66
|
+
|
67
|
+
_**elements** (`String` | `HTMLElement` | `Array` | `NodeList` | `HTMLCollection`)_:
|
68
|
+
|
69
|
+
1. `String`: If passed as a string, this is used as a selector in a call to `document.querySelectorAll()` to find elements on the page. All results are stored in the internal list of **elements**.
|
70
|
+
|
71
|
+
2. `HTMLElement`: If passed as a single element, this will be the only element in the internal list of **elements**.
|
72
|
+
|
73
|
+
3. `Array`: If passed as an `Array` of `HTMLElement`s, this will be used as the internal list of **elements**.
|
74
|
+
|
75
|
+
_**options** (`Object`)_:
|
76
|
+
|
77
|
+
Set of [custom options](OPTIONS.md) used to initialize `MediumEditor`.
|
78
|
+
|
79
|
+
***
|
80
|
+
### `destroy()`
|
81
|
+
|
82
|
+
Tear down the editor if already setup by doing the following:
|
83
|
+
* Calling the `destroy()` method on each extension within the editor. This should allow all extension to be torn down and cleaned up, including the toolbar and its elements.
|
84
|
+
* Detaching all event listeners from the DOM
|
85
|
+
* Detaching all references to custom event listeners
|
86
|
+
* Remove any custom attributes from the editor **elements**
|
87
|
+
* Unhide any `<textarea>` elements and remove any created `<div>` elements created for `<textarea>` elements.
|
88
|
+
|
89
|
+
***
|
90
|
+
### `setup()`
|
91
|
+
|
92
|
+
Initialize this instance of the editor if it has been destroyed. This will reuse the `elements` selector and `options` object passed in when the editor was instantiated.
|
93
|
+
|
94
|
+
***
|
95
|
+
### `addElements(elements)`
|
96
|
+
|
97
|
+
Dynamically add one or more elements to an already initialized instance of MediumEditor.
|
98
|
+
|
99
|
+
Passing an elements or array of elements to `addElements(elements)` will:
|
100
|
+
* Add the given element or array of elements to the editor **elements**
|
101
|
+
* Ensure the element(s) are initialized with the proper attributes and event handlers as if the element had been passed during instantiation of the editor
|
102
|
+
* For any `<textarea>` elements:
|
103
|
+
* Hide the `<textarea>`
|
104
|
+
* Create a new `<div contenteditable=true>` element and add it to the editor **elements**
|
105
|
+
* Ensure the 2 elements remain sync'd.
|
106
|
+
* Be intelligent enough to run the necessary code only once per element, no matter how often you will call it
|
107
|
+
|
108
|
+
So, every element you pass to `addElements` will turn into a fully supported contenteditable too - even earlier calls to `editor.subscribe(..)`
|
109
|
+
for custom events will work on the newly added element(s).
|
110
|
+
|
111
|
+
**Arguments**
|
112
|
+
|
113
|
+
_**elements** (`String` | `HTMLElement` | `Array` | `NodeList` | `HTMLCollection`)_:
|
114
|
+
|
115
|
+
1. `String`: If passed as a string, this is used as a selector in a call to `document.querySelectorAll()` to find elements on the page.
|
116
|
+
|
117
|
+
2. `HTMLElement`: If passed as a single element, this will be the only element added to the editor **elements**.
|
118
|
+
|
119
|
+
3. `Array` | `NodeList` | `HTMLCollection`: If passed as an `Array`-like collection of `HTMLElement`s, all of these elements will be added to the editor **elements**.
|
120
|
+
|
121
|
+
***
|
122
|
+
### `removeElements(elements)`
|
123
|
+
|
124
|
+
Remove one or more elements from an already initialized instance of MediumEditor.
|
125
|
+
|
126
|
+
Passing an elements or array of elements to `removeElements(elements)` will:
|
127
|
+
* Remove the given element or array of elements from the internal `this.elements` array.
|
128
|
+
* Remove any added event handlers or attributes (with the exception of `contenteditable`).
|
129
|
+
* Unhide any `<textarea>` elements and remove any created `<div>` elements created for `<textarea>` elements.
|
130
|
+
|
131
|
+
Each element itself will remain a contenteditable - it will just remove all event handlers and all references to it so you can safely remove it from DOM.
|
132
|
+
|
133
|
+
**Arguments**
|
134
|
+
|
135
|
+
_**elements** (`String` | `HTMLElement` | `Array` | `NodeList` | `HTMLCollection`)_:
|
136
|
+
|
137
|
+
1. `String`: If passed as a string, this is used as a selector in a call to `document.querySelectorAll()` to find elements on the page.
|
138
|
+
|
139
|
+
2. `HTMLElement`: If passed as a single element, this will be the only element removed from the editor **elements**.
|
140
|
+
|
141
|
+
3. `Array` | `NodeList` | `HTMLCollection`: If passed as an `Array`-like collection of `HTMLElement`s, all of these elements will be removed from the editor **elements**.
|
142
|
+
|
143
|
+
***
|
144
|
+
## Event Functions
|
145
|
+
|
146
|
+
### `on(targets, event, listener, useCapture)`
|
147
|
+
|
148
|
+
Attaches an event listener to a specific element or elements via the browser's built-in `addEventListener(type, listener, useCapture)` API. However, this helper method also ensures that when MediumEditor is destroyed, this event listener will be automatically be detached from the DOM.
|
149
|
+
|
150
|
+
**Arguments**
|
151
|
+
|
152
|
+
1. _**targets** (`HTMLElement` / `NodeList`)_:
|
153
|
+
|
154
|
+
* Element or elements to attach listener to via `addEventListener(type, listener, useCapture)`
|
155
|
+
|
156
|
+
2. _**event** (`String`)_:
|
157
|
+
|
158
|
+
* type argument for `addEventListener(type, listener, useCapture)`
|
159
|
+
|
160
|
+
3. _**listener** (`function`)_:
|
161
|
+
|
162
|
+
* listener argument for `addEventListener(type, listener, useCapture)`
|
163
|
+
|
164
|
+
4. _**useCapture** (`boolean`)_:
|
165
|
+
|
166
|
+
* useCapture argument for `addEventListener(type, listener, useCapture)`
|
167
|
+
|
168
|
+
***
|
169
|
+
### `off(targets, event, listener, useCapture)`
|
170
|
+
|
171
|
+
Detach an event listener from a specific element or elements via the browser's built-in `removeEventListener(type, listener, useCapture)` API.
|
172
|
+
|
173
|
+
**Arguments**
|
174
|
+
|
175
|
+
1. _**targets** (`HTMLElement` / `NodeList`)_:
|
176
|
+
|
177
|
+
* Element or elements to detach listener from via `removeEventListener(type, listener, useCapture)`
|
178
|
+
|
179
|
+
2. _**event** (`String`)_:
|
180
|
+
|
181
|
+
* type argument for `removeEventListener(type, listener, useCapture)`
|
182
|
+
|
183
|
+
3. _**listener** (`function`)_:
|
184
|
+
|
185
|
+
* listener argument for `removeEventListener(type, listener, useCapture)`
|
186
|
+
|
187
|
+
4. _**useCapture** (`boolean`)_:
|
188
|
+
|
189
|
+
* useCapture argument for `removeEventListener(type, listener, useCapture)`
|
190
|
+
|
191
|
+
***
|
192
|
+
### `subscribe(name, listener)`
|
193
|
+
|
194
|
+
Attaches a listener for the specified custom event name.
|
195
|
+
|
196
|
+
**Arguments**
|
197
|
+
|
198
|
+
1. _**name** (`String`)_:
|
199
|
+
|
200
|
+
* Name of the event to listen to. See the list of built-in [Custom Events](CUSTOM-EVENTS.md).
|
201
|
+
|
202
|
+
2. _**listener(data, editable)** (`function`)_:
|
203
|
+
|
204
|
+
* Listener method that will be called whenever the custom event is triggered.
|
205
|
+
|
206
|
+
**Arguments to listener**
|
207
|
+
|
208
|
+
1. _**data** (`Event` | `object`)_
|
209
|
+
* For most custom events, this will be the browser's native `Event` object for the event that triggered the custom event to fire.
|
210
|
+
* For some custom events, this will be an object containing information describing the event (depending on which custom event it is)
|
211
|
+
2. _**editable** (`HTMLElement`)_
|
212
|
+
* A reference to the contenteditable container element that this custom event corresponds to. This is especially useful for instances where one instance of MediumEditor contains multiple elements, or there are multiple instances of MediumEditor on the page.
|
213
|
+
* For example, when `blur` fires, this argument will be the `<div contenteditable=true></div>` element that is about to receive focus.
|
214
|
+
|
215
|
+
***
|
216
|
+
### `unsubscribe(name, listener)`
|
217
|
+
|
218
|
+
Detaches a custom event listener for the specified custom event name.
|
219
|
+
|
220
|
+
**Arguments**
|
221
|
+
|
222
|
+
1. _**name** (`String`)_:
|
223
|
+
|
224
|
+
* Name of the event to detach the listener for.
|
225
|
+
|
226
|
+
2. _**listener** (`function`)_:
|
227
|
+
|
228
|
+
* A reference to the listener to detach. This must be a match by-reference and not a copy.
|
229
|
+
|
230
|
+
**NOTE**
|
231
|
+
|
232
|
+
* Calling [destroy()](#destroy) on the MediumEditor object will automatically remove all custom event listeners.
|
233
|
+
|
234
|
+
***
|
235
|
+
### `trigger(name, data, editable)`
|
236
|
+
|
237
|
+
Manually triggers a custom event.
|
238
|
+
|
239
|
+
**Arguments**
|
240
|
+
|
241
|
+
1. _**name** (`String`)_:
|
242
|
+
|
243
|
+
* Name of the custom event to trigger.
|
244
|
+
|
245
|
+
2. _**data** (`Event` | `object`)_:
|
246
|
+
|
247
|
+
* Native `Event` object or custom data object to pass to all the listeners to this custom event.
|
248
|
+
|
249
|
+
3. _**editable** (`HTMLElement`)_:
|
250
|
+
|
251
|
+
* The `<div contenteditable=true></div>` element to pass to all of the listeners to this custom event.
|
252
|
+
|
253
|
+
***
|
254
|
+
## Selection Functions
|
255
|
+
|
256
|
+
### `checkSelection()`
|
257
|
+
|
258
|
+
If the toolbar is enabled, manually forces the toolbar to update based on the user's current selection. This includes hiding/showing the toolbar, positioning the toolbar, and updating the enabled/disable state of the toolbar buttons.
|
259
|
+
|
260
|
+
***
|
261
|
+
### `exportSelection()`
|
262
|
+
|
263
|
+
Returns a data representation of the selected text, which can be applied via `importSelection(selectionState)`. This data will include the beginning and end of the selection, as well as which of the editor **elements** the selection was within.
|
264
|
+
|
265
|
+
***
|
266
|
+
### `importSelection(selectionState, favorLaterSelectionAnchor)`
|
267
|
+
|
268
|
+
Restores the selection using a data representation of previously selected text (ie value returned by `exportSelection()`).
|
269
|
+
|
270
|
+
**Arguments**
|
271
|
+
|
272
|
+
1. _**selectionState** (`Object`)_:
|
273
|
+
|
274
|
+
* Data representing the state of the selection to restore.
|
275
|
+
|
276
|
+
2. _**favorLaterSelectionAnchor** (`boolean`)_:
|
277
|
+
|
278
|
+
* If `true`, import the cursor immediately subsequent to an anchor tag if it would otherwise be placed right at the trailing edge inside the anchor. THis cursor positioning, even though visually equivalent to the user, can affect behavior in Internet Explorer.
|
279
|
+
|
280
|
+
***
|
281
|
+
### `getFocusedElement()`
|
282
|
+
|
283
|
+
Returns a reference to the editor **element** that currently has focus (if the editor has focus).
|
284
|
+
|
285
|
+
***
|
286
|
+
### `getSelectedParentElement(range)`
|
287
|
+
|
288
|
+
Returns a reference to the editor **element** that the user's selection is currently within.
|
289
|
+
|
290
|
+
**Arguments**
|
291
|
+
|
292
|
+
1. _**range** (`Range`)_: _**OPTIONAL**_
|
293
|
+
* The `Range` to find the selection parent element within
|
294
|
+
* If no element is provided, the editor will use the current range within the selection of the editor's `contentWindow`
|
295
|
+
|
296
|
+
***
|
297
|
+
### `restoreSelection()`
|
298
|
+
|
299
|
+
Restores the selection to what was selected the last time `saveSelection()` was called.
|
300
|
+
|
301
|
+
***
|
302
|
+
### `saveSelection()`
|
303
|
+
|
304
|
+
Internally stores the user's current selection. This can be restored by calling `restoreSelection()`.
|
305
|
+
|
306
|
+
***
|
307
|
+
### `selectAllContents()`
|
308
|
+
|
309
|
+
Expands the selection to contain all text within the focused editor **element**.
|
310
|
+
|
311
|
+
***
|
312
|
+
### `selectElement(element)`
|
313
|
+
|
314
|
+
Change the user's selection to select the contents of the provided element and update the toolbar to reflect this change.
|
315
|
+
|
316
|
+
**Arguments**
|
317
|
+
|
318
|
+
1. _**element** (`HTMLElement`)_:
|
319
|
+
|
320
|
+
* DOM Element -- which is a descendant of one of the editor's **elements** -- to select.
|
321
|
+
|
322
|
+
***
|
323
|
+
### `stopSelectionUpdates()`
|
324
|
+
|
325
|
+
Stop the toolbar from updating to reflect changes in the user's selection.
|
326
|
+
|
327
|
+
***
|
328
|
+
### `startSelectionUpdates()`
|
329
|
+
|
330
|
+
Enable the toolbar to start updating based on the user's selection, after a call to `stopSelectionUpdates()`
|
331
|
+
|
332
|
+
***
|
333
|
+
## Editor Action Functions
|
334
|
+
|
335
|
+
### `cleanPaste(text)`
|
336
|
+
_convert text to plaintext and replace current selection with result_
|
337
|
+
|
338
|
+
**Arguments**
|
339
|
+
|
340
|
+
1. _**text** (`String`)_:
|
341
|
+
|
342
|
+
* Content to be pasted at the location of the current selection/cursor
|
343
|
+
|
344
|
+
***
|
345
|
+
### `createLink(opts)`
|
346
|
+
_creates a link via the native `document.execCommand('createLink')` command_
|
347
|
+
|
348
|
+
**Arguments**
|
349
|
+
|
350
|
+
1. _**opts** (`Object`)_:
|
351
|
+
|
352
|
+
* Object containing additional properties needed for creating a link
|
353
|
+
|
354
|
+
**Properties of 'opts'**
|
355
|
+
|
356
|
+
1. _**value** (`String`)_ _**REQUIRED**_
|
357
|
+
* The url to set as the `href` of the created link. A non-empty value must be provided for the link to be created.
|
358
|
+
2. _**target** (`String`)_
|
359
|
+
* Attribute to set as the `target` attribute of the created link. Passing 'self' or not passing this option at all are equivalent in that they will just ensure that `target="_blank"` will NOT be present on the created link.
|
360
|
+
* **NOTE** If the `targetBlank` option on the editor is set to true, the `target` property of opts will be ignored and `target="_blank"` will be added to all created links.
|
361
|
+
3. _**buttonClass** (`String`)_
|
362
|
+
* Class (or classes) to append to the `class` attribute of the created link.
|
363
|
+
|
364
|
+
##### Example
|
365
|
+
|
366
|
+
```js
|
367
|
+
editor.createLink({ value: 'https://github.com/yabwe/medium-editor', target: '_blank', buttonClass: 'medium-link' });
|
368
|
+
```
|
369
|
+
|
370
|
+
***
|
371
|
+
### `execAction(action, opts)`
|
372
|
+
_executes an built-in action via document.execCommand_
|
373
|
+
|
374
|
+
**Arguments**
|
375
|
+
|
376
|
+
1. _**action** (`String`)_:
|
377
|
+
|
378
|
+
* Action to be passed as the 'command' argument to `document.execCommand(command, showDefaultUI, value)`
|
379
|
+
|
380
|
+
2. _**opts** (`Object`)_ _**OPTIONAL**_:
|
381
|
+
|
382
|
+
* Object containing additional properties for specific commands
|
383
|
+
|
384
|
+
**Properties of 'opts'**
|
385
|
+
|
386
|
+
1. _**value** (`String`)_
|
387
|
+
* The value to pass as the 'value' argument to `document.execCommand(command, showDefaultUI, value)`
|
388
|
+
2. For 'createLink', the `opts` are passed directly to [`.createLink(opts)`]((#createlinkopts)) so see that method for additional options for that command
|
389
|
+
|
390
|
+
***
|
391
|
+
### `pasteHTML(html, options)`
|
392
|
+
_replace the current selection with html_
|
393
|
+
|
394
|
+
**Arguments**
|
395
|
+
|
396
|
+
1. _**html** (`String`)_:
|
397
|
+
|
398
|
+
* Content to be pasted at the location of the current selection/cursor
|
399
|
+
|
400
|
+
2. _**options** (`Object`)_ _**OPTIONAL**_:
|
401
|
+
|
402
|
+
* Optional overrides for `cleanTags`, `unwrapTags`, and/or `cleanAttrs` for removing/unwrapping specific element types (`cleanTags`/`unwrapTags`), or removing specific attributes (`cleanAttrs`) from the inserted HTML. See [cleanTags](OPTIONS.md#cleantags), [unwrapTags](OPTIONS.md#unwraptags), and [cleanAttrs](OPTIONS.md#cleanattrs) in OPTIONS.md for more information.
|
403
|
+
|
404
|
+
##### Example
|
405
|
+
|
406
|
+
```js
|
407
|
+
editor.pasteHTML('<p class="classy"><strong>Some Custom HTML</strong></p>', { cleanAttrs: ['class'], cleanTags: ['strong'], unwrapTags: ['em']});
|
408
|
+
```
|
409
|
+
|
410
|
+
***
|
411
|
+
### `queryCommandState(action)`
|
412
|
+
_wrapper around the browser's built in `document.queryCommandState(command)` for checking whether a specific action has already been applied to the selection._
|
413
|
+
|
414
|
+
**Arguments**
|
415
|
+
|
416
|
+
1. _**action** (`String`)_:
|
417
|
+
|
418
|
+
* Action to be passed as the 'command' argument to `document.queryCommandState(command)`
|
419
|
+
|
420
|
+
***
|
421
|
+
## Helper Functions
|
422
|
+
|
423
|
+
### `checkContentChanged(editable)`
|
424
|
+
|
425
|
+
Trigger the editor to check for updates to the html, and trigger the `editableInput` event if needed.
|
426
|
+
|
427
|
+
**Arguments**
|
428
|
+
|
429
|
+
1. _**editable** (`HTMLElement`)_: _**OPTIONAL**_
|
430
|
+
* The `<div contenteditable=true></div>` element that contains the html that may have changed.
|
431
|
+
* If no element is provided, the editor will check the currently 'active' editor element (the element with focus).
|
432
|
+
|
433
|
+
### `delay(fn)`
|
434
|
+
|
435
|
+
Delay any function from being executed by the amount of time passed as the **delay** option.
|
436
|
+
|
437
|
+
**Arguments**
|
438
|
+
|
439
|
+
1. _**fn** (`function`)_:
|
440
|
+
|
441
|
+
* Function to delay execution for.
|
442
|
+
|
443
|
+
***
|
444
|
+
### `getContent(index)`
|
445
|
+
|
446
|
+
Returns the trimmed html content for the first editor **element**, or the **element** at `index`.
|
447
|
+
|
448
|
+
**Arguments**
|
449
|
+
|
450
|
+
1. _**index** (`integer`)_: _**OPTIONAL**_
|
451
|
+
* Index of the editor **element** to retrieve the content from. Defaults to 0 when not provided (returns content of the first editor **element**).
|
452
|
+
|
453
|
+
***
|
454
|
+
### `getExtensionByName(name)`
|
455
|
+
|
456
|
+
Get a reference to an extension with the specified name.
|
457
|
+
|
458
|
+
**Arguments**
|
459
|
+
|
460
|
+
1. _**name** (`String`)_:
|
461
|
+
|
462
|
+
* The name of the extension to retrieve (ie `toolbar`).
|
463
|
+
|
464
|
+
***
|
465
|
+
### `resetContent(element)`
|
466
|
+
|
467
|
+
Reset the content of all editor **elements** to their value at the time they were added to the editor. If a specific editor **element** is provided, only the content of that element will be reset.
|
468
|
+
|
469
|
+
**Arguments**
|
470
|
+
|
471
|
+
1. _**element** (`DOMElement`)_: _**OPTIONAL**_
|
472
|
+
|
473
|
+
* Specific editor **element** to reset the content of.
|
474
|
+
|
475
|
+
***
|
476
|
+
### `serialize()`
|
477
|
+
|
478
|
+
Returns a JSON object including the content of each of the **elements** inside the editor.
|
479
|
+
|
480
|
+
***
|
481
|
+
### `setContent(html, index)`
|
482
|
+
|
483
|
+
Sets the html content for the first editor **element**, or the **element** at `index`. Ensures the the `editableInput` event is triggered.
|
484
|
+
|
485
|
+
**Arguments**
|
486
|
+
|
487
|
+
1. _**html** (`string`)_:
|
488
|
+
* The content to set the element to
|
489
|
+
|
490
|
+
2. _**index** (`integer`)_: _**OPTIONAL**_
|
491
|
+
* Index of the editor **element** to set the content of. Defaults to 0 when not provided (sets content of the first editor **element**).
|
492
|
+
|
493
|
+
***
|
494
|
+
## Static Functions/Properties
|
495
|
+
|
496
|
+
### `getEditorFromElement(element)`
|
497
|
+
|
498
|
+
Given an editor **element**, retrieves the instance of MediumEditor which created/is monitoring the **element**
|
499
|
+
|
500
|
+
**Arguments**
|
501
|
+
|
502
|
+
1. _**element** (`DOMElement`)_:
|
503
|
+
* An editor **element** which is part of a MediumEditor instance
|
504
|
+
|
505
|
+
### `version`
|
506
|
+
|
507
|
+
Object containing data about the version of the current MediumEditor library
|
508
|
+
|
509
|
+
**Properties of 'version'**
|
510
|
+
|
511
|
+
1. _**major** (`Number`)_
|
512
|
+
* The major version number (ie the `3` in `"3.2.1"`)
|
513
|
+
2. _**minor** (`Number`)_
|
514
|
+
* The minor version number (ie the `2` in `"3.2.1"`)
|
515
|
+
3. _**revision** (`Number`)_
|
516
|
+
* The revision (aka "patch") version number (ie the `1` in `"3.2.1"`)
|
517
|
+
4. _**preRelease** (`String`)_
|
518
|
+
* The pre-release version tag (ie the `"rc.1"` in `"5.0.0-rc.1"`)
|
519
|
+
5. _**toString** (`Function`)_
|
520
|
+
* Returns the full version number as a string (ie `"5.0.0-rc.1"`)
|