Plugin Directory

Changeset 2416464


Ignore:
Timestamp:
11/11/2020 09:29:53 AM (5 years ago)
Author:
hamworks
Message:

Update to version 0.0.4 from GitHub

Location:
simple-speech-bubble
Files:
26 edited
1 copied

Legend:

Unmodified
Added
Removed
  • simple-speech-bubble/tags/0.0.4/README.md

    r2416406 r2416464  
    66Tested up to:      5.5 
    77Requires PHP:      7.3 
    8 Stable tag:        0.0.3
     8Stable tag:        0.0.4
    99License:           GPLv2 or later 
    1010License URI:       https://www.gnu.org/licenses/gpl-2.0.html 
  • simple-speech-bubble/tags/0.0.4/build/index.asset.php

    r2416406 r2416464  
    1 <?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-polyfill', 'wp-primitives'), 'version' => '942218c29f01b6da3c66efbdb4013b30');
     1<?php return array('dependencies' => array('lodash', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-polyfill', 'wp-primitives'), 'version' => '0928098cc3698cec541b7cf96b3ebf8b');
  • simple-speech-bubble/tags/0.0.4/build/index.css

    r2416406 r2416464  
    1 :root{--bubble-arrow-size:15px;--bubble-bg-color:#f2f2f2;--bubble-bd-color:#ddd;--bubble-bd-width:2px}.wp-block-simple-speech-bubble-speech-bubble{justify-content:space-between;display:flex;width:100%;flex-direction:row;align-items:center}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right{flex-direction:row-reverse}.wp-block-simple-speech-bubble-speech-bubble__media{width:30%;box-sizing:border-box}.wp-block-simple-speech-bubble-speech-bubble__comment{display:block;position:relative;padding:1em;border-radius:.2em;box-sizing:border-box;width:calc(70% - 25px);width:calc(70% - var(--bubble-arrow-size) - 10px);background-color:#f2f2f2;background-color:var(--bubble-bg-color);border:2px solid #ddd;border:var(--bubble-bd-width) solid var(--bubble-bd-color)}.wp-block-simple-speech-bubble-speech-bubble__comment .wp-block-simple-speech-bubble-speech-bubble__arrow{z-index:100}.wp-block-simple-speech-bubble-speech-bubble__comment:before{border-color:inherit}.wp-block-simple-speech-bubble-speech-bubble__comment .wp-block-simple-speech-bubble-speech-bubble__arrow,.wp-block-simple-speech-bubble-speech-bubble__comment:after{border-color:#f2f2f2;border-color:var(--bubble-bg-color)}.wp-block-simple-speech-bubble-speech-bubble__comment .wp-block-simple-speech-bubble-speech-bubble__arrow,.wp-block-simple-speech-bubble-speech-bubble__comment:after,.wp-block-simple-speech-bubble-speech-bubble__comment:before{content:"";position:absolute;display:block;width:0;height:0;top:50%;transform:translateY(-50%);border-style:solid;border-width:0;border-top:15px solid transparent!important;border-top:var(--bubble-arrow-size) solid transparent!important;border-bottom:15px solid transparent!important;border-bottom:var(--bubble-arrow-size) solid transparent!important}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-left .wp-block-simple-speech-bubble-speech-bubble__comment .wp-block-simple-speech-bubble-speech-bubble__arrow,.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-left .wp-block-simple-speech-bubble-speech-bubble__comment:after,.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-left .wp-block-simple-speech-bubble-speech-bubble__comment:before{border-right-width:15px;border-right-width:var(--bubble-arrow-size)}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-left .wp-block-simple-speech-bubble-speech-bubble__comment:before{left:-15px;left:calc(var(--bubble-arrow-size)*-1)}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-left .wp-block-simple-speech-bubble-speech-bubble__comment .wp-block-simple-speech-bubble-speech-bubble__arrow,.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-left .wp-block-simple-speech-bubble-speech-bubble__comment:after{left:-12px;left:calc(var(--bubble-arrow-size)*-1 + var(--bubble-bd-width) + 1px)}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right .wp-block-simple-speech-bubble-speech-bubble__comment .wp-block-simple-speech-bubble-speech-bubble__arrow,.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right .wp-block-simple-speech-bubble-speech-bubble__comment:after,.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right .wp-block-simple-speech-bubble-speech-bubble__comment:before{border-left-width:15px;border-left-width:var(--bubble-arrow-size)}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right .wp-block-simple-speech-bubble-speech-bubble__comment:before{right:-15px;right:calc(var(--bubble-arrow-size)*-1)}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right .wp-block-simple-speech-bubble-speech-bubble__comment .wp-block-simple-speech-bubble-speech-bubble__arrow,.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right .wp-block-simple-speech-bubble-speech-bubble__comment:after{right:-12px;right:calc(var(--bubble-arrow-size)*-1 + var(--bubble-bd-width) + 1px)}
     1:root{--bubble-arrow-size:15px;--bubble-bg-color:#f2f2f2;--bubble-bd-color:#ddd;--bubble-bd-width:2px}.wp-block-simple-speech-bubble-speech-bubble{justify-content:space-between;display:flex;width:100%;margin-top:1em;margin-bottom:1em;flex-direction:row;align-items:center}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right{flex-direction:row-reverse}.wp-block-simple-speech-bubble-speech-bubble__media{max-width:30%;box-sizing:border-box}.wp-block-simple-speech-bubble-speech-bubble__comment{display:block;position:relative;padding:1em;border-radius:.2em;flex-grow:1;box-sizing:border-box;width:calc(70% - 25px);width:calc(70% - var(--bubble-arrow-size) - 10px);background-color:#f2f2f2;background-color:var(--bubble-bg-color);border:2px solid #ddd;border:var(--bubble-bd-width) solid var(--bubble-bd-color)}.wp-block-simple-speech-bubble-speech-bubble__comment .wp-block-simple-speech-bubble-speech-bubble__arrow{z-index:100}.wp-block-simple-speech-bubble-speech-bubble__comment:before{border-color:inherit}.wp-block-simple-speech-bubble-speech-bubble__comment .wp-block-simple-speech-bubble-speech-bubble__arrow,.wp-block-simple-speech-bubble-speech-bubble__comment:after{border-color:#f2f2f2;border-color:var(--bubble-bg-color)}.wp-block-simple-speech-bubble-speech-bubble__comment .wp-block-simple-speech-bubble-speech-bubble__arrow,.wp-block-simple-speech-bubble-speech-bubble__comment:after,.wp-block-simple-speech-bubble-speech-bubble__comment:before{content:"";position:absolute;display:block;width:0;height:0;top:50%;transform:translateY(-50%);border-style:solid;border-width:0;border-top:15px solid transparent!important;border-top:var(--bubble-arrow-size) solid transparent!important;border-bottom:15px solid transparent!important;border-bottom:var(--bubble-arrow-size) solid transparent!important}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-left .wp-block-simple-speech-bubble-speech-bubble__media{text-align:left}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-left .wp-block-simple-speech-bubble-speech-bubble__media img{margin-right:auto}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-left .wp-block-simple-speech-bubble-speech-bubble__comment{margin-left:25px;margin-left:calc(var(--bubble-arrow-size) + 10px)}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-left .wp-block-simple-speech-bubble-speech-bubble__comment .wp-block-simple-speech-bubble-speech-bubble__arrow,.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-left .wp-block-simple-speech-bubble-speech-bubble__comment:after,.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-left .wp-block-simple-speech-bubble-speech-bubble__comment:before{border-right-width:15px;border-right-width:var(--bubble-arrow-size)}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-left .wp-block-simple-speech-bubble-speech-bubble__comment:before{left:-15px;left:calc(var(--bubble-arrow-size)*-1)}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-left .wp-block-simple-speech-bubble-speech-bubble__comment .wp-block-simple-speech-bubble-speech-bubble__arrow,.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-left .wp-block-simple-speech-bubble-speech-bubble__comment:after{left:-12px;left:calc(var(--bubble-arrow-size)*-1 + var(--bubble-bd-width) + 1px)}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right .wp-block-simple-speech-bubble-speech-bubble__media{text-align:right}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right .wp-block-simple-speech-bubble-speech-bubble__media img{margin-left:auto}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right .wp-block-simple-speech-bubble-speech-bubble__comment{margin-right:25px;margin-right:calc(var(--bubble-arrow-size) + 10px)}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right .wp-block-simple-speech-bubble-speech-bubble__comment .wp-block-simple-speech-bubble-speech-bubble__arrow,.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right .wp-block-simple-speech-bubble-speech-bubble__comment:after,.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right .wp-block-simple-speech-bubble-speech-bubble__comment:before{border-left-width:15px;border-left-width:var(--bubble-arrow-size)}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right .wp-block-simple-speech-bubble-speech-bubble__comment:before{right:-15px;right:calc(var(--bubble-arrow-size)*-1)}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right .wp-block-simple-speech-bubble-speech-bubble__comment .wp-block-simple-speech-bubble-speech-bubble__arrow,.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right .wp-block-simple-speech-bubble-speech-bubble__comment:after{right:-12px;right:calc(var(--bubble-arrow-size)*-1 + var(--bubble-bd-width) + 1px)}
  • simple-speech-bubble/tags/0.0.4/build/index.js

    r2416370 r2416464  
    1 !function(e){var t={};function o(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.m=e,o.c=t,o.d=function(e,t,r){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)o.d(r,n,function(t){return e[t]}.bind(null,n));return r},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=12)}([function(e,t){!function(){e.exports=this.wp.element}()},function(e,t){e.exports=function(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}},function(e,t){!function(){e.exports=this.wp.blockEditor}()},function(e,t){!function(){e.exports=this.wp.i18n}()},function(e,t,o){var r;!function(){"use strict";var o={}.hasOwnProperty;function n(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var c=typeof r;if("string"===c||"number"===c)e.push(r);else if(Array.isArray(r)&&r.length){var l=n.apply(null,r);l&&e.push(l)}else if("object"===c)for(var i in r)o.call(r,i)&&r[i]&&e.push(i)}}return e.join(" ")}e.exports?(n.default=n,e.exports=n):void 0===(r=function(){return n}.apply(t,[]))||(e.exports=r)}()},function(e,t){!function(){e.exports=this.wp.primitives}()},function(e){e.exports=JSON.parse('{"name":"simple-speech-bubble/speech-bubble","title":"Speech Bubble","icon":"format-chat","description":"speech-bubble","textdomain":"simple-speech-bubble","category":"common","editorScript":"file:../../build/index.js","script":"file:../../build/script.js","editorStyle":"file:../../build/index.css","style":"file:../../build/index.css","attributes":{"mediaId":{"type":"integer","default":0},"mediaCaption":{"type":"string","default":"","selector":"figure figcaption"},"mediaURL":{"type":"string","default":"","selector":"figure img","attribute":"src"},"mediaPosition":{"type":"string","default":"left"},"backgroundColor":{"type":"string"},"customBackgroundColor":{"type":"string"},"borderColor":{"type":"string"},"customBorderColor":{"type":"string"},"textColor":{"type":"string"},"customTextColor":{"type":"string"}},"supports":{"color":{"link":true}}}')},function(e,t){!function(){e.exports=this.wp.blocks}()},function(e,t){function o(){return e.exports=o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},o.apply(this,arguments)}e.exports=o},function(e,t){!function(){e.exports=this.wp.components}()},,function(e,t,o){},function(e,t,o){"use strict";o.r(t);var r=o(1),n=o.n(r),c=o(7),l=(o(11),o(8)),i=o.n(l),a=o(0),s=o(2),u=o(4),b=o.n(u),p=o(5),m=Object(a.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(a.createElement)(p.Path,{d:"M4 18h6V6H4v12zm9-10v1.5h7V8h-7zm0 7.5h7V14h-7v1.5z"})),d=Object(a.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(a.createElement)(p.Path,{d:"M14 6v12h6V6h-6zM4 9.5h7V8H4v1.5zm0 6h7V14H4v1.5z"})),f=o(3),g=o(9),h=Object(s.withColors)({backgroundColor:"background-color",borderColor:"border-color",textColor:"text-color"})((function(e){var t,o=e.className,r=e.attributes,c=r.mediaId,l=r.mediaURL,u=r.mediaPosition,p=r.mediaCaption,h=e.setAttributes,O=e.backgroundColor,j=e.setBackgroundColor,v=e.borderColor,y=e.setBorderColor,C=e.textColor,x=e.setTextColor,w=function(e){var t=e.id,o=e.url,r=e.caption,n=e.alt;h({mediaId:t,mediaURL:o,mediaCaption:r||n||""})},k=l?Object(a.createElement)("img",{src:l,alt:""}):Object(a.createElement)(s.MediaPlaceholder,{onSelect:w,allowedTypes:["image"],multiple:!1}),E=[{icon:m,title:Object(f.__)("Show media on left"),isActive:"left"===u,onClick:function(){return h({mediaPosition:"left"})}},{icon:d,title:Object(f.__)("Show media on right"),isActive:"right"===u,onClick:function(){return h({mediaPosition:"right"})}}],_={"--bubble-bg-color":O.color,"--bubble-bd-color":v.color,color:C.color},P=b()("wp-block-simple-speech-bubble-speech-bubble__comment",(t={"has-background-color":O.color},n()(t,O.class,O.class),n()(t,"has-border-color",v.color),n()(t,v.class,v.class),n()(t,"has-text-color",C.color),n()(t,C.class,C.class),t));return Object(a.createElement)(a.Fragment,null,Object(a.createElement)(s.BlockControls,null,Object(a.createElement)(g.ToolbarGroup,{controls:E}),Object(a.createElement)(s.MediaReplaceFlow,{mediaId:c,mediaURL:l,allowedTypes:["image"],accept:"image/*",onSelect:w})),Object(a.createElement)(s.InspectorControls,null,Object(a.createElement)(s.PanelColorSettings,{title:Object(f.__)("Color settings"),colorSettings:[{value:O.color,onChange:function(e){j(e),h({customBackgroundColor:e})},label:Object(f.__)("Background color")},{value:v.color,onChange:function(e){y(e),h({customBorderColor:e})},label:Object(f.__)("Border color")},{value:C.color,onChange:function(e){x(e),h({customTextColor:e})},label:Object(f.__)("Text color")}]},Object(a.createElement)(s.ContrastChecker,i()({textColor:C.color,backgroundColor:O.color},{isLargeText:!1})))),Object(a.createElement)("div",{className:b()(o,n()({},"has-media-on-the-".concat(u),u)),style:_},Object(a.createElement)("figure",{className:"wp-block-simple-speech-bubble-speech-bubble__media"},k,Object(a.createElement)(s.RichText,{tagName:"figcaption",value:p,onChange:function(e){return h({mediaCaption:e})}})),Object(a.createElement)("div",{className:P,style:_},Object(a.createElement)(s.InnerBlocks,{template:[["core/paragraph",{placeholder:"Enter side content..."}]]}))))})),O=function(e){var t,o=e.attributes,r=o.mediaURL,c=o.mediaPosition,l=o.mediaCaption,i=o.backgroundColor,u=o.customBackgroundColor,p=o.borderColor,m=o.customBorderColor,d=o.textColor,f=o.customTextColor,g=Object(s.getColorClassName)("background-color",i),h=Object(s.getColorClassName)("border-color",p),O=Object(s.getColorClassName)("text-color",d),j={"--bubble-bg-color":u,"--bubble-bd-color":m,color:f},v=b()("wp-block-simple-speech-bubble-speech-bubble__comment",(t={"has-background":g||u},n()(t,g,g),n()(t,"has-border-color",h||m),n()(t,h,h),n()(t,"has-text-color",O||f),n()(t,O,O),t));return Object(a.createElement)("div",{className:b()(n()({},"has-media-on-the-".concat(c),c))},Object(a.createElement)("figure",{className:"wp-block-simple-speech-bubble-speech-bubble__media"},Object(a.createElement)("img",{src:r,alt:""}),l?Object(a.createElement)(s.RichText.Content,{tagName:"figcaption",value:l}):null),Object(a.createElement)("div",{className:v,style:j},Object(a.createElement)(s.InnerBlocks.Content,null)))},j=o(6);function v(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,r)}return o}function y(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?v(Object(o),!0).forEach((function(t){n()(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):v(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}var C=y(y({},j),{},{edit:h,save:O});Object(c.registerBlockType)(j.name,C)}]);
     1!function(e){var t={};function o(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.m=e,o.c=t,o.d=function(e,t,r){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)o.d(r,n,function(t){return e[t]}.bind(null,n));return r},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=14)}([function(e,t){!function(){e.exports=this.wp.element}()},function(e,t){e.exports=function(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}},function(e,t){!function(){e.exports=this.wp.blockEditor}()},function(e,t){!function(){e.exports=this.wp.i18n}()},function(e,t,o){var r;!function(){"use strict";var o={}.hasOwnProperty;function n(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var c=typeof r;if("string"===c||"number"===c)e.push(r);else if(Array.isArray(r)&&r.length){var l=n.apply(null,r);l&&e.push(l)}else if("object"===c)for(var i in r)o.call(r,i)&&r[i]&&e.push(i)}}return e.join(" ")}e.exports?(n.default=n,e.exports=n):void 0===(r=function(){return n}.apply(t,[]))||(e.exports=r)}()},function(e,t){!function(){e.exports=this.wp.primitives}()},function(e,t){!function(){e.exports=this.lodash}()},function(e,t){!function(){e.exports=this.wp.components}()},function(e,t){!function(){e.exports=this.wp.data}()},function(e){e.exports=JSON.parse('{"name":"simple-speech-bubble/speech-bubble","title":"Speech Bubble","icon":"format-chat","description":"speech-bubble","textdomain":"simple-speech-bubble","category":"common","editorScript":"file:../../build/index.js","script":"file:../../build/script.js","editorStyle":"file:../../build/index.css","style":"file:../../build/index.css","attributes":{"mediaId":{"type":"integer","default":0},"mediaCaption":{"type":"string","default":"","selector":"figure figcaption"},"mediaURL":{"type":"string","default":"","selector":"figure img","attribute":"src"},"mediaSizeSlug":{"type":"string","default":"full"},"mediaPosition":{"type":"string","default":"left"},"backgroundColor":{"type":"string"},"customBackgroundColor":{"type":"string"},"borderColor":{"type":"string"},"customBorderColor":{"type":"string"},"textColor":{"type":"string"},"customTextColor":{"type":"string"}},"supports":{"color":{"link":true}}}')},function(e,t){!function(){e.exports=this.wp.blocks}()},function(e,t){function o(){return e.exports=o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},o.apply(this,arguments)}e.exports=o},,function(e,t,o){},function(e,t,o){"use strict";o.r(t);var r=o(1),n=o.n(r),c=o(10),l=(o(13),o(11)),i=o.n(l),a=o(0),s=o(2),u=o(4),b=o.n(u),p=o(5),m=Object(a.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(a.createElement)(p.Path,{d:"M4 18h6V6H4v12zm9-10v1.5h7V8h-7zm0 7.5h7V14h-7v1.5z"})),d=Object(a.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(a.createElement)(p.Path,{d:"M14 6v12h6V6h-6zM4 9.5h7V8H4v1.5zm0 6h7V14H4v1.5z"})),f=o(8),g=o(6),h=o(3),O=o(7),j=Object(s.withColors)({backgroundColor:"background-color",borderColor:"border-color",textColor:"text-color"})((function(e){var t,o=e.className,r=e.attributes,c=r.mediaId,l=r.mediaURL,u=r.mediaPosition,p=r.mediaCaption,j=r.mediaSizeSlug,v=e.setAttributes,y=e.backgroundColor,C=e.setBackgroundColor,x=e.borderColor,w=e.setBorderColor,_=e.textColor,S=e.setTextColor,k=e.isSelected,E=Object(f.useSelect)((function(e){var t=e("core/block-editor").getSettings;return Object(g.pick)(t(),["imageSizes"])})).imageSizes,P=Object(f.useSelect)((function(e){var t=e("core").getMedia;return c&&k?t(c):null}),[c,k]),B=Object(g.map)(Object(g.filter)(E,(function(e){var t=e.slug;return Object(g.get)(P,["media_details","sizes",t,"source_url"])})),(function(e){var t=e.name;return{value:e.slug,label:t}})),z=function(e){var t=e.id,o=e.url,r=e.caption,n=e.alt;v({mediaId:t,mediaURL:o,mediaCaption:r||n||""})},T=l?Object(a.createElement)("img",{src:l,alt:""}):Object(a.createElement)(s.MediaPlaceholder,{onSelect:z,allowedTypes:["image"],multiple:!1}),N=[{icon:m,title:Object(h.__)("Show media on left"),isActive:"left"===u,onClick:function(){return v({mediaPosition:"left"})}},{icon:d,title:Object(h.__)("Show media on right"),isActive:"right"===u,onClick:function(){return v({mediaPosition:"right"})}}],M={"--bubble-bg-color":y.color,"--bubble-bd-color":x.color,color:_.color},I=b()("wp-block-simple-speech-bubble-speech-bubble__comment",(t={"has-background-color":y.color},n()(t,y.class,y.class),n()(t,"has-border-color",x.color),n()(t,x.class,x.class),n()(t,"has-text-color",_.color),n()(t,_.class,_.class),t));return Object(a.createElement)(a.Fragment,null,Object(a.createElement)(s.BlockControls,null,Object(a.createElement)(O.ToolbarGroup,{controls:N}),Object(a.createElement)(s.MediaReplaceFlow,{mediaId:c,mediaURL:l,allowedTypes:["image"],accept:"image/*",onSelect:z})),Object(a.createElement)(s.InspectorControls,null,Object(a.createElement)(O.PanelBody,{title:Object(h.__)("Image settings")},Object(a.createElement)(O.SelectControl,{label:Object(h.__)("Image size"),value:j,options:B,onChange:function(e){var t=Object(g.get)(P,["media_details","sizes",e,"source_url"]);v({mediaSizeSlug:e,mediaURL:t})}})),Object(a.createElement)(s.PanelColorSettings,{title:Object(h.__)("Color settings"),colorSettings:[{value:y.color,onChange:function(e){C(e),v({customBackgroundColor:e})},label:Object(h.__)("Background color")},{value:x.color,onChange:function(e){w(e),v({customBorderColor:e})},label:Object(h.__)("Border color")},{value:_.color,onChange:function(e){S(e),v({customTextColor:e})},label:Object(h.__)("Text color")}]},Object(a.createElement)(s.ContrastChecker,i()({textColor:_.color,backgroundColor:y.color},{isLargeText:!1})))),Object(a.createElement)("div",{className:b()(o,n()({},"has-media-on-the-".concat(u),u)),style:M},Object(a.createElement)("figure",{className:"wp-block-simple-speech-bubble-speech-bubble__media"},T,Object(a.createElement)(s.RichText,{tagName:"figcaption",value:p,onChange:function(e){return v({mediaCaption:e})}})),Object(a.createElement)("div",{className:I,style:M},Object(a.createElement)(s.InnerBlocks,{template:[["core/paragraph",{placeholder:"Enter side content..."}]]}))))})),v=function(e){var t,o=e.attributes,r=o.mediaURL,c=o.mediaPosition,l=o.mediaCaption,i=o.backgroundColor,u=o.customBackgroundColor,p=o.borderColor,m=o.customBorderColor,d=o.textColor,f=o.customTextColor,g=Object(s.getColorClassName)("background-color",i),h=Object(s.getColorClassName)("border-color",p),O=Object(s.getColorClassName)("text-color",d),j={"--bubble-bg-color":u,"--bubble-bd-color":m,color:f},v=b()("wp-block-simple-speech-bubble-speech-bubble__comment",(t={"has-background":g||u},n()(t,g,g),n()(t,"has-border-color",h||m),n()(t,h,h),n()(t,"has-text-color",O||f),n()(t,O,O),t));return Object(a.createElement)("div",{className:b()(n()({},"has-media-on-the-".concat(c),c))},Object(a.createElement)("figure",{className:"wp-block-simple-speech-bubble-speech-bubble__media"},Object(a.createElement)("img",{src:r,alt:""}),l?Object(a.createElement)(s.RichText.Content,{tagName:"figcaption",value:l}):null),Object(a.createElement)("div",{className:v,style:j},Object(a.createElement)(s.InnerBlocks.Content,null)))},y=o(9);function C(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,r)}return o}function x(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?C(Object(o),!0).forEach((function(t){n()(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):C(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}var w=x(x({},y),{},{edit:j,save:v});Object(c.registerBlockType)(y.name,w)}]);
  • simple-speech-bubble/tags/0.0.4/build/script.asset.php

    r2416370 r2416464  
    1 <?php return array('dependencies' => array('wp-dom-ready', 'wp-polyfill'), 'version' => '42b1198cf5d170501efbe86ee305a8a3');
     1<?php return array('dependencies' => array('wp-dom-ready', 'wp-polyfill'), 'version' => '8d9d9b702080a07704d953baa1da807a');
  • simple-speech-bubble/tags/0.0.4/build/script.js

    r2416370 r2416464  
    1 !function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=13)}({10:function(e,t){!function(){e.exports=this.wp.domReady}()},13:function(e,t,r){"use strict";r.r(t);var n,o,u=r(10),l=r.n(u),i=null===(n=window)||void 0===n||null===(o=n.CSS)||void 0===o?void 0:o.supports("(--a: 0)");l()((function(){if(!i){document.querySelectorAll(".wp-block-simple-speech-bubble-speech-bubble__comment").forEach((function(e){var t=window.getComputedStyle(e),r=document.createElement("div");r.classList.add("wp-block-simple-speech-bubble-speech-bubble__arrow"),r.style.borderColor=t.getPropertyValue("background-color"),e.appendChild(r)}))}}))}});
     1!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=15)}({12:function(e,t){!function(){e.exports=this.wp.domReady}()},15:function(e,t,r){"use strict";r.r(t);var n,o,u=r(12),l=r.n(u),i=null===(n=window)||void 0===n||null===(o=n.CSS)||void 0===o?void 0:o.supports("(--a: 0)");l()((function(){if(!i){document.querySelectorAll(".wp-block-simple-speech-bubble-speech-bubble__comment").forEach((function(e){var t=window.getComputedStyle(e),r=document.createElement("div");r.classList.add("wp-block-simple-speech-bubble-speech-bubble__arrow"),r.style.borderColor=t.getPropertyValue("background-color"),e.appendChild(r)}))}}))}});
  • simple-speech-bubble/tags/0.0.4/package-lock.json

    r2416406 r2416464  
    11{
    22    "name": "@hamworks/simple-speech-bubble",
    3     "version": "0.0.3",
     3    "version": "0.0.4",
    44    "lockfileVersion": 1,
    55    "requires": true,
  • simple-speech-bubble/tags/0.0.4/package.json

    r2416406 r2416464  
    11{
    22    "name": "@hamworks/simple-speech-bubble",
    3     "version": "0.0.3",
     3    "version": "0.0.4",
    44    "description": "Speech bubble block",
    55    "author": "Hiroshi Urabe <urabe@ham.works> (https://ham.works)",
     
    1919    "dependencies": {
    2020        "@wordpress/icons": "^2.8.0",
    21         "classnames": "^2.2.6"
     21        "classnames": "^2.2.6",
     22        "lodash": "^4.17.20"
    2223    },
    2324    "devDependencies": {
  • simple-speech-bubble/tags/0.0.4/readme.txt

    r2416406 r2416464  
    66Tested up to:      5.5 
    77Requires PHP:      7.3 
    8 Stable tag:        0.0.3
     8Stable tag:        0.0.4
    99License:           GPLv2 or later 
    1010License URI:       https://www.gnu.org/licenses/gpl-2.0.html 
  • simple-speech-bubble/tags/0.0.4/simple-speech-bubble.php

    r2416406 r2416464  
    1010 * Text Domain:     simple-speech-bubble
    1111 * Domain Path:     /languages
    12  * Version: 0.0.3
     12 * Version: 0.0.4
    1313 */
    1414
  • simple-speech-bubble/tags/0.0.4/src/speech-bubble/block.json

    r2416370 r2416464  
    2525            "selector": "figure img",
    2626            "attribute": "src"
     27        },
     28        "mediaSizeSlug": {
     29            "type": "string",
     30            "default": "full"
    2731        },
    2832        "mediaPosition": {
  • simple-speech-bubble/tags/0.0.4/src/speech-bubble/edit.js

    r2416370 r2416464  
    1212import classnames from 'classnames';
    1313import { pullLeft, pullRight } from '@wordpress/icons';
     14import { useSelect } from '@wordpress/data';
     15import { get, filter, map, pick } from 'lodash';
    1416import { __ } from '@wordpress/i18n';
    15 import { ToolbarGroup } from '@wordpress/components';
     17import { ToolbarGroup, PanelBody, SelectControl } from '@wordpress/components';
    1618
    1719const Edit = ( {
    1820    className,
    19     attributes: { mediaId, mediaURL, mediaPosition, mediaCaption },
     21    attributes: {
     22        mediaId,
     23        mediaURL,
     24        mediaPosition,
     25        mediaCaption,
     26        mediaSizeSlug,
     27    },
    2028    setAttributes,
    2129    backgroundColor,
     
    2533    textColor,
    2634    setTextColor,
     35    isSelected,
    2736} ) => {
     37    const { imageSizes } = useSelect( ( select ) => {
     38        const { getSettings } = select( 'core/block-editor' );
     39        return pick( getSettings(), [ 'imageSizes' ] );
     40    } );
     41
     42    const image = useSelect(
     43        ( select ) => {
     44            const { getMedia } = select( 'core' );
     45            return mediaId && isSelected ? getMedia( mediaId ) : null;
     46        },
     47        [ mediaId, isSelected ]
     48    );
     49
     50    const imageSizeOptions = map(
     51        filter( imageSizes, ( { slug } ) =>
     52            get( image, [ 'media_details', 'sizes', slug, 'source_url' ] )
     53        ),
     54        ( { name, slug } ) => ( { value: slug, label: name } )
     55    );
     56
    2857    const onSelectMedia = ( props ) => {
    2958        const { id, url, caption, alt } = props;
     
    3261            mediaURL: url,
    3362            mediaCaption: caption || alt || '',
     63        } );
     64    };
     65
     66    const onChangeMediaSize = ( slug ) => {
     67        const url = get( image, [
     68            'media_details',
     69            'sizes',
     70            slug,
     71            'source_url',
     72        ] );
     73        setAttributes( {
     74            mediaSizeSlug: slug,
     75            mediaURL: url,
    3476        } );
    3577    };
     
    91133            </BlockControls>
    92134            <InspectorControls>
     135                <PanelBody title={ __( 'Image settings' ) }>
     136                    <SelectControl
     137                        label={ __( 'Image size' ) }
     138                        value={ mediaSizeSlug }
     139                        options={ imageSizeOptions }
     140                        onChange={ onChangeMediaSize }
     141                    />
     142                </PanelBody>
    93143                <PanelColorSettings
    94144                    title={ __( 'Color settings' ) }
  • simple-speech-bubble/tags/0.0.4/src/speech-bubble/index.css

    r2416406 r2416464  
    1010    display: flex;
    1111    width: 100%;
     12    margin-top: 1em;
     13    margin-bottom: 1em;
    1214    flex-direction: row;
    1315    align-items: center;
     
    2022
    2123.wp-block-simple-speech-bubble-speech-bubble__media {
    22     width: 30%;
     24    max-width: 30%;
    2325    box-sizing: border-box;
    2426}
     
    2931    padding: 1em;
    3032    border-radius: 0.2em;
     33    flex-grow: 1;
    3134    box-sizing: border-box;
    3235    width: calc(70% - var(--bubble-arrow-size) - 10px);
     
    6669.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-left {
    6770
     71    & .wp-block-simple-speech-bubble-speech-bubble__media {
     72        text-align: left;
     73        & img {
     74            margin-right: auto;
     75        }
     76    }
     77
    6878    & .wp-block-simple-speech-bubble-speech-bubble__comment {
     79
     80        margin-left: calc(var(--bubble-arrow-size) + 10px);
    6981
    7082        &::before,
     
    8799.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right {
    88100
     101    & .wp-block-simple-speech-bubble-speech-bubble__media {
     102        text-align: right;
     103        & img {
     104            margin-left: auto;
     105        }
     106    }
     107
    89108    & .wp-block-simple-speech-bubble-speech-bubble__comment {
     109
     110        margin-right: calc(var(--bubble-arrow-size) + 10px);
    90111
    91112        &::before,
  • simple-speech-bubble/trunk/README.md

    r2416406 r2416464  
    66Tested up to:      5.5 
    77Requires PHP:      7.3 
    8 Stable tag:        0.0.3
     8Stable tag:        0.0.4
    99License:           GPLv2 or later 
    1010License URI:       https://www.gnu.org/licenses/gpl-2.0.html 
  • simple-speech-bubble/trunk/build/index.asset.php

    r2416406 r2416464  
    1 <?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-polyfill', 'wp-primitives'), 'version' => '942218c29f01b6da3c66efbdb4013b30');
     1<?php return array('dependencies' => array('lodash', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-polyfill', 'wp-primitives'), 'version' => '0928098cc3698cec541b7cf96b3ebf8b');
  • simple-speech-bubble/trunk/build/index.css

    r2416406 r2416464  
    1 :root{--bubble-arrow-size:15px;--bubble-bg-color:#f2f2f2;--bubble-bd-color:#ddd;--bubble-bd-width:2px}.wp-block-simple-speech-bubble-speech-bubble{justify-content:space-between;display:flex;width:100%;flex-direction:row;align-items:center}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right{flex-direction:row-reverse}.wp-block-simple-speech-bubble-speech-bubble__media{width:30%;box-sizing:border-box}.wp-block-simple-speech-bubble-speech-bubble__comment{display:block;position:relative;padding:1em;border-radius:.2em;box-sizing:border-box;width:calc(70% - 25px);width:calc(70% - var(--bubble-arrow-size) - 10px);background-color:#f2f2f2;background-color:var(--bubble-bg-color);border:2px solid #ddd;border:var(--bubble-bd-width) solid var(--bubble-bd-color)}.wp-block-simple-speech-bubble-speech-bubble__comment .wp-block-simple-speech-bubble-speech-bubble__arrow{z-index:100}.wp-block-simple-speech-bubble-speech-bubble__comment:before{border-color:inherit}.wp-block-simple-speech-bubble-speech-bubble__comment .wp-block-simple-speech-bubble-speech-bubble__arrow,.wp-block-simple-speech-bubble-speech-bubble__comment:after{border-color:#f2f2f2;border-color:var(--bubble-bg-color)}.wp-block-simple-speech-bubble-speech-bubble__comment .wp-block-simple-speech-bubble-speech-bubble__arrow,.wp-block-simple-speech-bubble-speech-bubble__comment:after,.wp-block-simple-speech-bubble-speech-bubble__comment:before{content:"";position:absolute;display:block;width:0;height:0;top:50%;transform:translateY(-50%);border-style:solid;border-width:0;border-top:15px solid transparent!important;border-top:var(--bubble-arrow-size) solid transparent!important;border-bottom:15px solid transparent!important;border-bottom:var(--bubble-arrow-size) solid transparent!important}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-left .wp-block-simple-speech-bubble-speech-bubble__comment .wp-block-simple-speech-bubble-speech-bubble__arrow,.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-left .wp-block-simple-speech-bubble-speech-bubble__comment:after,.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-left .wp-block-simple-speech-bubble-speech-bubble__comment:before{border-right-width:15px;border-right-width:var(--bubble-arrow-size)}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-left .wp-block-simple-speech-bubble-speech-bubble__comment:before{left:-15px;left:calc(var(--bubble-arrow-size)*-1)}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-left .wp-block-simple-speech-bubble-speech-bubble__comment .wp-block-simple-speech-bubble-speech-bubble__arrow,.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-left .wp-block-simple-speech-bubble-speech-bubble__comment:after{left:-12px;left:calc(var(--bubble-arrow-size)*-1 + var(--bubble-bd-width) + 1px)}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right .wp-block-simple-speech-bubble-speech-bubble__comment .wp-block-simple-speech-bubble-speech-bubble__arrow,.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right .wp-block-simple-speech-bubble-speech-bubble__comment:after,.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right .wp-block-simple-speech-bubble-speech-bubble__comment:before{border-left-width:15px;border-left-width:var(--bubble-arrow-size)}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right .wp-block-simple-speech-bubble-speech-bubble__comment:before{right:-15px;right:calc(var(--bubble-arrow-size)*-1)}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right .wp-block-simple-speech-bubble-speech-bubble__comment .wp-block-simple-speech-bubble-speech-bubble__arrow,.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right .wp-block-simple-speech-bubble-speech-bubble__comment:after{right:-12px;right:calc(var(--bubble-arrow-size)*-1 + var(--bubble-bd-width) + 1px)}
     1:root{--bubble-arrow-size:15px;--bubble-bg-color:#f2f2f2;--bubble-bd-color:#ddd;--bubble-bd-width:2px}.wp-block-simple-speech-bubble-speech-bubble{justify-content:space-between;display:flex;width:100%;margin-top:1em;margin-bottom:1em;flex-direction:row;align-items:center}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right{flex-direction:row-reverse}.wp-block-simple-speech-bubble-speech-bubble__media{max-width:30%;box-sizing:border-box}.wp-block-simple-speech-bubble-speech-bubble__comment{display:block;position:relative;padding:1em;border-radius:.2em;flex-grow:1;box-sizing:border-box;width:calc(70% - 25px);width:calc(70% - var(--bubble-arrow-size) - 10px);background-color:#f2f2f2;background-color:var(--bubble-bg-color);border:2px solid #ddd;border:var(--bubble-bd-width) solid var(--bubble-bd-color)}.wp-block-simple-speech-bubble-speech-bubble__comment .wp-block-simple-speech-bubble-speech-bubble__arrow{z-index:100}.wp-block-simple-speech-bubble-speech-bubble__comment:before{border-color:inherit}.wp-block-simple-speech-bubble-speech-bubble__comment .wp-block-simple-speech-bubble-speech-bubble__arrow,.wp-block-simple-speech-bubble-speech-bubble__comment:after{border-color:#f2f2f2;border-color:var(--bubble-bg-color)}.wp-block-simple-speech-bubble-speech-bubble__comment .wp-block-simple-speech-bubble-speech-bubble__arrow,.wp-block-simple-speech-bubble-speech-bubble__comment:after,.wp-block-simple-speech-bubble-speech-bubble__comment:before{content:"";position:absolute;display:block;width:0;height:0;top:50%;transform:translateY(-50%);border-style:solid;border-width:0;border-top:15px solid transparent!important;border-top:var(--bubble-arrow-size) solid transparent!important;border-bottom:15px solid transparent!important;border-bottom:var(--bubble-arrow-size) solid transparent!important}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-left .wp-block-simple-speech-bubble-speech-bubble__media{text-align:left}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-left .wp-block-simple-speech-bubble-speech-bubble__media img{margin-right:auto}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-left .wp-block-simple-speech-bubble-speech-bubble__comment{margin-left:25px;margin-left:calc(var(--bubble-arrow-size) + 10px)}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-left .wp-block-simple-speech-bubble-speech-bubble__comment .wp-block-simple-speech-bubble-speech-bubble__arrow,.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-left .wp-block-simple-speech-bubble-speech-bubble__comment:after,.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-left .wp-block-simple-speech-bubble-speech-bubble__comment:before{border-right-width:15px;border-right-width:var(--bubble-arrow-size)}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-left .wp-block-simple-speech-bubble-speech-bubble__comment:before{left:-15px;left:calc(var(--bubble-arrow-size)*-1)}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-left .wp-block-simple-speech-bubble-speech-bubble__comment .wp-block-simple-speech-bubble-speech-bubble__arrow,.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-left .wp-block-simple-speech-bubble-speech-bubble__comment:after{left:-12px;left:calc(var(--bubble-arrow-size)*-1 + var(--bubble-bd-width) + 1px)}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right .wp-block-simple-speech-bubble-speech-bubble__media{text-align:right}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right .wp-block-simple-speech-bubble-speech-bubble__media img{margin-left:auto}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right .wp-block-simple-speech-bubble-speech-bubble__comment{margin-right:25px;margin-right:calc(var(--bubble-arrow-size) + 10px)}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right .wp-block-simple-speech-bubble-speech-bubble__comment .wp-block-simple-speech-bubble-speech-bubble__arrow,.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right .wp-block-simple-speech-bubble-speech-bubble__comment:after,.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right .wp-block-simple-speech-bubble-speech-bubble__comment:before{border-left-width:15px;border-left-width:var(--bubble-arrow-size)}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right .wp-block-simple-speech-bubble-speech-bubble__comment:before{right:-15px;right:calc(var(--bubble-arrow-size)*-1)}.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right .wp-block-simple-speech-bubble-speech-bubble__comment .wp-block-simple-speech-bubble-speech-bubble__arrow,.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right .wp-block-simple-speech-bubble-speech-bubble__comment:after{right:-12px;right:calc(var(--bubble-arrow-size)*-1 + var(--bubble-bd-width) + 1px)}
  • simple-speech-bubble/trunk/build/index.js

    r2416370 r2416464  
    1 !function(e){var t={};function o(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.m=e,o.c=t,o.d=function(e,t,r){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)o.d(r,n,function(t){return e[t]}.bind(null,n));return r},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=12)}([function(e,t){!function(){e.exports=this.wp.element}()},function(e,t){e.exports=function(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}},function(e,t){!function(){e.exports=this.wp.blockEditor}()},function(e,t){!function(){e.exports=this.wp.i18n}()},function(e,t,o){var r;!function(){"use strict";var o={}.hasOwnProperty;function n(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var c=typeof r;if("string"===c||"number"===c)e.push(r);else if(Array.isArray(r)&&r.length){var l=n.apply(null,r);l&&e.push(l)}else if("object"===c)for(var i in r)o.call(r,i)&&r[i]&&e.push(i)}}return e.join(" ")}e.exports?(n.default=n,e.exports=n):void 0===(r=function(){return n}.apply(t,[]))||(e.exports=r)}()},function(e,t){!function(){e.exports=this.wp.primitives}()},function(e){e.exports=JSON.parse('{"name":"simple-speech-bubble/speech-bubble","title":"Speech Bubble","icon":"format-chat","description":"speech-bubble","textdomain":"simple-speech-bubble","category":"common","editorScript":"file:../../build/index.js","script":"file:../../build/script.js","editorStyle":"file:../../build/index.css","style":"file:../../build/index.css","attributes":{"mediaId":{"type":"integer","default":0},"mediaCaption":{"type":"string","default":"","selector":"figure figcaption"},"mediaURL":{"type":"string","default":"","selector":"figure img","attribute":"src"},"mediaPosition":{"type":"string","default":"left"},"backgroundColor":{"type":"string"},"customBackgroundColor":{"type":"string"},"borderColor":{"type":"string"},"customBorderColor":{"type":"string"},"textColor":{"type":"string"},"customTextColor":{"type":"string"}},"supports":{"color":{"link":true}}}')},function(e,t){!function(){e.exports=this.wp.blocks}()},function(e,t){function o(){return e.exports=o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},o.apply(this,arguments)}e.exports=o},function(e,t){!function(){e.exports=this.wp.components}()},,function(e,t,o){},function(e,t,o){"use strict";o.r(t);var r=o(1),n=o.n(r),c=o(7),l=(o(11),o(8)),i=o.n(l),a=o(0),s=o(2),u=o(4),b=o.n(u),p=o(5),m=Object(a.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(a.createElement)(p.Path,{d:"M4 18h6V6H4v12zm9-10v1.5h7V8h-7zm0 7.5h7V14h-7v1.5z"})),d=Object(a.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(a.createElement)(p.Path,{d:"M14 6v12h6V6h-6zM4 9.5h7V8H4v1.5zm0 6h7V14H4v1.5z"})),f=o(3),g=o(9),h=Object(s.withColors)({backgroundColor:"background-color",borderColor:"border-color",textColor:"text-color"})((function(e){var t,o=e.className,r=e.attributes,c=r.mediaId,l=r.mediaURL,u=r.mediaPosition,p=r.mediaCaption,h=e.setAttributes,O=e.backgroundColor,j=e.setBackgroundColor,v=e.borderColor,y=e.setBorderColor,C=e.textColor,x=e.setTextColor,w=function(e){var t=e.id,o=e.url,r=e.caption,n=e.alt;h({mediaId:t,mediaURL:o,mediaCaption:r||n||""})},k=l?Object(a.createElement)("img",{src:l,alt:""}):Object(a.createElement)(s.MediaPlaceholder,{onSelect:w,allowedTypes:["image"],multiple:!1}),E=[{icon:m,title:Object(f.__)("Show media on left"),isActive:"left"===u,onClick:function(){return h({mediaPosition:"left"})}},{icon:d,title:Object(f.__)("Show media on right"),isActive:"right"===u,onClick:function(){return h({mediaPosition:"right"})}}],_={"--bubble-bg-color":O.color,"--bubble-bd-color":v.color,color:C.color},P=b()("wp-block-simple-speech-bubble-speech-bubble__comment",(t={"has-background-color":O.color},n()(t,O.class,O.class),n()(t,"has-border-color",v.color),n()(t,v.class,v.class),n()(t,"has-text-color",C.color),n()(t,C.class,C.class),t));return Object(a.createElement)(a.Fragment,null,Object(a.createElement)(s.BlockControls,null,Object(a.createElement)(g.ToolbarGroup,{controls:E}),Object(a.createElement)(s.MediaReplaceFlow,{mediaId:c,mediaURL:l,allowedTypes:["image"],accept:"image/*",onSelect:w})),Object(a.createElement)(s.InspectorControls,null,Object(a.createElement)(s.PanelColorSettings,{title:Object(f.__)("Color settings"),colorSettings:[{value:O.color,onChange:function(e){j(e),h({customBackgroundColor:e})},label:Object(f.__)("Background color")},{value:v.color,onChange:function(e){y(e),h({customBorderColor:e})},label:Object(f.__)("Border color")},{value:C.color,onChange:function(e){x(e),h({customTextColor:e})},label:Object(f.__)("Text color")}]},Object(a.createElement)(s.ContrastChecker,i()({textColor:C.color,backgroundColor:O.color},{isLargeText:!1})))),Object(a.createElement)("div",{className:b()(o,n()({},"has-media-on-the-".concat(u),u)),style:_},Object(a.createElement)("figure",{className:"wp-block-simple-speech-bubble-speech-bubble__media"},k,Object(a.createElement)(s.RichText,{tagName:"figcaption",value:p,onChange:function(e){return h({mediaCaption:e})}})),Object(a.createElement)("div",{className:P,style:_},Object(a.createElement)(s.InnerBlocks,{template:[["core/paragraph",{placeholder:"Enter side content..."}]]}))))})),O=function(e){var t,o=e.attributes,r=o.mediaURL,c=o.mediaPosition,l=o.mediaCaption,i=o.backgroundColor,u=o.customBackgroundColor,p=o.borderColor,m=o.customBorderColor,d=o.textColor,f=o.customTextColor,g=Object(s.getColorClassName)("background-color",i),h=Object(s.getColorClassName)("border-color",p),O=Object(s.getColorClassName)("text-color",d),j={"--bubble-bg-color":u,"--bubble-bd-color":m,color:f},v=b()("wp-block-simple-speech-bubble-speech-bubble__comment",(t={"has-background":g||u},n()(t,g,g),n()(t,"has-border-color",h||m),n()(t,h,h),n()(t,"has-text-color",O||f),n()(t,O,O),t));return Object(a.createElement)("div",{className:b()(n()({},"has-media-on-the-".concat(c),c))},Object(a.createElement)("figure",{className:"wp-block-simple-speech-bubble-speech-bubble__media"},Object(a.createElement)("img",{src:r,alt:""}),l?Object(a.createElement)(s.RichText.Content,{tagName:"figcaption",value:l}):null),Object(a.createElement)("div",{className:v,style:j},Object(a.createElement)(s.InnerBlocks.Content,null)))},j=o(6);function v(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,r)}return o}function y(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?v(Object(o),!0).forEach((function(t){n()(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):v(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}var C=y(y({},j),{},{edit:h,save:O});Object(c.registerBlockType)(j.name,C)}]);
     1!function(e){var t={};function o(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.m=e,o.c=t,o.d=function(e,t,r){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)o.d(r,n,function(t){return e[t]}.bind(null,n));return r},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=14)}([function(e,t){!function(){e.exports=this.wp.element}()},function(e,t){e.exports=function(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}},function(e,t){!function(){e.exports=this.wp.blockEditor}()},function(e,t){!function(){e.exports=this.wp.i18n}()},function(e,t,o){var r;!function(){"use strict";var o={}.hasOwnProperty;function n(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var c=typeof r;if("string"===c||"number"===c)e.push(r);else if(Array.isArray(r)&&r.length){var l=n.apply(null,r);l&&e.push(l)}else if("object"===c)for(var i in r)o.call(r,i)&&r[i]&&e.push(i)}}return e.join(" ")}e.exports?(n.default=n,e.exports=n):void 0===(r=function(){return n}.apply(t,[]))||(e.exports=r)}()},function(e,t){!function(){e.exports=this.wp.primitives}()},function(e,t){!function(){e.exports=this.lodash}()},function(e,t){!function(){e.exports=this.wp.components}()},function(e,t){!function(){e.exports=this.wp.data}()},function(e){e.exports=JSON.parse('{"name":"simple-speech-bubble/speech-bubble","title":"Speech Bubble","icon":"format-chat","description":"speech-bubble","textdomain":"simple-speech-bubble","category":"common","editorScript":"file:../../build/index.js","script":"file:../../build/script.js","editorStyle":"file:../../build/index.css","style":"file:../../build/index.css","attributes":{"mediaId":{"type":"integer","default":0},"mediaCaption":{"type":"string","default":"","selector":"figure figcaption"},"mediaURL":{"type":"string","default":"","selector":"figure img","attribute":"src"},"mediaSizeSlug":{"type":"string","default":"full"},"mediaPosition":{"type":"string","default":"left"},"backgroundColor":{"type":"string"},"customBackgroundColor":{"type":"string"},"borderColor":{"type":"string"},"customBorderColor":{"type":"string"},"textColor":{"type":"string"},"customTextColor":{"type":"string"}},"supports":{"color":{"link":true}}}')},function(e,t){!function(){e.exports=this.wp.blocks}()},function(e,t){function o(){return e.exports=o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},o.apply(this,arguments)}e.exports=o},,function(e,t,o){},function(e,t,o){"use strict";o.r(t);var r=o(1),n=o.n(r),c=o(10),l=(o(13),o(11)),i=o.n(l),a=o(0),s=o(2),u=o(4),b=o.n(u),p=o(5),m=Object(a.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(a.createElement)(p.Path,{d:"M4 18h6V6H4v12zm9-10v1.5h7V8h-7zm0 7.5h7V14h-7v1.5z"})),d=Object(a.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(a.createElement)(p.Path,{d:"M14 6v12h6V6h-6zM4 9.5h7V8H4v1.5zm0 6h7V14H4v1.5z"})),f=o(8),g=o(6),h=o(3),O=o(7),j=Object(s.withColors)({backgroundColor:"background-color",borderColor:"border-color",textColor:"text-color"})((function(e){var t,o=e.className,r=e.attributes,c=r.mediaId,l=r.mediaURL,u=r.mediaPosition,p=r.mediaCaption,j=r.mediaSizeSlug,v=e.setAttributes,y=e.backgroundColor,C=e.setBackgroundColor,x=e.borderColor,w=e.setBorderColor,_=e.textColor,S=e.setTextColor,k=e.isSelected,E=Object(f.useSelect)((function(e){var t=e("core/block-editor").getSettings;return Object(g.pick)(t(),["imageSizes"])})).imageSizes,P=Object(f.useSelect)((function(e){var t=e("core").getMedia;return c&&k?t(c):null}),[c,k]),B=Object(g.map)(Object(g.filter)(E,(function(e){var t=e.slug;return Object(g.get)(P,["media_details","sizes",t,"source_url"])})),(function(e){var t=e.name;return{value:e.slug,label:t}})),z=function(e){var t=e.id,o=e.url,r=e.caption,n=e.alt;v({mediaId:t,mediaURL:o,mediaCaption:r||n||""})},T=l?Object(a.createElement)("img",{src:l,alt:""}):Object(a.createElement)(s.MediaPlaceholder,{onSelect:z,allowedTypes:["image"],multiple:!1}),N=[{icon:m,title:Object(h.__)("Show media on left"),isActive:"left"===u,onClick:function(){return v({mediaPosition:"left"})}},{icon:d,title:Object(h.__)("Show media on right"),isActive:"right"===u,onClick:function(){return v({mediaPosition:"right"})}}],M={"--bubble-bg-color":y.color,"--bubble-bd-color":x.color,color:_.color},I=b()("wp-block-simple-speech-bubble-speech-bubble__comment",(t={"has-background-color":y.color},n()(t,y.class,y.class),n()(t,"has-border-color",x.color),n()(t,x.class,x.class),n()(t,"has-text-color",_.color),n()(t,_.class,_.class),t));return Object(a.createElement)(a.Fragment,null,Object(a.createElement)(s.BlockControls,null,Object(a.createElement)(O.ToolbarGroup,{controls:N}),Object(a.createElement)(s.MediaReplaceFlow,{mediaId:c,mediaURL:l,allowedTypes:["image"],accept:"image/*",onSelect:z})),Object(a.createElement)(s.InspectorControls,null,Object(a.createElement)(O.PanelBody,{title:Object(h.__)("Image settings")},Object(a.createElement)(O.SelectControl,{label:Object(h.__)("Image size"),value:j,options:B,onChange:function(e){var t=Object(g.get)(P,["media_details","sizes",e,"source_url"]);v({mediaSizeSlug:e,mediaURL:t})}})),Object(a.createElement)(s.PanelColorSettings,{title:Object(h.__)("Color settings"),colorSettings:[{value:y.color,onChange:function(e){C(e),v({customBackgroundColor:e})},label:Object(h.__)("Background color")},{value:x.color,onChange:function(e){w(e),v({customBorderColor:e})},label:Object(h.__)("Border color")},{value:_.color,onChange:function(e){S(e),v({customTextColor:e})},label:Object(h.__)("Text color")}]},Object(a.createElement)(s.ContrastChecker,i()({textColor:_.color,backgroundColor:y.color},{isLargeText:!1})))),Object(a.createElement)("div",{className:b()(o,n()({},"has-media-on-the-".concat(u),u)),style:M},Object(a.createElement)("figure",{className:"wp-block-simple-speech-bubble-speech-bubble__media"},T,Object(a.createElement)(s.RichText,{tagName:"figcaption",value:p,onChange:function(e){return v({mediaCaption:e})}})),Object(a.createElement)("div",{className:I,style:M},Object(a.createElement)(s.InnerBlocks,{template:[["core/paragraph",{placeholder:"Enter side content..."}]]}))))})),v=function(e){var t,o=e.attributes,r=o.mediaURL,c=o.mediaPosition,l=o.mediaCaption,i=o.backgroundColor,u=o.customBackgroundColor,p=o.borderColor,m=o.customBorderColor,d=o.textColor,f=o.customTextColor,g=Object(s.getColorClassName)("background-color",i),h=Object(s.getColorClassName)("border-color",p),O=Object(s.getColorClassName)("text-color",d),j={"--bubble-bg-color":u,"--bubble-bd-color":m,color:f},v=b()("wp-block-simple-speech-bubble-speech-bubble__comment",(t={"has-background":g||u},n()(t,g,g),n()(t,"has-border-color",h||m),n()(t,h,h),n()(t,"has-text-color",O||f),n()(t,O,O),t));return Object(a.createElement)("div",{className:b()(n()({},"has-media-on-the-".concat(c),c))},Object(a.createElement)("figure",{className:"wp-block-simple-speech-bubble-speech-bubble__media"},Object(a.createElement)("img",{src:r,alt:""}),l?Object(a.createElement)(s.RichText.Content,{tagName:"figcaption",value:l}):null),Object(a.createElement)("div",{className:v,style:j},Object(a.createElement)(s.InnerBlocks.Content,null)))},y=o(9);function C(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,r)}return o}function x(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?C(Object(o),!0).forEach((function(t){n()(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):C(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}var w=x(x({},y),{},{edit:j,save:v});Object(c.registerBlockType)(y.name,w)}]);
  • simple-speech-bubble/trunk/build/script.asset.php

    r2416370 r2416464  
    1 <?php return array('dependencies' => array('wp-dom-ready', 'wp-polyfill'), 'version' => '42b1198cf5d170501efbe86ee305a8a3');
     1<?php return array('dependencies' => array('wp-dom-ready', 'wp-polyfill'), 'version' => '8d9d9b702080a07704d953baa1da807a');
  • simple-speech-bubble/trunk/build/script.js

    r2416370 r2416464  
    1 !function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=13)}({10:function(e,t){!function(){e.exports=this.wp.domReady}()},13:function(e,t,r){"use strict";r.r(t);var n,o,u=r(10),l=r.n(u),i=null===(n=window)||void 0===n||null===(o=n.CSS)||void 0===o?void 0:o.supports("(--a: 0)");l()((function(){if(!i){document.querySelectorAll(".wp-block-simple-speech-bubble-speech-bubble__comment").forEach((function(e){var t=window.getComputedStyle(e),r=document.createElement("div");r.classList.add("wp-block-simple-speech-bubble-speech-bubble__arrow"),r.style.borderColor=t.getPropertyValue("background-color"),e.appendChild(r)}))}}))}});
     1!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=15)}({12:function(e,t){!function(){e.exports=this.wp.domReady}()},15:function(e,t,r){"use strict";r.r(t);var n,o,u=r(12),l=r.n(u),i=null===(n=window)||void 0===n||null===(o=n.CSS)||void 0===o?void 0:o.supports("(--a: 0)");l()((function(){if(!i){document.querySelectorAll(".wp-block-simple-speech-bubble-speech-bubble__comment").forEach((function(e){var t=window.getComputedStyle(e),r=document.createElement("div");r.classList.add("wp-block-simple-speech-bubble-speech-bubble__arrow"),r.style.borderColor=t.getPropertyValue("background-color"),e.appendChild(r)}))}}))}});
  • simple-speech-bubble/trunk/package-lock.json

    r2416406 r2416464  
    11{
    22    "name": "@hamworks/simple-speech-bubble",
    3     "version": "0.0.3",
     3    "version": "0.0.4",
    44    "lockfileVersion": 1,
    55    "requires": true,
  • simple-speech-bubble/trunk/package.json

    r2416406 r2416464  
    11{
    22    "name": "@hamworks/simple-speech-bubble",
    3     "version": "0.0.3",
     3    "version": "0.0.4",
    44    "description": "Speech bubble block",
    55    "author": "Hiroshi Urabe <urabe@ham.works> (https://ham.works)",
     
    1919    "dependencies": {
    2020        "@wordpress/icons": "^2.8.0",
    21         "classnames": "^2.2.6"
     21        "classnames": "^2.2.6",
     22        "lodash": "^4.17.20"
    2223    },
    2324    "devDependencies": {
  • simple-speech-bubble/trunk/readme.txt

    r2416406 r2416464  
    66Tested up to:      5.5 
    77Requires PHP:      7.3 
    8 Stable tag:        0.0.3
     8Stable tag:        0.0.4
    99License:           GPLv2 or later 
    1010License URI:       https://www.gnu.org/licenses/gpl-2.0.html 
  • simple-speech-bubble/trunk/simple-speech-bubble.php

    r2416406 r2416464  
    1010 * Text Domain:     simple-speech-bubble
    1111 * Domain Path:     /languages
    12  * Version: 0.0.3
     12 * Version: 0.0.4
    1313 */
    1414
  • simple-speech-bubble/trunk/src/speech-bubble/block.json

    r2416370 r2416464  
    2525            "selector": "figure img",
    2626            "attribute": "src"
     27        },
     28        "mediaSizeSlug": {
     29            "type": "string",
     30            "default": "full"
    2731        },
    2832        "mediaPosition": {
  • simple-speech-bubble/trunk/src/speech-bubble/edit.js

    r2416370 r2416464  
    1212import classnames from 'classnames';
    1313import { pullLeft, pullRight } from '@wordpress/icons';
     14import { useSelect } from '@wordpress/data';
     15import { get, filter, map, pick } from 'lodash';
    1416import { __ } from '@wordpress/i18n';
    15 import { ToolbarGroup } from '@wordpress/components';
     17import { ToolbarGroup, PanelBody, SelectControl } from '@wordpress/components';
    1618
    1719const Edit = ( {
    1820    className,
    19     attributes: { mediaId, mediaURL, mediaPosition, mediaCaption },
     21    attributes: {
     22        mediaId,
     23        mediaURL,
     24        mediaPosition,
     25        mediaCaption,
     26        mediaSizeSlug,
     27    },
    2028    setAttributes,
    2129    backgroundColor,
     
    2533    textColor,
    2634    setTextColor,
     35    isSelected,
    2736} ) => {
     37    const { imageSizes } = useSelect( ( select ) => {
     38        const { getSettings } = select( 'core/block-editor' );
     39        return pick( getSettings(), [ 'imageSizes' ] );
     40    } );
     41
     42    const image = useSelect(
     43        ( select ) => {
     44            const { getMedia } = select( 'core' );
     45            return mediaId && isSelected ? getMedia( mediaId ) : null;
     46        },
     47        [ mediaId, isSelected ]
     48    );
     49
     50    const imageSizeOptions = map(
     51        filter( imageSizes, ( { slug } ) =>
     52            get( image, [ 'media_details', 'sizes', slug, 'source_url' ] )
     53        ),
     54        ( { name, slug } ) => ( { value: slug, label: name } )
     55    );
     56
    2857    const onSelectMedia = ( props ) => {
    2958        const { id, url, caption, alt } = props;
     
    3261            mediaURL: url,
    3362            mediaCaption: caption || alt || '',
     63        } );
     64    };
     65
     66    const onChangeMediaSize = ( slug ) => {
     67        const url = get( image, [
     68            'media_details',
     69            'sizes',
     70            slug,
     71            'source_url',
     72        ] );
     73        setAttributes( {
     74            mediaSizeSlug: slug,
     75            mediaURL: url,
    3476        } );
    3577    };
     
    91133            </BlockControls>
    92134            <InspectorControls>
     135                <PanelBody title={ __( 'Image settings' ) }>
     136                    <SelectControl
     137                        label={ __( 'Image size' ) }
     138                        value={ mediaSizeSlug }
     139                        options={ imageSizeOptions }
     140                        onChange={ onChangeMediaSize }
     141                    />
     142                </PanelBody>
    93143                <PanelColorSettings
    94144                    title={ __( 'Color settings' ) }
  • simple-speech-bubble/trunk/src/speech-bubble/index.css

    r2416406 r2416464  
    1010    display: flex;
    1111    width: 100%;
     12    margin-top: 1em;
     13    margin-bottom: 1em;
    1214    flex-direction: row;
    1315    align-items: center;
     
    2022
    2123.wp-block-simple-speech-bubble-speech-bubble__media {
    22     width: 30%;
     24    max-width: 30%;
    2325    box-sizing: border-box;
    2426}
     
    2931    padding: 1em;
    3032    border-radius: 0.2em;
     33    flex-grow: 1;
    3134    box-sizing: border-box;
    3235    width: calc(70% - var(--bubble-arrow-size) - 10px);
     
    6669.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-left {
    6770
     71    & .wp-block-simple-speech-bubble-speech-bubble__media {
     72        text-align: left;
     73        & img {
     74            margin-right: auto;
     75        }
     76    }
     77
    6878    & .wp-block-simple-speech-bubble-speech-bubble__comment {
     79
     80        margin-left: calc(var(--bubble-arrow-size) + 10px);
    6981
    7082        &::before,
     
    8799.wp-block-simple-speech-bubble-speech-bubble.has-media-on-the-right {
    88100
     101    & .wp-block-simple-speech-bubble-speech-bubble__media {
     102        text-align: right;
     103        & img {
     104            margin-left: auto;
     105        }
     106    }
     107
    89108    & .wp-block-simple-speech-bubble-speech-bubble__comment {
     109
     110        margin-right: calc(var(--bubble-arrow-size) + 10px);
    90111
    91112        &::before,
Note: See TracChangeset for help on using the changeset viewer.