diff --git a/backend/src/Squidex/wwwroot/scripts/embed-sdk.js b/backend/src/Squidex/wwwroot/scripts/embed-sdk.js index 95af380e4..917469921 100644 --- a/backend/src/Squidex/wwwroot/scripts/embed-sdk.js +++ b/backend/src/Squidex/wwwroot/scripts/embed-sdk.js @@ -1,2 +1,2 @@ -!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(r,o,function(t){return e[t]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/",t(t.s="mdyV")}({hosL:function(e,t,n){"use strict";function r(e,t){for(var n in t)e[n]=t[n];return e}function o(e){var t=e.parentNode;t&&t.removeChild(e)}function i(e,t,n){var r,o,i,l={};for(i in t)"key"==i?r=t[i]:"ref"==i?o=t[i]:l[i]=t[i];if(arguments.length>2&&(l.children=arguments.length>3?E.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===l[i]&&(l[i]=e.defaultProps[i]);return u(e,l,r,o,null)}function u(e,t,n,r,o){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==o?++C:o};return null==o&&null!=P.vnode&&P.vnode(i),i}function l(e){return e.children}function _(e,t){this.props=e,this.context=t}function c(e,t){if(null==t)return e.__?c(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t0?u(m.type,m.props,m.key,null,m.__v):m)){if(m.__=n,m.__b=n.__b+1,null===(y=j[d])||y&&m.key==y.key&&m.type===y.type)j[d]=void 0;else for(h=0;h=n.__.length&&n.__.push({}),n.__[e]}function o(e){return C=1,function(e,t,n){var o=r(S++,2);return o.t=e,o.__c||(o.__=[n?n(t):d(void 0,t),function(e){var t=o.t(o.__[0],e);o.__[0]!==t&&(o.__=[t,o.__[1]],o.__c.setState({}))}],o.__c=A),o.__}(d,e)}function i(e,t){var n=r(S++,3);!P.c.__s&&s(n.__H,t)&&(n.__=e,n.__H=t,A.__H.__h.push(n))}function u(e,t){var n=r(S++,4);!P.c.__s&&s(n.__H,t)&&(n.__=e,n.__H=t,A.__h.push(n))}function l(e){return C=5,_((function(){return{current:e}}),[])}function _(e,t){var n=r(S++,7);return s(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function c(){var e;for(I.sort((function(e,t){return e.__v.__b-t.__v.__b}));e=I.pop();)if(e.__P)try{e.__H.__h.forEach(a),e.__H.__h.forEach(f),e.__H.__h=[]}catch(t){e.__H.__h=[],P.c.__e(t,e.__v)}}function a(e){var t=A,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),A=t}function f(e){var t=A;e.__c=e.__(),A=t}function s(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function d(e,t){return"function"==typeof t?t(e):t}function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,i=[],u=!0,l=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(l)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return v(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return v(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return u=e.done,e},e:function(e){l=!0,i=e},f:function(){try{u||null==n.return||n.return()}finally{if(l)throw i}}}}(t);try{for(i.s();!(o=i.n()).done;){var u=o.value;if(0===r.indexOf(u)){var l,_,c=r.substring(u.length+1).split("/");if("api"===c[0]&&"assets"===c[1]&&(null===(l=c[2])||void 0===l?void 0:l.length)>0&&(null===(_=c[3])||void 0===_?void 0:_.length)>0)return{u:u,a:c[2],i:c[3]}}}}catch(e){i.e(e)}finally{i.f()}if(0===r.indexOf(R)){var a,f,s=r.substring(R.length+1).split("/");if((null===(a=s[0])||void 0===a?void 0:a.length)>0&&(null===(f=s[1])||void 0===f?void 0:f.length)>0)return{u:R,a:s[0],i:s[1]}}}}if(!n)return null;try{var d=atob(n),p=JSON.parse(d);if(!p.u||!p.i||!p.a)return null;for(;p.u.endsWith("/");)p.u=p.u.substring(0,p.u.length-1);return p}catch(e){return null}}function j(){var e;e=B,V||(V=document.body.appendChild(document.createElement("div"))),Object(P.d)(Object(P.a)(W,{baseUrl:e}),V),function(){var e;if(!B)return;var t=document.createElement("link");t.rel="stylesheet",t.href="".concat(B,"/scripts/embed-sdk.css"),t.type="text/css",null===(e=document.head)||void 0===e||e.appendChild(t)}()}n.r(t);var S,A,E,P=n("hosL"),C=0,I=[],H=P.c.__b,T=P.c.__r,N=P.c.diffed,q=P.c.__c,D=P.c.unmount;P.c.__b=function(e){A=null,H&&H(e)},P.c.__r=function(e){T&&T(e),S=0;var t=(A=e.__c).__H;t&&(t.__h.forEach(a),t.__h.forEach(f),t.__h=[])},P.c.diffed=function(e){N&&N(e);var t=e.__c;t&&t.__H&&t.__H.__h.length&&(1!==I.push(t)&&E===P.c.requestAnimationFrame||((E=P.c.requestAnimationFrame)||function(e){var t,n=function(){clearTimeout(r),L&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);L&&(t=requestAnimationFrame(n))})(c)),A=null},P.c.__c=function(e,t){t.some((function(e){try{e.__h.forEach(a),e.__h=e.__h.filter((function(e){return!e.__||f(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],P.c.__e(n,e.__v)}})),q&&q(e,t)},P.c.unmount=function(e){D&&D(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{a(e)}catch(e){t=e}})),t&&P.c.__e(t,n.__v))};var L="function"==typeof requestAnimationFrame,M=function(e){var t=e.url,n=e.onClose;return Object(P.a)("div",{class:"squidex-iframe"},Object(P.a)("button",{class:"squidex-iframe-close",onClick:n},Object(P.a)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24"},Object(P.a)("path",{d:"M18.984 6.422l-5.578 5.578 5.578 5.578-1.406 1.406-5.578-5.578-5.578 5.578-1.406-1.406 5.578-5.578-5.578-5.578 1.406-1.406 5.578 5.578 5.578-5.578z"}))),Object(P.a)("iframe",{src:t,frameBorder:0}))},U=function(e){var t,n,r,c,a,f,s=e.onOpen,d=e.target,v=e.token,h=l(),y=l(),m=l(),b=p(o(0),2),g=b[1];i((function(){g((function(e){return e+1}))}),[v]),i((function(){function e(){var e=d.getBoundingClientRect(),t=m.current;t&&e.height===t.height&&e.width===t.width&&e.x===t.x&&e.y===t.y||(m.current=e,g((function(e){return e+1})))}document.body.addEventListener("scroll",e);var t=setInterval((function(){e()}),500);return e(),function(){clearInterval(t),document.body.removeEventListener("scroll",e)}}),[d]),u((function(){if(h.current){var e=h.current.getBoundingClientRect(),t=y.current;t&&e.height===t.height&&e.width===t.width||(y.current=e,g((function(e){return e+1})))}}),[g]);var k=_((function(){var e=v.a,t=v.i,n=v.s,r=v.u;return n?"".concat(r,"/app/").concat(e,"/content/").concat(n,"/").concat(t):"".concat(r,"/app/").concat(e,"/assets/?ref=").concat(t)}),[v]),O=_((function(){var e=v.a,t=v.i,n=v.s,r=v.u;return n?"".concat(r,"/embed/app/").concat(e,"/content/").concat(n,"/").concat(t):"".concat(r,"/embed/app/").concat(e,"/assets/?ref=").concat(t)}),[v]),w=((null===(t=m.current)||void 0===t?void 0:t.x)||0)-2,x=((null===(n=m.current)||void 0===n?void 0:n.y)||0)-2,j=((null===(r=m.current)||void 0===r?void 0:r.width)||0)+4,S=((null===(c=m.current)||void 0===c?void 0:c.height)||0)+4,A=(null===(a=y.current)||void 0===a?void 0:a.width)||0,E=(null===(f=y.current)||void 0===f?void 0:f.height)||0,C=w,I=x-E+2;return I<0&&(I=x+S-2),I+E>window.innerHeight&&(C=window.innerHeight-E),C<0&&(C=0),C+A>window.innerWidth&&(C=window.innerWidth-A),Object(P.a)("div",{class:"squidex-overlay"},Object(P.a)("div",{class:"squidex-overlay-border",style:{left:w,top:x,width:j,height:S}}),Object(P.a)("div",{class:"squidex-overlay-toolbar",style:{left:C,top:I},ref:h},Object(P.a)("div",{class:"squidex-overlay-schema"},(null==v?void 0:v.s)||"Asset"),Object(P.a)("div",{class:"squidex-overlay-links","data-links":!0},Object(P.a)("a",{onClick:function(){return s(O)}},"Edit Inline"),Object(P.a)("a",{href:k,target:"_blank"},"Edit In Squidex"))))},F={x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY},W=function(e){var t=l(),n=k(o({}),2),r=n[0],u=n[1],c=k(o(),2),a=c[0],f=c[1],s=k(o(),2),d=s[0],p=s[1],v=l(r);i((function(){function e(e){var t=e.target;if(console.log(t),t&&!function(e){for(var t=e;t;){if("squidex-overlay-toolbar"===t.className)return!0;t=t.parentElement}return!1}(t)){var o=function(e,t){for(var n=e;n;){var r=x(n,t);if(r)return{token:r,target:n};n=n.parentElement}return{}}(t,Object.keys(v.current)),i=o.token,u=o.target,l={x:e.clientX,y:e.clientY};i&&u?(r(u,i),n=l):Math.abs(l.x-n.x)+Math.abs(l.y-n.y)>20&&r(void 0,void 0),t}}var t=void 0,n=F,r=function(e,n){e!==t&&(f(e&&n?{target:e,token:n}:void 0),t=e)};return document.addEventListener("mousemove",e),function(){document.removeEventListener("mousemove",e)}}),[]);var m,O=(m=function(e){if(e&&!v.current[e]){var t=function(t){var n=b(b({},v.current),{},g({},e,t));v.current=n,u(n)};if(0!==e.indexOf("http://")){var n=function(){var n,r=(n=function*(){t("Pending");try{var n=yield fetch("".concat(e,"/identity-server/info"),{credentials:"include"}),r=yield n.json();t(r.displayName?"Authenticated":"Failed")}catch(e){t("Failed")}},function(){var e=this,t=arguments;return new Promise((function(r,o){function i(e){y(l,r,o,i,u,"next",e)}function u(e){y(l,r,o,i,u,"throw",e)}var l=n.apply(e,t);i(void 0)}))});return function(){return r.apply(this,arguments)}}();n()}else t("Authenticated")}},C=8,_((function(){return m}),[r]));i((function(){O(e.baseUrl)}),[e.baseUrl]),i((function(){O(null==a?void 0:a.token.u)}),[null==a?void 0:a.token.u]);var w="Authenticated"===r[null==a?void 0:a.token.u];return Object(P.a)("div",{class:"squidex",ref:t},a&&w&&Object(P.a)(U,h({onOpen:p},a)),d&&Object(P.a)(M,{url:d,onClose:function(){return p(void 0)}}))},R="https://assets.squidex.io",V=null,B=function(){var e,t,n=null===(e=document.currentScript)||void 0===e?void 0:e.src;if(!("string"==typeof(t=n)||t instanceof String))return null;var r=(n=n.trim()).indexOf("/","https://".length);return r>0&&(n=n.substring(0,r)),n}();"complete"===document.readyState?j():window.addEventListener("load",(function(){return j()}))}}); +!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(r,o,function(t){return e[t]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/",t(t.s="mdyV")}({hosL:function(e,t,n){"use strict";function r(e,t){for(var n in t)e[n]=t[n];return e}function o(e){var t=e.parentNode;t&&t.removeChild(e)}function i(e,t,n){var r,o,i,l={};for(i in t)"key"==i?r=t[i]:"ref"==i?o=t[i]:l[i]=t[i];if(arguments.length>2&&(l.children=arguments.length>3?E.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===l[i]&&(l[i]=e.defaultProps[i]);return u(e,l,r,o,null)}function u(e,t,n,r,o){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==o?++C:o};return null==o&&null!=P.vnode&&P.vnode(i),i}function l(e){return e.children}function _(e,t){this.props=e,this.context=t}function c(e,t){if(null==t)return e.__?c(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t0?u(m.type,m.props,m.key,null,m.__v):m)){if(m.__=n,m.__b=n.__b+1,null===(y=j[d])||y&&m.key==y.key&&m.type===y.type)j[d]=void 0;else for(h=0;h=n.__.length&&n.__.push({}),n.__[e]}function o(e){return C=1,function(e,t,n){var o=r(S++,2);return o.t=e,o.__c||(o.__=[n?n(t):d(void 0,t),function(e){var t=o.t(o.__[0],e);o.__[0]!==t&&(o.__=[t,o.__[1]],o.__c.setState({}))}],o.__c=A),o.__}(d,e)}function i(e,t){var n=r(S++,3);!P.c.__s&&s(n.__H,t)&&(n.__=e,n.__H=t,A.__H.__h.push(n))}function u(e,t){var n=r(S++,4);!P.c.__s&&s(n.__H,t)&&(n.__=e,n.__H=t,A.__h.push(n))}function l(e){return C=5,_((function(){return{current:e}}),[])}function _(e,t){var n=r(S++,7);return s(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function c(){var e;for(I.sort((function(e,t){return e.__v.__b-t.__v.__b}));e=I.pop();)if(e.__P)try{e.__H.__h.forEach(a),e.__H.__h.forEach(f),e.__H.__h=[]}catch(t){e.__H.__h=[],P.c.__e(t,e.__v)}}function a(e){var t=A,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),A=t}function f(e){var t=A;e.__c=e.__(),A=t}function s(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function d(e,t){return"function"==typeof t?t(e):t}function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,i=[],u=!0,l=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(l)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return v(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return v(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return u=e.done,e},e:function(e){l=!0,i=e},f:function(){try{u||null==n.return||n.return()}finally{if(l)throw i}}}}(t);try{for(i.s();!(o=i.n()).done;){var u=o.value;if(0===r.indexOf(u)){var l,_,c=r.substring(u.length+1).split("/");if("api"===c[0]&&"assets"===c[1]&&(null===(l=c[2])||void 0===l?void 0:l.length)>0&&(null===(_=c[3])||void 0===_?void 0:_.length)>0)return{u:u,a:c[2],i:c[3]}}}}catch(e){i.e(e)}finally{i.f()}if(0===r.indexOf(R)){var a,f,s=r.substring(R.length+1).split("/");if((null===(a=s[0])||void 0===a?void 0:a.length)>0&&(null===(f=s[1])||void 0===f?void 0:f.length)>0)return{u:R,a:s[0],i:s[1]}}}}if(!n)return null;try{var d=atob(n),p=JSON.parse(d);if(!p.u||!p.i||!p.a)return null;for(;p.u.endsWith("/");)p.u=p.u.substring(0,p.u.length-1);return p}catch(e){return null}}function j(){var e;e=B,V||(V=document.body.appendChild(document.createElement("div"))),Object(P.d)(Object(P.a)(W,{baseUrl:e}),V),function(){var e;if(!B)return;var t=document.createElement("link");t.rel="stylesheet",t.href="".concat(B,"/scripts/embed-sdk.css"),t.type="text/css",null===(e=document.head)||void 0===e||e.appendChild(t)}()}n.r(t);var S,A,E,P=n("hosL"),C=0,I=[],H=P.c.__b,T=P.c.__r,N=P.c.diffed,q=P.c.__c,D=P.c.unmount;P.c.__b=function(e){A=null,H&&H(e)},P.c.__r=function(e){T&&T(e),S=0;var t=(A=e.__c).__H;t&&(t.__h.forEach(a),t.__h.forEach(f),t.__h=[])},P.c.diffed=function(e){N&&N(e);var t=e.__c;t&&t.__H&&t.__H.__h.length&&(1!==I.push(t)&&E===P.c.requestAnimationFrame||((E=P.c.requestAnimationFrame)||function(e){var t,n=function(){clearTimeout(r),L&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);L&&(t=requestAnimationFrame(n))})(c)),A=null},P.c.__c=function(e,t){t.some((function(e){try{e.__h.forEach(a),e.__h=e.__h.filter((function(e){return!e.__||f(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],P.c.__e(n,e.__v)}})),q&&q(e,t)},P.c.unmount=function(e){D&&D(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{a(e)}catch(e){t=e}})),t&&P.c.__e(t,n.__v))};var L="function"==typeof requestAnimationFrame,M=function(e){var t=e.url,n=e.onClose;return Object(P.a)("div",{class:"squidex-iframe"},Object(P.a)("button",{class:"squidex-iframe-close",onClick:n},Object(P.a)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24"},Object(P.a)("path",{d:"M18.984 6.422l-5.578 5.578 5.578 5.578-1.406 1.406-5.578-5.578-5.578 5.578-1.406-1.406 5.578-5.578-5.578-5.578 1.406-1.406 5.578 5.578 5.578-5.578z"}))),Object(P.a)("iframe",{src:t,frameBorder:0}))},U=function(e){var t,n,r,c,a,f,s=e.onOpen,d=e.target,v=e.token,h=l(),y=l(),m=l(),b=p(o(0),2),g=b[1];i((function(){g((function(e){return e+1}))}),[v]),i((function(){function e(){var e=d.getBoundingClientRect(),t=m.current;t&&e.height===t.height&&e.width===t.width&&e.x===t.x&&e.y===t.y||(m.current=e,g((function(e){return e+1})))}document.body.addEventListener("scroll",e);var t=setInterval((function(){e()}),500);return e(),function(){clearInterval(t),document.body.removeEventListener("scroll",e)}}),[d]),u((function(){if(h.current){var e=h.current.getBoundingClientRect(),t=y.current;t&&e.height===t.height&&e.width===t.width||(y.current=e,g((function(e){return e+1})))}}),[g]);var k=_((function(){var e=v.a,t=v.i,n=v.s,r=v.u;return n?"".concat(r,"/app/").concat(e,"/content/").concat(n,"/").concat(t):"".concat(r,"/app/").concat(e,"/assets/?ref=").concat(t)}),[v]),O=_((function(){var e=v.a,t=v.i,n=v.s,r=v.u;return n?"".concat(r,"/embed/app/").concat(e,"/content/").concat(n,"/").concat(t):"".concat(r,"/embed/app/").concat(e,"/assets/?ref=").concat(t)}),[v]),w=((null===(t=m.current)||void 0===t?void 0:t.x)||0)-2,x=((null===(n=m.current)||void 0===n?void 0:n.y)||0)-2,j=((null===(r=m.current)||void 0===r?void 0:r.width)||0)+4,S=((null===(c=m.current)||void 0===c?void 0:c.height)||0)+4,A=(null===(a=y.current)||void 0===a?void 0:a.width)||0,E=(null===(f=y.current)||void 0===f?void 0:f.height)||0,C=w,I=x-E+2;return I<0&&(I=x+S-2),I+E>window.innerHeight&&(C=window.innerHeight-E),C<0&&(C=0),C+A>window.innerWidth&&(C=window.innerWidth-A),Object(P.a)("div",{class:"squidex-overlay"},Object(P.a)("div",{class:"squidex-overlay-border",style:{left:w,top:x,width:j,height:S}}),Object(P.a)("div",{class:"squidex-overlay-toolbar",style:{left:C,top:I},ref:h},Object(P.a)("div",{class:"squidex-overlay-schema"},(null==v?void 0:v.s)||"Asset"),Object(P.a)("div",{class:"squidex-overlay-links","data-links":!0},Object(P.a)("a",{onClick:function(){return s(O)}},"Edit Inline"),Object(P.a)("a",{href:k,target:"_blank"},"Edit In Squidex"))))},F={x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY},W=function(e){var t=l(),n=k(o({}),2),r=n[0],u=n[1],c=k(o(),2),a=c[0],f=c[1],s=k(o(),2),d=s[0],p=s[1],v=l(r);i((function(){function e(e){var t=e.target;if(t&&!function(e){for(var t=e;t;){if("squidex-overlay-toolbar"===t.className)return!0;t=t.parentElement}return!1}(t)){var o=function(e,t){for(var n=e;n;){var r=x(n,t);if(r)return{token:r,target:n};n=n.parentElement}return{}}(t,Object.keys(v.current)),i=o.token,u=o.target,l={x:e.clientX,y:e.clientY};i&&u?(r(u,i),n=l):Math.abs(l.x-n.x)+Math.abs(l.y-n.y)>20&&r(void 0,void 0),t}}var t=void 0,n=F,r=function(e,n){e!==t&&(f(e&&n?{target:e,token:n}:void 0),t=e)};return document.addEventListener("mousemove",e),function(){document.removeEventListener("mousemove",e)}}),[]);var m,O=(m=function(e){if(e&&!v.current[e]){var t=function(t){var n=b(b({},v.current),{},g({},e,t));v.current=n,u(n)};if(0!==e.indexOf("http://")){var n=function(){var n,r=(n=function*(){t("Pending");try{var n=yield fetch("".concat(e,"/identity-server/info"),{credentials:"include"}),r=yield n.json();t(r.displayName?"Authenticated":"Failed")}catch(e){t("Failed")}},function(){var e=this,t=arguments;return new Promise((function(r,o){function i(e){y(l,r,o,i,u,"next",e)}function u(e){y(l,r,o,i,u,"throw",e)}var l=n.apply(e,t);i(void 0)}))});return function(){return r.apply(this,arguments)}}();n()}else t("Authenticated")}},C=8,_((function(){return m}),[r]));i((function(){O(e.baseUrl)}),[e.baseUrl]),i((function(){O(null==a?void 0:a.token.u)}),[null==a?void 0:a.token.u]);var w="Authenticated"===r[null==a?void 0:a.token.u];return Object(P.a)("div",{class:"squidex",ref:t},a&&w&&Object(P.a)(U,h({onOpen:p},a)),d&&Object(P.a)(M,{url:d,onClose:function(){return p(void 0)}}))},R="https://assets.squidex.io",V=null,B=function(){var e,t,n=null===(e=document.currentScript)||void 0===e?void 0:e.src;if(!("string"==typeof(t=n)||t instanceof String))return null;var r=(n=n.trim()).indexOf("/","https://".length);return r>0&&(n=n.substring(0,r)),n}();"complete"===document.readyState?j():window.addEventListener("load",(function(){return j()}))}}); //# sourceMappingURL=embed-sdk.js.map \ No newline at end of file diff --git a/sdk/preact.config.js b/sdk/preact.config.js new file mode 100644 index 000000000..936edef68 --- /dev/null +++ b/sdk/preact.config.js @@ -0,0 +1,11 @@ +export default (config, env, helpers, options) => { + config.output.filename = (pathData) => { + if (pathData.chunk.name === 'polyfills') { + return 'polyfill.js'; + } else { + return 'embed-sdk.js'; + } + }; + + config.plugins[4].options.filename = 'embed-sdk.css' +}; \ No newline at end of file diff --git a/sdk/size-plugin.json b/sdk/size-plugin.json index 2a4015bfb..47be02439 100644 --- a/sdk/size-plugin.json +++ b/sdk/size-plugin.json @@ -1 +1 @@ -[{"timestamp":1643040747792,"files":[{"filename":"bundle.8ec41.css","previous":665,"size":0,"diff":-665},{"filename":"index.html","previous":971,"size":982,"diff":11},{"filename":"bundle.*****.js","previous":7778,"size":7944,"diff":166},{"filename":"polyfills.*****.js","previous":2291,"size":2291,"diff":0},{"filename":"bundle.9727e.css","previous":0,"size":686,"diff":686}]},{"timestamp":1643037266163,"files":[{"filename":"bundle.8ec41.css","previous":665,"size":665,"diff":0},{"filename":"index.html","previous":951,"size":971,"diff":20},{"filename":"bundle.*****.js","previous":7778,"size":7778,"diff":0},{"filename":"polyfills.*****.js","previous":2291,"size":2291,"diff":0}]},{"timestamp":1643037028401,"files":[{"filename":"bundle.8ec41.css","previous":665,"size":665,"diff":0},{"filename":"index.html","previous":861,"size":951,"diff":90},{"filename":"bundle.*****.js","previous":7778,"size":7778,"diff":0},{"filename":"polyfills.*****.js","previous":2291,"size":2291,"diff":0}]},{"timestamp":1643036552475,"files":[{"filename":"bundle.8ec41.css","previous":665,"size":665,"diff":0},{"filename":"index.html","previous":860,"size":861,"diff":1},{"filename":"bundle.*****.js","previous":7779,"size":7778,"diff":-1},{"filename":"polyfills.*****.js","previous":2291,"size":2291,"diff":0}]},{"timestamp":1642880373297,"files":[{"filename":"bundle.8ec41.css","previous":665,"size":665,"diff":0},{"filename":"index.html","previous":770,"size":860,"diff":90},{"filename":"bundle.*****.js","previous":7165,"size":7779,"diff":614},{"filename":"polyfills.*****.js","previous":2291,"size":2291,"diff":0}]},{"timestamp":1642793188355,"files":[{"filename":"bundle.8ec41.css","previous":665,"size":665,"diff":0},{"filename":"index.html","previous":770,"size":770,"diff":0},{"filename":"bundle.*****.js","previous":7169,"size":7165,"diff":-4},{"filename":"polyfills.*****.js","previous":2291,"size":2291,"diff":0}]},{"timestamp":1642792886072,"files":[{"filename":"bundle.8ec41.css","previous":665,"size":665,"diff":0},{"filename":"index.html","previous":771,"size":770,"diff":-1},{"filename":"bundle.*****.js","previous":7165,"size":7169,"diff":4},{"filename":"polyfills.*****.js","previous":2291,"size":2291,"diff":0}]},{"timestamp":1642792872086,"files":[{"filename":"bundle.8ec41.css","previous":665,"size":665,"diff":0},{"filename":"index.html","previous":770,"size":771,"diff":1},{"filename":"bundle.*****.js","previous":7122,"size":7165,"diff":43},{"filename":"polyfills.*****.js","previous":2291,"size":2291,"diff":0}]},{"timestamp":1642792547160,"files":[{"filename":"bundle.8ec41.css","previous":665,"size":665,"diff":0},{"filename":"index.html","previous":772,"size":770,"diff":-2},{"filename":"bundle.*****.js","previous":7029,"size":7122,"diff":93},{"filename":"polyfills.*****.js","previous":2291,"size":2291,"diff":0}]},{"timestamp":1642792111367,"files":[{"filename":"bundle.8ec41.css","previous":665,"size":665,"diff":0},{"filename":"bundle.*****.esm.js","previous":6968,"size":0,"diff":-6968},{"filename":"polyfills.*****.esm.js","previous":2191,"size":0,"diff":-2191},{"filename":"sw.js","previous":10444,"size":0,"diff":-10444},{"filename":"sw-esm.js","previous":10447,"size":0,"diff":-10447},{"filename":"bundle.dbe17.js","previous":7062,"size":0,"diff":-7062},{"filename":"polyfills.03377.js","previous":2291,"size":0,"diff":-2291},{"filename":"index.html","previous":806,"size":772,"diff":-34},{"filename":"200.html","previous":806,"size":0,"diff":-806},{"filename":"bundle.*****.js","previous":0,"size":7029,"diff":7029},{"filename":"polyfills.*****.js","previous":0,"size":2291,"diff":2291}]},{"timestamp":1642792036250,"files":[{"filename":"bundle.8ec41.css","previous":0,"size":665,"diff":665},{"filename":"bundle.*****.esm.js","previous":0,"size":6968,"diff":6968},{"filename":"polyfills.*****.esm.js","previous":0,"size":2191,"diff":2191},{"filename":"sw.js","previous":0,"size":10444,"diff":10444},{"filename":"sw-esm.js","previous":0,"size":10447,"diff":10447},{"filename":"bundle.dbe17.js","previous":0,"size":7062,"diff":7062},{"filename":"polyfills.03377.js","previous":0,"size":2291,"diff":2291},{"filename":"index.html","previous":0,"size":806,"diff":806},{"filename":"200.html","previous":0,"size":806,"diff":806}]}] +[{"timestamp":1644926438355,"files":[{"filename":"embed-sdk.js","previous":7928,"size":7928,"diff":0},{"filename":"embed-sdk.css","previous":686,"size":686,"diff":0},{"filename":"polyfill.js","previous":0,"size":2284,"diff":2284},{"filename":"index.html","previous":0,"size":987,"diff":987}]},{"timestamp":1644926203000,"files":[{"filename":"index.html","previous":1002,"size":0,"diff":-1002},{"filename":"polyfills.js","previous":2284,"size":0,"diff":-2284},{"filename":"embed-sdk.js","previous":7928,"size":7928,"diff":0},{"filename":"embed-sdk.css","previous":686,"size":686,"diff":0},{"filename":"bundle.css","previous":686,"size":0,"diff":-686},{"filename":"bundle.js","previous":7930,"size":0,"diff":-7930}]},{"timestamp":1644926047050,"files":[{"filename":"index.html","previous":285,"size":1002,"diff":717},{"filename":"polyfills.js","previous":2284,"size":2284,"diff":0},{"filename":"embed-sdk.js","previous":7928,"size":7928,"diff":0},{"filename":"embed-sdk.css","previous":686,"size":686,"diff":0},{"filename":"bundle.css","previous":0,"size":686,"diff":686},{"filename":"bundle.js","previous":0,"size":7930,"diff":7930}]},{"timestamp":1644925980692,"files":[{"filename":"index.html","previous":1002,"size":285,"diff":-717},{"filename":"polyfills.js","previous":2284,"size":2284,"diff":0},{"filename":"embed-sdk.js","previous":7928,"size":7928,"diff":0},{"filename":"embed-sdk.css","previous":686,"size":686,"diff":0},{"filename":"bundle.css","previous":686,"size":0,"diff":-686},{"filename":"bundle.js","previous":7930,"size":0,"diff":-7930}]},{"timestamp":1644925939551,"files":[{"filename":"index.html","previous":285,"size":1002,"diff":717},{"filename":"polyfills.js","previous":2284,"size":2284,"diff":0},{"filename":"embed-sdk.js","previous":7928,"size":7928,"diff":0},{"filename":"embed-sdk.css","previous":686,"size":686,"diff":0},{"filename":"bundle.css","previous":0,"size":686,"diff":686},{"filename":"bundle.js","previous":0,"size":7930,"diff":7930}]},{"timestamp":1644925917035,"files":[{"filename":"index.html","previous":285,"size":285,"diff":0},{"filename":"foo.css","previous":686,"size":0,"diff":-686},{"filename":"polyfills.js","previous":2284,"size":2284,"diff":0},{"filename":"embed-sdk.js","previous":7928,"size":7928,"diff":0},{"filename":"embed-sdk.css","previous":0,"size":686,"diff":686}]},{"timestamp":1644925882553,"files":[{"filename":"index.html","previous":977,"size":285,"diff":-692},{"filename":"foo.css","previous":686,"size":686,"diff":0},{"filename":"bundle.js","previous":7930,"size":0,"diff":-7930},{"filename":"polyfills.js","previous":2284,"size":2284,"diff":0},{"filename":"embed-sdk.js","previous":0,"size":7928,"diff":7928}]},{"timestamp":1644925709436,"files":[{"filename":"bundle.9727e.css","previous":686,"size":0,"diff":-686},{"filename":"index.html","previous":992,"size":977,"diff":-15},{"filename":"bundle.*****.js","previous":7937,"size":0,"diff":-7937},{"filename":"polyfills.*****.js","previous":2291,"size":0,"diff":-2291},{"filename":"foo.css","previous":0,"size":686,"diff":686},{"filename":"bundle.js","previous":0,"size":7930,"diff":7930},{"filename":"polyfills.js","previous":0,"size":2284,"diff":2284}]},{"timestamp":1644925424135,"files":[{"filename":"bundle.9727e.css","previous":686,"size":686,"diff":0},{"filename":"index.html","previous":983,"size":992,"diff":9},{"filename":"bundle.js","previous":7930,"size":0,"diff":-7930},{"filename":"polyfills.js","previous":2284,"size":0,"diff":-2284},{"filename":"bundle.*****.js","previous":0,"size":7937,"diff":7937},{"filename":"polyfills.*****.js","previous":0,"size":2291,"diff":2291}]},{"timestamp":1644925348081,"files":[{"filename":"bundle.9727e.css","previous":686,"size":686,"diff":0},{"filename":"bundle.*****.js","previous":7937,"size":0,"diff":-7937},{"filename":"polyfills.*****.js","previous":2291,"size":0,"diff":-2291},{"filename":"index.html","previous":992,"size":983,"diff":-9},{"filename":"bundle.js","previous":0,"size":7930,"diff":7930},{"filename":"polyfills.js","previous":0,"size":2284,"diff":2284}]},{"timestamp":1644925261703,"files":[{"filename":"bundle.9727e.css","previous":686,"size":686,"diff":0},{"filename":"bundle.*****.js","previous":0,"size":7937,"diff":7937},{"filename":"polyfills.*****.js","previous":0,"size":2291,"diff":2291},{"filename":"index.html","previous":0,"size":992,"diff":992}]},{"timestamp":1644925249869,"files":[{"filename":"bundle.9727e.css","previous":686,"size":686,"diff":0},{"filename":"embed-sdk.js","previous":7928,"size":0,"diff":-7928}]},{"timestamp":1644925231743,"files":[{"filename":"index.html","previous":992,"size":0,"diff":-992},{"filename":"bundle.*****.js","previous":7937,"size":0,"diff":-7937},{"filename":"polyfills.*****.js","previous":2291,"size":0,"diff":-2291},{"filename":"bundle.9727e.css","previous":686,"size":686,"diff":0},{"filename":"embed-sdk.js","previous":0,"size":7928,"diff":7928}]},{"timestamp":1644924934973,"files":[{"filename":"index.html","previous":982,"size":992,"diff":10},{"filename":"bundle.*****.js","previous":7944,"size":7937,"diff":-7},{"filename":"polyfills.*****.js","previous":2291,"size":2291,"diff":0},{"filename":"bundle.9727e.css","previous":686,"size":686,"diff":0}]},{"timestamp":1643040747792,"files":[{"filename":"bundle.8ec41.css","previous":665,"size":0,"diff":-665},{"filename":"index.html","previous":971,"size":982,"diff":11},{"filename":"bundle.*****.js","previous":7778,"size":7944,"diff":166},{"filename":"polyfills.*****.js","previous":2291,"size":2291,"diff":0},{"filename":"bundle.9727e.css","previous":0,"size":686,"diff":686}]},{"timestamp":1643037266163,"files":[{"filename":"bundle.8ec41.css","previous":665,"size":665,"diff":0},{"filename":"index.html","previous":951,"size":971,"diff":20},{"filename":"bundle.*****.js","previous":7778,"size":7778,"diff":0},{"filename":"polyfills.*****.js","previous":2291,"size":2291,"diff":0}]},{"timestamp":1643037028401,"files":[{"filename":"bundle.8ec41.css","previous":665,"size":665,"diff":0},{"filename":"index.html","previous":861,"size":951,"diff":90},{"filename":"bundle.*****.js","previous":7778,"size":7778,"diff":0},{"filename":"polyfills.*****.js","previous":2291,"size":2291,"diff":0}]},{"timestamp":1643036552475,"files":[{"filename":"bundle.8ec41.css","previous":665,"size":665,"diff":0},{"filename":"index.html","previous":860,"size":861,"diff":1},{"filename":"bundle.*****.js","previous":7779,"size":7778,"diff":-1},{"filename":"polyfills.*****.js","previous":2291,"size":2291,"diff":0}]},{"timestamp":1642880373297,"files":[{"filename":"bundle.8ec41.css","previous":665,"size":665,"diff":0},{"filename":"index.html","previous":770,"size":860,"diff":90},{"filename":"bundle.*****.js","previous":7165,"size":7779,"diff":614},{"filename":"polyfills.*****.js","previous":2291,"size":2291,"diff":0}]},{"timestamp":1642793188355,"files":[{"filename":"bundle.8ec41.css","previous":665,"size":665,"diff":0},{"filename":"index.html","previous":770,"size":770,"diff":0},{"filename":"bundle.*****.js","previous":7169,"size":7165,"diff":-4},{"filename":"polyfills.*****.js","previous":2291,"size":2291,"diff":0}]},{"timestamp":1642792886072,"files":[{"filename":"bundle.8ec41.css","previous":665,"size":665,"diff":0},{"filename":"index.html","previous":771,"size":770,"diff":-1},{"filename":"bundle.*****.js","previous":7165,"size":7169,"diff":4},{"filename":"polyfills.*****.js","previous":2291,"size":2291,"diff":0}]},{"timestamp":1642792872086,"files":[{"filename":"bundle.8ec41.css","previous":665,"size":665,"diff":0},{"filename":"index.html","previous":770,"size":771,"diff":1},{"filename":"bundle.*****.js","previous":7122,"size":7165,"diff":43},{"filename":"polyfills.*****.js","previous":2291,"size":2291,"diff":0}]},{"timestamp":1642792547160,"files":[{"filename":"bundle.8ec41.css","previous":665,"size":665,"diff":0},{"filename":"index.html","previous":772,"size":770,"diff":-2},{"filename":"bundle.*****.js","previous":7029,"size":7122,"diff":93},{"filename":"polyfills.*****.js","previous":2291,"size":2291,"diff":0}]},{"timestamp":1642792111367,"files":[{"filename":"bundle.8ec41.css","previous":665,"size":665,"diff":0},{"filename":"bundle.*****.esm.js","previous":6968,"size":0,"diff":-6968},{"filename":"polyfills.*****.esm.js","previous":2191,"size":0,"diff":-2191},{"filename":"sw.js","previous":10444,"size":0,"diff":-10444},{"filename":"sw-esm.js","previous":10447,"size":0,"diff":-10447},{"filename":"bundle.dbe17.js","previous":7062,"size":0,"diff":-7062},{"filename":"polyfills.03377.js","previous":2291,"size":0,"diff":-2291},{"filename":"index.html","previous":806,"size":772,"diff":-34},{"filename":"200.html","previous":806,"size":0,"diff":-806},{"filename":"bundle.*****.js","previous":0,"size":7029,"diff":7029},{"filename":"polyfills.*****.js","previous":0,"size":2291,"diff":2291}]},{"timestamp":1642792036250,"files":[{"filename":"bundle.8ec41.css","previous":0,"size":665,"diff":665},{"filename":"bundle.*****.esm.js","previous":0,"size":6968,"diff":6968},{"filename":"polyfills.*****.esm.js","previous":0,"size":2191,"diff":2191},{"filename":"sw.js","previous":0,"size":10444,"diff":10444},{"filename":"sw-esm.js","previous":0,"size":10447,"diff":10447},{"filename":"bundle.dbe17.js","previous":0,"size":7062,"diff":7062},{"filename":"polyfills.03377.js","previous":0,"size":2291,"diff":2291},{"filename":"index.html","previous":0,"size":806,"diff":806},{"filename":"200.html","previous":0,"size":806,"diff":806}]}] diff --git a/sdk/src/components/overlay-container.tsx b/sdk/src/components/overlay-container.tsx index 47da70d00..93d140f9b 100644 --- a/sdk/src/components/overlay-container.tsx +++ b/sdk/src/components/overlay-container.tsx @@ -40,8 +40,6 @@ export const OverlayContainer = (props: OverlayContainerProps) => { function listen(event: MouseEvent) { const element = event.target as HTMLElement; - console.log(element); - if (!element || isToolbar(element)) { return; } diff --git a/sdk/src/template.html b/sdk/src/template.html index e4c28acd6..1bd5c13e7 100644 --- a/sdk/src/template.html +++ b/sdk/src/template.html @@ -89,7 +89,7 @@
- +