| | |
| | | (()=>{"use strict";var e,o={128:()=>{const e=window.wp.blocks,o=window.wp.i18n,l=window.wp.blockEditor,t=window.wp.components,i=window.ReactJSXRuntime,r=["video/mp4","video/webm","video/ogg","video/ogv"],n=[["core/heading",{level:1,placeholder:"Add heading...",textAlign:"center"}],["core/paragraph",{placeholder:"Add description...",align:"center"}],["core/buttons",{layout:{type:"flex",justifyContent:"center"}}]];(0,e.registerBlockType)("jvb/video",{edit:function({attributes:e,setAttributes:s}){const{posterId:a,posterUrl:d,videoSources:c,mobileSources:v,fadeEffect:p,overlayOpacity:b,contentAlignment:m,minHeight:h}=e,j=(0,l.useBlockProps)({className:"video-cover-editor",style:{minHeight:h?`${h}px`:void 0}}),_=(0,l.useInnerBlocksProps)({className:"video-cover-content"},{template:n,templateLock:!1}),u=(e,o=!1)=>{const l={id:e.id,url:e.url,mime:e.mime};o?v.some((o=>o.mime===e.mime))||s({mobileSources:[...v,l]}):c.some((o=>o.mime===e.mime))||s({videoSources:[...c,l]})},g=(e,l=!1)=>0===e.length?null:(0,i.jsx)("ul",{className:"video-source-list",children:e.map(((e,r)=>(0,i.jsxs)("li",{className:"video-source-item",children:[(0,i.jsx)("span",{className:"video-source-mime",children:e.mime}),(0,i.jsx)(t.Button,{isDestructive:!0,isSmall:!0,onClick:()=>((e,o=!1)=>{if(o){const o=[...v];o.splice(e,1),s({mobileSources:o})}else{const o=[...c];o.splice(e,1),s({videoSources:o})}})(r,l),children:(0,o.__)("Remove","jvb")})]},r)))});return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(l.InspectorControls,{children:[(0,i.jsxs)(t.PanelBody,{title:(0,o.__)("Video Settings","jvb"),initialOpen:!0,children:[(0,i.jsx)(t.BaseControl,{label:(0,o.__)("Poster Image","jvb"),help:(0,o.__)("Image shown while video loads","jvb"),children:(0,i.jsx)(l.MediaUploadCheck,{children:(0,i.jsx)(l.MediaUpload,{onSelect:e=>{s({posterId:e.id,posterUrl:e.url})},allowedTypes:["image"],value:a,render:({open:e})=>(0,i.jsxs)(i.Fragment,{children:[d&&(0,i.jsx)("img",{src:d,alt:(0,o.__)("Poster preview","jvb"),style:{maxWidth:"100%",marginBottom:"10px"}}),(0,i.jsx)(t.Button,{onClick:e,variant:d?"secondary":"primary",children:d?(0,o.__)("Change Poster","jvb"):(0,o.__)("Select Poster","jvb")}),d&&(0,i.jsx)(t.Button,{isDestructive:!0,onClick:()=>s({posterId:0,posterUrl:""}),style:{marginLeft:"10px"},children:(0,o.__)("Remove","jvb")})]})})})}),(0,i.jsxs)(t.BaseControl,{label:(0,o.__)("Desktop Video Sources","jvb"),help:(0,o.__)("Add multiple formats for better browser support","jvb"),children:[g(c,!1),(0,i.jsx)(l.MediaUploadCheck,{children:(0,i.jsx)(l.MediaUpload,{onSelect:e=>u(e,!1),allowedTypes:r,render:({open:e})=>(0,i.jsx)(t.Button,{onClick:e,variant:"secondary",children:(0,o.__)("Add Desktop Video","jvb")})})})]}),(0,i.jsxs)(t.BaseControl,{label:(0,o.__)("Mobile Video Sources (Optional)","jvb"),help:(0,o.__)("Smaller videos for mobile devices","jvb"),children:[g(v,!0),(0,i.jsx)(l.MediaUploadCheck,{children:(0,i.jsx)(l.MediaUpload,{onSelect:e=>u(e,!0),allowedTypes:r,render:({open:e})=>(0,i.jsx)(t.Button,{onClick:e,variant:"secondary",children:(0,o.__)("Add Mobile Video","jvb")})})})]}),(0,i.jsx)(t.ToggleControl,{label:(0,o.__)("Fade Effect","jvb"),help:(0,o.__)("Add fade class to video element","jvb"),checked:p,onChange:e=>s({fadeEffect:e})})]}),(0,i.jsxs)(t.PanelBody,{title:(0,o.__)("Overlay Settings","jvb"),initialOpen:!0,children:[(0,i.jsx)(t.RangeControl,{label:(0,o.__)("Overlay Opacity","jvb"),help:(0,o.__)("Darken video for better text readability","jvb"),value:b,onChange:e=>s({overlayOpacity:e}),min:0,max:100,step:5}),(0,i.jsx)(t.SelectControl,{label:(0,o.__)("Content Alignment","jvb"),value:m,options:[{label:(0,o.__)("Top Left","jvb"),value:"top-left"},{label:(0,o.__)("Top Center","jvb"),value:"top-center"},{label:(0,o.__)("Top Right","jvb"),value:"top-right"},{label:(0,o.__)("Center Left","jvb"),value:"center-left"},{label:(0,o.__)("Center","jvb"),value:"center"},{label:(0,o.__)("Center Right","jvb"),value:"center-right"},{label:(0,o.__)("Bottom Left","jvb"),value:"bottom-left"},{label:(0,o.__)("Bottom Center","jvb"),value:"bottom-center"},{label:(0,o.__)("Bottom Right","jvb"),value:"bottom-right"}],onChange:e=>s({contentAlignment:e})}),(0,i.jsx)(t.RangeControl,{label:(0,o.__)("Minimum Height","jvb"),help:(0,o.__)("Minimum height in pixels (leave 0 for auto)","jvb"),value:h,onChange:e=>s({minHeight:e}),min:0,max:1e3,step:50})]})]}),(0,i.jsx)("div",{...j,children:d||c.length>0?(0,i.jsxs)("div",{className:"video-cover-preview",children:[d&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("img",{src:d,alt:(0,o.__)("Video poster","jvb")}),b>0&&(0,i.jsx)("div",{className:"video-overlay-preview",style:{opacity:b/100}})]}),(0,i.jsx)("div",{className:`video-cover-content-preview align-${m}`,children:(0,i.jsx)("div",{..._})}),(0,i.jsx)("div",{className:"video-info",children:(0,i.jsxs)("p",{children:[c.length," ",(0,o.__)("desktop source(s)","jvb"),v.length>0&&`, ${v.length} ${(0,o.__)("mobile source(s)","jvb")}`]})})]}):(0,i.jsx)("div",{className:"video-cover-placeholder",children:(0,i.jsx)("p",{children:(0,o.__)("Configure video sources in the sidebar →","jvb")})})})]})},save:()=>null})}},l={};function t(e){var i=l[e];if(void 0!==i)return i.exports;var r=l[e]={exports:{}};return o[e](r,r.exports,t),r.exports}t.m=o,e=[],t.O=(o,l,i,r)=>{if(!l){var n=1/0;for(c=0;c<e.length;c++){for(var[l,i,r]=e[c],s=!0,a=0;a<l.length;a++)(!1&r||n>=r)&&Object.keys(t.O).every((e=>t.O[e](l[a])))?l.splice(a--,1):(s=!1,r<n&&(n=r));if(s){e.splice(c--,1);var d=i();void 0!==d&&(o=d)}}return o}r=r||0;for(var c=e.length;c>0&&e[c-1][2]>r;c--)e[c]=e[c-1];e[c]=[l,i,r]},t.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),(()=>{var e={205:0,601:0};t.O.j=o=>0===e[o];var o=(o,l)=>{var i,r,[n,s,a]=l,d=0;if(n.some((o=>0!==e[o]))){for(i in s)t.o(s,i)&&(t.m[i]=s[i]);if(a)var c=a(t)}for(o&&o(l);d<n.length;d++)r=n[d],t.o(e,r)&&e[r]&&e[r][0](),e[r]=0;return t.O(c)},l=globalThis.webpackChunkjvb=globalThis.webpackChunkjvb||[];l.forEach(o.bind(null,0)),l.push=o.bind(null,l.push.bind(l))})();var i=t.O(void 0,[601],(()=>t(128)));i=t.O(i)})(); |
| | | /******/ (() => { // 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 |