gulliverbms/django_grapesjs

View on GitHub
django_grapesjs/static/js/django_grapesjs/grapesjs-aviary.min.js

Summary

Maintainability
A
0 mins
Test Coverage
// Copyright (c) 2016, Artur Arseniev
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
//   list of conditions and the following disclaimer.
// - Redistributions in binary form must reproduce the above copyright notice, this
//   list of conditions and the following disclaimer in the documentation and/or
//   other materials provided with the distribution.
// - Neither the name "GrapesJS" nor the names of its contributors may be
//   used to endorse or promote products derived from this software without
//   specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("grapesjs")):"function"==typeof define&&define.amd?define(["grapesjs"],n):"object"==typeof exports?exports["grapesjs-aviary"]=n(require("grapesjs")):e["grapesjs-aviary"]=n(e.grapesjs)}(this,function(e){return function(e){function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var t={};return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},n.p="",n(n.s=0)}([function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=t(1),o=function(e){return e&&e.__esModule?e:{default:e}}(r);n.default=o.default.plugins.add("gjs-aviary",function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=n,r=e.getModel(),o=void 0,a={key:"1",onApply:null,getFilename:null,closeOnApply:!0,config:{}};for(var i in a)i in t||(t[i]=a[i]);var u=t.config;u.apiKey=t.key,u.onSave=function(e,n){o.set("src",n);var r="function"==typeof t.getFilename?t.getFilename:l,a=r(o);("function"==typeof t.onApply?t.onApply:p)(n,a,o),t.closeOnApply&&c.close()};var c=new Aviary.Feather(u),s=e.Commands,l=function(e){var n=e.get("src").split("/").pop();return Date.now()+"_"+n.slice(-15)},p=function(n,t){e.AssetManager.add({src:n,name:t})},f=document.createElement("img");s.add("image-editor",{run:function(e,n,t){var a=t||{},i=a.model||e.getSelected();o=i,f.src=i.get("src"),c.launch({image:f}),r.trigger("gjs-aviary:launch",i,c)}})})},function(n,t){n.exports=e}])});