Changeset 2589610
- Timestamp:
- 08/27/2021 03:37:41 AM (5 years ago)
- Location:
- modal-builder-block/trunk
- Files:
-
- 7 edited
-
block.json (modified) (1 diff)
-
build/index.asset.php (modified) (1 diff)
-
build/index.css (modified) (1 diff)
-
build/index.js (modified) (1 diff)
-
build/style-index.css (modified) (1 diff)
-
modal-builder-block.php (modified) (2 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
modal-builder-block/trunk/block.json
r2588935 r2589610 1 1 { 2 2 "apiVersion": 2, 3 "name": " create-block/modal-builder-block",3 "name": "htr-block/modal-builder-block", 4 4 "version": "1.0.0", 5 5 "title": "Modal Builder Block", -
modal-builder-block/trunk/build/index.asset.php
r2588935 r2589610 1 <?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => ' a238690ce1a8c6eaa844a5d4ccf111aa');1 <?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '978fe2c101583f934d06340af91510cf'); -
modal-builder-block/trunk/build/index.css
r2588935 r2589610 1 .wp-block-create-block-modal-builder-block .htr-modal-content-edit { 2 opacity: 0.6; 3 } 4 5 /*# sourceMappingURL=index.css.map*/ 1 .wp-block-htr-block-modal-builder-block .htr-modal-content-edit{opacity:.6} -
modal-builder-block/trunk/build/index.js
r2588935 r2589610 1 (window["webpackJsonp_modal_builder_block"] = window["webpackJsonp_modal_builder_block"] || []).push([["style-index"],{ 2 3 /***/ "./src/style.scss": 4 /*!************************!*\ 5 !*** ./src/style.scss ***! 6 \************************/ 7 /*! no exports provided */ 8 /***/ (function(module, __webpack_exports__, __webpack_require__) { 9 10 "use strict"; 11 __webpack_require__.r(__webpack_exports__); 12 // extracted by mini-css-extract-plugin 13 14 15 /***/ }) 16 17 }]); 18 19 /******/ (function(modules) { // webpackBootstrap 20 /******/ // install a JSONP callback for chunk loading 21 /******/ function webpackJsonpCallback(data) { 22 /******/ var chunkIds = data[0]; 23 /******/ var moreModules = data[1]; 24 /******/ var executeModules = data[2]; 25 /******/ 26 /******/ // add "moreModules" to the modules object, 27 /******/ // then flag all "chunkIds" as loaded and fire callback 28 /******/ var moduleId, chunkId, i = 0, resolves = []; 29 /******/ for(;i < chunkIds.length; i++) { 30 /******/ chunkId = chunkIds[i]; 31 /******/ if(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) { 32 /******/ resolves.push(installedChunks[chunkId][0]); 33 /******/ } 34 /******/ installedChunks[chunkId] = 0; 35 /******/ } 36 /******/ for(moduleId in moreModules) { 37 /******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { 38 /******/ modules[moduleId] = moreModules[moduleId]; 39 /******/ } 40 /******/ } 41 /******/ if(parentJsonpFunction) parentJsonpFunction(data); 42 /******/ 43 /******/ while(resolves.length) { 44 /******/ resolves.shift()(); 45 /******/ } 46 /******/ 47 /******/ // add entry modules from loaded chunk to deferred list 48 /******/ deferredModules.push.apply(deferredModules, executeModules || []); 49 /******/ 50 /******/ // run deferred modules when all chunks ready 51 /******/ return checkDeferredModules(); 52 /******/ }; 53 /******/ function checkDeferredModules() { 54 /******/ var result; 55 /******/ for(var i = 0; i < deferredModules.length; i++) { 56 /******/ var deferredModule = deferredModules[i]; 57 /******/ var fulfilled = true; 58 /******/ for(var j = 1; j < deferredModule.length; j++) { 59 /******/ var depId = deferredModule[j]; 60 /******/ if(installedChunks[depId] !== 0) fulfilled = false; 61 /******/ } 62 /******/ if(fulfilled) { 63 /******/ deferredModules.splice(i--, 1); 64 /******/ result = __webpack_require__(__webpack_require__.s = deferredModule[0]); 65 /******/ } 66 /******/ } 67 /******/ 68 /******/ return result; 69 /******/ } 70 /******/ 71 /******/ // The module cache 72 /******/ var installedModules = {}; 73 /******/ 74 /******/ // object to store loaded and loading chunks 75 /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched 76 /******/ // Promise = chunk loading, 0 = chunk loaded 77 /******/ var installedChunks = { 78 /******/ "index": 0 79 /******/ }; 80 /******/ 81 /******/ var deferredModules = []; 82 /******/ 83 /******/ // The require function 84 /******/ function __webpack_require__(moduleId) { 85 /******/ 86 /******/ // Check if module is in cache 87 /******/ if(installedModules[moduleId]) { 88 /******/ return installedModules[moduleId].exports; 89 /******/ } 90 /******/ // Create a new module (and put it into the cache) 91 /******/ var module = installedModules[moduleId] = { 92 /******/ i: moduleId, 93 /******/ l: false, 94 /******/ exports: {} 95 /******/ }; 96 /******/ 97 /******/ // Execute the module function 98 /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 99 /******/ 100 /******/ // Flag the module as loaded 101 /******/ module.l = true; 102 /******/ 103 /******/ // Return the exports of the module 104 /******/ return module.exports; 105 /******/ } 106 /******/ 107 /******/ 108 /******/ // expose the modules object (__webpack_modules__) 109 /******/ __webpack_require__.m = modules; 110 /******/ 111 /******/ // expose the module cache 112 /******/ __webpack_require__.c = installedModules; 113 /******/ 114 /******/ // define getter function for harmony exports 115 /******/ __webpack_require__.d = function(exports, name, getter) { 116 /******/ if(!__webpack_require__.o(exports, name)) { 117 /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 118 /******/ } 119 /******/ }; 120 /******/ 121 /******/ // define __esModule on exports 122 /******/ __webpack_require__.r = function(exports) { 123 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 124 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 125 /******/ } 126 /******/ Object.defineProperty(exports, '__esModule', { value: true }); 127 /******/ }; 128 /******/ 129 /******/ // create a fake namespace object 130 /******/ // mode & 1: value is a module id, require it 131 /******/ // mode & 2: merge all properties of value into the ns 132 /******/ // mode & 4: return value when already ns object 133 /******/ // mode & 8|1: behave like require 134 /******/ __webpack_require__.t = function(value, mode) { 135 /******/ if(mode & 1) value = __webpack_require__(value); 136 /******/ if(mode & 8) return value; 137 /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 138 /******/ var ns = Object.create(null); 139 /******/ __webpack_require__.r(ns); 140 /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 141 /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 142 /******/ return ns; 143 /******/ }; 144 /******/ 145 /******/ // getDefaultExport function for compatibility with non-harmony modules 146 /******/ __webpack_require__.n = function(module) { 147 /******/ var getter = module && module.__esModule ? 148 /******/ function getDefault() { return module['default']; } : 149 /******/ function getModuleExports() { return module; }; 150 /******/ __webpack_require__.d(getter, 'a', getter); 151 /******/ return getter; 152 /******/ }; 153 /******/ 154 /******/ // Object.prototype.hasOwnProperty.call 155 /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 156 /******/ 157 /******/ // __webpack_public_path__ 158 /******/ __webpack_require__.p = ""; 159 /******/ 160 /******/ var jsonpArray = window["webpackJsonp_modal_builder_block"] = window["webpackJsonp_modal_builder_block"] || []; 161 /******/ var oldJsonpFunction = jsonpArray.push.bind(jsonpArray); 162 /******/ jsonpArray.push = webpackJsonpCallback; 163 /******/ jsonpArray = jsonpArray.slice(); 164 /******/ for(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]); 165 /******/ var parentJsonpFunction = oldJsonpFunction; 166 /******/ 167 /******/ 168 /******/ // add entry module to deferred list 169 /******/ deferredModules.push(["./src/index.js","style-index"]); 170 /******/ // run deferred modules when ready 171 /******/ return checkDeferredModules(); 172 /******/ }) 173 /************************************************************************/ 174 /******/ ({ 175 176 /***/ "./src/edit.js": 177 /*!*********************!*\ 178 !*** ./src/edit.js ***! 179 \*********************/ 180 /*! exports provided: default */ 181 /***/ (function(module, __webpack_exports__, __webpack_require__) { 182 183 "use strict"; 184 __webpack_require__.r(__webpack_exports__); 185 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); 186 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 187 /* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./editor.scss */ "./src/editor.scss"); 188 /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); 189 /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__); 190 /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); 191 /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__); 192 /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); 193 /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__); 194 195 196 197 198 199 200 201 const Edit = ({ 202 attributes, 203 setAttributes 204 }) => { 205 const { 206 mbModalID, 207 mbModalContentType 208 } = attributes; 209 return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["Fragment"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__["InspectorControls"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__["PanelBody"], { 210 title: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__["__"])('Modal Settings') 211 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__["SelectControl"], { 212 label: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__["__"])('Modal Content Type'), 213 help: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__["__"])('Select what you will like to create. Modal Trigger, or Modal Content.'), 214 value: mbModalContentType, 215 options: [{ 216 label: 'Trigger', 217 value: 'htr-modal-trigger' 218 }, { 219 label: 'Content', 220 value: 'htr-modal-content' 221 }], 222 onChange: value => { 223 setAttributes({ 224 mbModalContentType: value 225 }); 226 } 227 }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__["TextControl"], { 228 label: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__["__"])('Content ID'), 229 help: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__["__"])("Match this ID with your Modal's trigger/content."), 230 value: mbModalID, 231 onChange: value => { 232 setAttributes({ 233 mbModalID: value 234 }); 235 } 236 }))), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", Object(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__["useBlockProps"])(), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", { 237 className: mbModalContentType === 'htr-modal-content' ? `${mbModalContentType}-edit` : mbModalContentType 238 }, mbModalContentType === 'htr-modal-trigger' ? Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", { 239 className: "modal-builder-header" 240 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("p", null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("strong", null, "Modal Trigger:"), " Build your Modal", ' ', Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("strong", null, "trigger"), " below (most commonly, triggers are buttons or images).", Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("br", null), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("small", null, "Note: This text will not show on the front-end."))) : Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", { 241 className: "modal-builder-header" 242 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("p", null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("strong", null, "Modal Content:"), " Build your Modal", ' ', Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("strong", null, "content"), " below.", Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("br", null), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("small", null, "Note: This text will not show on the front-end. The content below is also grayed out on the editor only. It will not be visible on the fron-tend until the trigger is clicked/tapped."), ".")), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__["InnerBlocks"], null))))); 243 }; 244 245 /* harmony default export */ __webpack_exports__["default"] = (Edit); 246 247 /***/ }), 248 249 /***/ "./src/editor.scss": 250 /*!*************************!*\ 251 !*** ./src/editor.scss ***! 252 \*************************/ 253 /*! no exports provided */ 254 /***/ (function(module, __webpack_exports__, __webpack_require__) { 255 256 "use strict"; 257 __webpack_require__.r(__webpack_exports__); 258 // extracted by mini-css-extract-plugin 259 260 261 /***/ }), 262 263 /***/ "./src/index.js": 264 /*!**********************!*\ 265 !*** ./src/index.js ***! 266 \**********************/ 267 /*! no exports provided */ 268 /***/ (function(module, __webpack_exports__, __webpack_require__) { 269 270 "use strict"; 271 __webpack_require__.r(__webpack_exports__); 272 /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); 273 /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__); 274 /* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./style.scss */ "./src/style.scss"); 275 /* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./edit */ "./src/edit.js"); 276 /* harmony import */ var _save__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./save */ "./src/save.js"); 277 278 279 280 281 Object(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__["registerBlockType"])('create-block/modal-builder-block', { 282 edit: _edit__WEBPACK_IMPORTED_MODULE_2__["default"], 283 save: _save__WEBPACK_IMPORTED_MODULE_3__["default"] 284 }); 285 286 /***/ }), 287 288 /***/ "./src/save.js": 289 /*!*********************!*\ 290 !*** ./src/save.js ***! 291 \*********************/ 292 /*! exports provided: default */ 293 /***/ (function(module, __webpack_exports__, __webpack_require__) { 294 295 "use strict"; 296 __webpack_require__.r(__webpack_exports__); 297 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); 298 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 299 /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); 300 /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); 301 /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); 302 /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__); 303 304 305 306 307 const save = props => { 308 const { 309 mbModalID, 310 mbModalContentType 311 } = props.attributes; // Learnings. Save.js/Save function can not have usestate or other interactivity. It is only to give HTMl. 312 // -- Note: The save function should be a pure function that depends only on the attributes used to invoke it. (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-edit-save/) 313 // You cannot use two inner blocks in edit or save. You are only allowed one. 314 // -- Note: A block can render at most a single InnerBlocks and InnerBlocks.Content element in edit and save respectively. To create distinct arrangements of nested blocks, create a separate block type which renders its own InnerBlocks and assign as the sole allowedBlocks type. (https://github.com/WordPress/gutenberg/tree/trunk/packages/block-editor/src/components/inner-blocks) 315 316 return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__["useBlockProps"].save(), mbModalContentType == 'htr-modal-trigger' ? Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", { 317 className: "htr-modal-trigger", 318 "data-modal-id": mbModalID 319 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__["InnerBlocks"].Content, null)) : Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("dialog", { 320 className: "htr-modal-content htr-modal-content-hide", 321 "data-modal-id": mbModalID 322 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", { 323 className: "htr-modal-content-background" 324 }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", { 325 className: "htr-modal-content-close-btn" 326 }, "X"), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", { 327 className: "htr-modal-content-wrap" 328 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__["InnerBlocks"].Content, null)))); 329 }; 330 331 /* harmony default export */ __webpack_exports__["default"] = (save); 332 333 /***/ }), 334 335 /***/ "@wordpress/block-editor": 336 /*!*************************************!*\ 337 !*** external ["wp","blockEditor"] ***! 338 \*************************************/ 339 /*! no static exports found */ 340 /***/ (function(module, exports) { 341 342 (function() { module.exports = window["wp"]["blockEditor"]; }()); 343 344 /***/ }), 345 346 /***/ "@wordpress/blocks": 347 /*!********************************!*\ 348 !*** external ["wp","blocks"] ***! 349 \********************************/ 350 /*! no static exports found */ 351 /***/ (function(module, exports) { 352 353 (function() { module.exports = window["wp"]["blocks"]; }()); 354 355 /***/ }), 356 357 /***/ "@wordpress/components": 358 /*!************************************!*\ 359 !*** external ["wp","components"] ***! 360 \************************************/ 361 /*! no static exports found */ 362 /***/ (function(module, exports) { 363 364 (function() { module.exports = window["wp"]["components"]; }()); 365 366 /***/ }), 367 368 /***/ "@wordpress/element": 369 /*!*********************************!*\ 370 !*** external ["wp","element"] ***! 371 \*********************************/ 372 /*! no static exports found */ 373 /***/ (function(module, exports) { 374 375 (function() { module.exports = window["wp"]["element"]; }()); 376 377 /***/ }), 378 379 /***/ "@wordpress/i18n": 380 /*!******************************!*\ 381 !*** external ["wp","i18n"] ***! 382 \******************************/ 383 /*! no static exports found */ 384 /***/ (function(module, exports) { 385 386 (function() { module.exports = window["wp"]["i18n"]; }()); 387 388 /***/ }) 389 390 /******/ }); 391 //# sourceMappingURL=index.js.map 1 (window.webpackJsonp_modal_builder_block=window.webpackJsonp_modal_builder_block||[]).push([[1],{5:function(e,t,n){}}]),function(e){function t(t){for(var l,a,c=t[0],i=t[1],d=t[2],b=0,s=[];b<c.length;b++)a=c[b],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&s.push(o[a][0]),o[a]=0;for(l in i)Object.prototype.hasOwnProperty.call(i,l)&&(e[l]=i[l]);for(u&&u(t);s.length;)s.shift()();return r.push.apply(r,d||[]),n()}function n(){for(var e,t=0;t<r.length;t++){for(var n=r[t],l=!0,c=1;c<n.length;c++){var i=n[c];0!==o[i]&&(l=!1)}l&&(r.splice(t--,1),e=a(a.s=n[0]))}return e}var l={},o={0:0},r=[];function a(t){if(l[t])return l[t].exports;var n=l[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.m=e,a.c=l,a.d=function(e,t,n){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var l in e)a.d(n,l,function(t){return e[t]}.bind(null,l));return n},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="";var c=window.webpackJsonp_modal_builder_block=window.webpackJsonp_modal_builder_block||[],i=c.push.bind(c);c.push=t,c=c.slice();for(var d=0;d<c.length;d++)t(c[d]);var u=i;r.push([6,1]),n()}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.blockEditor},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wp.components},function(e,t){e.exports=window.wp.blocks},,function(e,t,n){"use strict";n.r(t);var l=n(4),o=(n(5),n(0)),r=n(2),a=n(1),c=n(3);Object(l.registerBlockType)("htr-block/modal-builder-block",{edit:({attributes:e,setAttributes:t})=>{const{mbModalID:n,mbModalContentType:l}=e;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(a.InspectorControls,null,Object(o.createElement)(c.PanelBody,{title:Object(r.__)("Modal Settings")},Object(o.createElement)(c.SelectControl,{label:Object(r.__)("Modal Content Type"),help:Object(r.__)("Select what you will like to create. Modal Trigger, or Modal Content."),value:l,options:[{label:"Trigger",value:"htr-modal-trigger"},{label:"Content",value:"htr-modal-content"}],onChange:e=>{t({mbModalContentType:e})}}),Object(o.createElement)(c.TextControl,{label:Object(r.__)("Content ID"),help:Object(r.__)("Match this ID with your Modal's trigger/content."),value:n,onChange:e=>{t({mbModalID:e})}}))),Object(o.createElement)("div",Object(a.useBlockProps)(),Object(o.createElement)("div",{className:"htr-modal-content"===l?l+"-edit":l},"htr-modal-trigger"===l?Object(o.createElement)("div",{className:"modal-builder-header"},Object(o.createElement)("p",null,Object(o.createElement)("strong",null,"Modal Trigger:")," Build your Modal"," ",Object(o.createElement)("strong",null,"trigger")," below (most commonly, triggers are buttons or images).",Object(o.createElement)("br",null),Object(o.createElement)("small",null,"Note: This text will not show on the front-end."))):Object(o.createElement)("div",{className:"modal-builder-header"},Object(o.createElement)("p",null,Object(o.createElement)("strong",null,"Modal Content:")," Build your Modal"," ",Object(o.createElement)("strong",null,"content")," below.",Object(o.createElement)("br",null),Object(o.createElement)("small",null,"Note: This text will not show on the front-end. The content below is also grayed out on the editor only. It will not be visible on the fron-tend until the trigger is clicked/tapped."),".")),Object(o.createElement)("div",null,Object(o.createElement)(a.InnerBlocks,null)))))},save:e=>{const{mbModalID:t,mbModalContentType:n}=e.attributes;return Object(o.createElement)("div",a.useBlockProps.save(),"htr-modal-trigger"==n?Object(o.createElement)("div",{className:"htr-modal-trigger","data-modal-id":t},Object(o.createElement)(a.InnerBlocks.Content,null)):Object(o.createElement)("dialog",{className:"htr-modal-content htr-modal-content-hide","data-modal-id":t},Object(o.createElement)("div",{className:"htr-modal-content-background"}),Object(o.createElement)("div",{className:"htr-modal-content-close-btn"},"X"),Object(o.createElement)("div",{className:"htr-modal-content-wrap"},Object(o.createElement)(a.InnerBlocks.Content,null))))}})}]); -
modal-builder-block/trunk/build/style-index.css
r2588935 r2589610 1 .wp-block-create-block-modal-builder-block { 2 margin-top: 0 !important; 3 margin-bottom: 0 !important; 4 } 5 6 .htr-modal-content-hide { 7 opacity: 0; 8 z-index: -999999999; 9 } 10 11 .htr-modal-content-show { 12 opacity: 1; 13 z-index: 99999; 14 } 15 16 .htr-modal-prevent-scroll { 17 overflow: hidden; 18 } 19 20 .htr-modal-content { 21 position: fixed; 22 width: 100%; 23 height: 100%; 24 top: 0; 25 left: 0; 26 bottom: 0; 27 right: 0; 28 padding: 0; 29 border: 0; 30 overflow: hidden; 31 display: flex; 32 justify-content: center; 33 align-items: center; 34 background-color: transparent; 35 } 36 37 .htr-modal-content-wrap { 38 max-height: 80%; 39 max-width: 80%; 40 overflow-x: hidden; 41 overflow-y: scroll; 42 scrollbar-width: none; 43 /* Firefox */ 44 -ms-overflow-style: none; 45 /* IE 10+ */ 46 position: relative; 47 background-color: white; 48 } 49 50 .htr-modal-content-wrap::-webkit-scrollbar { 51 /* WebKit */ 52 width: 0px; 53 } 54 55 .htr-modal-content-close-btn { 56 position: absolute; 57 top: 2rem; 58 right: 2rem; 59 width: 38px; 60 height: 38px; 61 z-index: 9999; 62 color: white; 63 cursor: pointer; 64 line-height: 32px; 65 font-size: 1.6rem; 66 text-align: center; 67 border-radius: 100%; 68 background-color: black; 69 border: 2px solid white; 70 } 71 72 .htr-modal-content-background { 73 background-color: rgba(0, 0, 0, 0.6); 74 position: absolute; 75 width: 100%; 76 height: 100%; 77 top: 0; 78 left: 0; 79 bottom: 0; 80 right: 0; 81 } 82 83 @media (min-width: 1280px) { 84 .htr-modal-content-wrap { 85 max-width: 1280px; 86 } 87 } 88 89 /*# sourceMappingURL=style-index.css.map*/ 1 .wp-block-htr-block-modal-builder-block{margin-top:0 !important;margin-bottom:0 !important}.htr-modal-content-hide{opacity:0;z-index:-999999999}.htr-modal-content-show{opacity:1;z-index:99999}.htr-modal-prevent-scroll{overflow:hidden}.htr-modal-content{position:fixed;width:100%;height:100%;top:0;left:0;bottom:0;right:0;padding:0;border:0;overflow:hidden;display:flex;justify-content:center;align-items:center;background-color:transparent}.htr-modal-content-wrap{max-height:80%;max-width:80%;overflow-x:hidden;overflow-y:scroll;scrollbar-width:none;-ms-overflow-style:none;position:relative;background-color:#fff}.htr-modal-content-wrap::-webkit-scrollbar{width:0px}.htr-modal-content-close-btn{position:absolute;top:2rem;right:2rem;width:38px;height:38px;z-index:9999;color:#fff;cursor:pointer;line-height:32px;font-size:1.6rem;text-align:center;border-radius:100%;background-color:#000;border:2px solid #fff}.htr-modal-content-background{background-color:rgba(0,0,0,.6);position:absolute;width:100%;height:100%;top:0;left:0;bottom:0;right:0}@media(min-width: 1280px){.htr-modal-content-wrap{max-width:1280px}} -
modal-builder-block/trunk/modal-builder-block.php
r2588935 r2589610 11 11 * Text Domain: modal-builder-block 12 12 * 13 * @package create-block13 * @package htr-block 14 14 */ 15 15 … … 22 22 */ 23 23 24 function create_block_modal_builder_block_block_init() {24 function htr_block_modal_builder_block_init() { 25 25 register_block_type( __DIR__ ); 26 26 } 27 add_action( 'init', ' create_block_modal_builder_block_block_init' );27 add_action( 'init', 'htr_block_modal_builder_block_init' ); 28 28 29 29 30 30 31 function modal_builder_scripts($hook) {31 function htr_block_modal_builder_scripts($hook) { 32 32 $my_js_ver = date("ymd-Gis", filemtime( plugin_dir_path( __FILE__ ) . 'assets/js/app.js' )); 33 33 wp_enqueue_script( 'modal-builder', plugins_url( 'assets/js/app.js', __FILE__ ), array(), $my_js_ver, true ); 34 34 } 35 35 36 add_action('wp_enqueue_scripts', ' modal_builder_scripts');36 add_action('wp_enqueue_scripts', 'htr_block_modal_builder_scripts'); -
modal-builder-block/trunk/readme.txt
r2588935 r2589610 2 2 Contributors: rodrigoleon 3 3 Donate link: https://paypal.me/rodxleon 4 Tags: modal, popup, window, lightbox, gutenberg, block, 4 Tags: modal, popup, window, lightbox, gutenberg, block 5 Requires at least: 5.8 5 6 Tested up to: 5.8.0 6 7 Stable tag: 1.0.0 8 Requires PHP: 7.0 7 9 License: GPL-2.0-or-later 8 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 12 14 == Description == 13 15 14 This small plugin allows you to create a modal / popup / lightbox with WordPress' default Block editor (Gutenberg). The plugin provides you with a block that can be used for the modal trigger or the modal contents. Anything you can do with the block editor, you can use for the trigger or the contents of the modal.16 This small plugin allows you to create a modal / popup / lightbox with WordPress' default Block editor (Gutenberg). The plugin provides you with a block that can be used for the modal's trigger and the modal's window contents. Anything you can do with the block editor, you can use for the modal trigger or the contents. 15 17 16 18 * Multiple trigger methods. Use the power of the Block Editor to create your trigger (buttons, images, covers, and more). … … 20 22 21 23 To create a modal, simply use the Modal Builder block to create a trigger. Use another Modal Builder block to create the content (make sure you select the appropriate content type under the modal settings). On both instances, set the "Content ID" to whatever you want as long as both instances match. You are set. 24 25 = Donations = 26 27 If you like the plugin, consider leaving a donation to support further development of the plugin. [Click here](https://paypal.me/rodxleon). If you would like custom solutions or the like, please visit [HTR.Design](https://htr.design). 28 29 == Screenshots == 30 31 1. Modal Builder block in action. Adding a trigger. 32 2. Adding a button block inside the trigger block. 33 3. Add another Builder block and change "content type" to content. Add your modal content (like an image). 22 34 23 35 == Frequently Asked Questions ==
Note: See TracChangeset
for help on using the changeset viewer.