@yoopta/embed 1.9.3-rc → 1.9.5-rc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{UI_HELPERS as e,cx as t,createYooptaPlugin as i,getElementByPath as o,generateId as n}from"@yoopta/editor";import{Transforms as r,Element as s}from"slate";import{jsx as a,jsxs as d}from"react/jsx-runtime";import*as l from"react";import{useState as h,useEffect as c,useRef as p,useMemo as u}from"react";import{flushSync as g}from"react-dom";import{ReactEditor as m,useSelected as f,useReadOnly as v}from"slate-react";function b(e,t){var i={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(i[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(i[o[n]]=e[o[n]])}return i}function w(e,t,i,o){return new(i||(i=Promise))((function(n,r){function s(e){try{d(o.next(e))}catch(e){r(e)}}function a(e){try{d(o.throw(e))}catch(e){r(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}d((o=o.apply(e,t||[])).next())}))}function y(e,{threshold:t=0,root:i=null,rootMargin:o="0%",freezeOnceVisible:n=!1}={}){const[r,s]=h({}),a=r.isIntersecting&&n,d=([e])=>s(e);return c((()=>{const n=null==e?void 0:e.current;if(!window.IntersectionObserver||a||!n)return;const r=new IntersectionObserver(d,{threshold:t,root:i,rootMargin:o});return r.observe(n),()=>r.disconnect()}),[e,t,i,o,a]),r}function x(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===i&&o.firstChild?o.insertBefore(n,o.firstChild):o.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}var z={root:"ypSFFbjd",iframe:"DQszzmj7",container:"yc58m72J",iframePreview:"DYsS-Bbu",embed:"a1CpYHeG"};x(".ypSFFbjd{display:flex;height:0;justify-content:center;min-height:100px;padding-bottom:56.25%;position:relative;width:100%}.DQszzmj7{background-color:#fff}.DQszzmj7,.yc58m72J{border-radius:1px;height:100%;pointer-events:auto;width:100%}.DQszzmj7,.DYsS-Bbu,.yc58m72J{left:0;position:absolute;top:0}.DYsS-Bbu{filter:blur(10px);object-fit:cover;transition:opacity .15s ease-in,filter .15s ease-in}.a1CpYHeG{height:100%;position:relative;width:100%}");const O=e=>`https://api.dailymotion.com/video/${e}?fields=thumbnail_url`;var S={root:"C8Z8IWw5",iframe:"aGHn-pry",container:"-qZtVrzy",iframePreview:"kmC7RiaF",embed:"srCuArtd"};function N(e){var{providerId:t,url:i}=e;b(e,["providerId","url"]);const o=p(null),{isIntersecting:n}=y(o,{freezeOnceVisible:!0,rootMargin:"50%"});return a("div",Object.assign({className:S.root,ref:o},{children:a("div",Object.assign({className:S.container},{children:a("div",Object.assign({className:S.embed},{children:n&&a("iframe",{src:i,frameBorder:0,allowFullScreen:!0,className:S.iframe,height:"450px"})}))}))}))}x(".C8Z8IWw5{display:flex;height:0;justify-content:center;min-height:100px;padding-bottom:56.25%;position:relative;width:100%}.aGHn-pry{background-color:#fff}.-qZtVrzy,.aGHn-pry{border-radius:1px;height:100%;pointer-events:auto;width:100%}.-qZtVrzy,.aGHn-pry,.kmC7RiaF{left:0;position:absolute;top:0}.kmC7RiaF{filter:blur(10px);object-fit:cover;transition:opacity .15s ease-in,filter .15s ease-in}.srCuArtd{height:100%;position:relative;width:100%}");var j={root:"w4l4tKlB",iframe:"cbJcegGv",container:"g8V-uGLl",iframePreview:"hZuYZ7vp",embed:"j6pRoOC1"};x(".w4l4tKlB{display:flex;height:0;justify-content:center;min-height:100px;padding-bottom:56.25%;position:relative;width:100%}.cbJcegGv{background-color:#fff}.cbJcegGv,.g8V-uGLl{border-radius:1px;height:100%;pointer-events:auto;width:100%}.cbJcegGv,.g8V-uGLl,.hZuYZ7vp{left:0;position:absolute;top:0}.hZuYZ7vp{filter:blur(10px);object-fit:cover;transition:opacity .15s ease-in,filter .15s ease-in}.j6pRoOC1{height:100%;position:relative;width:100%}");var R={root:"e3lQDjTT",iframe:"O5Z0OWN-",container:"zxjqcq4y",iframePreview:"_5kC3Lf5J",embed:"ymOgdXs4"};x(".e3lQDjTT{display:flex;height:100%;justify-content:center;min-height:100px;padding-bottom:86%;position:relative;width:100%}.O5Z0OWN-{background-color:#fff}.O5Z0OWN-,.zxjqcq4y{border-radius:1px;height:100%;left:0;pointer-events:auto;position:absolute;top:0;width:100%}._5kC3Lf5J{filter:blur(10px);left:0;object-fit:cover;position:absolute;top:0;transition:opacity .15s ease-in,filter .15s ease-in}.ymOgdXs4{position:relative;width:100%}.ymOgdXs4,.ymOgdXs4>div,.ymOgdXs4>div>div{height:100%}.ymOgdXs4 iframe{height:100%!important;width:100%!important}");var W={root:"sD5QN14F",iframe:"mRrF4hwM",container:"LyyH1fsE",iframePreview:"U9EPxemn",embed:"_4AQiBYad"};x(".sD5QN14F{display:flex;height:0;justify-content:center;min-height:100px;padding-bottom:56.25%;position:relative;width:100%}.mRrF4hwM{background-color:#fff}.LyyH1fsE,.mRrF4hwM{border-radius:1px;height:100%;pointer-events:auto;width:100%}.LyyH1fsE,.U9EPxemn,.mRrF4hwM{left:0;position:absolute;top:0}.U9EPxemn{filter:blur(10px);object-fit:cover;transition:opacity .15s ease-in,filter .15s ease-in}._4AQiBYad{height:100%;position:relative;width:100%}");const E="https://vimeo.com/api/v2/video";var H={root:"zoqyIXwI",iframe:"WgoSECbO",container:"m07CnIxO",iframePreview:"NSr-cxfm",embed:"Cv1rIJbN"};x(".zoqyIXwI{display:flex;height:0;justify-content:center;min-height:100px;padding-bottom:56.25%;position:relative;width:100%}.WgoSECbO{background-color:#fff}.WgoSECbO,.m07CnIxO{border-radius:1px;height:100%;pointer-events:auto;width:100%}.NSr-cxfm,.WgoSECbO,.m07CnIxO{left:0;position:absolute;top:0}.NSr-cxfm{filter:blur(10px);object-fit:cover;transition:opacity .15s ease-in,filter .15s ease-in}.Cv1rIJbN{height:100%;position:relative;width:100%}");var P="HUtGPcJq";x(".HUtGPcJq{margin:20px 0 10px;position:relative}");const C={vimeo:function(e){var{providerId:t}=e,i=b(e,["providerId"]);const o=p(null),[n,r]=h(null),[s,l]=h(!1),{isIntersecting:u}=y(o,{freezeOnceVisible:!0,rootMargin:"50%"});return c((()=>{fetch(`${E}/${t}.json`).then((e=>e.json())).then((e=>r(e[0].thumbnail_medium))).catch((()=>r(null)))}),[t]),a("div",Object.assign({className:W.root,ref:o},{children:a("div",Object.assign({className:W.container},{children:d("div",Object.assign({className:W.embed},{children:[a("img",{src:n||"",alt:"vimeo_video_preview",width:"100%",height:"100%",className:W.iframePreview,style:{opacity:u&&s?0:1,zIndex:u&&s?-1:0}}),u&&a("iframe",Object.assign({title:"Vimeo Player",src:`https://player.vimeo.com/video/${t}?badge=0&byline=0&portrait=0&title=0`,frameBorder:0,allowFullScreen:!0,onLoad:()=>l(!0),className:W.iframe},i))]}))}))}))},youtube:function(e){var{providerId:t}=e,i=b(e,["providerId"]);const o=p(null),[n,r]=h(!1),{isIntersecting:s}=y(o,{freezeOnceVisible:!0,rootMargin:"50%"});return a("div",Object.assign({className:H.root,ref:o},{children:a("div",Object.assign({className:H.container},{children:d("div",Object.assign({className:H.embed},{children:[a("img",{src:`https://i.ytimg.com/vi/${t}/default.jpg`,alt:"youtube_video_preview",width:"100%",height:"100%",className:H.iframePreview,style:{opacity:s&&n?0:1,zIndex:s&&n?-1:0}}),s&&a("iframe",Object.assign({title:"Youtube Player",src:`https://www.youtube.com/embed/${t}?hl=no&rel=0`,frameBorder:0,onLoad:()=>r(!0),allowFullScreen:!0,className:H.iframe},i))]}))}))}))},dailymotion:function(e){var{providerId:t}=e,i=b(e,["providerId"]);const o=p(null),[n,r]=h(null),[s,l]=h(!1),{isIntersecting:u}=y(o,{freezeOnceVisible:!0,rootMargin:"50%"});return c((()=>{fetch(O(t)).then((e=>e.json())).then((e=>r(e.thumbnail_url))).catch((()=>r(null)))}),[t]),a("div",Object.assign({className:z.root,ref:o},{children:a("div",Object.assign({className:z.container},{children:d("div",Object.assign({className:z.embed},{children:[a("img",{src:n||"",alt:"daylimotion_video_preview",width:"100%",height:"100%",className:z.iframePreview,style:{opacity:u&&s?0:1,zIndex:u&&s?-1:0}}),u&&a("iframe",Object.assign({title:"Dailymotion Video Player",frameBorder:0,onLoad:()=>l(!0),src:`https://www.dailymotion.com/embed/video/${t}`,allowFullScreen:!0,className:z.iframe},i))]}))}))}))},twitter:function(e){var{providerId:t}=e;b(e,["providerId"]);const i=p(null),{isIntersecting:o}=y(i,{freezeOnceVisible:!0,rootMargin:"50%"});return c((()=>{var e;if(!o)return;const n=document.createElement("script");n.src="https://platform.twitter.com/widgets.js",null===(e=i.current)||void 0===e||e.appendChild(n),n.onload=()=>{window.twttr&&window.twttr.widgets.createTweet(t,document.getElementById(t),{align:"center",conversation:"none",dnt:!0,theme:"dark",height:300})}}),[t,o]),a("div",Object.assign({className:R.root,ref:i},{children:a("div",Object.assign({className:R.container},{children:a("div",Object.assign({className:R.embed},{children:a("div",{id:t})}))}))}))},figma:function(e){var{providerId:t,url:i}=e;b(e,["providerId","url"]);const o=p(null),{isIntersecting:n}=y(o,{freezeOnceVisible:!0,rootMargin:"50%"});return a("div",Object.assign({className:j.root,ref:o},{children:a("div",Object.assign({className:j.container},{children:a("div",Object.assign({className:j.embed},{children:n&&a("iframe",{src:`https://www.figma.com/embed?embed_host=share&url=${encodeURIComponent(i)}`,frameBorder:0,allowFullScreen:!0,className:j.iframe,height:"450px"})}))}))}))}};var L,k,B=(L=function(e,t){return L=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},L(e,t)},function(e,t){function i(){this.constructor=e}L(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),M=function(){return M=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},M.apply(this,arguments)},I={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},_={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},A={width:"20px",height:"20px",position:"absolute"},V={top:M(M({},I),{top:"-5px"}),right:M(M({},_),{left:void 0,right:"-5px"}),bottom:M(M({},I),{top:void 0,bottom:"-5px"}),left:M(M({},_),{left:"-5px"}),topRight:M(M({},A),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:M(M({},A),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:M(M({},A),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:M(M({},A),{left:"-10px",top:"-10px",cursor:"nw-resize"})},F=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.onMouseDown=function(e){t.props.onResizeStart(e,t.props.direction)},t.onTouchStart=function(e){t.props.onResizeStart(e,t.props.direction)},t}return B(t,e),t.prototype.render=function(){return l.createElement("div",{className:this.props.className||"",style:M(M({position:"absolute",userSelect:"none"},V[this.props.direction]),this.props.replaceStyles||{}),onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart},this.props.children)},t}(l.PureComponent),T=function(){var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},e(t,i)};return function(t,i){function o(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(o.prototype=i.prototype,new o)}}(),G=function(){return G=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},G.apply(this,arguments)},U={width:"auto",height:"auto"},D=function(e,t,i){return Math.max(Math.min(e,i),t)},Y=function(e,t){return Math.round(e/t)*t},Z=function(e,t){return new RegExp(e,"i").test(t)},q=function(e){return Boolean(e.touches&&e.touches.length)},J=function(e,t,i){void 0===i&&(i=0);var o=t.reduce((function(i,o,n){return Math.abs(o-e)<Math.abs(t[i]-e)?n:i}),0),n=Math.abs(t[o]-e);return 0===i||n<i?t[o]:e},X=function(e){return"auto"===(e=e.toString())||e.endsWith("px")||e.endsWith("%")||e.endsWith("vh")||e.endsWith("vw")||e.endsWith("vmax")||e.endsWith("vmin")?e:e+"px"},Q=function(e,t,i,o){if(e&&"string"==typeof e){if(e.endsWith("px"))return Number(e.replace("px",""));if(e.endsWith("%"))return t*(Number(e.replace("%",""))/100);if(e.endsWith("vw"))return i*(Number(e.replace("vw",""))/100);if(e.endsWith("vh"))return o*(Number(e.replace("vh",""))/100)}return e},$=["as","style","className","grid","snap","bounds","boundsByDirection","size","defaultSize","minWidth","minHeight","maxWidth","maxHeight","lockAspectRatio","lockAspectRatioExtraWidth","lockAspectRatioExtraHeight","enable","handleStyles","handleClasses","handleWrapperStyle","handleWrapperClass","children","onResizeStart","onResize","onResizeStop","handleComponent","scale","resizeRatio","snapGap"],K="__resizable_base__",ee=function(e){function t(t){var i=e.call(this,t)||this;return i.ratio=1,i.resizable=null,i.parentLeft=0,i.parentTop=0,i.resizableLeft=0,i.resizableRight=0,i.resizableTop=0,i.resizableBottom=0,i.targetLeft=0,i.targetTop=0,i.appendBase=function(){if(!i.resizable||!i.window)return null;var e=i.parentNode;if(!e)return null;var t=i.window.document.createElement("div");return t.style.width="100%",t.style.height="100%",t.style.position="absolute",t.style.transform="scale(0, 0)",t.style.left="0",t.style.flex="0 0 100%",t.classList?t.classList.add(K):t.className+=K,e.appendChild(t),t},i.removeBase=function(e){var t=i.parentNode;t&&t.removeChild(e)},i.ref=function(e){e&&(i.resizable=e)},i.state={isResizing:!1,width:void 0===(i.propsSize&&i.propsSize.width)?"auto":i.propsSize&&i.propsSize.width,height:void 0===(i.propsSize&&i.propsSize.height)?"auto":i.propsSize&&i.propsSize.height,direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"},flexBasis:void 0},i.onResizeStart=i.onResizeStart.bind(i),i.onMouseMove=i.onMouseMove.bind(i),i.onMouseUp=i.onMouseUp.bind(i),i}return T(t,e),Object.defineProperty(t.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"window",{get:function(){return this.resizable&&this.resizable.ownerDocument?this.resizable.ownerDocument.defaultView:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||U},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var e=0,t=0;if(this.resizable&&this.window){var i=this.resizable.offsetWidth,o=this.resizable.offsetHeight,n=this.resizable.style.position;"relative"!==n&&(this.resizable.style.position="relative"),e="auto"!==this.resizable.style.width?this.resizable.offsetWidth:i,t="auto"!==this.resizable.style.height?this.resizable.offsetHeight:o,this.resizable.style.position=n}return{width:e,height:t}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var e=this,t=this.props.size,i=function(t){if(void 0===e.state[t]||"auto"===e.state[t])return"auto";if(e.propsSize&&e.propsSize[t]&&e.propsSize[t].toString().endsWith("%")){if(e.state[t].toString().endsWith("%"))return e.state[t].toString();var i=e.getParentSize();return Number(e.state[t].toString().replace("px",""))/i[t]*100+"%"}return X(e.state[t])};return{width:t&&void 0!==t.width&&!this.state.isResizing?X(t.width):i("width"),height:t&&void 0!==t.height&&!this.state.isResizing?X(t.height):i("height")}},enumerable:!1,configurable:!0}),t.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var e=this.appendBase();if(!e)return{width:0,height:0};var t=!1,i=this.parentNode.style.flexWrap;"wrap"!==i&&(t=!0,this.parentNode.style.flexWrap="wrap"),e.style.position="relative",e.style.minWidth="100%",e.style.minHeight="100%";var o={width:e.offsetWidth,height:e.offsetHeight};return t&&(this.parentNode.style.flexWrap=i),this.removeBase(e),o},t.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},t.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},t.prototype.componentDidMount=function(){if(this.resizable&&this.window){var e=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:"auto"!==e.flexBasis?e.flexBasis:void 0})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(e,t){var i=this.propsSize&&this.propsSize[t];return"auto"!==this.state[t]||this.state.original[t]!==e||void 0!==i&&"auto"!==i?e:"auto"},t.prototype.calculateNewMaxFromBoundary=function(e,t){var i,o,n=this.props.boundsByDirection,r=this.state.direction,s=n&&Z("left",r),a=n&&Z("top",r);if("parent"===this.props.bounds){var d=this.parentNode;d&&(i=s?this.resizableRight-this.parentLeft:d.offsetWidth+(this.parentLeft-this.resizableLeft),o=a?this.resizableBottom-this.parentTop:d.offsetHeight+(this.parentTop-this.resizableTop))}else"window"===this.props.bounds?this.window&&(i=s?this.resizableRight:this.window.innerWidth-this.resizableLeft,o=a?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(i=s?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),o=a?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return i&&Number.isFinite(i)&&(e=e&&e<i?e:i),o&&Number.isFinite(o)&&(t=t&&t<o?t:o),{maxWidth:e,maxHeight:t}},t.prototype.calculateNewSizeFromDirection=function(e,t){var i=this.props.scale||1,o=this.props.resizeRatio||1,n=this.state,r=n.direction,s=n.original,a=this.props,d=a.lockAspectRatio,l=a.lockAspectRatioExtraHeight,h=a.lockAspectRatioExtraWidth,c=s.width,p=s.height,u=l||0,g=h||0;return Z("right",r)&&(c=s.width+(e-s.x)*o/i,d&&(p=(c-g)/this.ratio+u)),Z("left",r)&&(c=s.width-(e-s.x)*o/i,d&&(p=(c-g)/this.ratio+u)),Z("bottom",r)&&(p=s.height+(t-s.y)*o/i,d&&(c=(p-u)*this.ratio+g)),Z("top",r)&&(p=s.height-(t-s.y)*o/i,d&&(c=(p-u)*this.ratio+g)),{newWidth:c,newHeight:p}},t.prototype.calculateNewSizeFromAspectRatio=function(e,t,i,o){var n=this.props,r=n.lockAspectRatio,s=n.lockAspectRatioExtraHeight,a=n.lockAspectRatioExtraWidth,d=void 0===o.width?10:o.width,l=void 0===i.width||i.width<0?e:i.width,h=void 0===o.height?10:o.height,c=void 0===i.height||i.height<0?t:i.height,p=s||0,u=a||0;if(r){var g=(h-p)*this.ratio+u,m=(c-p)*this.ratio+u,f=(d-u)/this.ratio+p,v=(l-u)/this.ratio+p,b=Math.max(d,g),w=Math.min(l,m),y=Math.max(h,f),x=Math.min(c,v);e=D(e,b,w),t=D(t,y,x)}else e=D(e,d,l),t=D(t,h,c);return{newWidth:e,newHeight:t}},t.prototype.setBoundingClientRect=function(){if("parent"===this.props.bounds){var e=this.parentNode;if(e){var t=e.getBoundingClientRect();this.parentLeft=t.left,this.parentTop=t.top}}if(this.props.bounds&&"string"!=typeof this.props.bounds){var i=this.props.bounds.getBoundingClientRect();this.targetLeft=i.left,this.targetTop=i.top}if(this.resizable){var o=this.resizable.getBoundingClientRect(),n=o.left,r=o.top,s=o.right,a=o.bottom;this.resizableLeft=n,this.resizableRight=s,this.resizableTop=r,this.resizableBottom=a}},t.prototype.onResizeStart=function(e,t){if(this.resizable&&this.window){var i,o=0,n=0;if(e.nativeEvent&&function(e){return Boolean((e.clientX||0===e.clientX)&&(e.clientY||0===e.clientY))}(e.nativeEvent)?(o=e.nativeEvent.clientX,n=e.nativeEvent.clientY):e.nativeEvent&&q(e.nativeEvent)&&(o=e.nativeEvent.touches[0].clientX,n=e.nativeEvent.touches[0].clientY),this.props.onResizeStart)if(this.resizable)if(!1===this.props.onResizeStart(e,t,this.resizable))return;this.props.size&&(void 0!==this.props.size.height&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),void 0!==this.props.size.width&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio="number"==typeof this.props.lockAspectRatio?this.props.lockAspectRatio:this.size.width/this.size.height;var r=this.window.getComputedStyle(this.resizable);if("auto"!==r.flexBasis){var s=this.parentNode;if(s){var a=this.window.getComputedStyle(s).flexDirection;this.flexDir=a.startsWith("row")?"row":"column",i=r.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var d={original:{x:o,y:n,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:G(G({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(e.target).cursor||"auto"}),direction:t,flexBasis:i};this.setState(d)}},t.prototype.onMouseMove=function(e){var t=this;if(this.state.isResizing&&this.resizable&&this.window){if(this.window.TouchEvent&&q(e))try{e.preventDefault(),e.stopPropagation()}catch(e){}var i=this.props,o=i.maxWidth,n=i.maxHeight,r=i.minWidth,s=i.minHeight,a=q(e)?e.touches[0].clientX:e.clientX,d=q(e)?e.touches[0].clientY:e.clientY,l=this.state,h=l.direction,c=l.original,p=l.width,u=l.height,m=this.getParentSize(),f=function(e,t,i,o,n,r,s){return o=Q(o,e.width,t,i),n=Q(n,e.height,t,i),r=Q(r,e.width,t,i),s=Q(s,e.height,t,i),{maxWidth:void 0===o?void 0:Number(o),maxHeight:void 0===n?void 0:Number(n),minWidth:void 0===r?void 0:Number(r),minHeight:void 0===s?void 0:Number(s)}}(m,this.window.innerWidth,this.window.innerHeight,o,n,r,s);o=f.maxWidth,n=f.maxHeight,r=f.minWidth,s=f.minHeight;var v=this.calculateNewSizeFromDirection(a,d),b=v.newHeight,w=v.newWidth,y=this.calculateNewMaxFromBoundary(o,n);this.props.snap&&this.props.snap.x&&(w=J(w,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(b=J(b,this.props.snap.y,this.props.snapGap));var x=this.calculateNewSizeFromAspectRatio(w,b,{width:y.maxWidth,height:y.maxHeight},{width:r,height:s});if(w=x.newWidth,b=x.newHeight,this.props.grid){var z=Y(w,this.props.grid[0]),O=Y(b,this.props.grid[1]),S=this.props.snapGap||0;w=0===S||Math.abs(z-w)<=S?z:w,b=0===S||Math.abs(O-b)<=S?O:b}var N={width:w-c.width,height:b-c.height};if(p&&"string"==typeof p)if(p.endsWith("%"))w=w/m.width*100+"%";else if(p.endsWith("vw")){w=w/this.window.innerWidth*100+"vw"}else if(p.endsWith("vh")){w=w/this.window.innerHeight*100+"vh"}if(u&&"string"==typeof u)if(u.endsWith("%"))b=b/m.height*100+"%";else if(u.endsWith("vw")){b=b/this.window.innerWidth*100+"vw"}else if(u.endsWith("vh")){b=b/this.window.innerHeight*100+"vh"}var j={width:this.createSizeForCssProperty(w,"width"),height:this.createSizeForCssProperty(b,"height")};"row"===this.flexDir?j.flexBasis=j.width:"column"===this.flexDir&&(j.flexBasis=j.height),g((function(){t.setState(j)})),this.props.onResize&&this.props.onResize(e,h,this.resizable,N)}},t.prototype.onMouseUp=function(e){var t=this.state,i=t.isResizing,o=t.direction,n=t.original;if(i&&this.resizable){var r={width:this.size.width-n.width,height:this.size.height-n.height};this.props.onResizeStop&&this.props.onResizeStop(e,o,this.resizable,r),this.props.size&&this.setState(this.props.size),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:G(G({},this.state.backgroundStyle),{cursor:"auto"})})}},t.prototype.updateSize=function(e){this.setState({width:e.width,height:e.height})},t.prototype.renderResizer=function(){var e=this,t=this.props,i=t.enable,o=t.handleStyles,n=t.handleClasses,r=t.handleWrapperStyle,s=t.handleWrapperClass,a=t.handleComponent;if(!i)return null;var d=Object.keys(i).map((function(t){return!1!==i[t]?l.createElement(F,{key:t,direction:t,onResizeStart:e.onResizeStart,replaceStyles:o&&o[t],className:n&&n[t]},a&&a[t]?a[t]:null):null}));return l.createElement("div",{className:s,style:r},d)},t.prototype.render=function(){var e=this,t=Object.keys(this.props).reduce((function(t,i){return-1!==$.indexOf(i)||(t[i]=e.props[i]),t}),{}),i=G(G(G({position:"relative",userSelect:this.state.isResizing?"none":"auto"},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:"border-box",flexShrink:0});this.state.flexBasis&&(i.flexBasis=this.state.flexBasis);var o=this.props.as||"div";return l.createElement(o,G({ref:this.ref,style:i,className:this.props.className},t),this.state.isResizing&&l.createElement("div",{style:this.state.backgroundStyle}),this.props.children,this.renderResizer())},t.defaultProps={as:"div",onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},t}(l.PureComponent);function te(){return te=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e},te.apply(this,arguments)}var ie=function(e){return l.createElement("svg",te({fill:"currentColor","aria-hidden":"true",viewBox:"0 0 24 24","data-testid":"uploadImage"},e),k||(k=l.createElement("path",{d:"M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"})))},oe="_5ZnGUwAU",ne="wlwFaZpx",re="Obm15-qh",se="gJ5-oVLV",ae="_6jUel99o",de="HZgHUcV-",le="GF1PbH1g gU1gU-Wq",he="i7UwLauz",ce="cJSOiHYH";x('._5ZnGUwAU{position:fixed}.wlwFaZpx{background:#fff;box-shadow:0 0 0 1px hsla(0,0%,6%,.05),0 3px 6px hsla(0,0%,6%,.1),0 9px 24px hsla(0,0%,6%,.2);display:flex;flex-direction:column;height:100%;max-height:420px;max-width:calc(100vw - 24px);min-width:540px}.Obm15-qh{box-shadow:inset 0 -1px 0 rgba(55,53,47,.09);display:flex;height:40px;padding:0 8px;width:100%;z-index:1}.Obm15-qh,.gJ5-oVLV{font-size:14px;position:relative}.gJ5-oVLV{align-items:center;background-color:inherit;border:none;border-radius:4px;color:#37352f;cursor:pointer;display:inline-flex;flex-shrink:0;height:100%;line-height:1.2;min-width:0;padding:6px 8px;transition:height 20ms ease-in 0s;user-select:none;white-space:nowrap}._6jUel99o:after{background-color:#37352f;bottom:0;content:"";height:2px;left:0;position:absolute;width:100%}.HZgHUcV-{display:flex;justify-content:center;margin-left:12px;margin-right:12px;margin-top:4px;padding-bottom:6px;padding-top:6px}.gU1gU-Wq{border:1px solid rgba(55,53,47,.16);border-radius:4px;cursor:pointer;height:32px;padding-left:12px;padding-right:12px;transition:background 20ms ease-in 0s;user-select:none;white-space:nowrap;width:100%}.GF1PbH1g{border:none!important;cursor:pointer!important;height:auto!important;padding-left:0!important;padding-right:0!important}.i2lz5EKx{align-items:center;cursor:pointer;display:inline-flex;font-size:14px;font-weight:500;height:100%;justify-content:center;line-height:1.2;width:100%}._3cPFLttW{left:0;position:absolute;top:0;visibility:hidden}.i7UwLauz{background:hsla(45,13%,94%,.6);box-shadow:inset 0 0 0 1px hsla(0,0%,6%,.1);cursor:text;height:32px;line-height:20px;padding:3px 6px;position:relative}.cJSOiHYH,.i7UwLauz{align-items:center;border:none;border-radius:4px;display:flex;font-size:14px;width:100%}.cJSOiHYH{fill:#fff;background:#2383e2;box-shadow:inset 0 0 0 1px hsla(0,0%,6%,.1),0 1px 2px hsla(0,0%,6%,.1);color:#fff;cursor:pointer;flex-shrink:0;font-weight:500;height:28px;justify-content:center;line-height:1.2;margin:12px auto 6px;max-width:300px;padding-left:12px;padding-right:12px;transition:background 20ms ease-in 0s;user-select:none;white-space:nowrap}');const pe=({onEmbed:e})=>{const[t,i]=h("");return d("div",Object.assign({className:le},{children:[a("input",{type:"text",placeholder:"Paste embed link",value:t,className:he,onChange:e=>i(e.target.value)}),a("button",Object.assign({type:"button",className:ce,onClick:()=>e(t)},{children:"Embed"}))]}))},ue=({style:i,onEmbed:o,onClose:n})=>d(e.Overlay,Object.assign({onClose:n},{children:[a("div",Object.assign({className:oe,style:i},{children:d("div",Object.assign({className:ne},{children:[a("div",Object.assign({className:re},{children:a("button",Object.assign({type:"button",className:t(se,{[ae]:!0})},{children:"Embed link"}))})),a("div",Object.assign({className:de},{children:a(pe,{onEmbed:o})}))]}))})),a("div",{})]}));var ge=!1;if("undefined"!=typeof window){var me={get passive(){ge=!0}};window.addEventListener("testPassive",null,me),window.removeEventListener("testPassive",null,me)}var fe="undefined"!=typeof window&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||"MacIntel"===window.navigator.platform&&window.navigator.maxTouchPoints>1),ve=[],be=!1,we=-1,ye=void 0,xe=void 0,ze=void 0,Oe=function(e){return ve.some((function(t){return!(!t.options.allowTouchMove||!t.options.allowTouchMove(e))}))},Se=function(e){var t=e||window.event;return!!Oe(t.target)||(t.touches.length>1||(t.preventDefault&&t.preventDefault(),!1))},Ne=function(e,t){if(e){if(!ve.some((function(t){return t.targetElement===e}))){var i={targetElement:e,options:t||{}};ve=[].concat(function(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t<e.length;t++)i[t]=e[t];return i}return Array.from(e)}(ve),[i]),fe?window.requestAnimationFrame((function(){if(void 0===xe){xe={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left};var e=window,t=e.scrollY,i=e.scrollX,o=e.innerHeight;document.body.style.position="fixed",document.body.style.top=-t,document.body.style.left=-i,setTimeout((function(){return window.requestAnimationFrame((function(){var e=o-window.innerHeight;e&&t>=o&&(document.body.style.top=-(t+e))}))}),300)}})):function(e){if(void 0===ze){var t=!!e&&!0===e.reserveScrollBarGap,i=window.innerWidth-document.documentElement.clientWidth;if(t&&i>0){var o=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"),10);ze=document.body.style.paddingRight,document.body.style.paddingRight=o+i+"px"}}void 0===ye&&(ye=document.body.style.overflow,document.body.style.overflow="hidden")}(t),fe&&(e.ontouchstart=function(e){1===e.targetTouches.length&&(we=e.targetTouches[0].clientY)},e.ontouchmove=function(t){1===t.targetTouches.length&&function(e,t){var i=e.targetTouches[0].clientY-we;!Oe(e.target)&&(t&&0===t.scrollTop&&i>0||function(e){return!!e&&e.scrollHeight-e.scrollTop<=e.clientHeight}(t)&&i<0?Se(e):e.stopPropagation())}(t,e)},be||(document.addEventListener("touchmove",Se,ge?{passive:!1}:void 0),be=!0))}}else console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.")},je=function(e){e?(ve=ve.filter((function(t){return t.targetElement!==e})),fe&&(e.ontouchstart=null,e.ontouchmove=null,be&&0===ve.length&&(document.removeEventListener("touchmove",Se,ge?{passive:!1}:void 0),be=!1)),fe?function(){if(void 0!==xe){var e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);document.body.style.position=xe.position,document.body.style.top=xe.top,document.body.style.left=xe.left,window.scrollTo(t,e),xe=void 0}}():(void 0!==ze&&(document.body.style.paddingRight=ze,ze=void 0),void 0!==ye&&(document.body.style.overflow=ye,ye=void 0))):console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.")},Re="PoOhS4FU",We="PcGiiPpV",Ee="iQZH4Lf-";x(".PoOhS4FU{margin:20px 0 10px;user-select:none}.PcGiiPpV,.PoOhS4FU{position:relative;width:100%}.PcGiiPpV{align-items:center;background-color:#efefef;border:none;border-radius:3px;color:rgba(55,53,47,.65);cursor:pointer;display:flex;font-size:14px;overflow:hidden;padding:12px 36px 12px 12px;text-align:left;transition:background-color .1s ease-in}.PcGiiPpV:hover{background-color:#e3e3e3}.iQZH4Lf-{margin-right:8px;user-select:none}");const He=({element:e,attributes:t,maxSizes:i,children:o,editor:n})=>{const[l,c]=h(null),u=p(null),g=e=>{var t;if(e.stopPropagation(),null!==l)return je(document.body),void c(null);const i=null===(t=u.current)||void 0===t?void 0:t.getBoundingClientRect();if(i){const e=i.top+i.height+88+20>window.innerHeight,t=!e;console.log({showAtTop:e,showAtBottom:t}),Ne(document.body,{reserveScrollBarGap:!0}),c({left:i.left,top:e?i.top-88-5:i.top+i.height+5})}};return d("div",Object.assign({className:Re},t,{contentEditable:!1},{children:[d("div",Object.assign({ref:u},{children:[d("button",Object.assign({className:We,onClick:g},{children:[a(ie,{className:Ee,width:24,height:24}),a("span",{children:"Click to add embed"})]})),null!==l&&a(ue,{onEmbed:t=>w(void 0,void 0,void 0,(function*(){if(0===t.length)return;const i=(o=t).includes("youtube.com")||o.includes("youtu.be")?"youtube":o.includes("vimeo.com")?"vimeo":o.includes("dailymotion.com")||o.includes("dai.ly")?"dailymotion":o.includes("twitter")?"twitter":o.includes("figma")?"figma":null;var o;let a=null;"youtube"===i?a=(e=>{const t=e.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/);return t&&11===t[2].length?t[2]:null})(t):"vimeo"===i?a=(e=>new URL(e).pathname.split("/")[1])(t):"dailymotion"===i?a=(e=>{var t=e.match(/^.+dailymotion.com\/(video|hub)\/([^_]+)[^#]*(#video=([^_&]+))?/);return null!==t?void 0!==t[4]?t[4]:t[2]:null})(t):"twitter"===i?a=function(e){const t=e.match(/\/status\/(\d+)/);return t?t[1]:null}(t):"figma"===i&&(a=function(e){const t=new URL(e).searchParams,i=t.get("node-id");return t.get("node-id")?i:"unknown"}(t)),console.log({provider:i,providerId:a});try{je(document.body),c(null);const o={data:Object.assign(Object.assign({},e.data),{url:t,size:{width:e.data.size.width,height:e.data.size.height},provider:i,providerId:a})};r.setNodes(n,o,{at:m.findPath(n,e),match:e=>s.isElement(e)&&"embed"===e.type})}catch(e){je(document.body),c(null)}})),onClose:g,style:l})]})),o]}))};var Pe={root:"s8SlWwrL",resizer:"OLRmQVp3",dotsOptions:"_5qhGnBQW",loadingState:"_0z3X-ysz",extraMargin:"_9GorNz7R",resizeLib:"_6GzVi0JR",leftResizer:"HLz36qUX OLRmQVp3",rightResizer:"Tv1Fs118 OLRmQVp3",resizeItem:"_33V0MBSa",selectImg:"VdsHNo29",selected:"WARAR91D",loader:"_8VNstZwX",dot:"_92ciCRYx"};x(".s8SlWwrL{cursor:pointer;display:block;position:relative}.s8SlWwrL:hover .OLRmQVp3,.s8SlWwrL:hover ._5qhGnBQW{opacity:1}._0z3X-ysz{pointer-events:none}._9GorNz7R{margin:20px 0 30px}._6GzVi0JR{margin:0 auto}.OLRmQVp3{align-items:center;cursor:col-resize;display:flex;height:100%;justify-content:center;opacity:0;pointer-events:none;position:absolute;transition:opacity .15s ease-in 0s;width:15px;z-index:1}.HLz36qUX{left:0;top:0}.Tv1Fs118{right:0;top:0}._33V0MBSa{background:hsla(0,0%,6%,.6);border:1px solid hsla(0,0%,100%,.9);border-radius:20px;box-shadow:0 0 0 .5px #fff;height:48px;max-height:50%;opacity:1;transition:opacity .3s ease-in 0s;width:6px}.VdsHNo29{opacity:0}.WARAR91D{background:rgba(35,131,226,.14);border-radius:3px;inset:0;opacity:1;pointer-events:none;position:absolute;transition:opacity .15s ease-in 0s;z-index:81}._8VNstZwX{left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}._5qhGnBQW{align-items:center;background-color:#eee;border:none;border-radius:2px;cursor:pointer;display:flex;height:22px;justify-content:space-between;opacity:0;padding:0 4px;position:absolute;right:10px;top:10px;transition:opacity .15s ease-in 0s;width:22px;z-index:1}._92ciCRYx{background-color:gray;border-radius:50%;min-height:3px;min-width:3px}");const Ce=265;function Le(i){var o,n,l,p,g;const{element:b,editor:w,plugin:y}=i,x=f(),z=v(),[O,S]=h(null),[N,j]=h({width:(null===(n=null===(o=b.data)||void 0===o?void 0:o.size)||void 0===n?void 0:n.width)||750,height:(null===(p=null===(l=b.data)||void 0===l?void 0:l.size)||void 0===p?void 0:p.height)||440}),R=e=>j(Object.assign(Object.assign({},N),e));c((()=>{var e,t,i,o;b.data&&R({width:(null===(t=null===(e=b.data)||void 0===e?void 0:e.size)||void 0===t?void 0:t.width)||750,height:(null===(o=null===(i=b.data)||void 0===i?void 0:i.size)||void 0===o?void 0:o.height)||440})}),[null===(g=b.data)||void 0===g?void 0:g.size]);const W=u((()=>{var e,t;return{minWidth:300,size:{width:N.width,height:N.height},maxWidth:(null===(e=y.options)||void 0===e?void 0:e.maxWidth)||800,maxHeight:(null===(t=y.options)||void 0===t?void 0:t.maxHeight)||720,lockAspectRatio:!0,resizeRatio:2,enable:{left:!z,right:!z},handleStyles:{left:{left:0},right:{right:0}},onResize:(e,t,i)=>{R({width:i.offsetWidth,height:i.offsetHeight})},onResizeStop:(e,t,i)=>{console.log("image editor editor.children",w.children),console.log("ReactEditor.findPath(editor, element)",m.findPath(w,b)),console.log("element",b),r.setNodes(w,{data:Object.assign(Object.assign({},b.data),{size:{width:i.offsetWidth,height:i.offsetHeight}})},{at:m.findPath(w,b),match:e=>s.isElement(e)&&"embed"===e.type})},handleComponent:{left:a("div",Object.assign({contentEditable:!1,className:Pe.leftResizer},{children:a("div",{className:Pe.resizeItem})})),right:a("div",Object.assign({contentEditable:!1,className:Pe.rightResizer},{children:a("div",{className:Pe.resizeItem})}))}}}),[N.width,N.height,w]),E=()=>{je(document.body),S(null)},H=e=>{var t;if(null==e||e.stopPropagation(),null!==O)return E();const i=null===(t=null==e?void 0:e.currentTarget)||void 0===t?void 0:t.getBoundingClientRect();if(i){const e=i.top+i.height+164+20>window.innerHeight;Ne(document.body,{reserveScrollBarGap:!0}),S({left:i.right-i.width+Ce>window.innerWidth?window.innerWidth-Ce-i.width:i.right-i.width,top:e?i.top-82-i.height:i.top+i.height+5})}};if(!b.data.url&&!b.data["data-src"]){const{maxWidth:o=750,maxHeight:n=800}=y.options||{};return d("div",Object.assign({className:Pe.root,contentEditable:!1,draggable:!1},{children:[a("div",{className:t(Pe.selectImg,{[Pe.selected]:x})}),a(He,Object.assign({attributes:i.attributes,element:b,editor:w,maxSizes:{maxWidth:o,maxHeight:n}},{children:!z&&d("div",{children:[d("button",Object.assign({type:"button",className:Pe.dotsOptions,onClick:H},{children:[a("span",{className:Pe.dot}),a("span",{className:Pe.dot}),a("span",{className:Pe.dot})]})),null!==O&&a(e.ElementOptions,{onClose:E,style:O,element:b,onCopy:E,onDelete:E,onDuplicate:E},b.id)]})})),i.children]}),b.id)}return a("div",Object.assign({contentEditable:!1,draggable:!1,className:Pe.root},{children:d(ee,Object.assign({},W,{className:Pe.resizeLib},{children:[y.renderer.render(Object.assign(Object.assign({},i),{size:N})),a("div",{className:t(Pe.selectImg,{[Pe.selected]:x})}),!z&&d("div",{children:[d("button",Object.assign({type:"button",className:Pe.dotsOptions,onClick:H},{children:[a("span",{className:Pe.dot}),a("span",{className:Pe.dot}),a("span",{className:Pe.dot})]})),null!==O&&a(e.ElementOptions,{onClose:E,style:O,element:b,onCopy:E,onDelete:E,onDuplicate:E},b.id)]})]}))}),b.id)}const ke=i({type:"embed",shortcut:"embed",renderer:{editor:(e,t)=>i=>a(Le,Object.assign({editor:e,plugin:t},i)),render:({attributes:e,element:t,children:i,HTMLAttributes:o})=>{if("string"==typeof t.data.provider&&t.data.providerId&&C[t.data.provider]){const n=C[t.data.provider];return d("div",Object.assign({},e,{className:P,contentEditable:!1,draggable:!1},o,{children:[a(n,Object.assign({},t.data,{providerId:t.data.providerId})),i]}))}return t.data.url?d("div",Object.assign({},e,{className:P,contentEditable:!1,draggable:!1},o,{children:[a(N,Object.assign({},t.data,{providerId:t.data.providerId})),i]})):a("div",{})}},extendEditor(e){const{isVoid:t}=e;return e.isVoid=e=>e.type===ke.getPlugin.type||t(e),e},events:{onKeyDown:(e,{defaultNode:t,hotkeys:i})=>n=>{var s;if("embed"===o(e,null===(s=e.selection)||void 0===s?void 0:s.anchor.path,"highest").type&&e.selection)return i.isEnter(n)?(n.preventDefault(),void r.insertNodes(e,t,{mode:"highest"})):void 0}},defineElement:()=>({id:n(),type:"embed",nodeType:"void",data:{url:null,size:{width:"auto",height:"auto"},providerId:null},children:[{text:""}]}),createElement:function(e){var t;const i=ke.getPlugin.defineElement();r.setNodes(e,i,{at:null===(t=e.selection)||void 0===t?void 0:t.anchor})},exports:{markdown:{serialize:(e,t)=>`[embed-url](${e.data.url})\n`},html:{serialize:(e,t)=>{var i,o;return`<iframe src="https://player.vimeo.com/video/807053663?badge=0&byline=0&portrait=0&title=0" frameborder="0" height="${null===(i=e.data.size)||void 0===i?void 0:i.height}" width="${null===(o=e.data.size)||void 0===o?void 0:o.width}" allowfullscreen="" url="https://vimeo.com/807053663" provider="${e.data.provider||""}" />`},deserialize:{nodeName:"IFRAME",parse:e=>({url:e.getAttribute("src"),size:{height:"string"==typeof e.getAttribute("height")?Number(e.getAttribute("height")):"auto",width:"string"==typeof e.getAttribute("width")?Number(e.getAttribute("width")):"auto"}})}}}});export{ke as default};
|
|
1
|
+
import{getElementClassname as e,UI_HELPERS as t,cx as i,createYooptaPlugin as o,getElementByPath as n,generateId as r}from"@yoopta/editor";import{Transforms as s,Element as a}from"slate";import{jsx as d,jsxs as l}from"react/jsx-runtime";import*as h from"react";import{useState as c,useEffect as p,useRef as u,useMemo as g}from"react";import{flushSync as m}from"react-dom";import{ReactEditor as f,useSelected as v,useReadOnly as b}from"slate-react";function w(e,t){var i={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(i[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(i[o[n]]=e[o[n]])}return i}function y(e,t,i,o){return new(i||(i=Promise))((function(n,r){function s(e){try{d(o.next(e))}catch(e){r(e)}}function a(e){try{d(o.throw(e))}catch(e){r(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}d((o=o.apply(e,t||[])).next())}))}function x(e,{threshold:t=0,root:i=null,rootMargin:o="0%",freezeOnceVisible:n=!1}={}){const[r,s]=c({}),a=r.isIntersecting&&n,d=([e])=>s(e);return p((()=>{const n=null==e?void 0:e.current;if(!window.IntersectionObserver||a||!n)return;const r=new IntersectionObserver(d,{threshold:t,root:i,rootMargin:o});return r.observe(n),()=>r.disconnect()}),[e,t,i,o,a]),r}function z(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===i&&o.firstChild?o.insertBefore(n,o.firstChild):o.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}var O={root:"ypSFFbjd",iframe:"DQszzmj7",container:"yc58m72J",iframePreview:"DYsS-Bbu",embed:"a1CpYHeG"};z(".ypSFFbjd{display:flex;height:0;justify-content:center;min-height:100px;padding-bottom:56.25%;position:relative;width:100%}.DQszzmj7{background-color:#fff}.DQszzmj7,.yc58m72J{border-radius:1px;height:100%;pointer-events:auto;width:100%}.DQszzmj7,.DYsS-Bbu,.yc58m72J{left:0;position:absolute;top:0}.DYsS-Bbu{filter:blur(10px);object-fit:cover;transition:opacity .15s ease-in,filter .15s ease-in}.a1CpYHeG{height:100%;position:relative;width:100%}");const S=e=>`https://api.dailymotion.com/video/${e}?fields=thumbnail_url`;var N={root:"C8Z8IWw5",iframe:"aGHn-pry",container:"-qZtVrzy",iframePreview:"kmC7RiaF",embed:"srCuArtd"};function j(e){var{providerId:t,url:i}=e;w(e,["providerId","url"]);const o=u(null),{isIntersecting:n}=x(o,{freezeOnceVisible:!0,rootMargin:"50%"});return d("div",Object.assign({className:N.root,ref:o},{children:d("div",Object.assign({className:N.container},{children:d("div",Object.assign({className:N.embed},{children:n&&d("iframe",{src:i,frameBorder:0,allowFullScreen:!0,className:N.iframe,height:"450px"})}))}))}))}z(".C8Z8IWw5{display:flex;height:0;justify-content:center;min-height:100px;padding-bottom:56.25%;position:relative;width:100%}.aGHn-pry{background-color:#fff}.-qZtVrzy,.aGHn-pry{border-radius:1px;height:100%;pointer-events:auto;width:100%}.-qZtVrzy,.aGHn-pry,.kmC7RiaF{left:0;position:absolute;top:0}.kmC7RiaF{filter:blur(10px);object-fit:cover;transition:opacity .15s ease-in,filter .15s ease-in}.srCuArtd{height:100%;position:relative;width:100%}");var R={root:"w4l4tKlB",iframe:"cbJcegGv",container:"g8V-uGLl",iframePreview:"hZuYZ7vp",embed:"j6pRoOC1"};z(".w4l4tKlB{display:flex;height:0;justify-content:center;min-height:100px;padding-bottom:56.25%;position:relative;width:100%}.cbJcegGv{background-color:#fff}.cbJcegGv,.g8V-uGLl{border-radius:1px;height:100%;pointer-events:auto;width:100%}.cbJcegGv,.g8V-uGLl,.hZuYZ7vp{left:0;position:absolute;top:0}.hZuYZ7vp{filter:blur(10px);object-fit:cover;transition:opacity .15s ease-in,filter .15s ease-in}.j6pRoOC1{height:100%;position:relative;width:100%}");var W={root:"e3lQDjTT",iframe:"O5Z0OWN-",container:"zxjqcq4y",iframePreview:"_5kC3Lf5J",embed:"ymOgdXs4"};z(".e3lQDjTT{display:flex;height:100%;justify-content:center;min-height:100px;padding-bottom:86%;position:relative;width:100%}.O5Z0OWN-{background-color:#fff}.O5Z0OWN-,.zxjqcq4y{border-radius:1px;height:100%;left:0;pointer-events:auto;position:absolute;top:0;width:100%}._5kC3Lf5J{filter:blur(10px);left:0;object-fit:cover;position:absolute;top:0;transition:opacity .15s ease-in,filter .15s ease-in}.ymOgdXs4{position:relative;width:100%}.ymOgdXs4,.ymOgdXs4>div,.ymOgdXs4>div>div{height:100%}.ymOgdXs4 iframe{height:100%!important;width:100%!important}");var E={root:"sD5QN14F",iframe:"mRrF4hwM",container:"LyyH1fsE",iframePreview:"U9EPxemn",embed:"_4AQiBYad"};z(".sD5QN14F{display:flex;height:0;justify-content:center;min-height:100px;padding-bottom:56.25%;position:relative;width:100%}.mRrF4hwM{background-color:#fff}.LyyH1fsE,.mRrF4hwM{border-radius:1px;height:100%;pointer-events:auto;width:100%}.LyyH1fsE,.U9EPxemn,.mRrF4hwM{left:0;position:absolute;top:0}.U9EPxemn{filter:blur(10px);object-fit:cover;transition:opacity .15s ease-in,filter .15s ease-in}._4AQiBYad{height:100%;position:relative;width:100%}");const H="https://vimeo.com/api/v2/video";var P={root:"zoqyIXwI",iframe:"WgoSECbO",container:"m07CnIxO",iframePreview:"NSr-cxfm",embed:"Cv1rIJbN"};z(".zoqyIXwI{display:flex;height:0;justify-content:center;min-height:100px;padding-bottom:56.25%;position:relative;width:100%}.WgoSECbO{background-color:#fff}.WgoSECbO,.m07CnIxO{border-radius:1px;height:100%;pointer-events:auto;width:100%}.NSr-cxfm,.WgoSECbO,.m07CnIxO{left:0;position:absolute;top:0}.NSr-cxfm{filter:blur(10px);object-fit:cover;transition:opacity .15s ease-in,filter .15s ease-in}.Cv1rIJbN{height:100%;position:relative;width:100%}");var L="HUtGPcJq";z(".HUtGPcJq{margin:20px 0 10px;position:relative}");const C={vimeo:function(e){var{providerId:t}=e,i=w(e,["providerId"]);const o=u(null),[n,r]=c(null),[s,a]=c(!1),{isIntersecting:h}=x(o,{freezeOnceVisible:!0,rootMargin:"50%"});return p((()=>{fetch(`${H}/${t}.json`).then((e=>e.json())).then((e=>r(e[0].thumbnail_medium))).catch((()=>r(null)))}),[t]),d("div",Object.assign({className:E.root,ref:o},{children:d("div",Object.assign({className:E.container},{children:l("div",Object.assign({className:E.embed},{children:[d("img",{src:n||"",alt:"vimeo_video_preview",width:"100%",height:"100%",className:E.iframePreview,style:{opacity:h&&s?0:1,zIndex:h&&s?-1:0}}),h&&d("iframe",Object.assign({title:"Vimeo Player",src:`https://player.vimeo.com/video/${t}?badge=0&byline=0&portrait=0&title=0`,frameBorder:0,allowFullScreen:!0,onLoad:()=>a(!0),className:E.iframe},i))]}))}))}))},youtube:function(e){var{providerId:t}=e,i=w(e,["providerId"]);const o=u(null),[n,r]=c(!1),{isIntersecting:s}=x(o,{freezeOnceVisible:!0,rootMargin:"50%"});return d("div",Object.assign({className:P.root,ref:o},{children:d("div",Object.assign({className:P.container},{children:l("div",Object.assign({className:P.embed},{children:[d("img",{src:`https://i.ytimg.com/vi/${t}/default.jpg`,alt:"youtube_video_preview",width:"100%",height:"100%",className:P.iframePreview,style:{opacity:s&&n?0:1,zIndex:s&&n?-1:0}}),s&&d("iframe",Object.assign({title:"Youtube Player",src:`https://www.youtube.com/embed/${t}?hl=no&rel=0`,frameBorder:0,onLoad:()=>r(!0),allowFullScreen:!0,className:P.iframe},i))]}))}))}))},dailymotion:function(e){var{providerId:t}=e,i=w(e,["providerId"]);const o=u(null),[n,r]=c(null),[s,a]=c(!1),{isIntersecting:h}=x(o,{freezeOnceVisible:!0,rootMargin:"50%"});return p((()=>{fetch(S(t)).then((e=>e.json())).then((e=>r(e.thumbnail_url))).catch((()=>r(null)))}),[t]),d("div",Object.assign({className:O.root,ref:o},{children:d("div",Object.assign({className:O.container},{children:l("div",Object.assign({className:O.embed},{children:[d("img",{src:n||"",alt:"daylimotion_video_preview",width:"100%",height:"100%",className:O.iframePreview,style:{opacity:h&&s?0:1,zIndex:h&&s?-1:0}}),h&&d("iframe",Object.assign({title:"Dailymotion Video Player",frameBorder:0,onLoad:()=>a(!0),src:`https://www.dailymotion.com/embed/video/${t}`,allowFullScreen:!0,className:O.iframe},i))]}))}))}))},twitter:function(e){var{providerId:t}=e;w(e,["providerId"]);const i=u(null),{isIntersecting:o}=x(i,{freezeOnceVisible:!0,rootMargin:"50%"});return p((()=>{var e;if(!o)return;const n=document.createElement("script");n.src="https://platform.twitter.com/widgets.js",null===(e=i.current)||void 0===e||e.appendChild(n),n.onload=()=>{window.twttr&&window.twttr.widgets.createTweet(t,document.getElementById(t),{align:"center",conversation:"none",dnt:!0,theme:"dark",height:300})}}),[t,o]),d("div",Object.assign({className:W.root,ref:i},{children:d("div",Object.assign({className:W.container},{children:d("div",Object.assign({className:W.embed},{children:d("div",{id:t})}))}))}))},figma:function(e){var{providerId:t,url:i}=e;w(e,["providerId","url"]);const o=u(null),{isIntersecting:n}=x(o,{freezeOnceVisible:!0,rootMargin:"50%"});return d("div",Object.assign({className:R.root,ref:o},{children:d("div",Object.assign({className:R.container},{children:d("div",Object.assign({className:R.embed},{children:n&&d("iframe",{src:`https://www.figma.com/embed?embed_host=share&url=${encodeURIComponent(i)}`,frameBorder:0,allowFullScreen:!0,className:R.iframe,height:"450px"})}))}))}))}};var k,M,B=(k=function(e,t){return k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},k(e,t)},function(e,t){function i(){this.constructor=e}k(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),I=function(){return I=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},I.apply(this,arguments)},_={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},A={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},V={width:"20px",height:"20px",position:"absolute"},T={top:I(I({},_),{top:"-5px"}),right:I(I({},A),{left:void 0,right:"-5px"}),bottom:I(I({},_),{top:void 0,bottom:"-5px"}),left:I(I({},A),{left:"-5px"}),topRight:I(I({},V),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:I(I({},V),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:I(I({},V),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:I(I({},V),{left:"-10px",top:"-10px",cursor:"nw-resize"})},F=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.onMouseDown=function(e){t.props.onResizeStart(e,t.props.direction)},t.onTouchStart=function(e){t.props.onResizeStart(e,t.props.direction)},t}return B(t,e),t.prototype.render=function(){return h.createElement("div",{className:this.props.className||"",style:I(I({position:"absolute",userSelect:"none"},T[this.props.direction]),this.props.replaceStyles||{}),onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart},this.props.children)},t}(h.PureComponent),G=function(){var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},e(t,i)};return function(t,i){function o(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(o.prototype=i.prototype,new o)}}(),U=function(){return U=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},U.apply(this,arguments)},D={width:"auto",height:"auto"},Y=function(e,t,i){return Math.max(Math.min(e,i),t)},Z=function(e,t){return Math.round(e/t)*t},q=function(e,t){return new RegExp(e,"i").test(t)},J=function(e){return Boolean(e.touches&&e.touches.length)},X=function(e,t,i){void 0===i&&(i=0);var o=t.reduce((function(i,o,n){return Math.abs(o-e)<Math.abs(t[i]-e)?n:i}),0),n=Math.abs(t[o]-e);return 0===i||n<i?t[o]:e},Q=function(e){return"auto"===(e=e.toString())||e.endsWith("px")||e.endsWith("%")||e.endsWith("vh")||e.endsWith("vw")||e.endsWith("vmax")||e.endsWith("vmin")?e:e+"px"},$=function(e,t,i,o){if(e&&"string"==typeof e){if(e.endsWith("px"))return Number(e.replace("px",""));if(e.endsWith("%"))return t*(Number(e.replace("%",""))/100);if(e.endsWith("vw"))return i*(Number(e.replace("vw",""))/100);if(e.endsWith("vh"))return o*(Number(e.replace("vh",""))/100)}return e},K=["as","style","className","grid","snap","bounds","boundsByDirection","size","defaultSize","minWidth","minHeight","maxWidth","maxHeight","lockAspectRatio","lockAspectRatioExtraWidth","lockAspectRatioExtraHeight","enable","handleStyles","handleClasses","handleWrapperStyle","handleWrapperClass","children","onResizeStart","onResize","onResizeStop","handleComponent","scale","resizeRatio","snapGap"],ee="__resizable_base__",te=function(e){function t(t){var i=e.call(this,t)||this;return i.ratio=1,i.resizable=null,i.parentLeft=0,i.parentTop=0,i.resizableLeft=0,i.resizableRight=0,i.resizableTop=0,i.resizableBottom=0,i.targetLeft=0,i.targetTop=0,i.appendBase=function(){if(!i.resizable||!i.window)return null;var e=i.parentNode;if(!e)return null;var t=i.window.document.createElement("div");return t.style.width="100%",t.style.height="100%",t.style.position="absolute",t.style.transform="scale(0, 0)",t.style.left="0",t.style.flex="0 0 100%",t.classList?t.classList.add(ee):t.className+=ee,e.appendChild(t),t},i.removeBase=function(e){var t=i.parentNode;t&&t.removeChild(e)},i.ref=function(e){e&&(i.resizable=e)},i.state={isResizing:!1,width:void 0===(i.propsSize&&i.propsSize.width)?"auto":i.propsSize&&i.propsSize.width,height:void 0===(i.propsSize&&i.propsSize.height)?"auto":i.propsSize&&i.propsSize.height,direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"},flexBasis:void 0},i.onResizeStart=i.onResizeStart.bind(i),i.onMouseMove=i.onMouseMove.bind(i),i.onMouseUp=i.onMouseUp.bind(i),i}return G(t,e),Object.defineProperty(t.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"window",{get:function(){return this.resizable&&this.resizable.ownerDocument?this.resizable.ownerDocument.defaultView:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||D},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var e=0,t=0;if(this.resizable&&this.window){var i=this.resizable.offsetWidth,o=this.resizable.offsetHeight,n=this.resizable.style.position;"relative"!==n&&(this.resizable.style.position="relative"),e="auto"!==this.resizable.style.width?this.resizable.offsetWidth:i,t="auto"!==this.resizable.style.height?this.resizable.offsetHeight:o,this.resizable.style.position=n}return{width:e,height:t}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var e=this,t=this.props.size,i=function(t){if(void 0===e.state[t]||"auto"===e.state[t])return"auto";if(e.propsSize&&e.propsSize[t]&&e.propsSize[t].toString().endsWith("%")){if(e.state[t].toString().endsWith("%"))return e.state[t].toString();var i=e.getParentSize();return Number(e.state[t].toString().replace("px",""))/i[t]*100+"%"}return Q(e.state[t])};return{width:t&&void 0!==t.width&&!this.state.isResizing?Q(t.width):i("width"),height:t&&void 0!==t.height&&!this.state.isResizing?Q(t.height):i("height")}},enumerable:!1,configurable:!0}),t.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var e=this.appendBase();if(!e)return{width:0,height:0};var t=!1,i=this.parentNode.style.flexWrap;"wrap"!==i&&(t=!0,this.parentNode.style.flexWrap="wrap"),e.style.position="relative",e.style.minWidth="100%",e.style.minHeight="100%";var o={width:e.offsetWidth,height:e.offsetHeight};return t&&(this.parentNode.style.flexWrap=i),this.removeBase(e),o},t.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},t.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},t.prototype.componentDidMount=function(){if(this.resizable&&this.window){var e=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:"auto"!==e.flexBasis?e.flexBasis:void 0})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(e,t){var i=this.propsSize&&this.propsSize[t];return"auto"!==this.state[t]||this.state.original[t]!==e||void 0!==i&&"auto"!==i?e:"auto"},t.prototype.calculateNewMaxFromBoundary=function(e,t){var i,o,n=this.props.boundsByDirection,r=this.state.direction,s=n&&q("left",r),a=n&&q("top",r);if("parent"===this.props.bounds){var d=this.parentNode;d&&(i=s?this.resizableRight-this.parentLeft:d.offsetWidth+(this.parentLeft-this.resizableLeft),o=a?this.resizableBottom-this.parentTop:d.offsetHeight+(this.parentTop-this.resizableTop))}else"window"===this.props.bounds?this.window&&(i=s?this.resizableRight:this.window.innerWidth-this.resizableLeft,o=a?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(i=s?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),o=a?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return i&&Number.isFinite(i)&&(e=e&&e<i?e:i),o&&Number.isFinite(o)&&(t=t&&t<o?t:o),{maxWidth:e,maxHeight:t}},t.prototype.calculateNewSizeFromDirection=function(e,t){var i=this.props.scale||1,o=this.props.resizeRatio||1,n=this.state,r=n.direction,s=n.original,a=this.props,d=a.lockAspectRatio,l=a.lockAspectRatioExtraHeight,h=a.lockAspectRatioExtraWidth,c=s.width,p=s.height,u=l||0,g=h||0;return q("right",r)&&(c=s.width+(e-s.x)*o/i,d&&(p=(c-g)/this.ratio+u)),q("left",r)&&(c=s.width-(e-s.x)*o/i,d&&(p=(c-g)/this.ratio+u)),q("bottom",r)&&(p=s.height+(t-s.y)*o/i,d&&(c=(p-u)*this.ratio+g)),q("top",r)&&(p=s.height-(t-s.y)*o/i,d&&(c=(p-u)*this.ratio+g)),{newWidth:c,newHeight:p}},t.prototype.calculateNewSizeFromAspectRatio=function(e,t,i,o){var n=this.props,r=n.lockAspectRatio,s=n.lockAspectRatioExtraHeight,a=n.lockAspectRatioExtraWidth,d=void 0===o.width?10:o.width,l=void 0===i.width||i.width<0?e:i.width,h=void 0===o.height?10:o.height,c=void 0===i.height||i.height<0?t:i.height,p=s||0,u=a||0;if(r){var g=(h-p)*this.ratio+u,m=(c-p)*this.ratio+u,f=(d-u)/this.ratio+p,v=(l-u)/this.ratio+p,b=Math.max(d,g),w=Math.min(l,m),y=Math.max(h,f),x=Math.min(c,v);e=Y(e,b,w),t=Y(t,y,x)}else e=Y(e,d,l),t=Y(t,h,c);return{newWidth:e,newHeight:t}},t.prototype.setBoundingClientRect=function(){if("parent"===this.props.bounds){var e=this.parentNode;if(e){var t=e.getBoundingClientRect();this.parentLeft=t.left,this.parentTop=t.top}}if(this.props.bounds&&"string"!=typeof this.props.bounds){var i=this.props.bounds.getBoundingClientRect();this.targetLeft=i.left,this.targetTop=i.top}if(this.resizable){var o=this.resizable.getBoundingClientRect(),n=o.left,r=o.top,s=o.right,a=o.bottom;this.resizableLeft=n,this.resizableRight=s,this.resizableTop=r,this.resizableBottom=a}},t.prototype.onResizeStart=function(e,t){if(this.resizable&&this.window){var i,o=0,n=0;if(e.nativeEvent&&function(e){return Boolean((e.clientX||0===e.clientX)&&(e.clientY||0===e.clientY))}(e.nativeEvent)?(o=e.nativeEvent.clientX,n=e.nativeEvent.clientY):e.nativeEvent&&J(e.nativeEvent)&&(o=e.nativeEvent.touches[0].clientX,n=e.nativeEvent.touches[0].clientY),this.props.onResizeStart)if(this.resizable)if(!1===this.props.onResizeStart(e,t,this.resizable))return;this.props.size&&(void 0!==this.props.size.height&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),void 0!==this.props.size.width&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio="number"==typeof this.props.lockAspectRatio?this.props.lockAspectRatio:this.size.width/this.size.height;var r=this.window.getComputedStyle(this.resizable);if("auto"!==r.flexBasis){var s=this.parentNode;if(s){var a=this.window.getComputedStyle(s).flexDirection;this.flexDir=a.startsWith("row")?"row":"column",i=r.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var d={original:{x:o,y:n,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:U(U({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(e.target).cursor||"auto"}),direction:t,flexBasis:i};this.setState(d)}},t.prototype.onMouseMove=function(e){var t=this;if(this.state.isResizing&&this.resizable&&this.window){if(this.window.TouchEvent&&J(e))try{e.preventDefault(),e.stopPropagation()}catch(e){}var i=this.props,o=i.maxWidth,n=i.maxHeight,r=i.minWidth,s=i.minHeight,a=J(e)?e.touches[0].clientX:e.clientX,d=J(e)?e.touches[0].clientY:e.clientY,l=this.state,h=l.direction,c=l.original,p=l.width,u=l.height,g=this.getParentSize(),f=function(e,t,i,o,n,r,s){return o=$(o,e.width,t,i),n=$(n,e.height,t,i),r=$(r,e.width,t,i),s=$(s,e.height,t,i),{maxWidth:void 0===o?void 0:Number(o),maxHeight:void 0===n?void 0:Number(n),minWidth:void 0===r?void 0:Number(r),minHeight:void 0===s?void 0:Number(s)}}(g,this.window.innerWidth,this.window.innerHeight,o,n,r,s);o=f.maxWidth,n=f.maxHeight,r=f.minWidth,s=f.minHeight;var v=this.calculateNewSizeFromDirection(a,d),b=v.newHeight,w=v.newWidth,y=this.calculateNewMaxFromBoundary(o,n);this.props.snap&&this.props.snap.x&&(w=X(w,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(b=X(b,this.props.snap.y,this.props.snapGap));var x=this.calculateNewSizeFromAspectRatio(w,b,{width:y.maxWidth,height:y.maxHeight},{width:r,height:s});if(w=x.newWidth,b=x.newHeight,this.props.grid){var z=Z(w,this.props.grid[0]),O=Z(b,this.props.grid[1]),S=this.props.snapGap||0;w=0===S||Math.abs(z-w)<=S?z:w,b=0===S||Math.abs(O-b)<=S?O:b}var N={width:w-c.width,height:b-c.height};if(p&&"string"==typeof p)if(p.endsWith("%"))w=w/g.width*100+"%";else if(p.endsWith("vw")){w=w/this.window.innerWidth*100+"vw"}else if(p.endsWith("vh")){w=w/this.window.innerHeight*100+"vh"}if(u&&"string"==typeof u)if(u.endsWith("%"))b=b/g.height*100+"%";else if(u.endsWith("vw")){b=b/this.window.innerWidth*100+"vw"}else if(u.endsWith("vh")){b=b/this.window.innerHeight*100+"vh"}var j={width:this.createSizeForCssProperty(w,"width"),height:this.createSizeForCssProperty(b,"height")};"row"===this.flexDir?j.flexBasis=j.width:"column"===this.flexDir&&(j.flexBasis=j.height),m((function(){t.setState(j)})),this.props.onResize&&this.props.onResize(e,h,this.resizable,N)}},t.prototype.onMouseUp=function(e){var t=this.state,i=t.isResizing,o=t.direction,n=t.original;if(i&&this.resizable){var r={width:this.size.width-n.width,height:this.size.height-n.height};this.props.onResizeStop&&this.props.onResizeStop(e,o,this.resizable,r),this.props.size&&this.setState(this.props.size),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:U(U({},this.state.backgroundStyle),{cursor:"auto"})})}},t.prototype.updateSize=function(e){this.setState({width:e.width,height:e.height})},t.prototype.renderResizer=function(){var e=this,t=this.props,i=t.enable,o=t.handleStyles,n=t.handleClasses,r=t.handleWrapperStyle,s=t.handleWrapperClass,a=t.handleComponent;if(!i)return null;var d=Object.keys(i).map((function(t){return!1!==i[t]?h.createElement(F,{key:t,direction:t,onResizeStart:e.onResizeStart,replaceStyles:o&&o[t],className:n&&n[t]},a&&a[t]?a[t]:null):null}));return h.createElement("div",{className:s,style:r},d)},t.prototype.render=function(){var e=this,t=Object.keys(this.props).reduce((function(t,i){return-1!==K.indexOf(i)||(t[i]=e.props[i]),t}),{}),i=U(U(U({position:"relative",userSelect:this.state.isResizing?"none":"auto"},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:"border-box",flexShrink:0});this.state.flexBasis&&(i.flexBasis=this.state.flexBasis);var o=this.props.as||"div";return h.createElement(o,U({ref:this.ref,style:i,className:this.props.className},t),this.state.isResizing&&h.createElement("div",{style:this.state.backgroundStyle}),this.props.children,this.renderResizer())},t.defaultProps={as:"div",onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},t}(h.PureComponent);function ie(){return ie=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e},ie.apply(this,arguments)}var oe=function(e){return h.createElement("svg",ie({fill:"currentColor","aria-hidden":"true",viewBox:"0 0 24 24","data-testid":"uploadImage"},e),M||(M=h.createElement("path",{d:"M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"})))},ne="_5ZnGUwAU",re="wlwFaZpx",se="Obm15-qh",ae="gJ5-oVLV",de="_6jUel99o",le="HZgHUcV-",he="GF1PbH1g gU1gU-Wq",ce="i7UwLauz",pe="cJSOiHYH";z('._5ZnGUwAU{position:fixed}.wlwFaZpx{background:#fff;box-shadow:0 0 0 1px hsla(0,0%,6%,.05),0 3px 6px hsla(0,0%,6%,.1),0 9px 24px hsla(0,0%,6%,.2);display:flex;flex-direction:column;height:100%;max-height:420px;max-width:calc(100vw - 24px);min-width:540px}.Obm15-qh{box-shadow:inset 0 -1px 0 rgba(55,53,47,.09);display:flex;height:40px;padding:0 8px;width:100%;z-index:1}.Obm15-qh,.gJ5-oVLV{font-size:14px;position:relative}.gJ5-oVLV{align-items:center;background-color:inherit;border:none;border-radius:4px;color:#37352f;cursor:pointer;display:inline-flex;flex-shrink:0;height:100%;line-height:1.2;min-width:0;padding:6px 8px;transition:height 20ms ease-in 0s;user-select:none;white-space:nowrap}._6jUel99o:after{background-color:#37352f;bottom:0;content:"";height:2px;left:0;position:absolute;width:100%}.HZgHUcV-{display:flex;justify-content:center;margin-left:12px;margin-right:12px;margin-top:4px;padding-bottom:6px;padding-top:6px}.gU1gU-Wq{border:1px solid rgba(55,53,47,.16);border-radius:4px;cursor:pointer;height:32px;padding-left:12px;padding-right:12px;transition:background 20ms ease-in 0s;user-select:none;white-space:nowrap;width:100%}.GF1PbH1g{border:none!important;cursor:pointer!important;height:auto!important;padding-left:0!important;padding-right:0!important}.i2lz5EKx{align-items:center;cursor:pointer;display:inline-flex;font-size:14px;font-weight:500;height:100%;justify-content:center;line-height:1.2;width:100%}._3cPFLttW{left:0;position:absolute;top:0;visibility:hidden}.i7UwLauz{background:hsla(45,13%,94%,.6);box-shadow:inset 0 0 0 1px hsla(0,0%,6%,.1);cursor:text;height:32px;line-height:20px;padding:3px 6px;position:relative}.cJSOiHYH,.i7UwLauz{align-items:center;border:none;border-radius:4px;display:flex;font-size:14px;width:100%}.cJSOiHYH{fill:#fff;background:#2383e2;box-shadow:inset 0 0 0 1px hsla(0,0%,6%,.1),0 1px 2px hsla(0,0%,6%,.1);color:#fff;cursor:pointer;flex-shrink:0;font-weight:500;height:28px;justify-content:center;line-height:1.2;margin:12px auto 6px;max-width:300px;padding-left:12px;padding-right:12px;transition:background 20ms ease-in 0s;user-select:none;white-space:nowrap}');const ue=({onEmbed:e})=>{const[t,i]=c("");return l("div",Object.assign({className:he},{children:[d("input",{type:"text",placeholder:"Paste embed link",value:t,className:ce,onChange:e=>i(e.target.value)}),d("button",Object.assign({type:"button",className:pe,onClick:()=>e(t)},{children:"Embed"}))]}))},ge=({style:e,onEmbed:o,onClose:n})=>l(t.Overlay,Object.assign({onClose:n},{children:[d("div",Object.assign({className:ne,style:e},{children:l("div",Object.assign({className:re},{children:[d("div",Object.assign({className:se},{children:d("button",Object.assign({type:"button",className:i(ae,{[de]:!0})},{children:"Embed link"}))})),d("div",Object.assign({className:le},{children:d(ue,{onEmbed:o})}))]}))})),d("div",{})]}));var me=!1;if("undefined"!=typeof window){var fe={get passive(){me=!0}};window.addEventListener("testPassive",null,fe),window.removeEventListener("testPassive",null,fe)}var ve="undefined"!=typeof window&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||"MacIntel"===window.navigator.platform&&window.navigator.maxTouchPoints>1),be=[],we=!1,ye=-1,xe=void 0,ze=void 0,Oe=void 0,Se=function(e){return be.some((function(t){return!(!t.options.allowTouchMove||!t.options.allowTouchMove(e))}))},Ne=function(e){var t=e||window.event;return!!Se(t.target)||(t.touches.length>1||(t.preventDefault&&t.preventDefault(),!1))},je=function(e,t){if(e){if(!be.some((function(t){return t.targetElement===e}))){var i={targetElement:e,options:t||{}};be=[].concat(function(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t<e.length;t++)i[t]=e[t];return i}return Array.from(e)}(be),[i]),ve?window.requestAnimationFrame((function(){if(void 0===ze){ze={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left};var e=window,t=e.scrollY,i=e.scrollX,o=e.innerHeight;document.body.style.position="fixed",document.body.style.top=-t,document.body.style.left=-i,setTimeout((function(){return window.requestAnimationFrame((function(){var e=o-window.innerHeight;e&&t>=o&&(document.body.style.top=-(t+e))}))}),300)}})):function(e){if(void 0===Oe){var t=!!e&&!0===e.reserveScrollBarGap,i=window.innerWidth-document.documentElement.clientWidth;if(t&&i>0){var o=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"),10);Oe=document.body.style.paddingRight,document.body.style.paddingRight=o+i+"px"}}void 0===xe&&(xe=document.body.style.overflow,document.body.style.overflow="hidden")}(t),ve&&(e.ontouchstart=function(e){1===e.targetTouches.length&&(ye=e.targetTouches[0].clientY)},e.ontouchmove=function(t){1===t.targetTouches.length&&function(e,t){var i=e.targetTouches[0].clientY-ye;!Se(e.target)&&(t&&0===t.scrollTop&&i>0||function(e){return!!e&&e.scrollHeight-e.scrollTop<=e.clientHeight}(t)&&i<0?Ne(e):e.stopPropagation())}(t,e)},we||(document.addEventListener("touchmove",Ne,me?{passive:!1}:void 0),we=!0))}}else console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.")},Re=function(e){e?(be=be.filter((function(t){return t.targetElement!==e})),ve&&(e.ontouchstart=null,e.ontouchmove=null,we&&0===be.length&&(document.removeEventListener("touchmove",Ne,me?{passive:!1}:void 0),we=!1)),ve?function(){if(void 0!==ze){var e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);document.body.style.position=ze.position,document.body.style.top=ze.top,document.body.style.left=ze.left,window.scrollTo(t,e),ze=void 0}}():(void 0!==Oe&&(document.body.style.paddingRight=Oe,Oe=void 0),void 0!==xe&&(document.body.style.overflow=xe,xe=void 0))):console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.")},We="PoOhS4FU",Ee="PcGiiPpV",He="iQZH4Lf-";z(".PoOhS4FU{margin:20px 0 10px;user-select:none}.PcGiiPpV,.PoOhS4FU{position:relative;width:100%}.PcGiiPpV{align-items:center;background-color:#efefef;border:none;border-radius:3px;color:rgba(55,53,47,.65);cursor:pointer;display:flex;font-size:14px;overflow:hidden;padding:12px 36px 12px 12px;text-align:left;transition:background-color .1s ease-in}.PcGiiPpV:hover{background-color:#e3e3e3}.iQZH4Lf-{margin-right:8px;user-select:none}");const Pe=({element:e,attributes:t,maxSizes:i,children:o,editor:n})=>{const[r,h]=c(null),p=u(null),g=e=>{var t;if(e.stopPropagation(),null!==r)return Re(document.body),void h(null);const i=null===(t=p.current)||void 0===t?void 0:t.getBoundingClientRect();if(i){const e=i.top+i.height+88+20>window.innerHeight,t=!e;console.log({showAtTop:e,showAtBottom:t}),je(document.body,{reserveScrollBarGap:!0}),h({left:i.left,top:e?i.top-88-5:i.top+i.height+5})}};return l("div",Object.assign({className:We},t,{contentEditable:!1},{children:[l("div",Object.assign({ref:p},{children:[l("button",Object.assign({className:Ee,onClick:g},{children:[d(oe,{className:He,width:24,height:24}),d("span",{children:"Click to add embed"})]})),null!==r&&d(ge,{onEmbed:t=>y(void 0,void 0,void 0,(function*(){if(0===t.length)return;const i=(o=t).includes("youtube.com")||o.includes("youtu.be")?"youtube":o.includes("vimeo.com")?"vimeo":o.includes("dailymotion.com")||o.includes("dai.ly")?"dailymotion":o.includes("twitter")?"twitter":o.includes("figma")?"figma":null;var o;let r=null;"youtube"===i?r=(e=>{const t=e.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/);return t&&11===t[2].length?t[2]:null})(t):"vimeo"===i?r=(e=>new URL(e).pathname.split("/")[1])(t):"dailymotion"===i?r=(e=>{var t=e.match(/^.+dailymotion.com\/(video|hub)\/([^_]+)[^#]*(#video=([^_&]+))?/);return null!==t?void 0!==t[4]?t[4]:t[2]:null})(t):"twitter"===i?r=function(e){const t=e.match(/\/status\/(\d+)/);return t?t[1]:null}(t):"figma"===i&&(r=function(e){const t=new URL(e).searchParams,i=t.get("node-id");return t.get("node-id")?i:"unknown"}(t)),console.log({provider:i,providerId:r});try{Re(document.body),h(null);const o={data:Object.assign(Object.assign({},e.data),{url:t,size:{width:e.data.size.width,height:e.data.size.height},provider:i,providerId:r})};s.setNodes(n,o,{at:f.findPath(n,e),match:e=>a.isElement(e)&&"embed"===e.type})}catch(e){Re(document.body),h(null)}})),onClose:g,style:r})]})),o]}))};var Le={root:"s8SlWwrL",resizer:"OLRmQVp3",dotsOptions:"_5qhGnBQW",loadingState:"_0z3X-ysz",extraMargin:"_9GorNz7R",resizeLib:"_6GzVi0JR",leftResizer:"HLz36qUX OLRmQVp3",rightResizer:"Tv1Fs118 OLRmQVp3",resizeItem:"_33V0MBSa",selectImg:"VdsHNo29",selected:"WARAR91D",loader:"_8VNstZwX",dot:"_92ciCRYx"};z(".s8SlWwrL{cursor:pointer;display:block;position:relative}.s8SlWwrL:hover .OLRmQVp3,.s8SlWwrL:hover ._5qhGnBQW{opacity:1}._0z3X-ysz{pointer-events:none}._9GorNz7R{margin:20px 0 30px}._6GzVi0JR{margin:0 auto}.OLRmQVp3{align-items:center;cursor:col-resize;display:flex;height:100%;justify-content:center;opacity:0;pointer-events:none;position:absolute;transition:opacity .15s ease-in 0s;width:15px;z-index:1}.HLz36qUX{left:0;top:0}.Tv1Fs118{right:0;top:0}._33V0MBSa{background:hsla(0,0%,6%,.6);border:1px solid hsla(0,0%,100%,.9);border-radius:20px;box-shadow:0 0 0 .5px #fff;height:48px;max-height:50%;opacity:1;transition:opacity .3s ease-in 0s;width:6px}.VdsHNo29{opacity:0}.WARAR91D{background:rgba(35,131,226,.14);border-radius:3px;inset:0;opacity:1;pointer-events:none;position:absolute;transition:opacity .15s ease-in 0s;z-index:81}._8VNstZwX{left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}._5qhGnBQW{align-items:center;background-color:#eee;border:none;border-radius:2px;cursor:pointer;display:flex;height:22px;justify-content:space-between;opacity:0;padding:0 4px;position:absolute;right:10px;top:10px;transition:opacity .15s ease-in 0s;width:22px;z-index:1}._92ciCRYx{background-color:gray;border-radius:50%;min-height:3px;min-width:3px}");const Ce=265;function ke(e){var o,n,r,h,u;const{element:m,editor:w,plugin:y}=e,x=v(),z=b(),[O,S]=c(null),[N,j]=c({width:(null===(n=null===(o=m.data)||void 0===o?void 0:o.size)||void 0===n?void 0:n.width)||750,height:(null===(h=null===(r=m.data)||void 0===r?void 0:r.size)||void 0===h?void 0:h.height)||440}),R=e=>j(Object.assign(Object.assign({},N),e));p((()=>{var e,t,i,o;m.data&&R({width:(null===(t=null===(e=m.data)||void 0===e?void 0:e.size)||void 0===t?void 0:t.width)||750,height:(null===(o=null===(i=m.data)||void 0===i?void 0:i.size)||void 0===o?void 0:o.height)||440})}),[null===(u=m.data)||void 0===u?void 0:u.size]);const W=g((()=>{var e,t;return{minWidth:300,size:{width:N.width,height:N.height},maxWidth:(null===(e=y.options)||void 0===e?void 0:e.maxWidth)||800,maxHeight:(null===(t=y.options)||void 0===t?void 0:t.maxHeight)||720,lockAspectRatio:!0,resizeRatio:2,enable:{left:!z,right:!z},handleStyles:{left:{left:0},right:{right:0}},onResize:(e,t,i)=>{R({width:i.offsetWidth,height:i.offsetHeight})},onResizeStop:(e,t,i)=>{console.log("image editor editor.children",w.children),console.log("ReactEditor.findPath(editor, element)",f.findPath(w,m)),console.log("element",m),s.setNodes(w,{data:Object.assign(Object.assign({},m.data),{size:{width:i.offsetWidth,height:i.offsetHeight}})},{at:f.findPath(w,m),match:e=>a.isElement(e)&&"embed"===e.type})},handleComponent:{left:d("div",Object.assign({contentEditable:!1,className:Le.leftResizer},{children:d("div",{className:Le.resizeItem})})),right:d("div",Object.assign({contentEditable:!1,className:Le.rightResizer},{children:d("div",{className:Le.resizeItem})}))}}}),[N.width,N.height,w]),E=()=>{Re(document.body),S(null)},H=e=>{var t;if(null==e||e.stopPropagation(),null!==O)return E();const i=null===(t=null==e?void 0:e.currentTarget)||void 0===t?void 0:t.getBoundingClientRect();if(i){const e=i.top+i.height+164+20>window.innerHeight;je(document.body,{reserveScrollBarGap:!0}),S({left:i.right-i.width+Ce>window.innerWidth?window.innerWidth-Ce-i.width:i.right-i.width,top:e?i.top-82-i.height:i.top+i.height+5})}};if(!m.data.url&&!m.data["data-src"]){const{maxWidth:o=750,maxHeight:n=800}=y.options||{};return l("div",Object.assign({className:Le.root,contentEditable:!1,draggable:!1},{children:[d("div",{className:i(Le.selectImg,{[Le.selected]:x})}),d(Pe,Object.assign({attributes:e.attributes,element:m,editor:w,maxSizes:{maxWidth:o,maxHeight:n}},{children:!z&&l("div",{children:[l("button",Object.assign({type:"button",className:Le.dotsOptions,onClick:H},{children:[d("span",{className:Le.dot}),d("span",{className:Le.dot}),d("span",{className:Le.dot})]})),null!==O&&d(t.ElementOptions,{onClose:E,style:O,element:m,onCopy:E,onDelete:E,onDuplicate:E},m.id)]})})),e.children]}),m.id)}return d("div",Object.assign({contentEditable:!1,draggable:!1,className:Le.root},{children:l(te,Object.assign({},W,{className:Le.resizeLib},{children:[y.renderer.render(Object.assign(Object.assign({},e),{size:N})),d("div",{className:i(Le.selectImg,{[Le.selected]:x})}),!z&&l("div",{children:[l("button",Object.assign({type:"button",className:Le.dotsOptions,onClick:H},{children:[d("span",{className:Le.dot}),d("span",{className:Le.dot}),d("span",{className:Le.dot})]})),null!==O&&d(t.ElementOptions,{onClose:E,style:O,element:m,onCopy:E,onDelete:E,onDuplicate:E},m.id)]})]}))}),m.id)}const Me=o({type:"embed",shortcut:"embed",renderer:{editor:(e,t)=>i=>d(ke,Object.assign({editor:e,plugin:t},i)),render:({attributes:t,element:i,children:o,HTMLAttributes:n})=>{if("string"==typeof i.data.provider&&i.data.providerId&&C[i.data.provider]){const r=C[i.data.provider];return l("div",Object.assign({},t,{contentEditable:!1,draggable:!1},n,{className:e({element:i,HTMLAttributes:n,className:L})},{children:[d(r,Object.assign({},i.data,{providerId:i.data.providerId})),o]}))}return i.data.url?l("div",Object.assign({},t,{contentEditable:!1,draggable:!1},n,{className:e({element:i,HTMLAttributes:n,className:L})},{children:[d(j,Object.assign({},i.data,{providerId:i.data.providerId})),o]})):d("div",{})}},extendEditor(e){const{isVoid:t}=e;return e.isVoid=e=>e.type===Me.getPlugin.type||t(e),e},events:{onKeyDown:(e,{defaultNode:t,hotkeys:i})=>o=>{var r;if("embed"===n(e,null===(r=e.selection)||void 0===r?void 0:r.anchor.path,"highest").type&&e.selection)return i.isEnter(o)?(o.preventDefault(),void s.insertNodes(e,t,{mode:"highest"})):void 0}},defineElement:()=>({id:r(),type:"embed",nodeType:"void",data:{url:null,size:{width:"auto",height:"auto"},providerId:null},children:[{text:""}]}),createElement:function(e){var t;const i=Me.getPlugin.defineElement();s.setNodes(e,i,{at:null===(t=e.selection)||void 0===t?void 0:t.anchor})},exports:{markdown:{serialize:(e,t)=>`[embed-url](${e.data.url})\n`},html:{serialize:(e,t)=>{var i,o;return`<iframe src="https://player.vimeo.com/video/807053663?badge=0&byline=0&portrait=0&title=0" frameborder="0" height="${null===(i=e.data.size)||void 0===i?void 0:i.height}" width="${null===(o=e.data.size)||void 0===o?void 0:o.width}" allowfullscreen="" url="https://vimeo.com/807053663" provider="${e.data.provider||""}" />`},deserialize:{nodeName:"IFRAME",parse:e=>({url:e.getAttribute("src"),size:{height:"string"==typeof e.getAttribute("height")?Number(e.getAttribute("height")):"auto",width:"string"==typeof e.getAttribute("width")?Number(e.getAttribute("width")):"auto"}})}}}});export{Me as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yoopta/embed",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.5-rc",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "Darginec05 <devopsbanda@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/Darginec05/Editor-Yoopta#readme",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"dist/"
|
|
15
15
|
],
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"@yoopta/editor": "1.9.
|
|
17
|
+
"@yoopta/editor": "1.9.7-rc",
|
|
18
18
|
"react": ">=17.0.2",
|
|
19
19
|
"react-dom": ">=17.0.2",
|
|
20
20
|
"slate": ">=0.72.3",
|