Changeset 2875046
- Timestamp:
- 03/05/2023 08:58:33 PM (3 years ago)
- Location:
- codeless-hotspot-block/trunk
- Files:
-
- 9 edited
-
build/block.json (modified) (1 diff)
-
build/index.asset.php (modified) (1 diff)
-
build/index.js (modified) (1 diff)
-
build/style-index.css (modified) (1 diff)
-
codeless-hotspot-block.php (modified) (1 diff)
-
package-lock.json (modified) (2 diffs)
-
src/block.json (modified) (1 diff)
-
src/editor.scss (modified) (1 diff)
-
src/index.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
codeless-hotspot-block/trunk/build/block.json
r2875040 r2875046 2 2 "$schema": "https://schemas.wp.org/trunk/block.json", 3 3 "apiVersion": 2, 4 "name": "c reate-block/codeless-hotspot-block",4 "name": "codeless-blocks/hotspot", 5 5 "version": "0.1.0", 6 "title": " Codeless Hotspot Block",6 "title": "Hotspot Block by Codeless", 7 7 "category": "widgets", 8 8 "icon": "smiley", 9 "description": " Example block scaffolded with Create Block tool.",9 "description": "Add hotspots to a selected image", 10 10 "supports": { 11 11 "html": false 12 12 }, 13 "textdomain": "codeless- hotspot-block",13 "textdomain": "codeless-blocks", 14 14 "editorScript": "file:./index.js", 15 15 "editorStyle": "file:./index.css", -
codeless-hotspot-block/trunk/build/index.asset.php
r2875040 r2875046 1 <?php return array('dependencies' => array('wp-blocks', 'wp-components', 'wp-editor', 'wp-element'), 'version' => ' ad08dd934723babf33b9');1 <?php return array('dependencies' => array('wp-blocks', 'wp-components', 'wp-editor', 'wp-element'), 'version' => 'c777093b1af64effd18a'); -
codeless-hotspot-block/trunk/build/index.js
r2875040 r2875046 1 !function(){"use strict";var e,t={130:function(){var e=window.wp.element,t=window.wp.blocks,o=window.wp.editor,a=window.wp.components;const n={x:.5,y:.5,label:""};(0,t.registerBlockType)("codeless-blocks/hotspot",{title:"Codeless Hotspot",icon:"location",category:"common",attributes:{image:{type:"string",source:"attribute",selector:"img",attribute:"src"},hotspots:{type:"array",default:[],source:"query",selector:".hotspot",query:{x:{type:"number",source:"attribute",attribute:"data-x"},y:{type:"number",source:"attribute",attribute:"data-y"},label:{type:"string",source:"attribute",attribute:"data-label"},link:{type:"string",source:"attribute",attribute:"href"}}}},edit:t=>{let{attributes:l,setAttributes:r}=t;const[s,c]=(0,e.useState)(-1),i=e=>{e.target.closest(".hotspot-image-container")||c(-1)};return(0,e.useEffect)((()=>(document.addEventListener("click",i),()=>{document.removeEventListener("click",i)})),[]),(0,e.createElement)("div",{className:"hotspot-block"},(0,e.createElement)(o.MediaUpload,{onSelect:e=>r({image:e.sizes.full.url}),render:t=>{let{open:o}=t;return(0,e.createElement)(a.Button,{className:l.image?"image-button":"button button-large",onClick:o},l.image?"Change Image":"Select Image")}}),l.image&&(0,e.createElement)("div",{className:"hotspot-image-container"},(0,e.createElement)("img",{src:l.image,onClick:e=>{const t=e.target.getBoundingClientRect(),o=(e.clientX-t.left)/t.width,a=(e.clientY-t.top)/t.height,s=[...l.hotspots,{...n,x:o,y:a}];r({hotspots:s})},className:"hotspot-image"}),l.hotspots.map(((t,o)=>(0,e.createElement)("div",{key:o,className:"hotspot "+(s===o?"active":""),"data-x":t.x,"data-y":t.y,"data-label":t.label,style:{left:100*t.x+"%",top:100*t.y+"%"},onClick:e=>{e.preventDefault(),(e=>{c(e)})(o)}},(0,e.createElement)("div",{className:"hotspot-label"},t.label),s===o&&(0,e.createElement)("div",{className:"hotspot-options"},(0,e.createElement)("label",null,(0,e.createElement)("input",{type:"text",value:t.label,placeholder:"Label",onChange:e=>((e,t)=>{const o=[...l.hotspots];o[t].label=e,r({hotspots:o})})(e.target.value,o)})),(0,e.createElement)("label",null,(0,e.createElement)("input",{type:"text",value:t.link,onChange:e=>((e,t)=>{const o=[...l.hotspots];o[t].link=e,r({hotspots:o})})(e.target.value,o),placeholder:"Link URL"})),(0,e.createElement)(a.Button,{className:"remove-button",onClick:()=>(e=>{const t=[...l.hotspots];t.splice(e,1),r({hotspots:t})})(o),icon:"dismiss"})))))))},save:t=>{let{attributes:o}=t;const{image:a,hotspots:n}=o;return(0,e.createElement)("div",{className:"hotspot-block"},(0,e.createElement)("div",{class:"hotspot-image-container"},(0,e.createElement)("img",{src:a,alt:"Hotspot Background"}),n.map(((t,o)=>(0,e.createElement)("a",{key:o,className:"hotspot","data-x":t.x,"data-y":t.y,"data-label":t.label,style:{left:100*t.x+"%",top:100*t.y+"%"},href:t.link,target:"_blank",rel:"noopener noreferrer"},(0,e.createElement)("span",{className:"hotspot-label"},t.label))))))}})}},o={};function a(e){var n=o[e];if(void 0!==n)return n.exports;var l=o[e]={exports:{}};return t[e](l,l.exports,a),l.exports}a.m=t,e=[],a.O=function(t,o,n,l){if(!o){var r=1/0;for(u=0;u<e.length;u++){o=e[u][0],n=e[u][1],l=e[u][2];for(var s=!0,c=0;c<o.length;c++)(!1&l||r>=l)&&Object.keys(a.O).every((function(e){return a.O[e](o[c])}))?o.splice(c--,1):(s=!1,l<r&&(r=l));if(s){e.splice(u--,1);var i=n();void 0!==i&&(t=i)}}return t}l=l||0;for(var u=e.length;u>0&&e[u-1][2]>l;u--)e[u]=e[u-1];e[u]=[o,n,l]},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={826:0,431:0};a.O.j=function(t){return 0===e[t]};var t=function(t,o){var n,l,r=o[0],s=o[1],c=o[2],i=0;if(r.some((function(t){return 0!==e[t]}))){for(n in s)a.o(s,n)&&(a.m[n]=s[n]);if(c)var u=c(a)}for(t&&t(o);i<r.length;i++)l=r[i],a.o(e,l)&&e[l]&&e[l][0](),e[l]=0;return a.O(u)},o=self.webpackChunkcodeless_hotspot_block=self.webpackChunkcodeless_hotspot_block||[];o.forEach(t.bind(null,0)),o.push=t.bind(null,o.push.bind(o))}();var n=a.O(void 0,[431],(function(){return a(130)}));n=a.O(n)}(); 1 /******/ (function() { // webpackBootstrap 2 /******/ "use strict"; 3 /******/ var __webpack_modules__ = ({ 4 5 /***/ "./src/index.js": 6 /*!**********************!*\ 7 !*** ./src/index.js ***! 8 \**********************/ 9 /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { 10 11 __webpack_require__.r(__webpack_exports__); 12 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); 13 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 14 /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); 15 /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__); 16 /* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/editor */ "@wordpress/editor"); 17 /* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_editor__WEBPACK_IMPORTED_MODULE_2__); 18 /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); 19 /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__); 20 /* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./style.scss */ "./src/style.scss"); 21 22 23 24 25 26 // import the SCSS file 27 28 const HOTSPOT_DEFAULTS = { 29 x: 0.5, 30 y: 0.5, 31 label: '' 32 }; 33 (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__.registerBlockType)('codeless-blocks/hotspot', { 34 title: 'Hotspot Block by Codeless', 35 icon: 'location', 36 category: 'common', 37 attributes: { 38 image: { 39 type: 'string', 40 source: 'attribute', 41 selector: 'img', 42 attribute: 'src' 43 }, 44 hotspots: { 45 type: 'array', 46 default: [], 47 source: 'query', 48 selector: '.hotspot', 49 query: { 50 x: { 51 type: 'number', 52 source: 'attribute', 53 attribute: 'data-x' 54 }, 55 y: { 56 type: 'number', 57 source: 'attribute', 58 attribute: 'data-y' 59 }, 60 label: { 61 type: 'string', 62 source: 'attribute', 63 attribute: 'data-label' 64 }, 65 link: { 66 type: 'string', 67 source: 'attribute', 68 attribute: 'href' 69 } 70 } 71 } 72 }, 73 edit: _ref => { 74 let { 75 attributes, 76 setAttributes 77 } = _ref; 78 const [activeIndex, setActiveIndex] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(-1); 79 const onHotspotClick = e => { 80 const rect = e.target.getBoundingClientRect(); 81 const x = (e.clientX - rect.left) / rect.width; 82 const y = (e.clientY - rect.top) / rect.height; 83 const hotspots = [...attributes.hotspots, { 84 ...HOTSPOT_DEFAULTS, 85 x, 86 y 87 }]; 88 setAttributes({ 89 hotspots 90 }); 91 }; 92 const onHotspotLabelChange = (value, index) => { 93 const hotspots = [...attributes.hotspots]; 94 hotspots[index].label = value; 95 setAttributes({ 96 hotspots 97 }); 98 }; 99 const onHotspotLinkChange = (value, index) => { 100 const hotspots = [...attributes.hotspots]; 101 hotspots[index].link = value; 102 setAttributes({ 103 hotspots 104 }); 105 }; 106 const onHotspotRemove = index => { 107 const hotspots = [...attributes.hotspots]; 108 hotspots.splice(index, 1); 109 setAttributes({ 110 hotspots 111 }); 112 }; 113 const onHotspotOptionsClick = index => { 114 setActiveIndex(activeIndex === index ? index : index); 115 }; 116 const onClickOutside = e => { 117 const cont = e.target.closest('.hotspot-image-container'); 118 if (!cont) { 119 setActiveIndex(-1); 120 } 121 }; 122 (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { 123 document.addEventListener('click', onClickOutside); 124 return () => { 125 document.removeEventListener('click', onClickOutside); 126 }; 127 }, []); 128 return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { 129 className: "hotspot-block" 130 }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_editor__WEBPACK_IMPORTED_MODULE_2__.MediaUpload, { 131 onSelect: image => setAttributes({ 132 image: image.sizes.full.url 133 }), 134 render: _ref2 => { 135 let { 136 open 137 } = _ref2; 138 return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Button, { 139 className: attributes.image ? "image-button" : "button button-large", 140 onClick: open 141 }, !attributes.image ? "Select Image" : "Change Image"); 142 } 143 }), attributes.image && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { 144 className: "hotspot-image-container" 145 }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", { 146 src: attributes.image, 147 onClick: onHotspotClick, 148 className: "hotspot-image" 149 }), attributes.hotspots.map((hotspot, index) => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { 150 key: index, 151 className: `hotspot ${activeIndex === index ? "active" : ""}`, 152 "data-x": hotspot.x, 153 "data-y": hotspot.y, 154 "data-label": hotspot.label, 155 style: { 156 left: `${hotspot.x * 100}%`, 157 top: `${hotspot.y * 100}%` 158 }, 159 onClick: e => { 160 e.preventDefault(); 161 onHotspotOptionsClick(index); 162 } 163 }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { 164 className: "hotspot-label" 165 }, hotspot.label), activeIndex === index && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { 166 className: "hotspot-options" 167 }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("label", null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("input", { 168 type: "text", 169 value: hotspot.label, 170 placeholder: "Label", 171 onChange: e => onHotspotLabelChange(e.target.value, index) 172 })), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("label", null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("input", { 173 type: "text", 174 value: hotspot.link, 175 onChange: e => onHotspotLinkChange(e.target.value, index), 176 placeholder: "Link URL" 177 })), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Button, { 178 className: "remove-button", 179 onClick: () => onHotspotRemove(index), 180 icon: "dismiss" 181 })))))); 182 }, 183 save: _ref3 => { 184 let { 185 attributes 186 } = _ref3; 187 const { 188 image, 189 hotspots 190 } = attributes; 191 return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { 192 className: "hotspot-block" 193 }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { 194 class: "hotspot-image-container" 195 }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", { 196 src: image, 197 alt: "Hotspot Background" 198 }), hotspots.map((hotspot, index) => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("a", { 199 key: index, 200 className: "hotspot", 201 "data-x": hotspot.x, 202 "data-y": hotspot.y, 203 "data-label": hotspot.label, 204 style: { 205 left: `${hotspot.x * 100}%`, 206 top: `${hotspot.y * 100}%` 207 }, 208 href: hotspot.link, 209 target: "_blank", 210 rel: "noopener noreferrer" 211 }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", { 212 className: "hotspot-label" 213 }, hotspot.label))))); 214 } 215 }); 216 217 /***/ }), 218 219 /***/ "./src/style.scss": 220 /*!************************!*\ 221 !*** ./src/style.scss ***! 222 \************************/ 223 /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { 224 225 __webpack_require__.r(__webpack_exports__); 226 // extracted by mini-css-extract-plugin 227 228 229 /***/ }), 230 231 /***/ "@wordpress/blocks": 232 /*!********************************!*\ 233 !*** external ["wp","blocks"] ***! 234 \********************************/ 235 /***/ (function(module) { 236 237 module.exports = window["wp"]["blocks"]; 238 239 /***/ }), 240 241 /***/ "@wordpress/components": 242 /*!************************************!*\ 243 !*** external ["wp","components"] ***! 244 \************************************/ 245 /***/ (function(module) { 246 247 module.exports = window["wp"]["components"]; 248 249 /***/ }), 250 251 /***/ "@wordpress/editor": 252 /*!********************************!*\ 253 !*** external ["wp","editor"] ***! 254 \********************************/ 255 /***/ (function(module) { 256 257 module.exports = window["wp"]["editor"]; 258 259 /***/ }), 260 261 /***/ "@wordpress/element": 262 /*!*********************************!*\ 263 !*** external ["wp","element"] ***! 264 \*********************************/ 265 /***/ (function(module) { 266 267 module.exports = window["wp"]["element"]; 268 269 /***/ }) 270 271 /******/ }); 272 /************************************************************************/ 273 /******/ // The module cache 274 /******/ var __webpack_module_cache__ = {}; 275 /******/ 276 /******/ // The require function 277 /******/ function __webpack_require__(moduleId) { 278 /******/ // Check if module is in cache 279 /******/ var cachedModule = __webpack_module_cache__[moduleId]; 280 /******/ if (cachedModule !== undefined) { 281 /******/ return cachedModule.exports; 282 /******/ } 283 /******/ // Create a new module (and put it into the cache) 284 /******/ var module = __webpack_module_cache__[moduleId] = { 285 /******/ // no module.id needed 286 /******/ // no module.loaded needed 287 /******/ exports: {} 288 /******/ }; 289 /******/ 290 /******/ // Execute the module function 291 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); 292 /******/ 293 /******/ // Return the exports of the module 294 /******/ return module.exports; 295 /******/ } 296 /******/ 297 /******/ // expose the modules object (__webpack_modules__) 298 /******/ __webpack_require__.m = __webpack_modules__; 299 /******/ 300 /************************************************************************/ 301 /******/ /* webpack/runtime/chunk loaded */ 302 /******/ !function() { 303 /******/ var deferred = []; 304 /******/ __webpack_require__.O = function(result, chunkIds, fn, priority) { 305 /******/ if(chunkIds) { 306 /******/ priority = priority || 0; 307 /******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1]; 308 /******/ deferred[i] = [chunkIds, fn, priority]; 309 /******/ return; 310 /******/ } 311 /******/ var notFulfilled = Infinity; 312 /******/ for (var i = 0; i < deferred.length; i++) { 313 /******/ var chunkIds = deferred[i][0]; 314 /******/ var fn = deferred[i][1]; 315 /******/ var priority = deferred[i][2]; 316 /******/ var fulfilled = true; 317 /******/ for (var j = 0; j < chunkIds.length; j++) { 318 /******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every(function(key) { return __webpack_require__.O[key](chunkIds[j]); })) { 319 /******/ chunkIds.splice(j--, 1); 320 /******/ } else { 321 /******/ fulfilled = false; 322 /******/ if(priority < notFulfilled) notFulfilled = priority; 323 /******/ } 324 /******/ } 325 /******/ if(fulfilled) { 326 /******/ deferred.splice(i--, 1) 327 /******/ var r = fn(); 328 /******/ if (r !== undefined) result = r; 329 /******/ } 330 /******/ } 331 /******/ return result; 332 /******/ }; 333 /******/ }(); 334 /******/ 335 /******/ /* webpack/runtime/compat get default export */ 336 /******/ !function() { 337 /******/ // getDefaultExport function for compatibility with non-harmony modules 338 /******/ __webpack_require__.n = function(module) { 339 /******/ var getter = module && module.__esModule ? 340 /******/ function() { return module['default']; } : 341 /******/ function() { return module; }; 342 /******/ __webpack_require__.d(getter, { a: getter }); 343 /******/ return getter; 344 /******/ }; 345 /******/ }(); 346 /******/ 347 /******/ /* webpack/runtime/define property getters */ 348 /******/ !function() { 349 /******/ // define getter functions for harmony exports 350 /******/ __webpack_require__.d = function(exports, definition) { 351 /******/ for(var key in definition) { 352 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 353 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 354 /******/ } 355 /******/ } 356 /******/ }; 357 /******/ }(); 358 /******/ 359 /******/ /* webpack/runtime/hasOwnProperty shorthand */ 360 /******/ !function() { 361 /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } 362 /******/ }(); 363 /******/ 364 /******/ /* webpack/runtime/make namespace object */ 365 /******/ !function() { 366 /******/ // define __esModule on exports 367 /******/ __webpack_require__.r = function(exports) { 368 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 369 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 370 /******/ } 371 /******/ Object.defineProperty(exports, '__esModule', { value: true }); 372 /******/ }; 373 /******/ }(); 374 /******/ 375 /******/ /* webpack/runtime/jsonp chunk loading */ 376 /******/ !function() { 377 /******/ // no baseURI 378 /******/ 379 /******/ // object to store loaded and loading chunks 380 /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched 381 /******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded 382 /******/ var installedChunks = { 383 /******/ "index": 0, 384 /******/ "./style-index": 0 385 /******/ }; 386 /******/ 387 /******/ // no chunk on demand loading 388 /******/ 389 /******/ // no prefetching 390 /******/ 391 /******/ // no preloaded 392 /******/ 393 /******/ // no HMR 394 /******/ 395 /******/ // no HMR manifest 396 /******/ 397 /******/ __webpack_require__.O.j = function(chunkId) { return installedChunks[chunkId] === 0; }; 398 /******/ 399 /******/ // install a JSONP callback for chunk loading 400 /******/ var webpackJsonpCallback = function(parentChunkLoadingFunction, data) { 401 /******/ var chunkIds = data[0]; 402 /******/ var moreModules = data[1]; 403 /******/ var runtime = data[2]; 404 /******/ // add "moreModules" to the modules object, 405 /******/ // then flag all "chunkIds" as loaded and fire callback 406 /******/ var moduleId, chunkId, i = 0; 407 /******/ if(chunkIds.some(function(id) { return installedChunks[id] !== 0; })) { 408 /******/ for(moduleId in moreModules) { 409 /******/ if(__webpack_require__.o(moreModules, moduleId)) { 410 /******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; 411 /******/ } 412 /******/ } 413 /******/ if(runtime) var result = runtime(__webpack_require__); 414 /******/ } 415 /******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); 416 /******/ for(;i < chunkIds.length; i++) { 417 /******/ chunkId = chunkIds[i]; 418 /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { 419 /******/ installedChunks[chunkId][0](); 420 /******/ } 421 /******/ installedChunks[chunkId] = 0; 422 /******/ } 423 /******/ return __webpack_require__.O(result); 424 /******/ } 425 /******/ 426 /******/ var chunkLoadingGlobal = self["webpackChunkcodeless_hotspot_block"] = self["webpackChunkcodeless_hotspot_block"] || []; 427 /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); 428 /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); 429 /******/ }(); 430 /******/ 431 /************************************************************************/ 432 /******/ 433 /******/ // startup 434 /******/ // Load entry module and return exports 435 /******/ // This entry module depends on other loaded chunks and execution need to be delayed 436 /******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["./style-index"], function() { return __webpack_require__("./src/index.js"); }) 437 /******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__); 438 /******/ 439 /******/ })() 440 ; 441 //# sourceMappingURL=index.js.map -
codeless-hotspot-block/trunk/build/style-index.css
r2875040 r2875046 1 .hotspot-image-container{cursor:pointer;display:inline-block;position:relative}.hotspot-image-container .hotspot{position:absolute;z-index:2}.hotspot-image-container .hotspot:before{animation:pulse 2s infinite;background-color:rgba(0,0,0,.5);border-radius:50%;content:"";height:20px;left:0;position:absolute;top:0;transform:translate(-50%,-50%);width:20px}.hotspot-image-container .hotspot .hotspot-label{background-color:rgba(0,0,0,.8);border-radius:5px;color:#fff;display:none;font-size:14px;left:calc(50% + 10px);padding:5px;position:absolute;top:-50px;transform:translateX(-50%);white-space:nowrap;z-index:3}.hotspot-image-container .hotspot:hover .hotspot-label{display:block}.hotspot-image-container input[type=text]{background-color:#fff;border:1px solid #e1e1e1;border-radius:3px;color:#333;display:block;margin-bottom:10px;padding:5px;width:100%}.hotspot-image-container input[type=text]:focus{box-shadow:0 0 2px rgba(0,0,0,.3);outline:none}.hotspot-image-container .hotspot-arrow{border-bottom:10px solid transparent;border-right:10px solid rgba(0,0,0,.5);border-top:10px solid transparent;height:0;left:0;position:absolute;top:50%;transform:translateY(-50%);width:0;z-index:2}.hotspot-image-container .hotspot-options{background:#fff;border:1px solid #eee;box-shadow:1px 10px 10px rgba(0,0,0,.15);padding:15px}@keyframes pulse{0%{transform:scale(1)}50%{transform:scale(1.5)}to{transform:scale(1)}} 1 /*!***************************************************************************************************************************************************************************************************************************************!*\ 2 !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/style.scss ***! 3 \***************************************************************************************************************************************************************************************************************************************/ 4 .hotspot-image-container { 5 position: relative; 6 display: inline-block; 7 cursor: pointer; 8 } 9 .hotspot-image-container .hotspot { 10 position: absolute; 11 z-index: 2; 12 } 13 .hotspot-image-container .hotspot:before { 14 content: ""; 15 transform: translate(-50%, -50%); 16 border-radius: 50%; 17 background-color: rgba(0, 0, 0, 0.5); 18 width: 20px; 19 height: 20px; 20 left: 0px; 21 top: 0px; 22 position: absolute; 23 animation: pulse 2s infinite; 24 } 25 .hotspot-image-container .hotspot .hotspot-label { 26 position: absolute; 27 display: none; 28 top: -50px; 29 left: calc(50% + 10px); 30 transform: translateX(-50%); 31 padding: 5px; 32 border-radius: 5px; 33 background-color: rgba(0, 0, 0, 0.8); 34 color: white; 35 font-size: 14px; 36 white-space: nowrap; 37 z-index: 3; 38 } 39 .hotspot-image-container .hotspot:hover .hotspot-label { 40 display: block; 41 } 42 .hotspot-image-container input[type=text] { 43 display: block; 44 width: 100%; 45 margin-bottom: 10px; 46 padding: 5px; 47 border: none; 48 border-radius: 3px; 49 background-color: #fff; 50 color: #333; 51 border: 1px solid #e1e1e1; 52 } 53 .hotspot-image-container input[type=text]:focus { 54 outline: none; 55 box-shadow: 0 0 2px rgba(0, 0, 0, 0.3); 56 } 57 .hotspot-image-container .hotspot-arrow { 58 position: absolute; 59 width: 0; 60 height: 0; 61 border-top: 10px solid transparent; 62 border-bottom: 10px solid transparent; 63 border-right: 10px solid rgba(0, 0, 0, 0.5); 64 left: 0; 65 top: 50%; 66 transform: translateY(-50%); 67 z-index: 2; 68 } 69 .hotspot-image-container .hotspot-options { 70 background: #fff; 71 border: 1px solid #eee; 72 box-shadow: 1px 10px 10px rgba(0, 0, 0, 0.15); 73 padding: 15px; 74 } 75 76 @keyframes pulse { 77 0% { 78 transform: scale(1); 79 } 80 50% { 81 transform: scale(1.5); 82 } 83 100% { 84 transform: scale(1); 85 } 86 } 87 88 /*# sourceMappingURL=style-index.css.map*/ -
codeless-hotspot-block/trunk/codeless-hotspot-block.php
r2875040 r2875046 12 12 * Text Domain: codeless-hotspot-block 13 13 * 14 * @package c reate-block14 * @package codeless-blocks 15 15 */ 16 16 -
codeless-hotspot-block/trunk/package-lock.json
r2875040 r2875046 2975 2975 "webpack-cli": "^4.9.1", 2976 2976 "webpack-dev-server": "^4.4.0" 2977 }, 2978 "dependencies": { 2979 "prettier": { 2980 "version": "npm:wp-prettier@2.6.2", 2981 "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.6.2.tgz", 2982 "integrity": "sha512-AV33EzqiFJ3fj+mPlKABN59YFPReLkDxQnj067Z3uEOeRQf3g05WprL0RDuqM7UBhSRo9W1rMSC2KvZmjE5UOA==", 2983 "dev": true 2984 } 2977 2985 } 2978 2986 }, … … 9321 9329 "dev": true 9322 9330 }, 9323 "prettier": {9324 "version": "npm:wp-prettier@2.6.2",9325 "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.6.2.tgz",9326 "integrity": "sha512-AV33EzqiFJ3fj+mPlKABN59YFPReLkDxQnj067Z3uEOeRQf3g05WprL0RDuqM7UBhSRo9W1rMSC2KvZmjE5UOA==",9327 "dev": true9328 },9329 9331 "prettier-linter-helpers": { 9330 9332 "version": "1.0.0", -
codeless-hotspot-block/trunk/src/block.json
r2875040 r2875046 2 2 "$schema": "https://schemas.wp.org/trunk/block.json", 3 3 "apiVersion": 2, 4 "name": "c reate-block/codeless-hotspot-block",4 "name": "codeless-blocks/hotspot", 5 5 "version": "0.1.0", 6 "title": " Codeless Hotspot Block",6 "title": "Hotspot Block by Codeless", 7 7 "category": "widgets", 8 8 "icon": "smiley", 9 "description": " Example block scaffolded with Create Block tool.",9 "description": "Add hotspots to a selected image", 10 10 "supports": { 11 11 "html": false 12 12 }, 13 "textdomain": "codeless- hotspot-block",13 "textdomain": "codeless-blocks", 14 14 "editorScript": "file:./index.js", 15 15 "editorStyle": "file:./index.css", -
codeless-hotspot-block/trunk/src/editor.scss
r2875040 r2875046 4 4 * Replace them with your own styles or remove the file completely. 5 5 */ 6 7 .wp-block-create-block-codeless-hotspot-block {8 border: 1px dotted #f00;9 } -
codeless-hotspot-block/trunk/src/index.js
r2875040 r2875046 12 12 13 13 registerBlockType('codeless-blocks/hotspot', { 14 title: ' Codeless Hotspot',14 title: 'Hotspot Block by Codeless', 15 15 icon: 'location', 16 16 category: 'common',
Note: See TracChangeset
for help on using the changeset viewer.