| | |
| | | (()=>{"use strict";var e,o={128:()=>{const e=window.wp.blocks,o=window.wp.i18n,s=window.wp.blockEditor,i=window.wp.components,r=window.ReactJSXRuntime,l=["video/mp4","video/webm","video/ogg","video/ogv"],n=JSON.parse('{"UU":"jvb/video-cover"}');(0,e.registerBlockType)(n.UU,{edit:function({attributes:e,setAttributes:n}){const{posterId:d,posterUrl:t,videoSources:c,mobileSources:a,fadeEffect:v}=e,p=(0,s.useBlockProps)({className:"video-cover-editor"}),m=(e,o=!1)=>{const s={id:e.id,url:e.url,mime:e.mime};o?a.some((o=>o.mime===e.mime))||n({mobileSources:[...a,s]}):c.some((o=>o.mime===e.mime))||n({videoSources:[...c,s]})},j=(e,s=!1)=>0===e.length?null:(0,r.jsx)("ul",{className:"video-source-list",children:e.map(((e,l)=>(0,r.jsxs)("li",{className:"video-source-item",children:[(0,r.jsx)("span",{className:"video-source-mime",children:e.mime}),(0,r.jsx)(i.Button,{isDestructive:!0,isSmall:!0,onClick:()=>((e,o=!1)=>{if(o){const o=[...a];o.splice(e,1),n({mobileSources:o})}else{const o=[...c];o.splice(e,1),n({videoSources:o})}})(l,s),children:(0,o.__)("Remove","jvb")})]},l)))});return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s.InspectorControls,{children:(0,r.jsxs)(i.PanelBody,{title:(0,o.__)("Video Settings","jvb"),initialOpen:!0,children:[(0,r.jsx)(i.BaseControl,{label:(0,o.__)("Poster Image","jvb"),help:(0,o.__)("Image shown while video loads","jvb"),children:(0,r.jsx)(s.MediaUploadCheck,{children:(0,r.jsx)(s.MediaUpload,{onSelect:e=>{n({posterId:e.id,posterUrl:e.url})},allowedTypes:["image"],value:d,render:({open:e})=>(0,r.jsxs)(r.Fragment,{children:[t&&(0,r.jsx)("img",{src:t,alt:(0,o.__)("Poster preview","jvb"),style:{maxWidth:"100%",marginBottom:"10px"}}),(0,r.jsx)(i.Button,{onClick:e,variant:t?"secondary":"primary",children:t?(0,o.__)("Change Poster","jvb"):(0,o.__)("Select Poster","jvb")}),t&&(0,r.jsx)(i.Button,{isDestructive:!0,onClick:()=>n({posterId:0,posterUrl:""}),style:{marginLeft:"10px"},children:(0,o.__)("Remove","jvb")})]})})})}),(0,r.jsxs)(i.BaseControl,{label:(0,o.__)("Desktop Video Sources","jvb"),help:(0,o.__)("Add multiple formats for better browser support","jvb"),children:[j(c,!1),(0,r.jsx)(s.MediaUploadCheck,{children:(0,r.jsx)(s.MediaUpload,{onSelect:e=>m(e,!1),allowedTypes:l,render:({open:e})=>(0,r.jsx)(i.Button,{onClick:e,variant:"secondary",children:(0,o.__)("Add Desktop Video","jvb")})})})]}),(0,r.jsxs)(i.BaseControl,{label:(0,o.__)("Mobile Video Sources (Optional)","jvb"),help:(0,o.__)("Smaller videos for mobile devices","jvb"),children:[j(a,!0),(0,r.jsx)(s.MediaUploadCheck,{children:(0,r.jsx)(s.MediaUpload,{onSelect:e=>m(e,!0),allowedTypes:l,render:({open:e})=>(0,r.jsx)(i.Button,{onClick:e,variant:"secondary",children:(0,o.__)("Add Mobile Video","jvb")})})})]}),(0,r.jsx)(i.ToggleControl,{label:(0,o.__)("Fade Effect","jvb"),help:(0,o.__)("Add fade class to video element","jvb"),checked:v,onChange:e=>n({fadeEffect:e})})]})}),(0,r.jsx)("div",{...p,children:t?(0,r.jsxs)("div",{className:"video-cover-preview",children:[(0,r.jsx)("img",{src:t,alt:(0,o.__)("Video poster","jvb")}),(0,r.jsx)("div",{className:"video-overlay",children:(0,r.jsxs)("p",{children:[c.length," ",(0,o.__)("desktop source(s)","jvb"),a.length>0&&`, ${a.length} ${(0,o.__)("mobile source(s)","jvb")}`]})})]}):(0,r.jsx)("div",{className:"video-cover-placeholder",children:(0,r.jsx)("p",{children:(0,o.__)("Configure video sources in the sidebar →","jvb")})})}),(0,r.jsx)("div",{className:"inner-blocks",children:(0,r.jsx)(s.InnerBlocks,{})})]})},save:()=>null})}},s={};function i(e){var r=s[e];if(void 0!==r)return r.exports;var l=s[e]={exports:{}};return o[e](l,l.exports,i),l.exports}i.m=o,e=[],i.O=(o,s,r,l)=>{if(!s){var n=1/0;for(a=0;a<e.length;a++){for(var[s,r,l]=e[a],d=!0,t=0;t<s.length;t++)(!1&l||n>=l)&&Object.keys(i.O).every((e=>i.O[e](s[t])))?s.splice(t--,1):(d=!1,l<n&&(n=l));if(d){e.splice(a--,1);var c=r();void 0!==c&&(o=c)}}return o}l=l||0;for(var a=e.length;a>0&&e[a-1][2]>l;a--)e[a]=e[a-1];e[a]=[s,r,l]},i.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),(()=>{var e={205:0,601:0};i.O.j=o=>0===e[o];var o=(o,s)=>{var r,l,[n,d,t]=s,c=0;if(n.some((o=>0!==e[o]))){for(r in d)i.o(d,r)&&(i.m[r]=d[r]);if(t)var a=t(i)}for(o&&o(s);c<n.length;c++)l=n[c],i.o(e,l)&&e[l]&&e[l][0](),e[l]=0;return i.O(a)},s=globalThis.webpackChunkjvb=globalThis.webpackChunkjvb||[];s.forEach(o.bind(null,0)),s.push=o.bind(null,s.push.bind(s))})();var r=i.O(void 0,[601],(()=>i(128)));r=i.O(r)})(); |
| | | /******/ (() => { // webpackBootstrap |
| | | /******/ "use strict"; |
| | | /******/ var __webpack_modules__ = ({ |
| | | |
| | | /***/ "./src/video/edit.js" |
| | | /*!***************************!*\ |
| | | !*** ./src/video/edit.js ***! |
| | | \***************************/ |
| | | (__unused_webpack_module, __webpack_exports__, __webpack_require__) { |
| | | |
| | | __webpack_require__.r(__webpack_exports__); |
| | | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| | | /* harmony export */ "default": () => (/* binding */ Edit) |
| | | /* harmony export */ }); |
| | | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| | | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__); |
| | | /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); |
| | | /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__); |
| | | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); |
| | | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__); |
| | | /* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./editor.scss */ "./src/video/editor.scss"); |
| | | /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime"); |
| | | /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__); |
| | | //edit.js |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | const ALLOWED_VIDEO_TYPES = ['video']; |
| | | const INNER_BLOCKS_TEMPLATE = [['core/heading', { |
| | | level: 1, |
| | | placeholder: 'Add heading...', |
| | | textAlign: 'center' |
| | | }], ['core/paragraph', { |
| | | placeholder: 'Add description...', |
| | | align: 'center' |
| | | }], ['core/buttons', { |
| | | layout: { |
| | | type: 'flex', |
| | | justifyContent: 'center' |
| | | } |
| | | }]]; |
| | | function Edit({ |
| | | attributes, |
| | | setAttributes |
| | | }) { |
| | | const { |
| | | posterId, |
| | | posterUrl, |
| | | videoSources, |
| | | fadeEffect, |
| | | overlayOpacity, |
| | | contentAlignment, |
| | | minHeight |
| | | } = attributes; |
| | | const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps)({ |
| | | className: 'video-cover-editor', |
| | | style: { |
| | | minHeight: minHeight ? `${minHeight}px` : undefined |
| | | } |
| | | }); |
| | | const innerBlocksProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useInnerBlocksProps)({ |
| | | className: 'video-cover-content' |
| | | }, { |
| | | template: INNER_BLOCKS_TEMPLATE, |
| | | templateLock: false |
| | | }); |
| | | const onSelectPoster = media => { |
| | | setAttributes({ |
| | | posterId: media.id, |
| | | posterUrl: media.url |
| | | }); |
| | | }; |
| | | const onSelectVideos = mediaItems => { |
| | | // multiple=true returns an array |
| | | const items = Array.isArray(mediaItems) ? mediaItems : [mediaItems]; |
| | | const newSources = items.filter(media => !videoSources.some(s => s.id === media.id)).map(media => ({ |
| | | id: media.id, |
| | | url: media.url, |
| | | mime: media.mime |
| | | })); |
| | | if (newSources.length) { |
| | | setAttributes({ |
| | | videoSources: [...videoSources, ...newSources] |
| | | }); |
| | | } |
| | | }; |
| | | const removeVideoSource = index => { |
| | | const updated = [...videoSources]; |
| | | updated.splice(index, 1); |
| | | setAttributes({ |
| | | videoSources: updated |
| | | }); |
| | | }; |
| | | const renderVideoSourceList = (sources, isMobile = false) => { |
| | | if (sources.length === 0) return null; |
| | | return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("ul", { |
| | | className: "video-source-list", |
| | | children: sources.map((source, index) => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("li", { |
| | | className: "video-source-item", |
| | | children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("span", { |
| | | className: "video-source-mime", |
| | | children: source.mime |
| | | }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Button, { |
| | | isDestructive: true, |
| | | isSmall: true, |
| | | onClick: () => removeVideoSource(index, isMobile), |
| | | children: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Remove', 'jvb') |
| | | })] |
| | | }, index)) |
| | | }); |
| | | }; |
| | | return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.Fragment, { |
| | | children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.InspectorControls, { |
| | | children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.PanelBody, { |
| | | title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Video Settings', 'jvb'), |
| | | initialOpen: true, |
| | | children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.BaseControl, { |
| | | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Poster Image', 'jvb'), |
| | | help: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Image shown while video loads', 'jvb'), |
| | | children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.MediaUploadCheck, { |
| | | children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.MediaUpload, { |
| | | onSelect: onSelectPoster, |
| | | allowedTypes: ['image'], |
| | | value: posterId, |
| | | render: ({ |
| | | open |
| | | }) => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.Fragment, { |
| | | children: [posterUrl && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("img", { |
| | | src: posterUrl, |
| | | alt: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Poster preview', 'jvb'), |
| | | style: { |
| | | maxWidth: '100%', |
| | | marginBottom: '10px' |
| | | } |
| | | }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Button, { |
| | | onClick: open, |
| | | variant: posterUrl ? 'secondary' : 'primary', |
| | | children: posterUrl ? (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Change Poster', 'jvb') : (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Select Poster', 'jvb') |
| | | }), posterUrl && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Button, { |
| | | isDestructive: true, |
| | | onClick: () => setAttributes({ |
| | | posterId: 0, |
| | | posterUrl: '' |
| | | }), |
| | | style: { |
| | | marginLeft: '10px' |
| | | }, |
| | | children: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Remove', 'jvb') |
| | | })] |
| | | }) |
| | | }) |
| | | }) |
| | | }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.BaseControl, { |
| | | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Video Sources', 'jvb'), |
| | | help: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Add multiple formats for better browser support (mp4, webm, etc.)', 'jvb'), |
| | | children: [videoSources.length > 0 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("ul", { |
| | | className: "video-source-list", |
| | | children: videoSources.map((source, index) => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("li", { |
| | | className: "video-source-item", |
| | | children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("span", { |
| | | className: "video-source-mime", |
| | | children: source.mime |
| | | }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Button, { |
| | | isDestructive: true, |
| | | isSmall: true, |
| | | onClick: () => removeVideoSource(index), |
| | | children: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Remove', 'jvb') |
| | | })] |
| | | }, index)) |
| | | }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.MediaUploadCheck, { |
| | | children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.MediaUpload, { |
| | | multiple: true, |
| | | onSelect: onSelectVideos, |
| | | allowedTypes: ALLOWED_VIDEO_TYPES, |
| | | render: ({ |
| | | open |
| | | }) => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Button, { |
| | | onClick: open, |
| | | variant: "secondary", |
| | | children: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Add Video', 'jvb') |
| | | }) |
| | | }) |
| | | })] |
| | | }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.ToggleControl, { |
| | | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Fade Effect', 'jvb'), |
| | | help: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Add fade class to video element', 'jvb'), |
| | | checked: fadeEffect, |
| | | onChange: value => setAttributes({ |
| | | fadeEffect: value |
| | | }) |
| | | })] |
| | | }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.PanelBody, { |
| | | title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Overlay Settings', 'jvb'), |
| | | initialOpen: true, |
| | | children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.RangeControl, { |
| | | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Overlay Opacity', 'jvb'), |
| | | help: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Darken video for better text readability', 'jvb'), |
| | | value: overlayOpacity, |
| | | onChange: value => setAttributes({ |
| | | overlayOpacity: value |
| | | }), |
| | | min: 0, |
| | | max: 100, |
| | | step: 5 |
| | | }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.SelectControl, { |
| | | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Content Alignment', 'jvb'), |
| | | value: contentAlignment, |
| | | options: [{ |
| | | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Top Left', 'jvb'), |
| | | value: 'top-left' |
| | | }, { |
| | | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Top Center', 'jvb'), |
| | | value: 'top-center' |
| | | }, { |
| | | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Top Right', 'jvb'), |
| | | value: 'top-right' |
| | | }, { |
| | | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Center Left', 'jvb'), |
| | | value: 'center-left' |
| | | }, { |
| | | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Center', 'jvb'), |
| | | value: 'center' |
| | | }, { |
| | | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Center Right', 'jvb'), |
| | | value: 'center-right' |
| | | }, { |
| | | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Bottom Left', 'jvb'), |
| | | value: 'bottom-left' |
| | | }, { |
| | | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Bottom Center', 'jvb'), |
| | | value: 'bottom-center' |
| | | }, { |
| | | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Bottom Right', 'jvb'), |
| | | value: 'bottom-right' |
| | | }], |
| | | onChange: value => setAttributes({ |
| | | contentAlignment: value |
| | | }) |
| | | }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.RangeControl, { |
| | | label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Minimum Height', 'jvb'), |
| | | help: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Minimum height in pixels (leave 0 for auto)', 'jvb'), |
| | | value: minHeight, |
| | | onChange: value => setAttributes({ |
| | | minHeight: value |
| | | }), |
| | | min: 0, |
| | | max: 1000, |
| | | step: 50 |
| | | })] |
| | | })] |
| | | }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("div", { |
| | | ...blockProps, |
| | | children: posterUrl || videoSources.length > 0 ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", { |
| | | className: "video-cover-preview", |
| | | children: [posterUrl && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.Fragment, { |
| | | children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("img", { |
| | | src: posterUrl, |
| | | alt: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Video poster', 'jvb') |
| | | }), overlayOpacity > 0 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("div", { |
| | | className: "video-overlay-preview", |
| | | style: { |
| | | opacity: overlayOpacity / 100 |
| | | } |
| | | })] |
| | | }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("div", { |
| | | className: `video-cover-content-preview align-${contentAlignment}`, |
| | | children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("div", { |
| | | ...innerBlocksProps |
| | | }) |
| | | }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("div", { |
| | | className: "video-info", |
| | | children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("p", { |
| | | children: [videoSources.length, " ", (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('desktop source(s)', 'jvb')] |
| | | }) |
| | | })] |
| | | }) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("div", { |
| | | className: "video-cover-placeholder", |
| | | children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("p", { |
| | | children: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Configure video sources in the sidebar →', 'jvb') |
| | | }) |
| | | }) |
| | | })] |
| | | }); |
| | | } |
| | | |
| | | /***/ }, |
| | | |
| | | /***/ "./src/video/index.js" |
| | | /*!****************************!*\ |
| | | !*** ./src/video/index.js ***! |
| | | \****************************/ |
| | | (__unused_webpack_module, __webpack_exports__, __webpack_require__) { |
| | | |
| | | __webpack_require__.r(__webpack_exports__); |
| | | /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); |
| | | /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__); |
| | | /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); |
| | | /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__); |
| | | /* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./style.scss */ "./src/video/style.scss"); |
| | | /* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./edit */ "./src/video/edit.js"); |
| | | /* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./block.json */ "./src/video/block.json"); |
| | | /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime"); |
| | | /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__); |
| | | /* index.js */ |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_4__.name, { |
| | | edit: _edit__WEBPACK_IMPORTED_MODULE_3__["default"], |
| | | save: ({ |
| | | attributes |
| | | }) => { |
| | | const blockProps = _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps.save({ |
| | | className: 'video-cover-wrapper-placeholder' |
| | | }); |
| | | return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div", { |
| | | ...blockProps, |
| | | children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.InnerBlocks.Content, {}) |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | /***/ }, |
| | | |
| | | /***/ "./src/video/editor.scss" |
| | | /*!*******************************!*\ |
| | | !*** ./src/video/editor.scss ***! |
| | | \*******************************/ |
| | | (__unused_webpack_module, __webpack_exports__, __webpack_require__) { |
| | | |
| | | __webpack_require__.r(__webpack_exports__); |
| | | // extracted by mini-css-extract-plugin |
| | | |
| | | |
| | | /***/ }, |
| | | |
| | | /***/ "./src/video/style.scss" |
| | | /*!******************************!*\ |
| | | !*** ./src/video/style.scss ***! |
| | | \******************************/ |
| | | (__unused_webpack_module, __webpack_exports__, __webpack_require__) { |
| | | |
| | | __webpack_require__.r(__webpack_exports__); |
| | | // extracted by mini-css-extract-plugin |
| | | |
| | | |
| | | /***/ }, |
| | | |
| | | /***/ "react/jsx-runtime" |
| | | /*!**********************************!*\ |
| | | !*** external "ReactJSXRuntime" ***! |
| | | \**********************************/ |
| | | (module) { |
| | | |
| | | module.exports = window["ReactJSXRuntime"]; |
| | | |
| | | /***/ }, |
| | | |
| | | /***/ "@wordpress/block-editor" |
| | | /*!*************************************!*\ |
| | | !*** external ["wp","blockEditor"] ***! |
| | | \*************************************/ |
| | | (module) { |
| | | |
| | | module.exports = window["wp"]["blockEditor"]; |
| | | |
| | | /***/ }, |
| | | |
| | | /***/ "@wordpress/blocks" |
| | | /*!********************************!*\ |
| | | !*** external ["wp","blocks"] ***! |
| | | \********************************/ |
| | | (module) { |
| | | |
| | | module.exports = window["wp"]["blocks"]; |
| | | |
| | | /***/ }, |
| | | |
| | | /***/ "@wordpress/components" |
| | | /*!************************************!*\ |
| | | !*** external ["wp","components"] ***! |
| | | \************************************/ |
| | | (module) { |
| | | |
| | | module.exports = window["wp"]["components"]; |
| | | |
| | | /***/ }, |
| | | |
| | | /***/ "@wordpress/i18n" |
| | | /*!******************************!*\ |
| | | !*** external ["wp","i18n"] ***! |
| | | \******************************/ |
| | | (module) { |
| | | |
| | | module.exports = window["wp"]["i18n"]; |
| | | |
| | | /***/ }, |
| | | |
| | | /***/ "./src/video/block.json" |
| | | /*!******************************!*\ |
| | | !*** ./src/video/block.json ***! |
| | | \******************************/ |
| | | (module) { |
| | | |
| | | module.exports = /*#__PURE__*/JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"jvb/video","version":"1.0.0","title":"Video Cover","category":"jvb","icon":"video-alt3","description":"Self-hosted video cover with poster and multiple format support","supports":{"html":false,"align":["wide","full"],"spacing":{"margin":true,"padding":true},"color":{"background":true,"text":true}},"attributes":{"title":{"type":"string","default":""},"description":{"type":"string","default":""},"posterId":{"type":"number","default":0},"posterUrl":{"type":"string","default":""},"videoSources":{"type":"array","default":[],"items":{"type":"object","properties":{"id":{"type":"number"},"url":{"type":"string"},"mime":{"type":"string"}}}},"fadeEffect":{"type":"boolean","default":false},"overlayOpacity":{"type":"number","default":0},"contentAlignment":{"type":"string","default":"center"},"minHeight":{"type":"number","default":0}},"textdomain":"jvb","editorScript":"file:./index.js","viewScript":"file:./view.js","editorStyle":"file:./index.css","style":"file:./style-index.css"}'); |
| | | |
| | | /***/ } |
| | | |
| | | /******/ }); |
| | | /************************************************************************/ |
| | | /******/ // The module cache |
| | | /******/ var __webpack_module_cache__ = {}; |
| | | /******/ |
| | | /******/ // The require function |
| | | /******/ function __webpack_require__(moduleId) { |
| | | /******/ // Check if module is in cache |
| | | /******/ var cachedModule = __webpack_module_cache__[moduleId]; |
| | | /******/ if (cachedModule !== undefined) { |
| | | /******/ return cachedModule.exports; |
| | | /******/ } |
| | | /******/ // Create a new module (and put it into the cache) |
| | | /******/ var module = __webpack_module_cache__[moduleId] = { |
| | | /******/ // no module.id needed |
| | | /******/ // no module.loaded needed |
| | | /******/ exports: {} |
| | | /******/ }; |
| | | /******/ |
| | | /******/ // Execute the module function |
| | | /******/ if (!(moduleId in __webpack_modules__)) { |
| | | /******/ delete __webpack_module_cache__[moduleId]; |
| | | /******/ var e = new Error("Cannot find module '" + moduleId + "'"); |
| | | /******/ e.code = 'MODULE_NOT_FOUND'; |
| | | /******/ throw e; |
| | | /******/ } |
| | | /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); |
| | | /******/ |
| | | /******/ // Return the exports of the module |
| | | /******/ return module.exports; |
| | | /******/ } |
| | | /******/ |
| | | /******/ // expose the modules object (__webpack_modules__) |
| | | /******/ __webpack_require__.m = __webpack_modules__; |
| | | /******/ |
| | | /************************************************************************/ |
| | | /******/ /* webpack/runtime/chunk loaded */ |
| | | /******/ (() => { |
| | | /******/ var deferred = []; |
| | | /******/ __webpack_require__.O = (result, chunkIds, fn, priority) => { |
| | | /******/ if(chunkIds) { |
| | | /******/ priority = priority || 0; |
| | | /******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1]; |
| | | /******/ deferred[i] = [chunkIds, fn, priority]; |
| | | /******/ return; |
| | | /******/ } |
| | | /******/ var notFulfilled = Infinity; |
| | | /******/ for (var i = 0; i < deferred.length; i++) { |
| | | /******/ var [chunkIds, fn, priority] = deferred[i]; |
| | | /******/ var fulfilled = true; |
| | | /******/ for (var j = 0; j < chunkIds.length; j++) { |
| | | /******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) { |
| | | /******/ chunkIds.splice(j--, 1); |
| | | /******/ } else { |
| | | /******/ fulfilled = false; |
| | | /******/ if(priority < notFulfilled) notFulfilled = priority; |
| | | /******/ } |
| | | /******/ } |
| | | /******/ if(fulfilled) { |
| | | /******/ deferred.splice(i--, 1) |
| | | /******/ var r = fn(); |
| | | /******/ if (r !== undefined) result = r; |
| | | /******/ } |
| | | /******/ } |
| | | /******/ return result; |
| | | /******/ }; |
| | | /******/ })(); |
| | | /******/ |
| | | /******/ /* webpack/runtime/compat get default export */ |
| | | /******/ (() => { |
| | | /******/ // getDefaultExport function for compatibility with non-harmony modules |
| | | /******/ __webpack_require__.n = (module) => { |
| | | /******/ var getter = module && module.__esModule ? |
| | | /******/ () => (module['default']) : |
| | | /******/ () => (module); |
| | | /******/ __webpack_require__.d(getter, { a: getter }); |
| | | /******/ return getter; |
| | | /******/ }; |
| | | /******/ })(); |
| | | /******/ |
| | | /******/ /* webpack/runtime/define property getters */ |
| | | /******/ (() => { |
| | | /******/ // define getter functions for harmony exports |
| | | /******/ __webpack_require__.d = (exports, definition) => { |
| | | /******/ for(var key in definition) { |
| | | /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
| | | /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
| | | /******/ } |
| | | /******/ } |
| | | /******/ }; |
| | | /******/ })(); |
| | | /******/ |
| | | /******/ /* webpack/runtime/hasOwnProperty shorthand */ |
| | | /******/ (() => { |
| | | /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) |
| | | /******/ })(); |
| | | /******/ |
| | | /******/ /* webpack/runtime/make namespace object */ |
| | | /******/ (() => { |
| | | /******/ // define __esModule on exports |
| | | /******/ __webpack_require__.r = (exports) => { |
| | | /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
| | | /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
| | | /******/ } |
| | | /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
| | | /******/ }; |
| | | /******/ })(); |
| | | /******/ |
| | | /******/ /* webpack/runtime/jsonp chunk loading */ |
| | | /******/ (() => { |
| | | /******/ // no baseURI |
| | | /******/ |
| | | /******/ // object to store loaded and loading chunks |
| | | /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched |
| | | /******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded |
| | | /******/ var installedChunks = { |
| | | /******/ "video/index": 0, |
| | | /******/ "video/style-index": 0 |
| | | /******/ }; |
| | | /******/ |
| | | /******/ // no chunk on demand loading |
| | | /******/ |
| | | /******/ // no prefetching |
| | | /******/ |
| | | /******/ // no preloaded |
| | | /******/ |
| | | /******/ // no HMR |
| | | /******/ |
| | | /******/ // no HMR manifest |
| | | /******/ |
| | | /******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0); |
| | | /******/ |
| | | /******/ // install a JSONP callback for chunk loading |
| | | /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => { |
| | | /******/ var [chunkIds, moreModules, runtime] = data; |
| | | /******/ // add "moreModules" to the modules object, |
| | | /******/ // then flag all "chunkIds" as loaded and fire callback |
| | | /******/ var moduleId, chunkId, i = 0; |
| | | /******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) { |
| | | /******/ for(moduleId in moreModules) { |
| | | /******/ if(__webpack_require__.o(moreModules, moduleId)) { |
| | | /******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; |
| | | /******/ } |
| | | /******/ } |
| | | /******/ if(runtime) var result = runtime(__webpack_require__); |
| | | /******/ } |
| | | /******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); |
| | | /******/ for(;i < chunkIds.length; i++) { |
| | | /******/ chunkId = chunkIds[i]; |
| | | /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { |
| | | /******/ installedChunks[chunkId][0](); |
| | | /******/ } |
| | | /******/ installedChunks[chunkId] = 0; |
| | | /******/ } |
| | | /******/ return __webpack_require__.O(result); |
| | | /******/ } |
| | | /******/ |
| | | /******/ var chunkLoadingGlobal = globalThis["webpackChunkjvb"] = globalThis["webpackChunkjvb"] || []; |
| | | /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); |
| | | /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); |
| | | /******/ })(); |
| | | /******/ |
| | | /************************************************************************/ |
| | | /******/ |
| | | /******/ // startup |
| | | /******/ // Load entry module and return exports |
| | | /******/ // This entry module depends on other loaded chunks and execution need to be delayed |
| | | /******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["video/style-index"], () => (__webpack_require__("./src/video/index.js"))) |
| | | /******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__); |
| | | /******/ |
| | | /******/ })() |
| | | ; |
| | | //# sourceMappingURL=index.js.map |