UNPKG

ff-editor

Version:

Extensible WYSIWYG HTML Editor

2 lines 86.7 kB
/*! ff-editor - attrs */!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("ff",[],e):"object"==typeof exports?exports.ff=e():t.ff=e()}(this,function(){return function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=26)}([function(t,e,n){var i=n(60);n(61)(i);var r=i(document),o=t.exports=function(t){return t instanceof Document?t===document?r(t):t.__tinyselector__=t.__tinyselector__||i(t):r.apply(r,arguments)};o.fn=i.fn,o.util=i.util,o.each=i.each,o.create=i.create},function(t,e){function n(t,e){var n=t[1]||"",r=t[3];if(!r)return n;if(e&&"function"==typeof btoa){var o=i(r),a=r.sources.map(function(t){return"/*# sourceURL="+r.sourceRoot+t+" */"});return[n].concat(a).concat([o]).join("\n")}return[n].join("\n")}function i(t){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(t))))+" */"}t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var i=n(e,t);return e[2]?"@media "+e[2]+"{"+i+"}":i}).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var i={},r=0;r<this.length;r++){var o=this[r][0];"number"==typeof o&&(i[o]=!0)}for(r=0;r<t.length;r++){var a=t[r];"number"==typeof a[0]&&i[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),e.push(a))}},e}},function(t,e,n){function i(t,e){for(var n=0;n<t.length;n++){var i=t[n],r=p[i.id];if(r){r.refs++;for(var o=0;o<r.parts.length;o++)r.parts[o](i.parts[o]);for(;o<i.parts.length;o++)r.parts.push(l(i.parts[o],e))}else{for(var a=[],o=0;o<i.parts.length;o++)a.push(l(i.parts[o],e));p[i.id]={id:i.id,refs:1,parts:a}}}}function r(t,e){for(var n=[],i={},r=0;r<t.length;r++){var o=t[r],a=e.base?o[0]+e.base:o[0],s=o[1],f=o[2],c=o[3],l={css:s,media:f,sourceMap:c};i[a]?i[a].parts.push(l):n.push(i[a]={id:a,parts:[l]})}return n}function o(t,e){var n=m(t.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var i=y[y.length-1];if("top"===t.insertAt)i?i.nextSibling?n.insertBefore(e,i.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),y.push(e);else{if("bottom"!==t.insertAt)throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");n.appendChild(e)}}function a(t){t.parentNode.removeChild(t);var e=y.indexOf(t);e>=0&&y.splice(e,1)}function s(t){var e=document.createElement("style");return t.attrs.type="text/css",c(e,t.attrs),o(t,e),e}function f(t){var e=document.createElement("link");return t.attrs.type="text/css",t.attrs.rel="stylesheet",c(e,t.attrs),o(t,e),e}function c(t,e){Object.keys(e).forEach(function(n){t.setAttribute(n,e[n])})}function l(t,e){var n,i,r,o;if(e.transform&&t.css){if(!(o=e.transform(t.css)))return function(){};t.css=o}if(e.singleton){var c=b++;n=v||(v=s(e)),i=u.bind(null,n,c,!1),r=u.bind(null,n,c,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=f(e),i=d.bind(null,n,e),r=function(){a(n),n.href&&URL.revokeObjectURL(n.href)}):(n=s(e),i=h.bind(null,n),r=function(){a(n)});return i(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;i(t=e)}else r()}}function u(t,e,n,i){var r=n?"":i.css;if(t.styleSheet)t.styleSheet.cssText=w(e,r);else{var o=document.createTextNode(r),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(o,a[e]):t.appendChild(o)}}function h(t,e){var n=e.css,i=e.media;if(i&&t.setAttribute("media",i),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}function d(t,e,n){var i=n.css,r=n.sourceMap,o=void 0===e.convertToAbsoluteUrls&&r;(e.convertToAbsoluteUrls||o)&&(i=x(i)),r&&(i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var a=new Blob([i],{type:"text/css"}),s=t.href;t.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}var p={},g=function(t){var e;return function(){return void 0===e&&(e=t.apply(this,arguments)),e}}(function(){return window&&document&&document.all&&!window.atob}),m=function(t){var e={};return function(n){return void 0===e[n]&&(e[n]=t.call(this,n)),e[n]}}(function(t){return document.querySelector(t)}),v=null,b=0,y=[],x=n(46);t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");e=e||{},e.attrs="object"==typeof e.attrs?e.attrs:{},void 0===e.singleton&&(e.singleton=g()),void 0===e.insertInto&&(e.insertInto="head"),void 0===e.insertAt&&(e.insertAt="bottom");var n=r(t,e);return i(n,e),function(t){for(var o=[],a=0;a<n.length;a++){var s=n[a],f=p[s.id];f.refs--,o.push(f)}if(t){i(r(t,e),e)}for(var a=0;a<o.length;a++){var f=o[a];if(0===f.refs){for(var c=0;c<f.parts.length;c++)f.parts[c]();delete p[f.id]}}}};var w=function(){var t=[];return function(e,n){return t[e]=n,t.filter(Boolean).join("\n")}}()},function(t,e,n){function i(t){if(this._={},r.util.isArrayLike(t)){var e=this;[].forEach.call(t,function(t){e.add(t)})}}var r=n(0),o=i.prototype=[];o.push=function(){var t=this;return[].forEach.call(arguments,function(e){e&&e.id&&(t._[e.id]=e)}),[].push.apply(this,arguments)},o.add=function(t){if(r.util.isArrayLike(t)){var e=this;[].forEach.call(t,function(t){e.push(t)})}else this.push(t);return this},o.get=function(t){return this._[t]},o.remove=function(t){if(~["string","number"].indexOf(typeof t)&&(t=this._[t]),!t)return this;for(var e;~(e=this.indexOf(t));)this.splice(e,1);return this},o.clear=function(){return this.splice(0,this.length),this},t.exports=i},function(t,e,n){function i(t,e,n,i,r){return{id:t,text:e,tooltip:n,onupdate:function(t){var e=this.range();if(!e)return t.enable(!1);t.enable(!0),t.active(e.iswrapped(i))},fn:r||function(t){var e=this,n=e.range();n&&(n.togglewrap(i),e.history().save())}}}var r=n(0),o=n(6);t.exports={insert:{heading:{id:"insert.heading",text:'<i class="fa fa-header"></i>',tooltip:"Heading",fn:function(t){var e=r(this.dom()).attr("placeholder");this.insert((new o.Heading).placeholder(e))}},paragraph:{id:"insert.paragraph",text:'<i class="fa fa-font"></i>',tooltip:"문단",fn:function(t){var e=r(this.dom()).attr("placeholder");this.insert((new o.Paragraph).placeholder(e))}},imagefile:{id:"insert.imagefile",text:'<i class="fa fa-picture-o"></i>',tooltip:"이미지 파일",fn:function(t){var e=this;e.context().selectFiles(function(t,n){if(t)return o.error(t);n.length&&e.insert(n)},{upload:!1,type:"image"})}},image:{id:"insert.image",text:'<i class="fa fa-instagram"></i>',tooltip:"이미지",fn:function(t){var e=this;o.prompt("Please enter the image URL.",function(t){t&&e.insert(new o.Image(t))})}},video:{id:"insert.video",text:'<i class="fa fa-youtube-square"></i>',tooltip:"동영상",fn:function(t){var e=this;o.prompt("Please enter the video URL",function(t){t&&e.insert(new o.Video(t))})}},separator:{id:"insert.separator",text:'<i class="fa fa-minus"></i>',tooltip:"구분선",fn:function(t){this.insert(new o.Separator)}},link:{id:"insert.link",text:'<i class="fa fa-link"></i>',tooltip:"링크",fn:function(t){var e=this;o.prompt("Please enter the anchor URL",function(t){t&&e.insert(new o.Link(t))})}},attach:{id:"insert.attach",text:'<i class="fa fa-paperclip"></i>',tooltip:"첨부파일",fn:function(t){var e=this;e.context().selectFile(function(t,n){if(t)return o.error(t);e.insert(new o.Link(n))})}}},clear:{id:"clear",text:'<i class="fa fa-eraser"></i>',tooltip:"내용 삭제",fn:function(t){this.clear()}},heading:{id:"heading",type:"list",text:'<i class="fa fa-header"></i>',tooltip:"Select Heading",onselect:function(t,e,n){var i=this;if(i.dom().tagName.toLowerCase()!==t.tag){var a=r(i.dom()),s=i.parent(),f=new o.Heading({tag:t.tag,html:a.html()});a.after(f.dom()).remove(),f.focus(),s&&s.history().save()}},items:[{text:"<h1>Title</h1>",tag:"h1"},{text:"<h2>Title</h2>",tag:"h2"},{text:"<h3>Title</h3>",tag:"h3"},{text:"<h4>Title</h4>",tag:"h4"},{text:"<h5>Title</h5>",tag:"h5"},{text:"<h6>Title</h6>",tag:"h6"}]},align:{id:"align",text:'<i class="fa fa-align-justify"></i>',tooltip:"정렬",onupdate:function(t){"center"==t.align?t.text('<i class="fa fa-align-center"></i>'):"right"==t.align?t.text('<i class="fa fa-align-right"></i>'):"justify"==t.align?t.text('<i class="fa fa-align-justify"></i>'):t.text('<i class="fa fa-align-left"></i>')},fn:function(t){var e=this,n=r(e.dom());"center"==t.align?(n.css("text-align","right"),t.align="right"):"right"==t.align?(n.css("text-align","justify"),t.align="justify"):"justify"==t.align?(n.css("text-align",""),t.align=""):(n.css("text-align","center"),t.align="center"),e.history().save()}},draggable:{id:"draggable",text:'<i class="fa fa-hand-pointer-o"></i>',tooltip:"요소이동",onupdate:function(t){r(this.dom()).ha("draggable")?t.active(!0):t.active(!1)},fn:function(){var t=this;t.dragmode(!t.dragmode())}},clearfix:{id:"clearfix",text:'<i class="fa fa-asterisk"></i>',tooltip:"클리어픽스",onupdate:function(t){t.active(r(this.dom()).hc("f_clearfix"))},fn:function(){r(this.dom()).tc("f_clearfix"),this.history().save()}},remove:{id:"remove",text:'<i class="fa fa-remove"></i>',onupdate:function(t){this.removable()?t.show():t.hide()},fn:function(){this.remove()}},target:{id:"target",text:'<i class="fa fa-external-link"></i>',tooltip:"새창으로",onupdate:function(t){r(this.dom()).find("a").attr("target")?t.active(!0):t.active(!1)},fn:function(){this.target(this.target()?null:"_blank")}},separator:{shape:{id:"separator.shape",text:'<i class="fa fa-chevron-up"></i>',tooltip:"모양",onupdate:function(t){var e=this,n=e.shape();"dotted"==n?t.text('<i class="fa fa-ellipsis-h"></i>'):"dashed"==n?t.text('<i class="fa fa-ellipsis-h"></i>'):"zigzag"==n?t.text('<i class="fa fa-chevron-up"></i>'):t.text('<i class="fa fa-minus"></i>')},fn:function(t){var e=this,n=e.shape();"dotted"==n?e.shape("dashed"):"dashed"==n?e.shape("zigzag"):"zigzag"==n?e.shape("line"):"line"==n?e.shape(!1):e.shape("dotted"),e.history().save()}},width:{id:"separator.width",text:'<i class="fa fa-arrows-h"></i>',tooltip:"너비",onupdate:function(t){var e=this,n=r(e.dom());if(e.shape()===!1)return t.hide();t.show(),n.hc("f_sep_narrow")?t.text('<i class="fa fa-minus"></i>'):t.text('<i class="fa fa-arrows-h"></i>')},fn:function(t){r(this.dom()).tc("f_sep_narrow"),this.history().save()}}},row:{valign:{id:"row.valign",text:'<i class="fa fa-align-justify"></i>',tooltip:"정렬",onupdate:function(t){var e=this,n=e.valign();"middle"==n?t.text('<i class="fa fa-align-center ff-vert"></i>'):"bottom"==n?t.text('<i class="fa fa-align-left ff-vert"></i>'):"justify"==n?t.text('<i class="fa fa-align-justify ff-vert"></i>'):t.text('<i class="fa fa-align-right ff-vert"></i>')},fn:function(t){var e=this,n=e.valign();"middle"==n?e.valign("bottom"):"bottom"==n?e.valign("justify"):"justify"==n?e.valign(!1):e.valign("middle"),e.history().save()}}},image:{floatleft:{id:"image.floatleft",text:'<i class="fa fa-dedent"></i>',tooltip:"좌측플로팅",fn:function(t){this.floating("left").history().save()}},floatright:{id:"image.floatright",text:'<i class="fa fa-dedent ff-flip"></i>',tooltip:"우측플로팅",fn:function(t){this.floating("right").history().save()}},size:{id:"image.size",text:'<i class="fa fa-circle-o"></i>',tooltip:"크기변경",onupdate:function(t){var e=this,n=e.blockmode();"natural"==n?t.text('<i class="fa fa-square-o"></i>'):"medium"==n?t.text('<i class="fa fa-arrows-alt"></i>'):"full"==n?t.text('<i class="fa fa-circle-o"></i>'):t.text('<i class="fa fa-align-center"></i>')},fn:function(t){var e=this,n=e.blockmode();"natural"==n?e.blockmode("medium"):"medium"==n?e.blockmode("full"):"full"==n?e.blockmode(!1):e.blockmode("natural"),e.history().save()}},upload:{id:"image.upload",text:'<i class="fa fa-file-image-o"></i>',tooltip:"사진변경(업로드)",fn:function(){var t=this;o.selectFile(function(e,n){if(e)return o.error(e);n&&(t.src(n.src).title(n.name),t.history().save())})}},change:{id:"image.change",text:'<i class="fa fa-instagram"></i>',tooltip:"사진변경",fn:function(){var t=this;o.prompt("Please enter the image URL.",function(e){e&&t.src(e).title(null),t.history().save()})}},align:{id:"image.align",text:'<i class="fa fa-align-justify"></i>',tooltip:"정렬",onupdate:function(t){var e=this,n=r(e.figcaption()),i=n.css("text-align");e.isFigure()?t.show():t.hide(),"right"==i?t.text('<i class="fa fa-align-right"></i>'):"left"==i?t.text('<i class="fa fa-align-left"></i>'):t.text('<i class="fa fa-align-center"></i>')},fn:function(t){var e=this,n=r(e.figcaption()),i=n.css("text-align");"right"==i?n.css("text-align","left"):"left"==i?n.css("text-align",null):n.css("text-align","right"),e.history().save()}},caption:{id:"image.caption",text:'<i class="fa fa-text-width"></i>',onupdate:function(t){this.isFigure()?t.active(!0):t.active(!1)},tooltip:"캡션",fn:function(){this.caption(!this.isFigure())}}},video:{size:{id:"video.size",text:'<i class="fa fa-circle-o"></i>',tooltip:"크기변경",onupdate:function(t){r(this.dom()).hc("f_video_fit")?t.text('<i class="fa fa-circle-o"></i>'):t.text('<i class="fa fa-arrows-alt"></i>')},fn:function(){var t=r(this.dom());t.hc("f_video_fit")?t.rc("f_video_fit").ac("f_video_narrow"):t.rc("f_video_narrow").ac("f_video_fit")}}},paragraph:{font:{id:"paragraph.font",type:"list",text:'<i class="fa fa-font"></i>',tooltip:"Select Font",onupdate:function(t){var e=this.range();e&&t.active(e.iswrapped("span.f_txt_font"))},onselect:function(t,e,n){var i=this,r=i.dom(),o=i.range();if(!o)return r.style.fontFamily=t.font||"",void i.history().save();o.unwrap("span.f_txt_font"),o.wrap("span.f_txt_font").style.fontFamily=t.font||"",i.history().save()},items:function(){return o.fonts()}},fontsize:{id:"paragraph.fontsize",type:"list",text:'<i class="fa fa-text-height"></i>',tooltip:"Select Font Size",onupdate:function(t){var e=this.range();e&&t.active(e.iswrapped("span.f_txt_fontsize"))},onselect:function(t,e,n){var i=this,r=i.dom(),o=i.range();if(!o)return r.style.fontSize=t.size||"",void i.history().save();o.unwrap("span.f_txt_fontsize"),o.wrap("span.f_txt_fontsize").style.fontSize=t.size||"",i.history().save()},items:[{text:"Default"},{text:'<span style="font-size:11px;">11px</span>',size:"11px"},{text:'<span style="font-size:12px;">12px</span>',size:"12px"},{text:'<span style="font-size:14px;">14px</span>',size:"14px"},{text:'<span style="font-size:16px;">16px</span>',size:"16px"},{text:'<span style="font-size:18px;">18px</span>',size:"18px"},{text:'<span style="font-size:20px;">20px</span>',size:"20px"}]},color:{id:"paragraph.color",type:"list",text:'<i class="fa fa-square"></i>',tooltip:"Select Color",onupdate:function(t){var e=this.range();e&&t.active(e.iswrapped("span.f_txt_color"))},onselect:function(t,e,n){var i=this,o=i.dom(),a=i.range(),s=function(t){if(!a)return void(o.style.color=t||"");a.unwrap("span.f_txt_color"),a.wrap("span.f_txt_color").style.color=t||""};"picker"==t.id?r('<input type="color">').on("change",function(){this.value&&s(this.value)}).click():(s(t.color),i.history().save())},items:function(){var t=o.colors().slice();return t.push({id:"picker",text:"Select Color"}),t}},bold:i("paragraph.bold",'<i class="fa fa-bold"></i>',"굵게","b"),underline:i("paragraph.underline",'<i class="fa fa-underline"></i>',"밑줄","u"),italic:i("paragraph.italic",'<i class="fa fa-italic"></i>',"이탤릭","i"),strike:i("paragraph.strike",'<i class="fa fa-strikethrough"></i>',"가로줄","strike"),anchor:i("paragraph.anchor",'<i class="fa fa-link"></i>',"링크","a",function(t){var e=this,n=e.range();if(!n||n.iswrapped("a"))return n.unwrap("a");o.prompt("Please enter the anchor URL.",function(t){if(t){var i=n.wrap("a");i.href=t,i.target="_blank",e.history().save()}})})}}},function(t,e,n){var i=n(0),r=n(28);r.Button=n(8),r.Separator=n(13),r.ListButton=n(12),r.update=function(){i(".ff-toolbar").each(function(t,e){var n=e.toolbar;n&&n.update()})},t.exports=r},function(t,e,n){var i,r,o=n(0),a=n(14),s=n(3),f=n(11),c=n(25),f=n(11),l=window,u=document,h=!1,d={},p=new s,g=new s,m=o('<input type="file">'),v={scan:function(t,e){return v.parts.apply(v,arguments),v},parts:function(t,e){return t===!0&&(e=t),o(e?".ff [ff-id], [ff], [ff-type]":"[ff-id], [ff], [ff-type]").reverse().each(function(e,n){var i=n.getAttribute("ff-id"),r=n.getAttribute("ff-type")||n.getAttribute("ff")||"default",o=n._ff;if(!o){var s=a.get(r);if(!s)return console.warn("[ff] not found type: "+r);o=n._ff=new s(n),i&&d[i]&&o.data(d[i])}o.id=i,"function"==typeof t&&t.call(v,o)}).slice()},data:function(t,e){return arguments.length?(d=t||{},o("[ff-id]").reverse().each(function(t,n){var i=n.getAttribute("ff-id"),r=n.getAttribute("ff-type")||n.getAttribute("ff")||"default",o=n._ff;if(!o){var s=a.get(r);if(!s)return console.warn("[ff] not found type: "+r);o=new s(n)}d[i]?o.data(d[i]):e===!0&&o.data(null)}),v.fire("ff-data",{data:t}),v):(t={},v.parts(function(e){e.id&&(t[e.id]=e.data())}),t)},clear:function(){return v.data(null,!0).fire("ff-clear"),v},reset:function(){return console.warn("[ff] ff.reset is deprecated, use ff.data instead"),v.data.apply(v,arguments)},get:function(){return console.warn("[ff] ff.get is deprecated, use ff.partof instead"),v.partof.apply(v,arguments)},part:function(t){var e=o('[ff-id="'+t+'"]');return e[0]&&e[0]._ff},partof:function(t){var e=o(t).parent(function(){return this._ff},!0)[0];return e&&e._ff},partsof:function(t){var e=[];return o(t).parent(function(){var t=this._ff;t&&e.push(t)},!0),e},editmode:function(t){return arguments.length?h===!!t?v:(h=!!t,v.parts(function(t){t.editmode(h)},!0),v.fire("ff-modechange",{editmode:h}),v):h},fire:function(t,e,n,i){return!!o(u).fire(t,e,n,i)[0]},on:function(t,e){return e._wrapper=function(){return e.apply(v,arguments)},o(u).on(t,e._wrapper),this},once:function(t,e){return e._wrapper=function(){return e.apply(v,arguments)},o(u).once(t,e._wrapper),this},off:function(t,e){return o(u).off(t,e._wrapper||e),this},types:function(){return a},type:function(t,e){return arguments.length<=1?a.get(t):(a.define(t,e),v)},uploader:function(t){if(!t||"function"!=typeof t)throw new TypeError("uploader must be a function");return i=t,v},upload:function(t,e){return i.call(v,t,function(t,n){if(t&&v.fire("ff-upload-error",{error:t}),t)return e&&e(t);v.fire("ff-upload",{result:n}),e&&e(null,n)}),v},selectFiles:function(t,e){e=e||{},"boolean"==typeof e&&(e={upload:e}),"string"==typeof e&&(e={type:e}),"number"==typeof e&&(e={limit:e});var n=e.type,i=e.upload!==!1,a=e.limit,s=r;return r=function(){var e=[].slice.call(this.files);if(a&&e.length&&(e=e.slice(0,a)),n){var r=[];e.forEach(function(t){t.type&&!t.type.indexOf(n)&&r.push(t)}),e=r}if(!i)return t(null,e);var s=[];o(e).async(function(t,e){v.upload(t,function(t,n){if(t)return e(t);s.push(n),e()})},function(e){if(e)return t(e);t(null,s)})},m.value("").attr("multiple",1===a?null:"").off("change",s).on("change",r).click(),v},selectFile:function(t,e){return e=e||{},e.limit=1,v.selectFiles(function(e,n){if(e)return t(e);t(null,n&&n[0])},e)},prompt:function(t,e,n){return v.fire("ff-prompt",{message:t,callback:e,options:n},!0)&&e&&e.call(v,prompt(t)),v},confirm:function(t,e,n){return v.fire("ff-prompt",{message:t,callback:e,options:n},!0)&&e&&e.call(v,confirm(t)),v},alert:function(t,e,n){return v.fire("ff-alert",{message:t,callback:e,options:n},!0)&&(e&&e.call(v),alert(t)),v},error:function(t,e,n){return"string"==typeof t&&(t=new Error(t)),v.fire("ff-error",{error:t,message:t.message,callback:e,options:n},!0)&&(e&&e.call(v),console.error(t),alert(t.message)),v},history:function(t){return arguments.length?(c.add(t),this):c},ranges:function(t,e){var n=l.getSelection(),i=[];if(n.rangeCount)for(var r=0;r<n.rangeCount;r++)i.push(n.getRangeAt(r));return arguments.length?i.filter(function(n){if(e||!n.collapsed)return n&&t.contains(n.startContainer)&&t.contains(n.endContainer)&&f(n)}):i},range:function(t,e){var n=v.ranges(t,e);return n&&n.length&&f(n[n.length-1])},fonts:function(t){return arguments.length?(p=new s(t),v):p},colors:function(t){return arguments.length?(g=new s(t),v):g}};o(u).on("mousedown",function(t){if(h){var e=t.target||t.srcElement,n=v.partof(e),i=v.focused;n?n.focus():i&&i.blur()}}),t.exports=v},function(t,e,n){function i(t){var e=t;if(e&&e._ff)return e._ff;if(!(this instanceof i))return null;if(e&&o.util.isElement(e)||(e=this.create.apply(this,arguments)),!o.util.isElement(e))throw new TypeError("illegal arguments: dom");var n=e._ff=this,r=o(n._n=e).ac("ff").on("ff-data ff-focus ff-blur ff-modechange mouseenter mouseleave mouseup mousedown dragstart dragend",n);!function(){var t=n,e=[];do{if(t===i.prototype)break;e.push(t)}while(t=Object.getPrototypeOf(t));e.reverse().forEach(function(t){Object.getOwnPropertyNames(t).forEach(function(t){~["on","once"].indexOf(t)||t.indexOf("on")||n.on("ff-"+t.substring(2),n[t])})})}(),e!==t&&n.removable(!0);var s=n.toolbar();i.toolbar.forEach(function(t){s.last(t)});var f=r.attr("ff-toolbar");"true"===f&&(f=null),"false"===f?s.enable(!1):f&&s.position(f),n.fire("ff-init"),a.editmode()&&n.editmode(!0),a.fire("ff-detect",{part:n}),n.history().init()}var r=(n(14),n(5)),o=n(0),a=n(6),s=n(3),f=n(4);i.prototype={handleEvent:function(t){if(!t.defaultPrevented){var e=t.type,n=this,i=n.editmode(),r=n.toolbar(),s=t.target||t.srcElement,f=n.dom(),c=o(f);"ff-data"==e?n.fire("ff-render",{type:"data",originalEvent:t}):"ff-modechange"==e&&(i?(r.always()&&r.show(),c.ac("ff-edit-state"),n.fire("ff-editmode")):(r.hide(!0),c.rc("ff-edit-state").rc("ff-focus-state").rc("ff-enter-state").rc("ff-dragging"),n.fire("ff-viewmode"),n.blur()),n.fire("ff-render",{type:"modechange",originalEvent:t})),i&&("ff-focus"==e?(c.attr("draggable",!0),r.show()):"ff-blur"==e?(c.attr("draggable",null),r.hide()):"mouseenter"==e?(r.update(),c.ac("ff-enter-state")):~["mousedown","mouseup"].indexOf(e)?setTimeout(function(){r.update()},0):"mouseleave"==e?c.rc("ff-enter-state"):"dragstart"==e?s===f&&(r.hide(),a.dragging=f,t.dataTransfer.setDragImage(f,0,0),t.dataTransfer.setData("text",f.outerHTML),c.ac("ff-dragging"),n.history().init()):"dragend"==e&&s===f&&(r.show(),a.dragging=null,c.rc("ff-dragging")))}},context:function(){return a},createToolbar:function(){return new r(this)},toolbar:function(){return this._t||(this._t=this.createToolbar())},removable:function(t){return arguments.length?(this._rm=!!t,this):this._rm},dom:function(){return this._n},create:function(t){return o("<div/>").html(t)[0]},html:function(t){var e=this,n=e.dom();if(!arguments.length){var i=e.editmode();e.editmode(!1);var t=n.innerHTML;e.editmode(i);var r=o("<div/>").html(t);return r.find(".ff, .ff-edit-state, .ff-enter-state, .ff-focus-state, .ff-dragging, [draggable], [contenteditable]").rc("ff ff-edit-state ff-enter-state ff-focus-state ff-dragging").attr("draggable",null).attr("contenteditable",null),r.find(".ff-acc").remove(),r.html()}return n.innerHTML=t||"",e.history().init(),e},parent:function(){var t=this.dom().parentNode;return t&&a.partof(t)},parents:function(){var t=this.dom().parentNode;return t&&a.partsof(t)},remove:function(){var t=this;return t.blur(),t.toolbar().hide(),t.fire("ff-remove"),o(t.dom()).remove(),t},editmode:function(t){var e=this;if(!arguments.length)return!!e._md;var n=e._md,i=e._md=!!t;return i!==n&&e.fire("ff-modechange",{editmode:i}),e},data:function(t){var e=this;return arguments.length?(e.setData?e.setData(t):e._d=t,e.fire("ff-data",{old:e._d,data:t}),e.history().init(),e):e.getData?e.getData():e._d||null},fire:function(t,e,n,i){return!!o(this.dom()).fire(t,e,n,i)[0]},on:function(t,e){var n=this;return e._wrapper=function(){return e.apply(n,arguments)},o(this.dom()).on(t,e._wrapper),this},once:function(t,e){var n=this;return e._wrapper=function(){return e.apply(n,arguments)},o(this.dom()).once(t,e._wrapper),this},off:function(t,e){return o(this.dom()).off(t,e._wrapper||e),this},clear:function(){return this.data(null).fire("ff-clear"),this},click:function(){return this.dom().click(),this},focus:function(){var t=this,e=t.dom();return t.editmode()&&t!==a.focused&&document.body.contains(e)&&(a.focused&&"function"==typeof a.focused.blur&&a.focused.blur(),o(e).ac("ff-focus-state"),t.fire("ff-focus"),a.focused=t),t},blur:function(){var t=this;return t.editmode()&&t===a.focused&&(o(t.dom()).rc("ff-focus-state"),t.fire("ff-blur"),a.focused=null),t},ranges:function(t){return a.ranges(this.dom(),t)},range:function(t){return a.range(this.dom(),t)},createHistory:function(){var t=this,e=t.dom();return function(n,i){return function(){e.className=n||"",e.style.cssText=i||"",t.focus()}}(e.className,e.style.cssText)},history:function(){var t,e=this,n=a.history();return e._history=e._history||{init:function(n){return n===!1?(t=null,this):(t="function"==typeof n?n:e.createHistory(),this)},save:function(i){return"function"!=typeof i&&(i=null),t&&(n.add(t),t=null),n.add(i||e.createHistory()),this}}}},i.toolbar=new s([f.clearfix,f.remove]),t.exports=i},function(t,e,n){function i(t){"string"==typeof t&&(t={text:t});var e=this;e.options(t),e._el=r('<div class="ff-toolbar-btn"></div>').ac(t.cls).on("click",e).on("mousemove",e).on("mousedown",e),setTimeout(function(){e.text(t.text)},0)}var r=n(0);n(48),i.prototype={handleEvent:function(t){if(t.preventDefault(),t.stopPropagation(),"click"==t.type){this.click(t);var e=this.toolbar();e&&e.update(t)}},options:function(t){var e=this._options=this._options||t||{};return arguments.length?(this.id=e.id,this._scope=e.scope||this._scope,this._toolbar=e.toolbar||this._toolbar,this):e},dom:function(){return this._el[0]},scope:function(t){return arguments.length?(this._scope=t,this):this._scope},toolbar:function(t){return arguments.length?(this._toolbar=t,this):this._toolbar},cls:function(t){return this._el.cc().ac("ff-toolbar-btn").ac(t),this},active:function(t){return arguments.length?(this._el.tc("ff-toolbar-btn-active",t),this):this._el.hc("ff-toolbar-btn-active")},hide:function(){return this._el.hide(),this},show:function(){return this._el.show(),this},enable:function(t){return arguments.length?(this._el.tc("ff-toolbar-btn-disabled",!t),this):!this._el.hc("ff-toolbar-btn-disabled")},update:function(t,e,n,i){var r=this.options(),o=r.onupdate;return o&&o.call(this.scope(),this,t,e,n,i),this},click:function(t,e,n,i){var r=this.options(),o=r.onclick||r.fn;return o&&o.call(this.scope(),this,t,e,n,i),this},text:function(t){return arguments.length?(this._el.html(t),this):this._el.html()},appendTo:function(t,e){return r(t).append(this._el[0],e),this},remove:function(){return this._el.remove(),this}},t.exports=i},function(t,e,n){function i(){o.apply(this,arguments)}var r=n(0),o=n(7),a=n(5),s=(n(6),n(3)),f=n(4),c=n(10),l=window,u=document;n(56);var h=i.prototype=Object.create(o.prototype);i.toolbar=new s([f.paragraph.font,f.paragraph.fontsize,f.paragraph.color,f.align,"-",f.paragraph.bold,f.paragraph.underline,f.paragraph.italic,f.paragraph.strike,f.paragraph.anchor,"-",f.draggable]),h.createToolbar=function(){return new a(this).position(i.toolbar.position).add(i.toolbar)},h.oninit=function(t){var e=this,n=e.dom(),o=c(function(t){e.history().save()},200),a=r(n).ac("f_txt").on("paste",function(t){if(!e.multiline()){t.preventDefault();var i=l.getSelection(),r=i.rangeCount>0?i.getRangeAt(0):null,o=t.clipboardData||l.clipboardData,a=o.getData("Text");if(a&&r){var s=u.createTextNode(a);r.deleteContents(),r.insertNode(s);var f=u.createRange();f.selectNode(s),i.removeAllRanges(),i.addRange(f),n.normalize()}}}).on("keydown",function(t){!e.editmode()||t.metaKey||t.ctrKey||o(),13!==t.keyCode||e.multiline()||t.preventDefault()}).on("dblclick",function(t){e.dragmode(!1)}).on("drop",function(t){t.preventDefault()});(e._placeholder=function(){var t,i=r('<div class="ff-placeholder ff-acc"/>'),o=!1;return{text:function(e){return arguments.length?(t=e,i.html(t),this):t},show:function(){if(!e.editmode())return this.hide(),this;i.html(t).remove(),a.text().split("\n").join().trim()||a.empty().append(i);var r=window.getComputedStyle(n,null).display;return~["inline","inline-block"].indexOf(r)&&i[0].clientWidth&&(n.style.minWidth=i[0].clientWidth+"px",o=!0),this},hide:function(){return o&&(n.style.minWidth=""),i.remove(),this}}}()).text(a.attr("placeholder")||i.placeholder||this.context().placeholder)},h.multiline=function(t){return"_multiline"in this||(this._multiline="false"!=r(this.dom()).attr("ff-multiline")),arguments.length?(el.attr("ff-multiline",t!==!1&&null),this._multiline=!!t,this):this._multiline},h.dragmode=function(t){var e=r(this.dom());return arguments.length?this.editmode()?(e.attr("draggable",!!t||null).attr("contenteditable",!t||null),this):this:e.ha("draggable")},h.onchildlist=function(){this.editmode()&&this.placeholder().show()},h.text=function(t){var e=r(this.dom());if(!arguments.length){var n=this.editmode();this.editmode(!1);var t=e.text().split("\n").join().trim();return this.editmode(n),t}return e.text(r("<div/>").html(t).text()),this},h.onfocus=function(t){if(this.editmode()){t.stopImmediatePropagation();var e=this.dom();this.toolbar().show(),this.placeholder().hide(),r(e).attr("draggable",null),e.focus()}},h.onblur=function(){this.editmode()&&this.placeholder().show()},h.oneditmode=function(t){r(this.dom()).attr("contenteditable",!0).attr("draggable",null).ac("ff-paragraph"),this.placeholder().show()},h.onviewmode=function(t){r(this.dom()).attr("contenteditable",null).attr("draggable",null).rc("ff-paragraph"),this.placeholder().hide()},h.create=function(t){var e="string"==typeof t?t:"";return r("<div/>").html(e)[0]},h.placeholder=function(t){return arguments.length?(this._placeholder.text(t),this):this._placeholder},h.getData=function(){this.placeholder().hide();var t=this.dom().innerHTML;return this.editmode()&&this.placeholder().show(),{html:t}},h.setData=function(t){var e=t&&"string"!=typeof t?t.html:t;return this.html(e),this.placeholder().show(),this},h.createHistory=function(){var t=this,e=t.dom();return function(n,i,r){return function(){e.innerHTML=n||"",e.className=i||"",e.style.cssText=r||"",t.focus()}}(e.innerHTML,e.className,e.style.cssText)},t.exports=i},function(t,e){t.exports=function(t,e){if("function"!=typeof t||"number"!=typeof e||e<0)return console.error("illegal arguments");var n,i=[],r=function(){n&&window.clearTimeout(n);var e=i;i=[],t(e)},o=function(t){i.push(t),n&&window.clearTimeout(n),n=window.setTimeout(function(){r()},e)};return o.flush=r,o}},function(t,e,n){function i(t,e){return t.firstChild&&!e?t.firstChild:t.parentNode?t.nextSibling||i(t.parentNode,!0):null}function r(t){var e=t.startContainer.childNodes[t.startOffset]||t.startContainer,n=t.endContainer.childNodes[t.endOffset]||t.endContainer;if(e===n)return[e];var r=[],o=e;do{r.push(o)}while((o=i(o))&&o!=n);return r}function o(t,e){if(!t)return null;"string"==typeof e&&e||(e="div");var n=t.cloneContents(),i=l.util.assemble(e),r=h.createElement(i.tag);i.id&&(r.id=id),i.classes&&(r.className=i.classes),r.appendChild(n),r.normalize(),t.deleteContents(),t.insertNode(r);var t=h.createRange();t.selectNodeContents(r);var o=u.getSelection();return o.removeAllRanges(),o.addRange(t),r}function a(t,e){if(!t||!e)return this;var n=(l(t.commonAncestorContainer),t.cloneContents()),i=l("<div/>").append(n);i.nodes().each(function(){var t=l(this);t.find(e).nodes().unwrap(),t.is(e)&&t.nodes().unwrap()});var r=i.normalize().nodes();if(!r.length)return this;var o=r[0],a=r[r.length-1];t.deleteContents(),r.reverse().each(function(){t.insertNode(this)}),t=h.createRange(),t.selectNodeContents(o);var s=t.startOffset;t=h.createRange(),t.selectNodeContents(a);var f=t.endOffset ;t=h.createRange(),t.setStart(o,s),t.setEnd(a,f);var c=u.getSelection();return c.removeAllRanges(),c.addRange(t),o.parentNode.normalize(),this}function s(t,e){if(!t)return!1;var n=!1;return l(r(t)).each(function(){if(n)return!1;var t=l(this);n=t.is(e)||t.parent(e).length||t.find(e).length}),n}function f(t,e){return t?(s(t,e)?a(t,e):o(t,e),this):this}function c(t){return{range:function(){return t},iswrapped:function(e){return s(t,e)},togglewrap:function(e){return f(t,e)},unwrap:function(e){return a(t,e)},wrap:function(e){return o(t,e)}}}var l=n(0),u=window,h=document;t.exports=c},function(t,e,n){function i(t){o.apply(this,arguments);var e=this._dropdown=r("<ul/>").ac("ff-toolbar-list-dropdown").html("dropdown");r(this.dom()).ac("ff-toolbar-list-btn").append(e),t&&t.items&&this.items(t.items)}var r=n(0),o=n(8);n(49);var a=i.prototype=Object.create(o.prototype);a.dropdown=function(){return this._dropdown[0]},a.handleEvent=function(t){"click"!=t.type||this.dropdown().contains(t.target)||this.toggleList(),o.prototype.handleEvent.call(this,t)},a.enable=function(t){var e=o.prototype.enable.apply(this,arguments);return arguments.length?(t||r(this.dropdown()).rc("open"),this):e},a.toggleList=function(){var t=r(this.dropdown());return r(".ff-toolbar-list-dropdown").rc("open"),this.enable()?t.tc("open"):t.rc("open"),this},a.text=function(t){return this._el.html(t).append(this.dropdown()),this},a.select=function(t){r(".ff-toolbar-list-dropdown").rc("open");var e=this.items(),n=e.indexOf(t),i=this.options(),o=i.onselect;return o&&o.call(this.scope(),t,n,this),this},a.items=function(t){if(!arguments.length)return this._items;t||(t=[]),"function"==typeof t&&(t=t.call(this.scope(),this));var e=this,n=r(this.dropdown()).empty()[0];return this._items=r.each(t,function(t,i){var o=("string"==typeof i?i:i.text)||i;r("<li/>").html(o).appendTo(n).on("click",function(t){e.select(i)})}),this},r(document).ready(function(){r(document.body).on("click",function(){r(".ff-toolbar-list-dropdown").rc("open")})}),t.exports=i},function(t,e,n){function i(){o.apply(this,arguments),r(this.dom()).ac("ff-toolbar-separator-btn")}var r=n(0),o=n(8);n(50),(i.prototype=Object.create(o.prototype)).handleEvent=function(t){},t.exports=i},function(t,e){var n={};t.exports={get:function(t){return n[t]},define:function(t,e){if(!t)throw new TypeError("missing id");if("string"!=typeof t)throw new TypeError("id must be a string");if("function"!=typeof e)throw new TypeError("type plugin must be a function");return n[t]=e,this},exists:function(t){return!!n[t]}}},function(t,e){var n=Element.prototype.matches||Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(t){for(var e=(this.document||this.ownerDocument).querySelectorAll(t),n=e.length;--n>=0&&e.item(n)!==this;);return n>-1},i=t.exports={isNull:function(t){return null===t||void 0===t},isArrayLike:function(t){var e=typeof t;if(!t||"string"==e||"object"!=e||t===window||"number"!=typeof t.length)return!1;if(t instanceof Array||Array.isArray&&Array.isArray(t))return!0;var n=Object.prototype.toString.call(t);return/^\[object (HTMLCollection|NodeList|Array|FileList|Arguments)\]$/.test(n)},create:function(t){if(!t||"string"!=typeof t)return null;var e=document.createElement("div");e.innerHTML=t.trim();var n=[];return[].forEach.call(e.childNodes,function(t){var e=t.parentNode;e&&e.removeChild(t),n.push(t)}),n},accessor:function(t){var e=t.tagName.toLowerCase(),n=t.id,i=t.className.split(" ").join(".");return n=n?"#"+n:"",i=i?"."+i:"",e+n+i},assemble:function(t){if(!t||"string"!=typeof t)return console.error("invalid selector",t);var e=t.split(":"),n=e[0],i=e[1];e=n.split(".");var r,o=e[0],a=e.splice(1).join(" ").trim();if(~o.indexOf("#")){var s=o.split("#");o=s[0],r=s[1]}return{selector:t,accessor:n,tag:o&&o.toLowerCase()||"",id:r||"",classes:a||"",pseudo:i||""}},isHTML:function(t){return!("string"!=typeof t||!t.match(/(<([^>]+)>)/gi))},matches:function(t,e){try{return"function"==typeof e?!!e.call(t):!(!t||!n.call(t,e))}catch(t){return!1}},each:function(t,e,n){return t?(i.isArrayLike(t)||(t=[t]),[].every.call(t,function(i){return(n===!0||null!==i&&void 0!==i)&&(!e||e.apply(i,[t.indexOf(i),i])!==!1)}),t):t},chunk:function(t,e){return[].concat.apply([],t.map(function(n,i){return i%e?[]:[t.slice(i,i+e)]}))},async:function(t,e,n){if(t&&!i.isArrayLike(t)&&(t=[t]),!t||!t.length||"function"!=typeof e)return n&&n.call(t),t;var r=0,o=function(){e.call(t,t[r],function(e){if(e)return n&&n.call(t,e);++r,r>=t.length?n&&n.call(t):setImmediate(o)})};return o(),t},offset:function(t,e){if(!t||"number"!=typeof t.offsetTop)return{top:null,left:null};var n=t.offsetTop,i=t.offsetLeft;if(e)for(;(t=t.offsetParent)&&t&&"BODY"!==t.tagName;)n+=t.offsetTop-(t.scrollTop||0),i+=t.offsetLeft-(t.scrollLeft||0);return{top:n,left:i}},isElement:function(t){return"object"==typeof HTMLElement?t instanceof HTMLElement:t&&"object"==typeof t&&1===t.nodeType&&"string"==typeof t.nodeName},isNode:function(t){return"object"==typeof Node?t instanceof Node:t&&"object"==typeof t&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName},computed:function(t,e){return window.getComputedStyle(t,null)},number:function(t){return t&&"number"!=typeof t?(t+="",["px","em","pt","%","in","deg"].every(function(e){return!t.endsWith(e)||(t=t.split(e).join(""),!1)}),+t):t}}},function(t,e,n){function i(){f.apply(this,arguments)}var r=n(0),o=n(6),a=n(4),s=n(3),f=o.Part,c=o.Toolbar,l=n(31),u=n(30);n(51);var h=i.prototype=Object.create(f.prototype);i.toolbar=new s([a.clear,"-",a.insert.heading,a.insert.paragraph,a.insert.imagefile,a.insert.image,a.insert.video,a.insert.separator,a.insert.link,a.insert.attach]),h.createToolbar=function(){return new c(this).position(i.toolbar.position||"vertical top right outside").add(i.toolbar).always(!0)},h.oninit=function(t){var e=this,n=this.dom();if(e.toolbar().remove("clearfix"),r(n).ac("ff-article").on("click",function(t){var n=t.target||t.srcElement;if(e.editmode()&&n===e.dom()){e.validate();var i=e.children();if(i.length){var r=f(i[i.length-1]);r&&r.focus()}}}),window.MutationObserver){(this._observer=new MutationObserver(function(){e.scan()})).observe(n,{childList:!0})}else n.addEventListener("DOMNodeInserted",function(){e.scan()});this.scan()},h.scan=function(){var t=r(this.dom()),e=this.editmode();o.scan(),t.find("figure").each(function(){r(this).hc("ff-acc")||this._ff||new o.Image(this)}),t.find("img").each(function(){r(this).hc("ff-acc")||"FIGURE"==this.parentNode.tagName||this._ff||new o.Image(this)}),t.find("blockquote").each(function(){r(this).hc("ff-acc")||this._ff||new o.Paragraph(this)}),t.find("h1, h2, h3, h4, h5, h6").each(function(){r(this).hc("ff-acc")||this._ff||new o.Heading(this)}),t.find("hr").each(function(){r(this).hc("ff-acc")||this._ff||new o.Separator(this)}),t.children().each(function(){r(this).hc("ff-acc")||this._ff||new o.Paragraph(this)});var n=r(this.dom()).attr("placeholder");t.find(".ff").each(function(){var t=f(this);t&&(t.removable(!0),t.editmode()!==e&&t.editmode(e),t instanceof o.Paragraph&&t.placeholder(n))}),t.nodes().length||t.append((new o.Paragraph).placeholder(n).dom())},h.validate=function(){var t=this,e=t.dom();r(e),t.editmode();return t.editmode()?(t._mk||(t._mk=l(t,e)),t._dnd||(t._dnd=u(t,e))):(t._mk&&t._mk.destroy(),t._dnd&&t._dnd.destroy(),delete t._mk,delete t._dnd),t.scan(),t},h.onmodechange=function(t){this.validate()},h.marker=function(){return this._mk},h.oninsert=function(){this.validate()},h.clear=function(){return this.dom().innerHTML="",this.validate(),this},h.get=function(t){return this.children()[t]},h.find=function(t){return r(this.dom()).find(t)},h.indexOf=function(t){return t?(t=t.dom()||t,r(this.dom()).indexOf(t)):-1},h.children=function(){return r(this.dom()).children().filter(function(){return!r(this).hc("ff-acc")})},h.insert=function(t,e){var n=this.context(),i=this,o=r(this.dom()),a=this.marker(),s=this.children();arguments.length<=1&&a.isExpanded()?(e=a.getRef(),a.collapse()):"number"==typeof e&&(e=s[e]);var f=function(t,e){e?e.parentNode&&e.parentNode.insertBefore(t,e):o.append(t),t._ff&&t._ff.focus()},c=[];return r(t).reverse().async(function(t,i){var r=t.dom&&t.dom()||t;if(window.File&&t instanceof File)return function(r){n.upload(t,function(t,o){if(t)return i(t);0!==r.indexOf("image/")?f(new n.Link(o).dom(),e):c.push(new n.Image(o)),i()})}(t.type);f(r,e),i()},function(a){if(a)return n.error(a);if(1===c.length)f(c[0].dom(),e);else if(c.length){var s=+o.attr("ff-row-chunk-size");c.reverse(),(!s||s<1)&&(s=5),r.util.chunk(c,s).forEach(function(t){var i=(new n.Row).valign("justify");t.forEach(function(t){i.add(t),t.on("load",function(){i.validate()})}),f(i.dom(),e)})}i.fire("ff-insert",{node:t,ref:e,target:o}),i.history().save()}),this},h.getData=function(){return{html:this.html()}},h.setData=function(t){return this.html(t&&t.html),this},h.createHistory=function(){var t=this,e=t.dom(),n=t.children().slice();return function(n,i,o){return function(){r(e).empty().append(n),e.className=i||"",e.style.cssText=o||"",t.focus()}}(n,e.className,e.style.cssText)},i.Marker=l,i.DnD=u,t.exports=i},function(t,e,n){function i(){s.apply(this,arguments)}var r=n(4),o=n(0),a=n(5),s=n(9),f=n(3),c=i.prototype=Object.create(s.prototype);i.toolbar=new f([r.heading,r.align,r.draggable]),c.createToolbar=function(){return new a(this).position(i.toolbar.position).add(i.toolbar)},c.create=function(t){var e="h1",n="string"==typeof t?t:"";return t&&"object"==typeof t&&(e=t.tag||"h1",n=t.html),o("<"+e+"/>").html(n)[0]},t.exports=i},function(t,e,n){function i(t){if(t&&~t.indexOf("instagram.com")){var e=t.split("//")[1];e=e&&e.split("/p/")[1],e=e&&e.split("/")[0],e&&(t="https://www.instagram.com/p/"+e+"/media")}return t}function r(t){s.apply(this,arguments)}var o=n(0),a=n(6),s=n(7),f=n(5),c=n(4),l=n(3);n(54),r.placeholder="Caption Here";var u=r.prototype=Object.create(s.prototype);r.toolbar=new l([c.image.floatleft,c.image.floatright,c.image.size,c.image.upload,c.image.change,c.image.align,c.image.caption]),u.createToolbar=function(){return new f(this).position(r.toolbar.position||"inside top center").add(r.toolbar)},u.oninit=function(){var t=this,e=t.dom(),n=o(e).ac("f_img").on("click",function(n){t.editmode()||a.fire("ff-imageshow",{originalEvent:n,image:i[0]||e,src:(i[0]||e).src,part:t})}),i=n.find("img").on("load",function(e){t.fire(e.type)}),s=t._placeholder=o('<div class="ff-placeholder ff-acc"/>').attr("contenteditable",!1).html(n.attr("placeholder")||r.placeholder||""),f=function(t){var e=n.find("figcaption");if(s.remove(),"mousedown"==t.type)return e[0].click();setTimeout(function(){e.html()||s.appendTo(e)},10)};t.on("ff-modechange",function(){var e=o(t.dom()),n=e.find("figcaption");if(n.off("mousedown",f).off("keydown",f).off("keyup",f),s.off("mousedown",f),t.off("ff-blur",f),t.editmode()){n.length||(n=o("<figcaption/>").appendTo(e));n.html()||s.appendTo(n),n.on("mousedown",f).on("keydown",f).on("keyup",f),s.on("mousedown",f),t.on("ff-blur",f),n.attr("contenteditable",!0)}else s.remove(),n.attr("contenteditable",null)})},u.create=function(t){var e,n,r;"object"==typeof t?(e=t.src,n=t.name||t.title,r=t.caption):e=t;var a=o("<img/>").attr("title",n).src(i(e));return r?("string"!=typeof r&&(r=""),a=o("<figure/>").append(a).append(o("<figcaption/>").html(r))):a.ac("f_img_block"),a[0]},u.img=function(){var t=this.dom();return"IMG"==t.tagName?t:o(t).find("img")[0]},u.figcaption=function(){return o(this.dom()).find("figcaption")[0]},u.src=function(t){return arguments.length?(t=i(t),t&&(this.img().src=t),this):this.img().src},u.title=function(t){var e=o(this.img());return arguments.length?(e.attr("title",t),this):e.attr("title")},u.isFigure=function(){return"FIGURE"==this.dom().tagName},u.caption=function(t){var e=this,n=e.dom();if(!arguments.length)return o(n).find("figcaption").html();var i=o(e.dom()),a=(e.parent(),e.floating()),s=e.blockmode(),f=new r({src:e.src(),title:e.title(),caption:t}).blockmode(s).floating(a);return i.after(f.dom()).remove(),this},u.floating=function(t){var e=o(this.dom());return arguments.length?(e.rc("f_pullleft f_pullright"),"left"==t?e.ac("f_pullleft"):"right"==t&&e.ac("f_pullright"),this):e.hc("f_pullleft")?"left":!!e.hc("f_pullright")&&"right"},u.blockmode=function(t){var e=o(this.dom());return arguments.length?(e.rc("f_img_block f_img_medium f_img_full"),"natural"==t?e.ac("f_img_block"):"medium"==t?e.ac("f_img_medium"):"full"==t?e.ac("f_img_full"):e.rc("f_pullleft f_pullright"),this):e.hc("f_img_block")?"natural":e.hc("f_img_full")?"full":!!e.hc("f_img_medium")&&"medium"},u.createHistory=function(){var t=this,e=t.dom();return function(n,i,r){return function(){e.src=n,e.className=i||"",e.style.cssText=r||"",t.focus()}}(e.src,e.className,e.style.cssText)},t.exports=r},function(t,e,n){function i(){o.apply(this,arguments)}var r=n(0),o=n(7),a=n(5),s=n(10),f=n(4),c=n(3);n(55);var l=i.prototype=Object.create(o.prototype);i.toolbar=new c([f.align,f.target]),l.createToolbar=function(){return new a(this).position(i.toolbar.position).add(i.toolbar)},l.oninit=function(){var t=this,e=this.dom(),n=s(function(e){t.history().save()},200);r(e).ac("f_link").on("keydown",function(e){!t.editmode()||e.metaKey||e.ctrKey||"A"!=e.target.tagName||n()})},l.create=function(t){var e=i.defaultLabel,n=t&&(t.src||t.href)||t,o=t&&(t.name||t.title||t.label)||t||e,a=t&&t.target;return n.indexOf("data:")||(n=null),n&&"string"==typeof n||(n="javascript:;"),o&&"string"==typeof o||(o=e),r('<div ff-type="link"/>').append(r('<a href="'+n+'" />').attr("target",a).html(o))[0]},l.label=function(t){return r(this.dom()).children("a").html(t||i.defaultLabel),this.history().save(),this},l.target=function(t){var e=r(this.dom());return arguments.length?(e.find("a").attr("target",t),this.history().save(),this):e.find("a").attr("target")},l.href=function(t){var e=r(this.dom());return arguments.length?(e.find("a").attr("href",t),this.history().save(),this):e.find("a").attr("href")},l.oneditmode=function(){r(this.dom()).children("a").attr("contenteditable",!0)},l.onviewmode=function(){r(this.dom()).children("a").attr("contenteditable",null)},l.createHistory=function(){var t=this,e=t.dom();return function(n,i,r){return function(){e.innerHTML=n||"",e.className=i||"",e.style.cssText=r||"",t.focus()}}(e.innerHTML,e.className,e.style.cssText)},i.defaultLabel="Link",t.exports=i},function(t,e,n){function i(t,e){var n=a.util.offset(t).top,i=t.offsetHeight;return e<n+30||e>n+i-30}function r(t,e,n){if(!t.contains(e))return-1;var i=a(t).children(".f_row_cell").each(function(t,e){e.style.borderLeft=e.style.borderRight=null}),r=a(e).parent(".f_row_cell")[0],o=i.indexOf(r);return~o?(n>a.util.offset(r).left+r.offsetWidth/2?(o+=1,r.style.borderRight="2px solid #2796DD"):r.style.borderLeft="2px solid #2796DD",o):o}function o(t){f.call(this,t)}var a=n(0),s=n(6),f=n(7),c=n(5),l=n(4),u=n(3);n(57);var h=o.prototype=Object.create(f.prototype);o.toolbar=new u([l.row.valign]),h.createToolbar=function(){return new c(this).position(o.toolbar.position).add(o.toolbar)},h.oninit=function(){var t=this,e=t.dom(),n=function(){o.children(".f_row_cell").each(function(t,e){e.style.borderLeft=e.style.borderRight=null})},o=a(e).ac("f_row").on("mouseleave dragend",function(){n()}).on("dragover",function(o){if(t.editmode()){if(i(e,o.pageY))return n();var a=o.target||o.srcElement,s=t.context().dragging;r(e,a,o.pageX);s?(o.stopPropagation(),o.preventDefault()):o.dataTransfer&&o.dataTransfer.files&&o.dataTransfer.files.length&&(o.stopPropagation(),o.preventDefault())}}).on("drop",function(o){if(t.editmode()&&!i(e,o.pageY)){var f=o.target||o.srcElement,c=t.context().dragging,l=r(e,f,o.pageX);if(n(),c){if(o.stopPropagation(),o.preventDefault(),f===c||c.contains(f))return;t.add(c,l)}else o.dataTransfer&&o.dataTransfer.files&&o.dataTransfer.files.length&&(o.stopPropagation(),o.preventDefault(),a(o.dataTransfer.files).each(function(){var e=this.type;e&&s.upload(this,function(n,i){0===e.indexOf("image/")&&(t.add(new s.Image(i),l),t.validate())})}))}})},h.oneditmode=function(){if(window.MutationObserver){var t=this;(this._observer=new MutationObserver(function(){t.validate()})).observe(this.dom(),{childList:!0,subtree:!0})}},h.onviewmode=function(){var t=this._observer;t&&(t.disconnect(),delete this._observer)},h.create=function(t){return a('<div ff-type="row" />').ac("f_clearfix")[0]},h.cols=function(t){var e=a(this.dom());return arguments.length?(e.attr("cols",+t||null),this):+e.attr("cols")||0},h.validate=function(){var t=this,e=t.dom(),n=a(e);n.find(".f_row_cell").each(function(t,e){var e=this;e.children.length||e.parentNode.removeChild(e)});var i=n.children(".f_row_cell"),r=t.cols()||i.length;if(n.hc("f_row_justify")){var o=0,s=[];i.children(":first-child").each(function(t,e){"FIGURE"==e.tagName&&(e=a(e).find("img")[0]);var n=e.naturalWidth,i=e.naturalHeight;n?(n=n/i*100,o+=n,s.push(n)):(e.style.width="100px",i=e.offsetHeight,n=100/i*100,o+=n,s.push(n),e.style.width=null)}),i.each(function(t,e){a(e).css("width",s[t]/o*100+"%")})}else i.each(function(t,e){a(e).css("width",100/r+"%")});return t},h.add=function(t,e){var n=this,i=n.dom(),r=a(i).children(".f_row_cell");return a(t).each(function(t,n){var o=a('<div class="f_row_cell" />').append(function(){return n&&n.dom&&n.dom()||n});if(~e){var s=r[e++];if(s)return o.insertBefore(s)}o.appendTo(i)}),n.validate().history().save(),n},h.valign=function(t){var e=this,n=a(e.dom());return arguments.length?(n.rc("f_row_middle f_row_bottom f_row_justify"),"middle"==t?n.ac("f_row_middle"):"bottom"==t?n.ac("f_row_bottom"):"justify"==t&&n.ac("f_row_justify"),e.validate().history().save(),e):n.hc("f_row_middle")?"middle":n.hc("f_row_bottom")?"bottom":!!n.hc("f_row_justify")&&"justify"},h.createHistory=function(){var t=this,e=t.dom(),n=e.innerHTML;return function(n,i,r){return function(){e.className=i||"",e.style.cssText=r||"