@yoopta/video 1.9.14-rc → 1.9.16-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{getElementClassname as t,UI_HELPERS as e,cx as i,createYooptaPlugin as o,getElementByPath as n,generateId as s}from"@yoopta/editor";import{Transforms as r,Element as a}from"slate";import{jsxs as d,jsx 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 f}from"react-dom";import{ReactEditor as m,useSelected as v,useReadOnly as b}from"slate-react";function w(t,e){var i={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(i[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(t);n<o.length;n++)e.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(t,o[n])&&(i[o[n]]=t[o[n]])}return i}function y(t,e,i,o){return new(i||(i=Promise))((function(n,s){function r(t){try{d(o.next(t))}catch(t){s(t)}}function a(t){try{d(o.throw(t))}catch(t){s(t)}}function d(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(r,a)}d((o=o.apply(t,e||[])).next())}))}function x(t,{threshold:e=0,root:i=null,rootMargin:o="0%",freezeOnceVisible:n=!1}={}){const[s,r]=c({}),a=s.isIntersecting&&n,d=([t])=>r(t);return p((()=>{const n=null==t?void 0:t.current;if(!window.IntersectionObserver||a||!n)return;const s=new IntersectionObserver(d,{threshold:e,root:i,rootMargin:o});return s.observe(n),()=>s.disconnect()}),[t,e,i,o,a]),s}function z(t,e){void 0===e&&(e={});var i=e.insertAt;if(t&&"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=t:n.appendChild(document.createTextNode(t))}}var N={videoElement:"TvZseAeh",video:"EZu95fyq",iframRoot:"dkxsZ5ZT",iframe:"KsFU0JBg",iframeWrap:"D-8E3vsv",iframePreview:"eEtEqZrx",iframeRoot:"_0icGyC6M"};z(".TvZseAeh{margin:20px 0 10px;position:relative}.EZu95fyq{border-radius:1px;display:block;margin:0 auto;max-width:100%;object-fit:cover;pointer-events:auto}.dkxsZ5ZT{display:flex;height:0;justify-content:center;min-height:100px;padding-bottom:56.25%;position:relative;width:100%}.KsFU0JBg{background-color:#fff}.D-8E3vsv,.KsFU0JBg{border-radius:1px;height:100%;pointer-events:auto;width:100%}.D-8E3vsv,.KsFU0JBg,.eEtEqZrx{left:0;position:absolute;top:0}.eEtEqZrx{filter:blur(10px);object-fit:cover;transition:opacity .15s ease-in,filter .15s ease-in}._0icGyC6M{height:100%;position:relative;width:100%}");const S=t=>`https://api.dailymotion.com/video/${t}?fields=thumbnail_url`;const O="https://vimeo.com/api/v2/video";const j={vimeo:function(t){var{videoId:e}=t,i=w(t,["videoId"]);const o=u(null),[n,s]=c(null),[r,a]=c(!1),{isIntersecting:h}=x(o,{freezeOnceVisible:!0,rootMargin:"50%"});return p((()=>{fetch(`${O}/${e}.json`).then((t=>t.json())).then((t=>s(t[0].thumbnail_medium))).catch((()=>s(null)))}),[e]),d("div",Object.assign({ref:o,className:N.iframeRoot},{children:[l("img",{src:n||"",alt:"vimeo_video_preview",width:"100%",height:"100%",className:N.iframePreview,style:{opacity:h&&r?0:1,zIndex:h&&r?-1:0}}),h&&l("iframe",Object.assign({title:"Video Player",src:`https://player.vimeo.com/video/${e}?badge=0&byline=0&portrait=0&title=0`,frameBorder:0,allowFullScreen:!0,onLoad:()=>a(!0),className:N.iframe},i))]}))},youtube:function(t){var{videoId:e}=t,i=w(t,["videoId"]);const o=u(null),[n,s]=c(!1),{isIntersecting:r}=x(o,{freezeOnceVisible:!0,rootMargin:"50%"});return d("div",Object.assign({ref:o,className:N.iframeRoot},{children:[l("img",{src:`https://i.ytimg.com/vi/${e}/default.jpg`,alt:"youtube_video_preview",width:"100%",height:"100%",className:N.iframePreview,style:{opacity:r&&n?0:1,zIndex:r&&n?-1:0}}),r&&l("iframe",Object.assign({title:"Video Player",src:`https://www.youtube.com/embed/${e}`,frameBorder:0,onLoad:()=>s(!0),allowFullScreen:!0,className:N.iframe},i))]}))},dailymotion:function(t){var{videoId:e}=t,i=w(t,["videoId"]);const o=u(null),[n,s]=c(null),[r,a]=c(!1),{isIntersecting:h}=x(o,{freezeOnceVisible:!0,rootMargin:"50%"});return p((()=>{fetch(S(e)).then((t=>t.json())).then((t=>s(t.thumbnail_url))).catch((()=>s(null)))}),[e]),d("div",Object.assign({ref:o,className:N.iframeRoot},{children:[l("img",{src:n||"",alt:"daylimotion_video_preview",width:"100%",height:"100%",className:N.iframePreview,style:{opacity:h&&r?0:1,zIndex:h&&r?-1:0}}),h&&l("iframe",Object.assign({title:"Dailymotion Video Player",frameBorder:0,onLoad:()=>a(!0),src:`https://www.dailymotion.com/embed/video/${e}`,allowFullScreen:!0,className:N.iframe},i))]}))}};var E,k,R=(E=function(t,e){return E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},E(t,e)},function(t,e){function i(){this.constructor=t}E(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),W=function(){return W=Object.assign||function(t){for(var e,i=1,o=arguments.length;i<o;i++)for(var n in e=arguments[i])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},W.apply(this,arguments)},H={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},M={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},C={width:"20px",height:"20px",position:"absolute"},B={top:W(W({},H),{top:"-5px"}),right:W(W({},M),{left:void 0,right:"-5px"}),bottom:W(W({},H),{top:void 0,bottom:"-5px"}),left:W(W({},M),{left:"-5px"}),topRight:W(W({},C),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:W(W({},C),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:W(W({},C),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:W(W({},C),{left:"-10px",top:"-10px",cursor:"nw-resize"})},P=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.onMouseDown=function(t){e.props.onResizeStart(t,e.props.direction)},e.onTouchStart=function(t){e.props.onResizeStart(t,e.props.direction)},e}return R(e,t),e.prototype.render=function(){return h.createElement("div",{className:this.props.className||"",style:W(W({position:"absolute",userSelect:"none"},B[this.props.direction]),this.props.replaceStyles||{}),onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart},this.props.children)},e}(h.PureComponent),A=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function o(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(o.prototype=i.prototype,new o)}}(),L=function(){return L=Object.assign||function(t){for(var e,i=1,o=arguments.length;i<o;i++)for(var n in e=arguments[i])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},L.apply(this,arguments)},I={width:"auto",height:"auto"},D=function(t,e,i){return Math.max(Math.min(t,i),e)},_=function(t,e){return Math.round(t/e)*e},T=function(t,e){return new RegExp(t,"i").test(e)},V=function(t){return Boolean(t.touches&&t.touches.length)},G=function(t,e,i){void 0===i&&(i=0);var o=e.reduce((function(i,o,n){return Math.abs(o-t)<Math.abs(e[i]-t)?n:i}),0),n=Math.abs(e[o]-t);return 0===i||n<i?e[o]:t},U=function(t){return"auto"===(t=t.toString())||t.endsWith("px")||t.endsWith("%")||t.endsWith("vh")||t.endsWith("vw")||t.endsWith("vmax")||t.endsWith("vmin")?t:t+"px"},F=function(t,e,i,o){if(t&&"string"==typeof t){if(t.endsWith("px"))return Number(t.replace("px",""));if(t.endsWith("%"))return e*(Number(t.replace("%",""))/100);if(t.endsWith("vw"))return i*(Number(t.replace("vw",""))/100);if(t.endsWith("vh"))return o*(Number(t.replace("vh",""))/100)}return t},Y=["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"],X="__resizable_base__",Q=function(t){function e(e){var i=t.call(this,e)||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 t=i.parentNode;if(!t)return null;var e=i.window.document.createElement("div");return e.style.width="100%",e.style.height="100%",e.style.position="absolute",e.style.transform="scale(0, 0)",e.style.left="0",e.style.flex="0 0 100%",e.classList?e.classList.add(X):e.className+=X,t.appendChild(e),e},i.removeBase=function(t){var e=i.parentNode;e&&e.removeChild(t)},i.ref=function(t){t&&(i.resizable=t)},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 A(e,t),Object.defineProperty(e.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"window",{get:function(){return this.resizable&&this.resizable.ownerDocument?this.resizable.ownerDocument.defaultView:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||I},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){var t=0,e=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"),t="auto"!==this.resizable.style.width?this.resizable.offsetWidth:i,e="auto"!==this.resizable.style.height?this.resizable.offsetHeight:o,this.resizable.style.position=n}return{width:t,height:e}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sizeStyle",{get:function(){var t=this,e=this.props.size,i=function(e){if(void 0===t.state[e]||"auto"===t.state[e])return"auto";if(t.propsSize&&t.propsSize[e]&&t.propsSize[e].toString().endsWith("%")){if(t.state[e].toString().endsWith("%"))return t.state[e].toString();var i=t.getParentSize();return Number(t.state[e].toString().replace("px",""))/i[e]*100+"%"}return U(t.state[e])};return{width:e&&void 0!==e.width&&!this.state.isResizing?U(e.width):i("width"),height:e&&void 0!==e.height&&!this.state.isResizing?U(e.height):i("height")}},enumerable:!1,configurable:!0}),e.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var t=this.appendBase();if(!t)return{width:0,height:0};var e=!1,i=this.parentNode.style.flexWrap;"wrap"!==i&&(e=!0,this.parentNode.style.flexWrap="wrap"),t.style.position="relative",t.style.minWidth="100%",t.style.minHeight="100%";var o={width:t.offsetWidth,height:t.offsetHeight};return e&&(this.parentNode.style.flexWrap=i),this.removeBase(t),o},e.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))},e.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))},e.prototype.componentDidMount=function(){if(this.resizable&&this.window){var t=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:"auto"!==t.flexBasis?t.flexBasis:void 0})}},e.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},e.prototype.createSizeForCssProperty=function(t,e){var i=this.propsSize&&this.propsSize[e];return"auto"!==this.state[e]||this.state.original[e]!==t||void 0!==i&&"auto"!==i?t:"auto"},e.prototype.calculateNewMaxFromBoundary=function(t,e){var i,o,n=this.props.boundsByDirection,s=this.state.direction,r=n&&T("left",s),a=n&&T("top",s);if("parent"===this.props.bounds){var d=this.parentNode;d&&(i=r?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=r?this.resizableRight:this.window.innerWidth-this.resizableLeft,o=a?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(i=r?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)&&(t=t&&t<i?t:i),o&&Number.isFinite(o)&&(e=e&&e<o?e:o),{maxWidth:t,maxHeight:e}},e.prototype.calculateNewSizeFromDirection=function(t,e){var i=this.props.scale||1,o=this.props.resizeRatio||1,n=this.state,s=n.direction,r=n.original,a=this.props,d=a.lockAspectRatio,l=a.lockAspectRatioExtraHeight,h=a.lockAspectRatioExtraWidth,c=r.width,p=r.height,u=l||0,g=h||0;return T("right",s)&&(c=r.width+(t-r.x)*o/i,d&&(p=(c-g)/this.ratio+u)),T("left",s)&&(c=r.width-(t-r.x)*o/i,d&&(p=(c-g)/this.ratio+u)),T("bottom",s)&&(p=r.height+(e-r.y)*o/i,d&&(c=(p-u)*this.ratio+g)),T("top",s)&&(p=r.height-(e-r.y)*o/i,d&&(c=(p-u)*this.ratio+g)),{newWidth:c,newHeight:p}},e.prototype.calculateNewSizeFromAspectRatio=function(t,e,i,o){var n=this.props,s=n.lockAspectRatio,r=n.lockAspectRatioExtraHeight,a=n.lockAspectRatioExtraWidth,d=void 0===o.width?10:o.width,l=void 0===i.width||i.width<0?t:i.width,h=void 0===o.height?10:o.height,c=void 0===i.height||i.height<0?e:i.height,p=r||0,u=a||0;if(s){var g=(h-p)*this.ratio+u,f=(c-p)*this.ratio+u,m=(d-u)/this.ratio+p,v=(l-u)/this.ratio+p,b=Math.max(d,g),w=Math.min(l,f),y=Math.max(h,m),x=Math.min(c,v);t=D(t,b,w),e=D(e,y,x)}else t=D(t,d,l),e=D(e,h,c);return{newWidth:t,newHeight:e}},e.prototype.setBoundingClientRect=function(){if("parent"===this.props.bounds){var t=this.parentNode;if(t){var e=t.getBoundingClientRect();this.parentLeft=e.left,this.parentTop=e.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,s=o.top,r=o.right,a=o.bottom;this.resizableLeft=n,this.resizableRight=r,this.resizableTop=s,this.resizableBottom=a}},e.prototype.onResizeStart=function(t,e){if(this.resizable&&this.window){var i,o=0,n=0;if(t.nativeEvent&&function(t){return Boolean((t.clientX||0===t.clientX)&&(t.clientY||0===t.clientY))}(t.nativeEvent)?(o=t.nativeEvent.clientX,n=t.nativeEvent.clientY):t.nativeEvent&&V(t.nativeEvent)&&(o=t.nativeEvent.touches[0].clientX,n=t.nativeEvent.touches[0].clientY),this.props.onResizeStart)if(this.resizable)if(!1===this.props.onResizeStart(t,e,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 s=this.window.getComputedStyle(this.resizable);if("auto"!==s.flexBasis){var r=this.parentNode;if(r){var a=this.window.getComputedStyle(r).flexDirection;this.flexDir=a.startsWith("row")?"row":"column",i=s.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var d={original:{x:o,y:n,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:L(L({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(t.target).cursor||"auto"}),direction:e,flexBasis:i};this.setState(d)}},e.prototype.onMouseMove=function(t){var e=this;if(this.state.isResizing&&this.resizable&&this.window){if(this.window.TouchEvent&&V(t))try{t.preventDefault(),t.stopPropagation()}catch(t){}var i=this.props,o=i.maxWidth,n=i.maxHeight,s=i.minWidth,r=i.minHeight,a=V(t)?t.touches[0].clientX:t.clientX,d=V(t)?t.touches[0].clientY:t.clientY,l=this.state,h=l.direction,c=l.original,p=l.width,u=l.height,g=this.getParentSize(),m=function(t,e,i,o,n,s,r){return o=F(o,t.width,e,i),n=F(n,t.height,e,i),s=F(s,t.width,e,i),r=F(r,t.height,e,i),{maxWidth:void 0===o?void 0:Number(o),maxHeight:void 0===n?void 0:Number(n),minWidth:void 0===s?void 0:Number(s),minHeight:void 0===r?void 0:Number(r)}}(g,this.window.innerWidth,this.window.innerHeight,o,n,s,r);o=m.maxWidth,n=m.maxHeight,s=m.minWidth,r=m.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=G(w,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(b=G(b,this.props.snap.y,this.props.snapGap));var x=this.calculateNewSizeFromAspectRatio(w,b,{width:y.maxWidth,height:y.maxHeight},{width:s,height:r});if(w=x.newWidth,b=x.newHeight,this.props.grid){var z=_(w,this.props.grid[0]),N=_(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(N-b)<=S?N:b}var O={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),f((function(){e.setState(j)})),this.props.onResize&&this.props.onResize(t,h,this.resizable,O)}},e.prototype.onMouseUp=function(t){var e=this.state,i=e.isResizing,o=e.direction,n=e.original;if(i&&this.resizable){var s={width:this.size.width-n.width,height:this.size.height-n.height};this.props.onResizeStop&&this.props.onResizeStop(t,o,this.resizable,s),this.props.size&&this.setState(this.props.size),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:L(L({},this.state.backgroundStyle),{cursor:"auto"})})}},e.prototype.updateSize=function(t){this.setState({width:t.width,height:t.height})},e.prototype.renderResizer=function(){var t=this,e=this.props,i=e.enable,o=e.handleStyles,n=e.handleClasses,s=e.handleWrapperStyle,r=e.handleWrapperClass,a=e.handleComponent;if(!i)return null;var d=Object.keys(i).map((function(e){return!1!==i[e]?h.createElement(P,{key:e,direction:e,onResizeStart:t.onResizeStart,replaceStyles:o&&o[e],className:n&&n[e]},a&&a[e]?a[e]:null):null}));return h.createElement("div",{className:r,style:s},d)},e.prototype.render=function(){var t=this,e=Object.keys(this.props).reduce((function(e,i){return-1!==Y.indexOf(i)||(e[i]=t.props[i]),e}),{}),i=L(L(L({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,L({ref:this.ref,style:i,className:this.props.className},e),this.state.isResizing&&h.createElement("div",{style:this.state.backgroundStyle}),this.props.children,this.renderResizer())},e.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},e}(h.PureComponent);function q(){return q=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(t[o]=i[o])}return t},q.apply(this,arguments)}var J=function(t){return h.createElement("svg",q({fill:"currentColor","aria-hidden":"true",viewBox:"0 0 24 24","data-testid":"uploadImage"},t),k||(k=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"})))},Z="rq2V2ceB",$="rc-sSm2o",K="pa2jWsNN",tt="WCrDI0dy",et="d-YDdEGm",it="zaYe5qHX",ot="M0t11tGQ",nt="_9cpXcl96",st="DZJetA3e",rt="oVy3BbqO M0t11tGQ",at="GIpAKCJ0",dt="k7HVhRkA";z('.rq2V2ceB{position:fixed}.rc-sSm2o{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}.pa2jWsNN{box-shadow:inset 0 -1px 0 rgba(55,53,47,.09);display:flex;height:40px;padding:0 8px;width:100%;z-index:1}.WCrDI0dy,.pa2jWsNN{font-size:14px;position:relative}.WCrDI0dy{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}.d-YDdEGm:after{background-color:#37352f;bottom:0;content:"";height:2px;left:0;position:absolute;width:100%}.zaYe5qHX{display:flex;justify-content:center;margin-left:12px;margin-right:12px;margin-top:4px;padding-bottom:6px;padding-top:6px}.M0t11tGQ{border:1px solid rgba(55,53,47,.16);border-radius:4px;height:32px;padding-left:12px;padding-right:12px;transition:background 20ms ease-in 0s;user-select:none;white-space:nowrap}.M0t11tGQ,._9cpXcl96{cursor:pointer;width:100%}._9cpXcl96{align-items:center;display:inline-flex;font-size:14px;font-weight:500;height:100%;justify-content:center;line-height:1.2}.DZJetA3e{left:0;position:absolute;top:0;visibility:hidden}.oVy3BbqO{border:none!important;cursor:pointer!important;height:auto!important;padding-left:0!important;padding-right:0!important}.GIpAKCJ0{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}.GIpAKCJ0,.k7HVhRkA{align-items:center;border:none;border-radius:4px;display:flex;font-size:14px;width:100%}.k7HVhRkA{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 lt=({onChange:t})=>l("div",Object.assign({className:ot},{children:d("label",Object.assign({htmlFor:"video-uploader",className:nt},{children:[l("input",{type:"file",id:"video-uploader",className:st,accept:"video/*",onChange:e=>{const i=e.currentTarget.files;i&&i.length>0&&t(i[0])},multiple:!1}),"Upload file"]}))})),ht=({onEmbed:t})=>{const[e,i]=c("");return d("div",Object.assign({className:rt},{children:[l("input",{type:"text",placeholder:"Paste video link (Youtube, Vimeo, Dailymotion)",value:e,className:at,onChange:t=>i(t.target.value)}),l("button",Object.assign({type:"button",className:dt,onClick:()=>t(e)},{children:"Embed video"}))]}))},ct=({activeTab:t="upload",style:o,switchTab:n,onChange:s,onClose:r,onEmbed:a})=>{const h="upload"===t,c="embed"===t;return l(e.Overlay,Object.assign({onClose:r},{children:l("div",Object.assign({className:Z,style:o},{children:d("div",Object.assign({className:$},{children:[d("div",Object.assign({className:K},{children:[l("button",Object.assign({type:"button",onClick:()=>n("upload"),className:i(tt,{[et]:h})},{children:"Upload"})),l("button",Object.assign({type:"button",onClick:()=>n("embed"),className:i(tt,{[et]:c})},{children:"Video link"}))]})),d("div",Object.assign({className:it},{children:[h&&l(lt,{onChange:s}),c&&l(ht,{onEmbed:a})]}))]}))}))}))};var pt=!1;if("undefined"!=typeof window){var ut={get passive(){pt=!0}};window.addEventListener("testPassive",null,ut),window.removeEventListener("testPassive",null,ut)}var gt="undefined"!=typeof window&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||"MacIntel"===window.navigator.platform&&window.navigator.maxTouchPoints>1),ft=[],mt=!1,vt=-1,bt=void 0,wt=void 0,yt=void 0,xt=function(t){return ft.some((function(e){return!(!e.options.allowTouchMove||!e.options.allowTouchMove(t))}))},zt=function(t){var e=t||window.event;return!!xt(e.target)||(e.touches.length>1||(e.preventDefault&&e.preventDefault(),!1))},Nt=function(t,e){if(t){if(!ft.some((function(e){return e.targetElement===t}))){var i={targetElement:t,options:e||{}};ft=[].concat(function(t){if(Array.isArray(t)){for(var e=0,i=Array(t.length);e<t.length;e++)i[e]=t[e];return i}return Array.from(t)}(ft),[i]),gt?window.requestAnimationFrame((function(){if(void 0===wt){wt={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left};var t=window,e=t.scrollY,i=t.scrollX,o=t.innerHeight;document.body.style.position="fixed",document.body.style.top=-e,document.body.style.left=-i,setTimeout((function(){return window.requestAnimationFrame((function(){var t=o-window.innerHeight;t&&e>=o&&(document.body.style.top=-(e+t))}))}),300)}})):function(t){if(void 0===yt){var e=!!t&&!0===t.reserveScrollBarGap,i=window.innerWidth-document.documentElement.clientWidth;if(e&&i>0){var o=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"),10);yt=document.body.style.paddingRight,document.body.style.paddingRight=o+i+"px"}}void 0===bt&&(bt=document.body.style.overflow,document.body.style.overflow="hidden")}(e),gt&&(t.ontouchstart=function(t){1===t.targetTouches.length&&(vt=t.targetTouches[0].clientY)},t.ontouchmove=function(e){1===e.targetTouches.length&&function(t,e){var i=t.targetTouches[0].clientY-vt;!xt(t.target)&&(e&&0===e.scrollTop&&i>0||function(t){return!!t&&t.scrollHeight-t.scrollTop<=t.clientHeight}(e)&&i<0?zt(t):t.stopPropagation())}(e,t)},mt||(document.addEventListener("touchmove",zt,pt?{passive:!1}:void 0),mt=!0))}}else console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.")},St=function(t){t?(ft=ft.filter((function(e){return e.targetElement!==t})),gt&&(t.ontouchstart=null,t.ontouchmove=null,mt&&0===ft.length&&(document.removeEventListener("touchmove",zt,pt?{passive:!1}:void 0),mt=!1)),gt?function(){if(void 0!==wt){var t=-parseInt(document.body.style.top,10),e=-parseInt(document.body.style.left,10);document.body.style.position=wt.position,document.body.style.top=wt.top,document.body.style.left=wt.left,window.scrollTo(e,t),wt=void 0}}():(void 0!==yt&&(document.body.style.paddingRight=yt,yt=void 0),void 0!==bt&&(document.body.style.overflow=bt,bt=void 0))):console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.")};var Ot="ejxIcizu",jt="tGCxkSAc",Et="BAqjz8jz",kt="tab3XKrp",Rt="UnxRu3H0";z(".ejxIcizu{margin:20px 0 10px;user-select:none}.ejxIcizu,.tGCxkSAc{position:relative;width:100%}.tGCxkSAc{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}.tGCxkSAc:hover{background-color:#e3e3e3}.BAqjz8jz{background-color:#efefef;color:rgba(55,53,47,.65);cursor:not-allowed;pointer-events:none}.tab3XKrp{margin-right:8px;user-select:none}.UnxRu3H0{left:50%;position:absolute;top:50%}");var Wt="tmpFyHNs",Ht="NdlfkJmx";z(".tmpFyHNs{height:100%;position:relative;width:100%}.tmpFyHNs .NdlfkJmx{background-color:#909090;border-radius:5rem;height:10px;position:absolute;top:50%;transform:translate(-50%,-50%);width:10px}.tmpFyHNs .NdlfkJmx:first-child{animation:p3veiLIQ 2s,_4Q-HiXe1 2s;animation-iteration-count:infinite;animation-timing-function:ease-in-out;left:calc(50% - 60px)}.tmpFyHNs .NdlfkJmx:nth-child(2){animation:p3veiLIQ 2s,NAkUMYzr 2s;animation-delay:.15s;animation-iteration-count:infinite;animation-timing-function:ease-in-out;left:calc(50% - 30px)}.tmpFyHNs .NdlfkJmx:nth-child(3){animation:p3veiLIQ 2s,_4Q-HiXe1 2s;animation-delay:.3s;animation-iteration-count:infinite;animation-timing-function:ease-in-out;left:50%}.tmpFyHNs .NdlfkJmx:nth-child(4){animation:p3veiLIQ 2s,NAkUMYzr 2s;animation-delay:.45s;animation-iteration-count:infinite;animation-timing-function:ease-in-out;left:calc(50% + 30px)}.tmpFyHNs .NdlfkJmx:nth-child(5){animation:p3veiLIQ 2s,_4Q-HiXe1 2s;animation-delay:.6s;animation-iteration-count:infinite;animation-timing-function:ease-in-out;left:calc(50% + 60px)}@keyframes p3veiLIQ{0%,15%{top:50%}45%,65%{top:42.5%}85%,to{top:50%}}@keyframes _4Q-HiXe1{0%,8%{background-color:#909090;height:10px}14%,34%{background-color:#f8f8f8;height:17.5px}46%,to{background-color:#909090;height:10px}}@keyframes NAkUMYzr{0%,8%{background-color:#909090;height:10px}14%,34%{background-color:#f8f8f8;height:32.5px}46%,to{background-color:#909090;height:10px}}");const Mt=()=>d("div",Object.assign({className:Wt},{children:[l("div",{className:Ht}),l("div",{className:Ht}),l("div",{className:Ht}),l("div",{className:Ht}),l("div",{className:Ht})]})),Ct=({element:t,attributes:e,maxSizes:o,children:n,editor:s,onUpload:h})=>{const[p,g]=c(null),[f,v]=c(!1),[b,w]=c("upload"),x=u(null),z=t=>{var e;if(t.stopPropagation(),null!==p)return St(document.body),void g(null);const i=null===(e=x.current)||void 0===e?void 0:e.getBoundingClientRect();if(i){const t=i.top+i.height+88+20>window.innerHeight,e=!t;console.log({showAtTop:t,showAtBottom:e}),Nt(document.body,{reserveScrollBarGap:!0}),g({left:i.left,top:t?i.top-88-5:i.top+i.height+5})}};return d("div",Object.assign({className:i(Ot,{[Et]:f})},e,{contentEditable:!1},{children:[d("div",Object.assign({ref:x},{children:[d("button",Object.assign({className:jt,onClick:z,disabled:f},{children:[f&&l("div",Object.assign({className:Rt},{children:l(Mt,{})})),l(J,{className:kt,width:24,height:24}),l("span",{children:"Click to add video"})]})),null!==p&&l(ct,{onChange:e=>y(void 0,void 0,void 0,(function*(){if(St(document.body),g(null),v(!0),!h)return console.error("Provide `onUpload` props in Video options");try{const i=yield h(e),{width:n,height:d}=((t,e,i,o)=>{if(!t||!e)return{};const n=Math.min(i/t,o/e);return{width:t*n,height:e*n}})(i.width,i.height,o.maxWidth,o.maxHeight),l={data:{url:i.url,"data-src":void 0,size:{width:n||t.data.size.width,height:d||t.data.size.height}}};v(!1),r.setNodes(s,l,{at:m.findPath(s,t),match:t=>a.isElement(t)&&"video"===t.type})}catch(t){St(document.body),g(null),v(!1)}})),onClose:z,activeTab:b,switchTab:t=>w(t),style:p,onEmbed:e=>y(void 0,void 0,void 0,(function*(){if(0===e.length)return;const i=(o=e).includes("youtube.com")||o.includes("youtu.be")?"youtube":o.includes("vimeo.com")?"vimeo":o.includes("dailymotion.com")||o.includes("dai.ly")?"dailymotion":null;var o;let n=null;if("youtube"===i?n=(t=>{const e=t.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/);return e&&11===e[2].length?e[2]:null})(e):"vimeo"===i?n=(t=>new URL(t).pathname.split("/")[1])(e):"dailymotion"===i&&(n=(t=>{var e=t.match(/^.+dailymotion.com\/(video|hub)\/([^_]+)[^#]*(#video=([^_&]+))?/);return null!==e?void 0!==e[4]?e[4]:e[2]:null})(e)),n)try{St(document.body),g(null);const e={data:Object.assign(Object.assign({},t.data),{url:null,"data-src":void 0,size:{width:t.data.size.width,height:t.data.size.height},provider:i,videoId:n})};r.setNodes(s,e,{at:m.findPath(s,t),match:t=>a.isElement(t)&&"video"===t.type})}catch(t){St(document.body),g(null)}}))})]})),n]}))};var Bt={root:"jsof5eGh",resizer:"WOn73-dw",dotsOptions:"_9ivUDLVr",loadingState:"hD5QV2jP",extraMargin:"M9o3j8I5",resizeLib:"-dEl6QRc",leftResizer:"_72L6ylPc WOn73-dw",rightResizer:"OhmV3u2l WOn73-dw",resizeItem:"fdfDEgiq",selectImg:"_7b-PdGXE",selected:"YKGzSDVj",loader:"yDd0Sn4a",dot:"VZUnkjYn"};z(".jsof5eGh{cursor:pointer;display:block;position:relative}.jsof5eGh:hover .WOn73-dw,.jsof5eGh:hover ._9ivUDLVr{opacity:1}.hD5QV2jP{pointer-events:none}.M9o3j8I5{margin:20px 0 30px}.-dEl6QRc{margin:0 auto}.WOn73-dw{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}._72L6ylPc{left:0;top:0}.OhmV3u2l{right:0;top:0}.fdfDEgiq{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}._7b-PdGXE{opacity:0}.YKGzSDVj{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}.yDd0Sn4a{left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}._9ivUDLVr{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}.VZUnkjYn{background-color:gray;border-radius:50%;min-height:3px;min-width:3px}");const Pt=265;function At(t){var o,n,s,h,u,f,w;const{element:y,editor:x,plugin:z}=t,N=v(),S=b(),[O,j]=c(null),[E,k]=c({width:(null===(n=null===(o=y.data)||void 0===o?void 0:o.size)||void 0===n?void 0:n.width)||"auto",height:(null===(h=null===(s=y.data)||void 0===s?void 0:s.size)||void 0===h?void 0:h.height)||"auto"});p((()=>{var t,e,i,o;y.data&&k({width:(null===(e=null===(t=y.data)||void 0===t?void 0:t.size)||void 0===e?void 0:e.width)||"auto",height:(null===(o=null===(i=y.data)||void 0===i?void 0:i.size)||void 0===o?void 0:o.height)||"auto"})}),[null===(u=y.data)||void 0===u?void 0:u.size]);const R=g((()=>{var t;return{minWidth:92,size:{width:E.width,height:E.height},maxWidth:(null===(t=z.options)||void 0===t?void 0:t.maxWidth)||800,lockAspectRatio:!0,resizeRatio:2,enable:{left:!S,right:!S},handleStyles:{left:{left:0},right:{right:0}},onResize:(t,e,i)=>{k({width:i.offsetWidth,height:i.offsetHeight})},onResizeStop:(t,e,i)=>{console.log("video editor editor.children",x.children),console.log("ReactEditor.findPath(editor, element)",m.findPath(x,y)),console.log("element",y),r.setNodes(x,{data:Object.assign(Object.assign({},y.data),{size:{width:i.offsetWidth,height:i.offsetHeight}})},{at:m.findPath(x,y),match:t=>a.isElement(t)&&"video"===t.type})},handleComponent:{left:l("div",Object.assign({contentEditable:!1,className:Bt.leftResizer},{children:l("div",{className:Bt.resizeItem})})),right:l("div",Object.assign({contentEditable:!1,className:Bt.rightResizer},{children:l("div",{className:Bt.resizeItem})}))}}}),[E.width,E.height,x]),W=!!(null===(f=y.data)||void 0===f?void 0:f.caption),H=!!y.data["data-src"]&&!y.data.url,M=()=>{St(document.body),j(null)},C=t=>{var e;if(null==t||t.stopPropagation(),null!==O)return M();const i=null===(e=null==t?void 0:t.currentTarget)||void 0===e?void 0:e.getBoundingClientRect();if(i){const t=i.top+i.height+164+20>window.innerHeight;Nt(document.body,{reserveScrollBarGap:!0}),j({left:i.right-i.width+Pt>window.innerWidth?window.innerWidth-Pt-i.width:i.right-i.width,top:t?i.top-82-i.height:i.top+i.height+5})}};if(!y.data.url&&!y.data["data-src"]&&!y.data.videoId){const{maxWidth:o=750,maxHeight:n=800}=z.options||{};return d("div",Object.assign({className:Bt.root,contentEditable:!1},{children:[l("div",{className:i(Bt.selectImg,{[Bt.selected]:N})}),l(Ct,Object.assign({attributes:t.attributes,element:t.element,editor:x,onUpload:null===(w=z.options)||void 0===w?void 0:w.onUpload,maxSizes:{maxWidth:o,maxHeight:n}},{children:!S&&d("div",{children:[d("button",Object.assign({type:"button",className:Bt.dotsOptions,onClick:C},{children:[l("span",{className:Bt.dot}),l("span",{className:Bt.dot}),l("span",{className:Bt.dot})]})),null!==O&&l(e.ElementOptions,{onClose:M,style:O,element:y,onCopy:M,onDelete:M,onDuplicate:M},y.id)]})})),t.children]}),y.id)}return l("div",Object.assign({contentEditable:!1,draggable:!1,className:i(Bt.root,{[Bt.extraMargin]:W,[Bt.loadingState]:H})},{children:d(Q,Object.assign({},R,{className:Bt.resizeLib},{children:[z.renderer.render(Object.assign(Object.assign({},t),{size:E})),l("div",{className:i(Bt.selectImg,{[Bt.selected]:N})}),H&&l("div",Object.assign({className:Bt.loader},{children:l(Mt,{})})),!S&&d("div",{children:[d("button",Object.assign({type:"button",className:Bt.dotsOptions,onClick:C},{children:[l("span",{className:Bt.dot}),l("span",{className:Bt.dot}),l("span",{className:Bt.dot})]})),null!==O&&l(e.ElementOptions,{onClose:M,style:O,element:y,onCopy:M,onDelete:M,onDuplicate:M},y.id)]})]}))}),y.id)}const Lt=o({type:"video",renderer:{editor:(t,e)=>i=>l(At,Object.assign({editor:t,plugin:e},i)),render:({attributes:e,element:i,children:o,size:n,HTMLAttributes:s})=>{var r,a,h,c;const p=(null==n?void 0:n.width)||(null===(a=null===(r=i.data)||void 0===r?void 0:r.size)||void 0===a?void 0:a.width)||"100%",u=(null==n?void 0:n.height)||(null===(c=null===(h=i.data)||void 0===h?void 0:h.size)||void 0===c?void 0:c.height)||400;if("string"==typeof i.data.provider&&i.data.videoId&&j[i.data.provider]){const n=j[i.data.provider];return d("div",Object.assign({},e,s,{className:t({element:i,HTMLAttributes:s,className:N.videoElement}),contentEditable:!1,draggable:!1},{children:[l("div",Object.assign({className:N.iframRoot},{children:l("div",Object.assign({className:N.iframeWrap},{children:l(n,{videoId:i.data.videoId})}))})),o]}))}return i.data.url||i.data["data-src"]?d("div",Object.assign({},e,{className:N.videoElement,contentEditable:!1,draggable:!1},{children:[l("video",Object.assign({controls:!0,preload:"metadata",playsInline:!0,src:i.data.url||i.data["data-src"]||"",width:p,height:u,onDragStart:t=>t.preventDefault()},s,{className:t({element:i,HTMLAttributes:s,className:N.video})})),o]})):l("div",Object.assign({},e,{className:N.videoElement,contentEditable:!1,draggable:!1},{children:o}))}},extendEditor(t){const{isVoid:e}=t;return t.isVoid=t=>t.type===Lt.getPlugin.type||e(t),t},events:{onKeyDown:(t,{defaultNode:e,hotkeys:i})=>o=>{var s;if("video"===n(t,null===(s=t.selection)||void 0===s?void 0:s.anchor.path,"highest").type&&t.selection)return console.log("hotkeys.isEnter(event)",i.isEnter(o)),i.isEnter(o)?(o.preventDefault(),void r.insertNodes(t,e,{mode:"highest"})):void 0}},defineElement:()=>({id:s(),type:"video",nodeType:"void",data:{url:null,size:{width:"auto",height:"auto"}},children:[{text:""}]}),createElement:(t,e)=>{var i;const o=Object.assign(Object.assign({},Lt.getPlugin.defineElement()),e);r.setNodes(t,o,{at:null===(i=t.selection)||void 0===i?void 0:i.anchor})},exports:{markdown:{serialize:(t,e)=>`<video preload controls src="${t.data.url}" height="${t.data.size.height}" width="${t.data.size.width}"></video>\n`},html:{serialize:t=>`<video preload controls src="${t.data.url}" height="${t.data.size.height}" width="${t.data.size.width}"></video>`,deserialize:{nodeName:"VIDEO",parse:t=>({url:t.getAttribute("src"),size:{height:"string"==typeof t.getAttribute("height")?Number(t.getAttribute("height")):"auto",width:"string"==typeof t.getAttribute("width")?Number(t.getAttribute("width")):"auto"}})}}},options:{searchString:"video media",displayLabel:"Video"}});export{Lt as default};
|
|
1
|
+
import{getElementClassname as t,UI_HELPERS as e,cx as i,createYooptaPlugin as o,getElementByPath as n,generateId as s}from"@yoopta/editor";import{Transforms as r,Element as a}from"slate";import{jsxs as d,jsx 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 f}from"react-dom";import{ReactEditor as m,useSelected as v,useReadOnly as b}from"slate-react";function w(t,e){var i={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(i[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(t);n<o.length;n++)e.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(t,o[n])&&(i[o[n]]=t[o[n]])}return i}function y(t,e,i,o){return new(i||(i=Promise))((function(n,s){function r(t){try{d(o.next(t))}catch(t){s(t)}}function a(t){try{d(o.throw(t))}catch(t){s(t)}}function d(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(r,a)}d((o=o.apply(t,e||[])).next())}))}function x(t,{threshold:e=0,root:i=null,rootMargin:o="0%",freezeOnceVisible:n=!1}={}){const[s,r]=c({}),a=s.isIntersecting&&n,d=([t])=>r(t);return p((()=>{const n=null==t?void 0:t.current;if(!window.IntersectionObserver||a||!n)return;const s=new IntersectionObserver(d,{threshold:e,root:i,rootMargin:o});return s.observe(n),()=>s.disconnect()}),[t,e,i,o,a]),s}function z(t,e){void 0===e&&(e={});var i=e.insertAt;if(t&&"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=t:n.appendChild(document.createTextNode(t))}}"function"==typeof SuppressedError&&SuppressedError;var N="TvZseAeh",S="EZu95fyq",j="dkxsZ5ZT",O="KsFU0JBg",E="D-8E3vsv",k="eEtEqZrx",R="_0icGyC6M";z(".TvZseAeh{margin:20px 0 10px;position:relative}.EZu95fyq{border-radius:1px;display:block;margin:0 auto;max-width:100%;object-fit:cover;pointer-events:auto}.dkxsZ5ZT{display:flex;height:0;justify-content:center;min-height:100px;padding-bottom:56.25%;position:relative;width:100%}.KsFU0JBg{background-color:#fff}.D-8E3vsv,.KsFU0JBg{border-radius:1px;height:100%;pointer-events:auto;width:100%}.D-8E3vsv,.KsFU0JBg,.eEtEqZrx{left:0;position:absolute;top:0}.eEtEqZrx{filter:blur(10px);object-fit:cover;transition:opacity .15s ease-in,filter .15s ease-in}._0icGyC6M{height:100%;position:relative;width:100%}");const W={vimeo:function(t){var{videoId:e}=t,i=w(t,["videoId"]);const o=u(null),[n,s]=c(null),[r,a]=c(!1),{isIntersecting:h}=x(o,{freezeOnceVisible:!0,rootMargin:"50%"});return p((()=>{fetch(`https://vimeo.com/api/v2/video/${e}.json`).then((t=>t.json())).then((t=>s(t[0].thumbnail_medium))).catch((()=>s(null)))}),[e]),d("div",Object.assign({ref:o,className:R},{children:[l("img",{src:n||"",alt:"vimeo_video_preview",width:"100%",height:"100%",className:k,style:{opacity:h&&r?0:1,zIndex:h&&r?-1:0}}),h&&l("iframe",Object.assign({title:"Video Player",src:`https://player.vimeo.com/video/${e}?badge=0&byline=0&portrait=0&title=0`,frameBorder:0,allowFullScreen:!0,onLoad:()=>a(!0),className:O},i))]}))},youtube:function(t){var{videoId:e}=t,i=w(t,["videoId"]);const o=u(null),[n,s]=c(!1),{isIntersecting:r}=x(o,{freezeOnceVisible:!0,rootMargin:"50%"});return d("div",Object.assign({ref:o,className:R},{children:[l("img",{src:`https://i.ytimg.com/vi/${e}/default.jpg`,alt:"youtube_video_preview",width:"100%",height:"100%",className:k,style:{opacity:r&&n?0:1,zIndex:r&&n?-1:0}}),r&&l("iframe",Object.assign({title:"Video Player",src:`https://www.youtube.com/embed/${e}`,frameBorder:0,onLoad:()=>s(!0),allowFullScreen:!0,className:O},i))]}))},dailymotion:function(t){var{videoId:e}=t,i=w(t,["videoId"]);const o=u(null),[n,s]=c(null),[r,a]=c(!1),{isIntersecting:h}=x(o,{freezeOnceVisible:!0,rootMargin:"50%"});return p((()=>{fetch((t=>`https://api.dailymotion.com/video/${t}?fields=thumbnail_url`)(e)).then((t=>t.json())).then((t=>s(t.thumbnail_url))).catch((()=>s(null)))}),[e]),d("div",Object.assign({ref:o,className:R},{children:[l("img",{src:n||"",alt:"daylimotion_video_preview",width:"100%",height:"100%",className:k,style:{opacity:h&&r?0:1,zIndex:h&&r?-1:0}}),h&&l("iframe",Object.assign({title:"Dailymotion Video Player",frameBorder:0,onLoad:()=>a(!0),src:`https://www.dailymotion.com/embed/video/${e}`,allowFullScreen:!0,className:O},i))]}))}};var H,M,C=(H=function(t,e){return H=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},H(t,e)},function(t,e){function i(){this.constructor=t}H(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),B=function(){return B=Object.assign||function(t){for(var e,i=1,o=arguments.length;i<o;i++)for(var n in e=arguments[i])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},B.apply(this,arguments)},A={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},L={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},P={width:"20px",height:"20px",position:"absolute"},D={top:B(B({},A),{top:"-5px"}),right:B(B({},L),{left:void 0,right:"-5px"}),bottom:B(B({},A),{top:void 0,bottom:"-5px"}),left:B(B({},L),{left:"-5px"}),topRight:B(B({},P),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:B(B({},P),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:B(B({},P),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:B(B({},P),{left:"-10px",top:"-10px",cursor:"nw-resize"})},I=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.onMouseDown=function(t){e.props.onResizeStart(t,e.props.direction)},e.onTouchStart=function(t){e.props.onResizeStart(t,e.props.direction)},e}return C(e,t),e.prototype.render=function(){return h.createElement("div",{className:this.props.className||"",style:B(B({position:"absolute",userSelect:"none"},D[this.props.direction]),this.props.replaceStyles||{}),onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart},this.props.children)},e}(h.PureComponent),_=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function o(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(o.prototype=i.prototype,new o)}}(),T=function(){return T=Object.assign||function(t){for(var e,i=1,o=arguments.length;i<o;i++)for(var n in e=arguments[i])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},T.apply(this,arguments)},V={width:"auto",height:"auto"},G=function(t,e,i){return Math.max(Math.min(t,i),e)},U=function(t,e){return Math.round(t/e)*e},F=function(t,e){return new RegExp(t,"i").test(e)},Y=function(t){return Boolean(t.touches&&t.touches.length)},X=function(t,e,i){void 0===i&&(i=0);var o=e.reduce((function(i,o,n){return Math.abs(o-t)<Math.abs(e[i]-t)?n:i}),0),n=Math.abs(e[o]-t);return 0===i||n<i?e[o]:t},Q=function(t){return"auto"===(t=t.toString())||t.endsWith("px")||t.endsWith("%")||t.endsWith("vh")||t.endsWith("vw")||t.endsWith("vmax")||t.endsWith("vmin")?t:t+"px"},q=function(t,e,i,o){if(t&&"string"==typeof t){if(t.endsWith("px"))return Number(t.replace("px",""));if(t.endsWith("%"))return e*(Number(t.replace("%",""))/100);if(t.endsWith("vw"))return i*(Number(t.replace("vw",""))/100);if(t.endsWith("vh"))return o*(Number(t.replace("vh",""))/100)}return t},J=["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"],Z="__resizable_base__",K=function(t){function e(e){var i=t.call(this,e)||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 t=i.parentNode;if(!t)return null;var e=i.window.document.createElement("div");return e.style.width="100%",e.style.height="100%",e.style.position="absolute",e.style.transform="scale(0, 0)",e.style.left="0",e.style.flex="0 0 100%",e.classList?e.classList.add(Z):e.className+=Z,t.appendChild(e),e},i.removeBase=function(t){var e=i.parentNode;e&&e.removeChild(t)},i.ref=function(t){t&&(i.resizable=t)},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 _(e,t),Object.defineProperty(e.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"window",{get:function(){return this.resizable&&this.resizable.ownerDocument?this.resizable.ownerDocument.defaultView:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||V},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){var t=0,e=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"),t="auto"!==this.resizable.style.width?this.resizable.offsetWidth:i,e="auto"!==this.resizable.style.height?this.resizable.offsetHeight:o,this.resizable.style.position=n}return{width:t,height:e}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sizeStyle",{get:function(){var t=this,e=this.props.size,i=function(e){if(void 0===t.state[e]||"auto"===t.state[e])return"auto";if(t.propsSize&&t.propsSize[e]&&t.propsSize[e].toString().endsWith("%")){if(t.state[e].toString().endsWith("%"))return t.state[e].toString();var i=t.getParentSize();return Number(t.state[e].toString().replace("px",""))/i[e]*100+"%"}return Q(t.state[e])};return{width:e&&void 0!==e.width&&!this.state.isResizing?Q(e.width):i("width"),height:e&&void 0!==e.height&&!this.state.isResizing?Q(e.height):i("height")}},enumerable:!1,configurable:!0}),e.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var t=this.appendBase();if(!t)return{width:0,height:0};var e=!1,i=this.parentNode.style.flexWrap;"wrap"!==i&&(e=!0,this.parentNode.style.flexWrap="wrap"),t.style.position="relative",t.style.minWidth="100%",t.style.minHeight="100%";var o={width:t.offsetWidth,height:t.offsetHeight};return e&&(this.parentNode.style.flexWrap=i),this.removeBase(t),o},e.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))},e.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))},e.prototype.componentDidMount=function(){if(this.resizable&&this.window){var t=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:"auto"!==t.flexBasis?t.flexBasis:void 0})}},e.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},e.prototype.createSizeForCssProperty=function(t,e){var i=this.propsSize&&this.propsSize[e];return"auto"!==this.state[e]||this.state.original[e]!==t||void 0!==i&&"auto"!==i?t:"auto"},e.prototype.calculateNewMaxFromBoundary=function(t,e){var i,o,n=this.props.boundsByDirection,s=this.state.direction,r=n&&F("left",s),a=n&&F("top",s);if("parent"===this.props.bounds){var d=this.parentNode;d&&(i=r?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=r?this.resizableRight:this.window.innerWidth-this.resizableLeft,o=a?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(i=r?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)&&(t=t&&t<i?t:i),o&&Number.isFinite(o)&&(e=e&&e<o?e:o),{maxWidth:t,maxHeight:e}},e.prototype.calculateNewSizeFromDirection=function(t,e){var i=this.props.scale||1,o=this.props.resizeRatio||1,n=this.state,s=n.direction,r=n.original,a=this.props,d=a.lockAspectRatio,l=a.lockAspectRatioExtraHeight,h=a.lockAspectRatioExtraWidth,c=r.width,p=r.height,u=l||0,g=h||0;return F("right",s)&&(c=r.width+(t-r.x)*o/i,d&&(p=(c-g)/this.ratio+u)),F("left",s)&&(c=r.width-(t-r.x)*o/i,d&&(p=(c-g)/this.ratio+u)),F("bottom",s)&&(p=r.height+(e-r.y)*o/i,d&&(c=(p-u)*this.ratio+g)),F("top",s)&&(p=r.height-(e-r.y)*o/i,d&&(c=(p-u)*this.ratio+g)),{newWidth:c,newHeight:p}},e.prototype.calculateNewSizeFromAspectRatio=function(t,e,i,o){var n=this.props,s=n.lockAspectRatio,r=n.lockAspectRatioExtraHeight,a=n.lockAspectRatioExtraWidth,d=void 0===o.width?10:o.width,l=void 0===i.width||i.width<0?t:i.width,h=void 0===o.height?10:o.height,c=void 0===i.height||i.height<0?e:i.height,p=r||0,u=a||0;if(s){var g=(h-p)*this.ratio+u,f=(c-p)*this.ratio+u,m=(d-u)/this.ratio+p,v=(l-u)/this.ratio+p,b=Math.max(d,g),w=Math.min(l,f),y=Math.max(h,m),x=Math.min(c,v);t=G(t,b,w),e=G(e,y,x)}else t=G(t,d,l),e=G(e,h,c);return{newWidth:t,newHeight:e}},e.prototype.setBoundingClientRect=function(){if("parent"===this.props.bounds){var t=this.parentNode;if(t){var e=t.getBoundingClientRect();this.parentLeft=e.left,this.parentTop=e.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,s=o.top,r=o.right,a=o.bottom;this.resizableLeft=n,this.resizableRight=r,this.resizableTop=s,this.resizableBottom=a}},e.prototype.onResizeStart=function(t,e){if(this.resizable&&this.window){var i,o=0,n=0;if(t.nativeEvent&&function(t){return Boolean((t.clientX||0===t.clientX)&&(t.clientY||0===t.clientY))}(t.nativeEvent)?(o=t.nativeEvent.clientX,n=t.nativeEvent.clientY):t.nativeEvent&&Y(t.nativeEvent)&&(o=t.nativeEvent.touches[0].clientX,n=t.nativeEvent.touches[0].clientY),this.props.onResizeStart)if(this.resizable)if(!1===this.props.onResizeStart(t,e,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 s=this.window.getComputedStyle(this.resizable);if("auto"!==s.flexBasis){var r=this.parentNode;if(r){var a=this.window.getComputedStyle(r).flexDirection;this.flexDir=a.startsWith("row")?"row":"column",i=s.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var d={original:{x:o,y:n,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:T(T({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(t.target).cursor||"auto"}),direction:e,flexBasis:i};this.setState(d)}},e.prototype.onMouseMove=function(t){var e=this;if(this.state.isResizing&&this.resizable&&this.window){if(this.window.TouchEvent&&Y(t))try{t.preventDefault(),t.stopPropagation()}catch(t){}var i=this.props,o=i.maxWidth,n=i.maxHeight,s=i.minWidth,r=i.minHeight,a=Y(t)?t.touches[0].clientX:t.clientX,d=Y(t)?t.touches[0].clientY:t.clientY,l=this.state,h=l.direction,c=l.original,p=l.width,u=l.height,g=this.getParentSize(),m=function(t,e,i,o,n,s,r){return o=q(o,t.width,e,i),n=q(n,t.height,e,i),s=q(s,t.width,e,i),r=q(r,t.height,e,i),{maxWidth:void 0===o?void 0:Number(o),maxHeight:void 0===n?void 0:Number(n),minWidth:void 0===s?void 0:Number(s),minHeight:void 0===r?void 0:Number(r)}}(g,this.window.innerWidth,this.window.innerHeight,o,n,s,r);o=m.maxWidth,n=m.maxHeight,s=m.minWidth,r=m.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:s,height:r});if(w=x.newWidth,b=x.newHeight,this.props.grid){var z=U(w,this.props.grid[0]),N=U(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(N-b)<=S?N:b}var j={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 O={width:this.createSizeForCssProperty(w,"width"),height:this.createSizeForCssProperty(b,"height")};"row"===this.flexDir?O.flexBasis=O.width:"column"===this.flexDir&&(O.flexBasis=O.height),f((function(){e.setState(O)})),this.props.onResize&&this.props.onResize(t,h,this.resizable,j)}},e.prototype.onMouseUp=function(t){var e=this.state,i=e.isResizing,o=e.direction,n=e.original;if(i&&this.resizable){var s={width:this.size.width-n.width,height:this.size.height-n.height};this.props.onResizeStop&&this.props.onResizeStop(t,o,this.resizable,s),this.props.size&&this.setState(this.props.size),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:T(T({},this.state.backgroundStyle),{cursor:"auto"})})}},e.prototype.updateSize=function(t){this.setState({width:t.width,height:t.height})},e.prototype.renderResizer=function(){var t=this,e=this.props,i=e.enable,o=e.handleStyles,n=e.handleClasses,s=e.handleWrapperStyle,r=e.handleWrapperClass,a=e.handleComponent;if(!i)return null;var d=Object.keys(i).map((function(e){return!1!==i[e]?h.createElement(I,{key:e,direction:e,onResizeStart:t.onResizeStart,replaceStyles:o&&o[e],className:n&&n[e]},a&&a[e]?a[e]:null):null}));return h.createElement("div",{className:r,style:s},d)},e.prototype.render=function(){var t=this,e=Object.keys(this.props).reduce((function(e,i){return-1!==J.indexOf(i)||(e[i]=t.props[i]),e}),{}),i=T(T(T({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,T({ref:this.ref,style:i,className:this.props.className},e),this.state.isResizing&&h.createElement("div",{style:this.state.backgroundStyle}),this.props.children,this.renderResizer())},e.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},e}(h.PureComponent);function $(){return $=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(t[o]=i[o])}return t},$.apply(this,arguments)}var tt=function(t){return h.createElement("svg",$({fill:"currentColor","aria-hidden":"true",viewBox:"0 0 24 24","data-testid":"uploadImage"},t),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"})))},et="rq2V2ceB",it="rc-sSm2o",ot="pa2jWsNN",nt="WCrDI0dy",st="d-YDdEGm",rt="zaYe5qHX",at="M0t11tGQ",dt="_9cpXcl96",lt="DZJetA3e",ht="oVy3BbqO M0t11tGQ",ct="GIpAKCJ0",pt="k7HVhRkA";z('.rq2V2ceB{position:fixed}.rc-sSm2o{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}.pa2jWsNN{box-shadow:inset 0 -1px 0 rgba(55,53,47,.09);display:flex;height:40px;padding:0 8px;width:100%;z-index:1}.WCrDI0dy,.pa2jWsNN{font-size:14px;position:relative}.WCrDI0dy{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}.d-YDdEGm:after{background-color:#37352f;bottom:0;content:"";height:2px;left:0;position:absolute;width:100%}.zaYe5qHX{display:flex;justify-content:center;margin-left:12px;margin-right:12px;margin-top:4px;padding-bottom:6px;padding-top:6px}.M0t11tGQ{border:1px solid rgba(55,53,47,.16);border-radius:4px;height:32px;padding-left:12px;padding-right:12px;transition:background 20ms ease-in 0s;user-select:none;white-space:nowrap}.M0t11tGQ,._9cpXcl96{cursor:pointer;width:100%}._9cpXcl96{align-items:center;display:inline-flex;font-size:14px;font-weight:500;height:100%;justify-content:center;line-height:1.2}.DZJetA3e{left:0;position:absolute;top:0;visibility:hidden}.oVy3BbqO{border:none!important;cursor:pointer!important;height:auto!important;padding-left:0!important;padding-right:0!important}.GIpAKCJ0{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}.GIpAKCJ0,.k7HVhRkA{align-items:center;border:none;border-radius:4px;display:flex;font-size:14px;width:100%}.k7HVhRkA{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 ut=({onChange:t})=>l("div",Object.assign({className:at},{children:d("label",Object.assign({htmlFor:"video-uploader",className:dt},{children:[l("input",{type:"file",id:"video-uploader",className:lt,accept:"video/*",onChange:e=>{const i=e.currentTarget.files;i&&i.length>0&&t(i[0])},multiple:!1}),"Upload file"]}))})),gt=({onEmbed:t})=>{const[e,i]=c("");return d("div",Object.assign({className:ht},{children:[l("input",{type:"text",placeholder:"Paste video link (Youtube, Vimeo, Dailymotion)",value:e,className:ct,onChange:t=>i(t.target.value)}),l("button",Object.assign({type:"button",className:pt,onClick:()=>t(e)},{children:"Embed video"}))]}))},ft=({activeTab:t="upload",style:o,switchTab:n,onChange:s,onClose:r,onEmbed:a})=>{const h="upload"===t,c="embed"===t;return l(e.Overlay,Object.assign({onClose:r},{children:l("div",Object.assign({className:et,style:o},{children:d("div",Object.assign({className:it},{children:[d("div",Object.assign({className:ot},{children:[l("button",Object.assign({type:"button",onClick:()=>n("upload"),className:i(nt,{[st]:h})},{children:"Upload"})),l("button",Object.assign({type:"button",onClick:()=>n("embed"),className:i(nt,{[st]:c})},{children:"Video link"}))]})),d("div",Object.assign({className:rt},{children:[h&&l(ut,{onChange:s}),c&&l(gt,{onEmbed:a})]}))]}))}))}))};var mt=!1;if("undefined"!=typeof window){var vt={get passive(){mt=!0}};window.addEventListener("testPassive",null,vt),window.removeEventListener("testPassive",null,vt)}var bt="undefined"!=typeof window&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||"MacIntel"===window.navigator.platform&&window.navigator.maxTouchPoints>1),wt=[],yt=!1,xt=-1,zt=void 0,Nt=void 0,St=void 0,jt=function(t){return wt.some((function(e){return!(!e.options.allowTouchMove||!e.options.allowTouchMove(t))}))},Ot=function(t){var e=t||window.event;return!!jt(e.target)||(e.touches.length>1||(e.preventDefault&&e.preventDefault(),!1))},Et=function(t,e){if(t){if(!wt.some((function(e){return e.targetElement===t}))){var i={targetElement:t,options:e||{}};wt=[].concat(function(t){if(Array.isArray(t)){for(var e=0,i=Array(t.length);e<t.length;e++)i[e]=t[e];return i}return Array.from(t)}(wt),[i]),bt?window.requestAnimationFrame((function(){if(void 0===Nt){Nt={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left};var t=window,e=t.scrollY,i=t.scrollX,o=t.innerHeight;document.body.style.position="fixed",document.body.style.top=-e,document.body.style.left=-i,setTimeout((function(){return window.requestAnimationFrame((function(){var t=o-window.innerHeight;t&&e>=o&&(document.body.style.top=-(e+t))}))}),300)}})):function(t){if(void 0===St){var e=!!t&&!0===t.reserveScrollBarGap,i=window.innerWidth-document.documentElement.clientWidth;if(e&&i>0){var o=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"),10);St=document.body.style.paddingRight,document.body.style.paddingRight=o+i+"px"}}void 0===zt&&(zt=document.body.style.overflow,document.body.style.overflow="hidden")}(e),bt&&(t.ontouchstart=function(t){1===t.targetTouches.length&&(xt=t.targetTouches[0].clientY)},t.ontouchmove=function(e){1===e.targetTouches.length&&function(t,e){var i=t.targetTouches[0].clientY-xt;!jt(t.target)&&(e&&0===e.scrollTop&&i>0||function(t){return!!t&&t.scrollHeight-t.scrollTop<=t.clientHeight}(e)&&i<0?Ot(t):t.stopPropagation())}(e,t)},yt||(document.addEventListener("touchmove",Ot,mt?{passive:!1}:void 0),yt=!0))}}else console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.")},kt=function(t){t?(wt=wt.filter((function(e){return e.targetElement!==t})),bt&&(t.ontouchstart=null,t.ontouchmove=null,yt&&0===wt.length&&(document.removeEventListener("touchmove",Ot,mt?{passive:!1}:void 0),yt=!1)),bt?function(){if(void 0!==Nt){var t=-parseInt(document.body.style.top,10),e=-parseInt(document.body.style.left,10);document.body.style.position=Nt.position,document.body.style.top=Nt.top,document.body.style.left=Nt.left,window.scrollTo(e,t),Nt=void 0}}():(void 0!==St&&(document.body.style.paddingRight=St,St=void 0),void 0!==zt&&(document.body.style.overflow=zt,zt=void 0))):console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.")};var Rt="ejxIcizu",Wt="tGCxkSAc",Ht="BAqjz8jz",Mt="tab3XKrp",Ct="UnxRu3H0";z(".ejxIcizu{margin:20px 0 10px;user-select:none}.ejxIcizu,.tGCxkSAc{position:relative;width:100%}.tGCxkSAc{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}.tGCxkSAc:hover{background-color:#e3e3e3}.BAqjz8jz{background-color:#efefef;color:rgba(55,53,47,.65);cursor:not-allowed;pointer-events:none}.tab3XKrp{margin-right:8px;user-select:none}.UnxRu3H0{left:50%;position:absolute;top:50%}");var Bt="tmpFyHNs",At="NdlfkJmx";z(".tmpFyHNs{height:100%;position:relative;width:100%}.tmpFyHNs .NdlfkJmx{background-color:#909090;border-radius:5rem;height:10px;position:absolute;top:50%;transform:translate(-50%,-50%);width:10px}.tmpFyHNs .NdlfkJmx:first-child{animation:p3veiLIQ 2s,_4Q-HiXe1 2s;animation-iteration-count:infinite;animation-timing-function:ease-in-out;left:calc(50% - 60px)}.tmpFyHNs .NdlfkJmx:nth-child(2){animation:p3veiLIQ 2s,NAkUMYzr 2s;animation-delay:.15s;animation-iteration-count:infinite;animation-timing-function:ease-in-out;left:calc(50% - 30px)}.tmpFyHNs .NdlfkJmx:nth-child(3){animation:p3veiLIQ 2s,_4Q-HiXe1 2s;animation-delay:.3s;animation-iteration-count:infinite;animation-timing-function:ease-in-out;left:50%}.tmpFyHNs .NdlfkJmx:nth-child(4){animation:p3veiLIQ 2s,NAkUMYzr 2s;animation-delay:.45s;animation-iteration-count:infinite;animation-timing-function:ease-in-out;left:calc(50% + 30px)}.tmpFyHNs .NdlfkJmx:nth-child(5){animation:p3veiLIQ 2s,_4Q-HiXe1 2s;animation-delay:.6s;animation-iteration-count:infinite;animation-timing-function:ease-in-out;left:calc(50% + 60px)}@keyframes p3veiLIQ{0%,15%{top:50%}45%,65%{top:42.5%}85%,to{top:50%}}@keyframes _4Q-HiXe1{0%,8%{background-color:#909090;height:10px}14%,34%{background-color:#f8f8f8;height:17.5px}46%,to{background-color:#909090;height:10px}}@keyframes NAkUMYzr{0%,8%{background-color:#909090;height:10px}14%,34%{background-color:#f8f8f8;height:32.5px}46%,to{background-color:#909090;height:10px}}");const Lt=()=>d("div",Object.assign({className:Bt},{children:[l("div",{className:At}),l("div",{className:At}),l("div",{className:At}),l("div",{className:At}),l("div",{className:At})]})),Pt=({element:t,attributes:e,maxSizes:o,children:n,editor:s,onUpload:h})=>{const[p,g]=c(null),[f,v]=c(!1),[b,w]=c("upload"),x=u(null),z=t=>{var e;if(t.stopPropagation(),null!==p)return kt(document.body),void g(null);const i=null===(e=x.current)||void 0===e?void 0:e.getBoundingClientRect();if(i){const t=i.top+i.height+88+20>window.innerHeight,e=!t;console.log({showAtTop:t,showAtBottom:e}),Et(document.body,{reserveScrollBarGap:!0}),g({left:i.left,top:t?i.top-88-5:i.top+i.height+5})}};return d("div",Object.assign({className:i(Rt,{[Ht]:f})},e,{contentEditable:!1},{children:[d("div",Object.assign({ref:x},{children:[d("button",Object.assign({className:Wt,onClick:z,disabled:f},{children:[f&&l("div",Object.assign({className:Ct},{children:l(Lt,{})})),l(tt,{className:Mt,width:24,height:24}),l("span",{children:"Click to add video"})]})),null!==p&&l(ft,{onChange:e=>y(void 0,void 0,void 0,(function*(){if(kt(document.body),g(null),v(!0),!h)return console.error("Provide `onUpload` props in Video options");try{const i=yield h(e),{width:n,height:d}=((t,e,i,o)=>{if(!t||!e)return{};const n=Math.min(i/t,o/e);return{width:t*n,height:e*n}})(i.width,i.height,o.maxWidth,o.maxHeight),l={data:{url:i.url,"data-src":void 0,size:{width:n||t.data.size.width,height:d||t.data.size.height}}};v(!1),r.setNodes(s,l,{at:m.findPath(s,t),match:t=>a.isElement(t)&&"video"===t.type})}catch(t){kt(document.body),g(null),v(!1)}})),onClose:z,activeTab:b,switchTab:t=>w(t),style:p,onEmbed:e=>y(void 0,void 0,void 0,(function*(){if(0===e.length)return;const i=(o=e).includes("youtube.com")||o.includes("youtu.be")?"youtube":o.includes("vimeo.com")?"vimeo":o.includes("dailymotion.com")||o.includes("dai.ly")?"dailymotion":null;var o;let n=null;if("youtube"===i?n=(t=>{const e=t.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/);return e&&11===e[2].length?e[2]:null})(e):"vimeo"===i?n=(t=>new URL(t).pathname.split("/")[1])(e):"dailymotion"===i&&(n=(t=>{var e=t.match(/^.+dailymotion.com\/(video|hub)\/([^_]+)[^#]*(#video=([^_&]+))?/);return null!==e?void 0!==e[4]?e[4]:e[2]:null})(e)),n)try{kt(document.body),g(null);const e={data:Object.assign(Object.assign({},t.data),{url:null,"data-src":void 0,size:{width:t.data.size.width,height:t.data.size.height},provider:i,videoId:n})};r.setNodes(s,e,{at:m.findPath(s,t),match:t=>a.isElement(t)&&"video"===t.type})}catch(t){kt(document.body),g(null)}}))})]})),n]}))};var Dt="jsof5eGh",It="_9ivUDLVr",_t="hD5QV2jP",Tt="M9o3j8I5",Vt="-dEl6QRc",Gt="_72L6ylPc WOn73-dw",Ut="OhmV3u2l WOn73-dw",Ft="fdfDEgiq",Yt="_7b-PdGXE",Xt="YKGzSDVj",Qt="yDd0Sn4a",qt="VZUnkjYn";z(".jsof5eGh{cursor:pointer;display:block;position:relative}.jsof5eGh:hover .WOn73-dw,.jsof5eGh:hover ._9ivUDLVr{opacity:1}.hD5QV2jP{pointer-events:none}.M9o3j8I5{margin:20px 0 30px}.-dEl6QRc{margin:0 auto}.WOn73-dw{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}._72L6ylPc{left:0;top:0}.OhmV3u2l{right:0;top:0}.fdfDEgiq{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}._7b-PdGXE{opacity:0}.YKGzSDVj{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}.yDd0Sn4a{left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}._9ivUDLVr{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}.VZUnkjYn{background-color:gray;border-radius:50%;min-height:3px;min-width:3px}");function Jt(t){var o,n,s,h,u,f,w;const{element:y,editor:x,plugin:z}=t,N=v(),S=b(),[j,O]=c(null),[E,k]=c({width:(null===(n=null===(o=y.data)||void 0===o?void 0:o.size)||void 0===n?void 0:n.width)||"auto",height:(null===(h=null===(s=y.data)||void 0===s?void 0:s.size)||void 0===h?void 0:h.height)||"auto"});p((()=>{var t,e,i,o;y.data&&k({width:(null===(e=null===(t=y.data)||void 0===t?void 0:t.size)||void 0===e?void 0:e.width)||"auto",height:(null===(o=null===(i=y.data)||void 0===i?void 0:i.size)||void 0===o?void 0:o.height)||"auto"})}),[null===(u=y.data)||void 0===u?void 0:u.size]);const R=g((()=>{var t;return{minWidth:92,size:{width:E.width,height:E.height},maxWidth:(null===(t=z.options)||void 0===t?void 0:t.maxWidth)||800,lockAspectRatio:!0,resizeRatio:2,enable:{left:!S,right:!S},handleStyles:{left:{left:0},right:{right:0}},onResize:(t,e,i)=>{k({width:i.offsetWidth,height:i.offsetHeight})},onResizeStop:(t,e,i)=>{console.log("video editor editor.children",x.children),console.log("ReactEditor.findPath(editor, element)",m.findPath(x,y)),console.log("element",y),r.setNodes(x,{data:Object.assign(Object.assign({},y.data),{size:{width:i.offsetWidth,height:i.offsetHeight}})},{at:m.findPath(x,y),match:t=>a.isElement(t)&&"video"===t.type})},handleComponent:{left:l("div",Object.assign({contentEditable:!1,className:Gt},{children:l("div",{className:Ft})})),right:l("div",Object.assign({contentEditable:!1,className:Ut},{children:l("div",{className:Ft})}))}}}),[E.width,E.height,x]),W=!!(null===(f=y.data)||void 0===f?void 0:f.caption),H=!!y.data["data-src"]&&!y.data.url,M=()=>{kt(document.body),O(null)},C=t=>{var e;if(null==t||t.stopPropagation(),null!==j)return M();const i=null===(e=null==t?void 0:t.currentTarget)||void 0===e?void 0:e.getBoundingClientRect();if(i){const t=i.top+i.height+164+20>window.innerHeight;Et(document.body,{reserveScrollBarGap:!0}),O({left:i.right-i.width+265>window.innerWidth?window.innerWidth-265-i.width:i.right-i.width,top:t?i.top-82-i.height:i.top+i.height+5})}};if(!y.data.url&&!y.data["data-src"]&&!y.data.videoId){const{maxWidth:o=750,maxHeight:n=800}=z.options||{};return d("div",Object.assign({className:Dt,contentEditable:!1},{children:[l("div",{className:i(Yt,{[Xt]:N})}),l(Pt,Object.assign({attributes:t.attributes,element:t.element,editor:x,onUpload:null===(w=z.options)||void 0===w?void 0:w.onUpload,maxSizes:{maxWidth:o,maxHeight:n}},{children:!S&&d("div",{children:[d("button",Object.assign({type:"button",className:It,onClick:C},{children:[l("span",{className:qt}),l("span",{className:qt}),l("span",{className:qt})]})),null!==j&&l(e.ElementOptions,{onClose:M,style:j,element:y,onCopy:M,onDelete:M,onDuplicate:M},y.id)]})})),t.children]}),y.id)}return l("div",Object.assign({contentEditable:!1,draggable:!1,className:i(Dt,{[Tt]:W,[_t]:H})},{children:d(K,Object.assign({},R,{className:Vt},{children:[z.renderer.render(Object.assign(Object.assign({},t),{size:E})),l("div",{className:i(Yt,{[Xt]:N})}),H&&l("div",Object.assign({className:Qt},{children:l(Lt,{})})),!S&&d("div",{children:[d("button",Object.assign({type:"button",className:It,onClick:C},{children:[l("span",{className:qt}),l("span",{className:qt}),l("span",{className:qt})]})),null!==j&&l(e.ElementOptions,{onClose:M,style:j,element:y,onCopy:M,onDelete:M,onDuplicate:M},y.id)]})]}))}),y.id)}const Zt=o({type:"video",renderer:{editor:(t,e)=>i=>l(Jt,Object.assign({editor:t,plugin:e},i)),render:({attributes:e,element:i,children:o,size:n,HTMLAttributes:s})=>{var r,a,h,c;const p=(null==n?void 0:n.width)||(null===(a=null===(r=i.data)||void 0===r?void 0:r.size)||void 0===a?void 0:a.width)||"100%",u=(null==n?void 0:n.height)||(null===(c=null===(h=i.data)||void 0===h?void 0:h.size)||void 0===c?void 0:c.height)||400;if("string"==typeof i.data.provider&&i.data.videoId&&W[i.data.provider]){const n=W[i.data.provider];return d("div",Object.assign({},e,s,{className:t({element:i,HTMLAttributes:s,className:N}),contentEditable:!1,draggable:!1},{children:[l("div",Object.assign({className:j},{children:l("div",Object.assign({className:E},{children:l(n,{videoId:i.data.videoId})}))})),o]}))}return i.data.url||i.data["data-src"]?d("div",Object.assign({},e,{className:N,contentEditable:!1,draggable:!1},{children:[l("video",Object.assign({controls:!0,preload:"metadata",playsInline:!0,src:i.data.url||i.data["data-src"]||"",width:p,height:u,onDragStart:t=>t.preventDefault()},s,{className:t({element:i,HTMLAttributes:s,className:S})})),o]})):l("div",Object.assign({},e,{className:N,contentEditable:!1,draggable:!1},{children:o}))}},extendEditor(t){const{isVoid:e}=t;return t.isVoid=t=>t.type===Zt.getPlugin.type||e(t),t},events:{onKeyDown:(t,{defaultNode:e,hotkeys:i})=>o=>{var s;if("video"===n(t,null===(s=t.selection)||void 0===s?void 0:s.anchor.path,"highest").type&&t.selection)return console.log("hotkeys.isEnter(event)",i.isEnter(o)),i.isEnter(o)?(o.preventDefault(),void r.insertNodes(t,e,{mode:"highest"})):void 0}},defineElement:()=>({id:s(),type:"video",nodeType:"void",data:{url:null,size:{width:"auto",height:"auto"}},children:[{text:""}]}),createElement:(t,e)=>{var i;const o=Object.assign(Object.assign({},Zt.getPlugin.defineElement()),e);r.setNodes(t,o,{at:null===(i=t.selection)||void 0===i?void 0:i.anchor})},exports:{markdown:{serialize:(t,e)=>`<video preload controls src="${t.data.url}" height="${t.data.size.height}" width="${t.data.size.width}"></video>\n`},html:{serialize:t=>`<video preload controls src="${t.data.url}" height="${t.data.size.height}" width="${t.data.size.width}"></video>`,deserialize:{nodeName:"VIDEO",parse:t=>({url:t.getAttribute("src"),size:{height:"string"==typeof t.getAttribute("height")?Number(t.getAttribute("height")):"auto",width:"string"==typeof t.getAttribute("width")?Number(t.getAttribute("width")):"auto"}})}}},options:{searchString:"video media",displayLabel:"Video"}});export{Zt as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yoopta/video",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.16-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.18-rc",
|
|
18
18
|
"react": ">=17.0.2",
|
|
19
19
|
"react-dom": ">=17.0.2",
|
|
20
20
|
"slate": ">=0.72.3",
|