/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ({
/***/ "./assets/blocks/accordion/block.jsx":
/*!*******************************************!*\
!*** ./assets/blocks/accordion/block.jsx ***!
\*******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
(function (wpI18n, wpBlocks, wpElement, wpEditor, wpComponents) {
var __ = wpI18n.__;
var Component = wpElement.Component,
Fragment = wpElement.Fragment;
var registerBlockType = wpBlocks.registerBlockType;
var InspectorControls = wpEditor.InspectorControls,
RichText = wpEditor.RichText,
PanelColorSettings = wpEditor.PanelColorSettings;
var RangeControl = wpComponents.RangeControl,
PanelBody = wpComponents.PanelBody,
BaseControl = wpComponents.BaseControl,
SelectControl = wpComponents.SelectControl,
Dashicon = wpComponents.Dashicon,
Tooltip = wpComponents.Tooltip;
var HEADER_ICONS = {
plus: React.createElement(
Fragment,
null,
React.createElement("path", { fill: "none", d: "M0,0h24v24H0V0z" }),
React.createElement("path", { d: "M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6V13z" })
),
plusCircle: React.createElement(
Fragment,
null,
React.createElement("path", { fill: "none", d: "M0,0h24v24H0V0z" }),
React.createElement("path", { d: "M12,2C6.48,2,2,6.48,2,12s4.48,10,10,10s10-4.48,10-10S17.52,2,12,2z M17,13h-4v4h-2v-4H7v-2h4V7h2v4h4V13z" })
),
plusCircleOutline: React.createElement(
Fragment,
null,
React.createElement("path", { fill: "none", d: "M0,0h24v24H0V0z" }),
React.createElement("path", { d: "M13,7h-2v4H7v2h4v4h2v-4h4v-2h-4V7z M12,2C6.48,2,2,6.48,2,12s4.48,10,10,10s10-4.48,10-10S17.52,2,12,2z M12,20 c-4.41,0-8-3.59-8-8s3.59-8,8-8s8,3.59,8,8S16.41,20,12,20z" })
),
plusBox: React.createElement(
Fragment,
null,
React.createElement("path", { fill: "none", d: "M0,0h24v24H0V0z" }),
React.createElement("path", { d: "M19,3H5C3.89,3,3,3.9,3,5v14c0,1.1,0.89,2,2,2h14c1.1,0,2-0.9,2-2V5C21,3.9,20.1,3,19,3z M19,19H5V5h14V19z" }),
React.createElement("polygon", { points: "11,17 13,17 13,13 17,13 17,11 13,11 13,7 11,7 11,11 7,11 7,13 11,13" })
),
unfold: React.createElement(
Fragment,
null,
React.createElement("path", { fill: "none", d: "M0,0h24v24H0V0z" }),
React.createElement("path", { d: "M12,5.83L15.17,9l1.41-1.41L12,3L7.41,7.59L8.83,9L12,5.83z M12,18.17L8.83,15l-1.41,1.41L12,21l4.59-4.59L15.17,15 L12,18.17z" })
),
threeDots: React.createElement(
Fragment,
null,
React.createElement("path", { fill: "none", d: "M0,0h24v24H0V0z" }),
React.createElement("path", { d: "M6,10c-1.1,0-2,0.9-2,2s0.9,2,2,2s2-0.9,2-2S7.1,10,6,10z M18,10c-1.1,0-2,0.9-2,2s0.9,2,2,2s2-0.9,2-2S19.1,10,18,10z M12,10c-1.1,0-2,0.9-2,2s0.9,2,2,2s2-0.9,2-2S13.1,10,12,10z" })
),
arrowDown: React.createElement(
Fragment,
null,
React.createElement("path", { opacity: "0.87", fill: "none", d: "M24,24H0L0,0l24,0V24z" }),
React.createElement("path", { d: "M16.59,8.59L12,13.17L7.41,8.59L6,10l6,6l6-6L16.59,8.59z" })
)
};
var AdvAccordion = function (_Component) {
_inherits(AdvAccordion, _Component);
function AdvAccordion() {
_classCallCheck(this, AdvAccordion);
var _this = _possibleConstructorReturn(this, (AdvAccordion.__proto__ || Object.getPrototypeOf(AdvAccordion)).apply(this, arguments));
_this.state = {
currentAccordion: null
};
return _this;
}
_createClass(AdvAccordion, [{
key: "componentWillMount",
value: function componentWillMount() {
var _props = this.props,
attributes = _props.attributes,
setAttributes = _props.setAttributes;
var currentBlockConfig = advgbDefaultConfig['advgb-accordion'];
// No override attributes of blocks inserted before
if (attributes.changed !== true) {
if (currentBlockConfig !== undefined && (typeof currentBlockConfig === "undefined" ? "undefined" : _typeof(currentBlockConfig)) === 'object') {
Object.keys(currentBlockConfig).map(function (attribute) {
attributes[attribute] = currentBlockConfig[attribute];
});
// Finally set changed attribute to true, so we don't modify anything again
setAttributes({ changed: true });
}
}
}
}, {
key: "componentDidMount",
value: function componentDidMount() {
this.initAccordion();
}
}, {
key: "componentDidUpdate",
value: function componentDidUpdate(prevProps) {
if (prevProps.attributes.items.length < this.props.attributes.items.length) {
this.initAccordion(true);
}
if (this.props.attributes.items.length === 0) {
this.props.setAttributes({
items: [{
header: 'Header 1',
body: 'At least one accordion must remaining, to remove block use "Remove Block" button from right menu.'
}]
});
}
}
}, {
key: "initAccordion",
value: function initAccordion() {
var refresh = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
if (typeof jQuery !== "undefined") {
if (!refresh) {
jQuery("#block-" + this.props.clientId + " .advgb-accordion-block").accordion({
header: ".advgb-accordion-header",
heightStyle: "content"
});
} else {
jQuery("#block-" + this.props.clientId + " .advgb-accordion-block").accordion('refresh');
}
jQuery("#block-" + this.props.clientId + " .advgb-accordion-block h4").on('keydown', function (e) {
e.stopPropagation();
});
}
}
}, {
key: "updateAccordion",
value: function updateAccordion(value, index) {
var _this2 = this;
var _props2 = this.props,
attributes = _props2.attributes,
setAttributes = _props2.setAttributes;
var items = attributes.items;
var newItems = items.map(function (item, thisIndex) {
if (index === thisIndex) {
if (value.body) {
if (value.body.length !== item.body.length) {
_this2.initAccordion(true);
}
}
item = _extends({}, item, value);
}
return item;
});
setAttributes({ items: newItems });
}
}, {
key: "render",
value: function render() {
var _this3 = this;
var _props3 = this.props,
isSelected = _props3.isSelected,
attributes = _props3.attributes,
setAttributes = _props3.setAttributes;
var items = attributes.items,
headerBgColor = attributes.headerBgColor,
headerTextColor = attributes.headerTextColor,
headerIcon = attributes.headerIcon,
headerIconColor = attributes.headerIconColor,
bodyBgColor = attributes.bodyBgColor,
bodyTextColor = attributes.bodyTextColor,
borderStyle = attributes.borderStyle,
borderWidth = attributes.borderWidth,
borderColor = attributes.borderColor,
borderRadius = attributes.borderRadius;
return React.createElement(
Fragment,
null,
React.createElement(
InspectorControls,
null,
React.createElement(
PanelBody,
{ title: __('Header Settings') },
React.createElement(
BaseControl,
{ label: __('Header Icon Style') },
React.createElement(
"div",
{ className: "advgb-icon-items-wrapper" },
Object.keys(HEADER_ICONS).map(function (key, index) {
return React.createElement(
"div",
{ className: "advgb-icon-item", key: index },
React.createElement(
"span",
{ className: key === headerIcon ? 'active' : '',
onClick: function onClick() {
return setAttributes({ headerIcon: key });
} },
React.createElement(
"svg",
{ xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24" },
HEADER_ICONS[key]
)
)
);
})
)
),
React.createElement(PanelColorSettings, {
title: __('Color Settings'),
initialOpen: false,
colorSettings: [{
label: __('Background Color'),
value: headerBgColor,
onChange: function onChange(value) {
return setAttributes({ headerBgColor: value });
}
}, {
label: __('Text Color'),
value: headerTextColor,
onChange: function onChange(value) {
return setAttributes({ headerTextColor: value });
}
}, {
label: __('Icon Color'),
value: headerIconColor,
onChange: function onChange(value) {
return setAttributes({ headerIconColor: value });
}
}]
})
),
React.createElement(PanelColorSettings, {
title: __('Body Color Settings'),
initialOpen: false,
colorSettings: [{
label: __('Background Color'),
value: bodyBgColor,
onChange: function onChange(value) {
return setAttributes({ bodyBgColor: value });
}
}, {
label: __('Text Color'),
value: bodyTextColor,
onChange: function onChange(value) {
return setAttributes({ bodyTextColor: value });
}
}]
}),
React.createElement(
PanelBody,
{ title: __('Border Settings'), initialOpen: false },
React.createElement(SelectControl, {
label: __('Border Style'),
value: borderStyle,
options: [{ label: __('Solid'), value: 'solid' }, { label: __('Dashed'), value: 'dashed' }, { label: __('Dotted'), value: 'dotted' }],
onChange: function onChange(value) {
return setAttributes({ borderStyle: value });
}
}),
React.createElement(PanelColorSettings, {
title: __('Color Settings'),
initialOpen: false,
colorSettings: [{
label: __('Border Color'),
value: borderColor,
onChange: function onChange(value) {
return setAttributes({ borderColor: value });
}
}]
}),
React.createElement(RangeControl, {
label: __('Border width'),
value: borderWidth,
min: 0,
max: 10,
onChange: function onChange(value) {
return setAttributes({ borderWidth: value });
}
}),
React.createElement(RangeControl, {
label: __('Border radius'),
value: borderRadius,
min: 0,
max: 100,
onChange: function onChange(value) {
return setAttributes({ borderRadius: value });
}
})
)
),
React.createElement(
"div",
{ className: "advgb-accordion-block" },
items.map(function (item, index) {
return React.createElement(
Fragment,
{ key: index },
React.createElement(
"div",
{ className: "advgb-accordion-header",
style: {
backgroundColor: headerBgColor,
color: headerTextColor,
borderStyle: borderStyle,
borderWidth: borderWidth + 'px',
borderColor: borderColor,
borderRadius: borderRadius + 'px'
}
},
React.createElement(
Tooltip,
{ text: __('Remove item') },
React.createElement(
"span",
{ className: "advgb-accordion-remove",
onClick: function onClick() {
return setAttributes({ items: items.filter(function (cItem, cIndex) {
return cIndex !== index;
}) });
}
},
React.createElement(Dashicon, { icon: "no" })
)
),
React.createElement(
"span",
{ className: "advgb-accordion-header-icon" },
React.createElement(
"svg",
{ fill: headerIconColor, xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24" },
HEADER_ICONS[headerIcon]
)
),
React.createElement(RichText, {
tagName: "h4",
value: item.header,
onChange: function onChange(value) {
return _this3.updateAccordion({ header: value }, index);
},
onSplit: function onSplit() {
return null;
},
placeholder: __('Enter header…')
})
),
React.createElement(
"div",
{ className: "advgb-accordion-body",
style: {
backgroundColor: bodyBgColor,
color: bodyTextColor,
borderStyle: borderStyle,
borderWidth: borderWidth + 'px',
borderColor: borderColor,
borderRadius: borderRadius + 'px'
}
},
React.createElement(RichText, {
tagName: "p",
value: item.body,
onChange: function onChange(value) {
return _this3.updateAccordion({ body: value }, index);
},
placeholder: __('Enter text…')
})
)
);
})
),
isSelected && React.createElement(
"div",
{ className: "advgb-accordion-controls" },
React.createElement(
"button",
{ className: "button button-large button-primary",
onClick: function onClick() {
return setAttributes({
items: [].concat(_toConsumableArray(items), [{ header: __('New item'), body: __('New item') }])
});
}
},
__('Add item')
)
)
);
}
}]);
return AdvAccordion;
}(Component);
var accordionBlockIcon = React.createElement(
"svg",
{ xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "2 2 22 22" },
React.createElement("path", { fill: "none", d: "M0,0h24v24H0V0z" }),
React.createElement("rect", { x: "3", y: "17", width: "18", height: "2" }),
React.createElement("path", { d: "M19,12v1H5v-1H19 M21,10H3v5h18V10L21,10z" }),
React.createElement("rect", { x: "3", y: "6", width: "18", height: "2" })
);
registerBlockType('advgb/accordion', {
title: __('Accordion'),
description: __('Easy to create an accordion for your post/page.'),
icon: {
src: accordionBlockIcon,
foreground: typeof advgbBlocks !== 'undefined' ? advgbBlocks.color : undefined
},
category: 'formatting',
keywords: [__('accordion'), __('list'), __('faq')],
attributes: {
items: {
type: 'array',
default: [{
header: 'Header 1',
body: 'Filler text (also placeholder text or dummy text) is text that shares some characteristics of a real written text, but is random or otherwise generated'
}, {
header: 'Header 2',
body: 'Description 2'
}, {
header: 'Header 3',
body: 'Description 3'
}]
},
headerBgColor: {
type: 'string',
default: '#000'
},
headerTextColor: {
type: 'string',
default: '#eee'
},
headerIcon: {
type: 'string',
default: 'unfold'
},
headerIconColor: {
type: 'string',
default: '#fff'
},
bodyBgColor: {
type: 'string'
},
bodyTextColor: {
type: 'string'
},
borderStyle: {
type: 'string',
default: 'solid'
},
borderWidth: {
type: 'number',
default: 0
},
borderColor: {
type: 'string'
},
borderRadius: {
type: 'number',
default: 2
},
changed: {
type: 'boolean',
default: false
}
},
edit: AdvAccordion,
save: function save(_ref) {
var attributes = _ref.attributes;
var items = attributes.items,
headerBgColor = attributes.headerBgColor,
headerTextColor = attributes.headerTextColor,
headerIcon = attributes.headerIcon,
headerIconColor = attributes.headerIconColor,
bodyBgColor = attributes.bodyBgColor,
bodyTextColor = attributes.bodyTextColor,
borderStyle = attributes.borderStyle,
borderWidth = attributes.borderWidth,
borderColor = attributes.borderColor,
borderRadius = attributes.borderRadius;
return React.createElement(
"div",
{ className: "advgb-accordion-block" },
items.map(function (item, index) {
return React.createElement(
Fragment,
{ key: index },
React.createElement(
"div",
{ className: "advgb-accordion-header",
style: {
backgroundColor: headerBgColor,
color: headerTextColor,
borderStyle: borderStyle,
borderWidth: borderWidth + 'px',
borderColor: borderColor,
borderRadius: borderRadius + 'px'
}
},
React.createElement(
"span",
{ className: "advgb-accordion-header-icon" },
React.createElement(
"svg",
{ fill: headerIconColor, xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24" },
HEADER_ICONS[headerIcon]
)
),
React.createElement(
"h4",
{ className: "advgb-accordion-header-title" },
item.header
)
),
React.createElement(
"div",
{ className: "advgb-accordion-body",
style: {
backgroundColor: bodyBgColor,
color: bodyTextColor,
borderStyle: borderStyle,
borderWidth: borderWidth + 'px',
borderColor: borderColor,
borderRadius: borderRadius + 'px'
}
},
React.createElement(RichText.Content, { tagName: "p", value: item.body })
)
);
})
);
}
});
})(wp.i18n, wp.blocks, wp.element, wp.editor, wp.components);
/***/ }),
/***/ "./assets/blocks/advbutton/block.jsx":
/*!*******************************************!*\
!*** ./assets/blocks/advbutton/block.jsx ***!
\*******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
(function (wpI18n, wpBlocks, wpElement, wpEditor, wpComponents) {
var __ = wpI18n.__;
var Component = wpElement.Component,
Fragment = wpElement.Fragment;
var registerBlockType = wpBlocks.registerBlockType,
createBlock = wpBlocks.createBlock;
var InspectorControls = wpEditor.InspectorControls,
BlockControls = wpEditor.BlockControls,
BlockAlignmentToolbar = wpEditor.BlockAlignmentToolbar,
RichText = wpEditor.RichText,
PanelColorSettings = wpEditor.PanelColorSettings;
var RangeControl = wpComponents.RangeControl,
PanelBody = wpComponents.PanelBody,
TextControl = wpComponents.TextControl,
ToggleControl = wpComponents.ToggleControl,
SelectControl = wpComponents.SelectControl,
IconButton = wpComponents.IconButton,
Toolbar = wpComponents.Toolbar;
var AdvButton = function (_Component) {
_inherits(AdvButton, _Component);
function AdvButton() {
_classCallCheck(this, AdvButton);
return _possibleConstructorReturn(this, (AdvButton.__proto__ || Object.getPrototypeOf(AdvButton)).apply(this, arguments));
}
_createClass(AdvButton, [{
key: 'componentWillMount',
value: function componentWillMount() {
var _props = this.props,
attributes = _props.attributes,
setAttributes = _props.setAttributes;
var currentBlockConfig = advgbDefaultConfig['advgb-button'];
// No override attributes of blocks inserted before
if (attributes.changed !== true) {
if (currentBlockConfig !== undefined && (typeof currentBlockConfig === 'undefined' ? 'undefined' : _typeof(currentBlockConfig)) === 'object') {
Object.keys(currentBlockConfig).map(function (attribute) {
attributes[attribute] = currentBlockConfig[attribute];
});
// Finally set changed attribute to true, so we don't modify anything again
setAttributes({ changed: true });
}
}
}
}, {
key: 'componentDidMount',
value: function componentDidMount() {
var _props2 = this.props,
attributes = _props2.attributes,
setAttributes = _props2.setAttributes,
clientId = _props2.clientId;
if (!attributes.id) {
setAttributes({ id: 'advgbbtn-' + clientId });
}
}
}, {
key: 'render',
value: function render() {
var listBorderStyles = [{ label: __('None'), value: 'none' }, { label: __('Solid'), value: 'solid' }, { label: __('Dotted'), value: 'dotted' }, { label: __('Dashed'), value: 'dashed' }, { label: __('Double'), value: 'double' }, { label: __('Groove'), value: 'groove' }, { label: __('Ridge'), value: 'ridge' }, { label: __('Inset'), value: 'inset' }, { label: __('Outset'), value: 'outset' }];
var _props3 = this.props,
attributes = _props3.attributes,
setAttributes = _props3.setAttributes,
isSelected = _props3.isSelected,
className = _props3.className,
blockID = _props3.clientId;
var id = attributes.id,
align = attributes.align,
url = attributes.url,
urlOpenNewTab = attributes.urlOpenNewTab,
title = attributes.title,
text = attributes.text,
bgColor = attributes.bgColor,
textColor = attributes.textColor,
textSize = attributes.textSize,
paddingTop = attributes.paddingTop,
paddingRight = attributes.paddingRight,
paddingBottom = attributes.paddingBottom,
paddingLeft = attributes.paddingLeft,
borderWidth = attributes.borderWidth,
borderColor = attributes.borderColor,
borderRadius = attributes.borderRadius,
borderStyle = attributes.borderStyle,
hoverTextColor = attributes.hoverTextColor,
hoverBgColor = attributes.hoverBgColor,
hoverShadowColor = attributes.hoverShadowColor,
hoverShadowH = attributes.hoverShadowH,
hoverShadowV = attributes.hoverShadowV,
hoverShadowBlur = attributes.hoverShadowBlur,
hoverShadowSpread = attributes.hoverShadowSpread,
transitionSpeed = attributes.transitionSpeed;
return React.createElement(
Fragment,
null,
React.createElement(
BlockControls,
null,
React.createElement(BlockAlignmentToolbar, { value: align, onChange: function onChange(align) {
return setAttributes({ align: align });
} }),
React.createElement(
Toolbar,
null,
React.createElement(IconButton, {
label: __('Refresh this button when it conflict with other buttons styles'),
icon: 'update',
className: 'components-toolbar__control',
onClick: function onClick() {
return setAttributes({ id: 'advgbbutton-' + blockID });
}
})
)
),
React.createElement(
'span',
{ style: { display: 'inline-block' } },
React.createElement(RichText, {
placeholder: __('Add text…'),
value: text,
onChange: function onChange(value) {
return setAttributes({ text: value });
},
formattingControls: ['bold', 'italic', 'strikethrough'],
isSelected: isSelected,
className: 'wp-block-advgb-button_link ' + id,
keepPlaceholderOnFocus: true
})
),
React.createElement(
'style',
null,
'.' + id + ' {\n font-size: ' + textSize + 'px;\n color: ' + textColor + ';\n background-color: ' + bgColor + ';\n padding: ' + paddingTop + 'px ' + paddingRight + 'px ' + paddingBottom + 'px ' + paddingLeft + 'px;\n border-width: ' + borderWidth + 'px;\n border-color: ' + borderColor + ';\n border-radius: ' + borderRadius + 'px;\n border-style: ' + borderStyle + ';\n }\n .' + id + ':hover {\n color: ' + hoverTextColor + ';\n background-color: ' + hoverBgColor + ';\n box-shadow: ' + hoverShadowH + 'px ' + hoverShadowV + 'px ' + hoverShadowBlur + 'px ' + hoverShadowSpread + 'px ' + hoverShadowColor + ';\n transition: all ' + transitionSpeed + 's ease;\n }'
),
React.createElement(
InspectorControls,
null,
React.createElement(
PanelBody,
{ title: __('Button link') },
React.createElement(TextControl, {
label: [__('Link URL'), url && React.createElement(
'a',
{ href: url || '#', key: 'link_url', target: '_blank', style: { float: 'right' } },
__('Preview')
)],
value: url || '',
placeholder: __('Enter URL…'),
onChange: function onChange(text) {
return setAttributes({ url: text });
}
}),
React.createElement(ToggleControl, {
label: __('Open in new tab'),
checked: !!urlOpenNewTab,
onChange: function onChange() {
return setAttributes({ urlOpenNewTab: !attributes.urlOpenNewTab });
}
})
),
React.createElement(
PanelBody,
{ title: __('Text/Color') },
React.createElement(RangeControl, {
label: __('Text size'),
value: textSize || '',
onChange: function onChange(size) {
return setAttributes({ textSize: size });
},
min: 10,
max: 100,
beforeIcon: 'editor-textcolor',
allowReset: true
}),
React.createElement(PanelColorSettings, {
title: __('Color Settings'),
initialOpen: false,
colorSettings: [{
label: __('Background Color'),
value: bgColor,
onChange: function onChange(value) {
return setAttributes({ bgColor: value });
}
}, {
label: __('Text Color'),
value: textColor,
onChange: function onChange(value) {
return setAttributes({ textColor: value });
}
}]
})
),
React.createElement(
PanelBody,
{ title: __('Border'), initialOpen: false },
React.createElement(RangeControl, {
label: __('Border radius'),
value: borderRadius || '',
onChange: function onChange(value) {
return setAttributes({ borderRadius: value });
},
min: 0,
max: 100
}),
React.createElement(SelectControl, {
label: __('Border style'),
value: borderStyle,
options: listBorderStyles,
onChange: function onChange(value) {
return setAttributes({ borderStyle: value });
}
}),
borderStyle !== 'none' && React.createElement(
Fragment,
null,
React.createElement(PanelColorSettings, {
title: __('Border Color'),
initialOpen: false,
colorSettings: [{
label: __('Border Color'),
value: borderColor,
onChange: function onChange(value) {
return setAttributes({ borderColor: value });
}
}]
}),
React.createElement(RangeControl, {
label: __('Border width'),
value: borderWidth || '',
onChange: function onChange(value) {
return setAttributes({ borderWidth: value });
},
min: 0,
max: 100
})
)
),
React.createElement(
PanelBody,
{ title: __('Padding'), initialOpen: false },
React.createElement(RangeControl, {
label: __('Padding top'),
value: paddingTop || '',
onChange: function onChange(value) {
return setAttributes({ paddingTop: value });
},
min: 0,
max: 100
}),
React.createElement(RangeControl, {
label: __('Padding right'),
value: paddingRight || '',
onChange: function onChange(value) {
return setAttributes({ paddingRight: value });
},
min: 0,
max: 100
}),
React.createElement(RangeControl, {
label: __('Padding bottom'),
value: paddingBottom || '',
onChange: function onChange(value) {
return setAttributes({ paddingBottom: value });
},
min: 0,
max: 100
}),
React.createElement(RangeControl, {
label: __('Padding left'),
value: paddingLeft || '',
onChange: function onChange(value) {
return setAttributes({ paddingLeft: value });
},
min: 0,
max: 100
})
),
React.createElement(
PanelBody,
{ title: __('Hover'), initialOpen: false },
React.createElement(PanelColorSettings, {
title: __('Color Settings'),
initialOpen: false,
colorSettings: [{
label: __('Background Color'),
value: hoverBgColor,
onChange: function onChange(value) {
return setAttributes({ hoverBgColor: value });
}
}, {
label: __('Text Color'),
value: hoverTextColor,
onChange: function onChange(value) {
return setAttributes({ hoverTextColor: value });
}
}, {
label: __('Shadow Color'),
value: hoverShadowColor,
onChange: function onChange(value) {
return setAttributes({ hoverShadowColor: value });
}
}]
}),
React.createElement(
PanelBody,
{ title: __('Shadow'), initialOpen: false },
React.createElement(RangeControl, {
label: __('Shadow H offset'),
value: hoverShadowH || '',
onChange: function onChange(value) {
return setAttributes({ hoverShadowH: value });
},
min: -50,
max: 50
}),
React.createElement(RangeControl, {
label: __('Shadow V offset'),
value: hoverShadowV || '',
onChange: function onChange(value) {
return setAttributes({ hoverShadowV: value });
},
min: -50,
max: 50
}),
React.createElement(RangeControl, {
label: __('Shadow blur'),
value: hoverShadowBlur || '',
onChange: function onChange(value) {
return setAttributes({ hoverShadowBlur: value });
},
min: 0,
max: 50
}),
React.createElement(RangeControl, {
label: __('Shadow spread'),
value: hoverShadowSpread || '',
onChange: function onChange(value) {
return setAttributes({ hoverShadowSpread: value });
},
min: 0,
max: 50
})
),
React.createElement(RangeControl, {
label: __('Transition speed'),
value: transitionSpeed || '',
onChange: function onChange(value) {
return setAttributes({ transitionSpeed: value });
},
min: 0,
max: 3
})
)
)
);
}
}]);
return AdvButton;
}(Component);
var buttonBlockIcon = React.createElement(
'svg',
{ height: '20', viewBox: '2 2 22 22', width: '20', xmlns: 'http://www.w3.org/2000/svg' },
React.createElement('path', { d: 'M0 0h24v24H0V0z', fill: 'none' }),
React.createElement('path', { d: 'M5 14.5h14v-6H5v6zM11 .55V3.5h2V.55h-2zm8.04 2.5l-1.79 1.79 1.41 1.41 1.8-1.79-1.42-1.41zM13 22.45V19.5h-2v2.95h2zm7.45-3.91l-1.8-1.79-1.41 1.41 1.79 1.8 1.42-1.42zM3.55 4.46l1.79 1.79 1.41-1.41-1.79-1.79-1.41 1.41zm1.41 15.49l1.79-1.8-1.41-1.41-1.79 1.79 1.41 1.42z' })
);
registerBlockType('advgb/button', {
title: __('Advanced Button'),
description: __('New button with more styles.'),
icon: {
src: buttonBlockIcon,
foreground: typeof advgbBlocks !== 'undefined' ? advgbBlocks.color : undefined
},
category: 'layout',
keywords: [__('button'), __('link')],
attributes: {
id: {
type: 'string'
},
url: {
type: 'string'
},
urlOpenNewTab: {
type: 'boolean',
default: true
},
title: {
type: 'string'
},
text: {
source: 'children',
selector: 'a'
},
bgColor: {
type: 'string',
default: '#2196f3'
},
textColor: {
type: 'string',
default: '#fff'
},
textSize: {
type: 'number',
default: 18
},
paddingTop: {
type: 'number',
default: 6
},
paddingRight: {
type: 'number',
default: 12
},
paddingBottom: {
type: 'number',
default: 6
},
paddingLeft: {
type: 'number',
default: 12
},
borderWidth: {
type: 'number',
default: 1
},
borderColor: {
type: 'string',
default: '#2196f3'
},
borderStyle: {
type: 'string',
default: 'solid'
},
borderRadius: {
type: 'number',
default: 50
},
hoverTextColor: {
type: 'string',
default: '#fff'
},
hoverBgColor: {
type: 'string',
default: '#2196f3'
},
hoverShadowColor: {
type: 'string',
default: '#ccc'
},
hoverShadowH: {
type: 'number',
default: 3
},
hoverShadowV: {
type: 'number',
default: 3
},
hoverShadowBlur: {
type: 'number',
default: 1
},
hoverShadowSpread: {
type: 'number',
default: 0
},
transitionSpeed: {
type: 'number',
default: 0.2
},
align: {
type: 'string',
default: 'none'
},
changed: {
type: 'boolean',
default: false
}
},
transforms: {
from: [{
type: 'block',
blocks: ['core/button'],
transform: function transform(attributes) {
return createBlock('advgb/button', _extends({}, attributes, {
bgColor: attributes.color
}));
}
}],
to: [{
type: 'block',
blocks: ['core/button'],
transform: function transform(attributes) {
return createBlock('core/button', _extends({}, attributes, {
color: attributes.bgColor
}));
}
}]
},
edit: AdvButton,
save: function save(_ref) {
var attributes = _ref.attributes;
var id = attributes.id,
align = attributes.align,
url = attributes.url,
urlOpenNewTab = attributes.urlOpenNewTab,
title = attributes.title,
text = attributes.text,
bgColor = attributes.bgColor,
textColor = attributes.textColor,
textSize = attributes.textSize,
paddingTop = attributes.paddingTop,
paddingRight = attributes.paddingRight,
paddingBottom = attributes.paddingBottom,
paddingLeft = attributes.paddingLeft,
borderWidth = attributes.borderWidth,
borderColor = attributes.borderColor,
borderRadius = attributes.borderRadius,
borderStyle = attributes.borderStyle,
hoverTextColor = attributes.hoverTextColor,
hoverBgColor = attributes.hoverBgColor,
hoverShadowColor = attributes.hoverShadowColor,
hoverShadowH = attributes.hoverShadowH,
hoverShadowV = attributes.hoverShadowV,
hoverShadowBlur = attributes.hoverShadowBlur,
hoverShadowSpread = attributes.hoverShadowSpread,
transitionSpeed = attributes.transitionSpeed;
return React.createElement(
'div',
{ className: 'align' + align },
React.createElement(RichText.Content, {
tagName: 'a',
className: 'wp-block-advgb-button_link ' + id,
href: url || '#',
title: title,
target: !urlOpenNewTab ? '_self' : '_blank',
value: text
}),
React.createElement(
'style',
null,
'.' + id + ' {\n font-size: ' + textSize + 'px;\n color: ' + textColor + ';\n background-color: ' + bgColor + ';\n padding: ' + paddingTop + 'px ' + paddingRight + 'px ' + paddingBottom + 'px ' + paddingLeft + 'px;\n border-width: ' + borderWidth + 'px;\n border-color: ' + borderColor + ';\n border-radius: ' + borderRadius + 'px;\n border-style: ' + borderStyle + ';\n }\n .' + id + ':hover {\n color: ' + hoverTextColor + ';\n background-color: ' + hoverBgColor + ';\n box-shadow: ' + hoverShadowH + 'px ' + hoverShadowV + 'px ' + hoverShadowBlur + 'px ' + hoverShadowSpread + 'px ' + hoverShadowColor + ';\n transition: all ' + transitionSpeed + 's ease;\n }'
)
);
},
getEditWrapperProps: function getEditWrapperProps(attributes) {
var align = attributes.align;
var props = { 'data-resized': true };
if ('left' === align || 'right' === align || 'center' === align) {
props['data-align'] = align;
}
return props;
}
});
})(wp.i18n, wp.blocks, wp.element, wp.editor, wp.components);
/***/ }),
/***/ "./assets/blocks/advimage/block.jsx":
/*!******************************************!*\
!*** ./assets/blocks/advimage/block.jsx ***!
\******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
(function (wpI18n, wpBlocks, wpElement, wpEditor, wpComponents) {
var __ = wpI18n.__;
var Component = wpElement.Component,
Fragment = wpElement.Fragment;
var registerBlockType = wpBlocks.registerBlockType;
var InspectorControls = wpEditor.InspectorControls,
BlockControls = wpEditor.BlockControls,
RichText = wpEditor.RichText,
PanelColorSettings = wpEditor.PanelColorSettings,
MediaUpload = wpEditor.MediaUpload;
var RangeControl = wpComponents.RangeControl,
PanelBody = wpComponents.PanelBody,
ToggleControl = wpComponents.ToggleControl,
SelectControl = wpComponents.SelectControl,
TextControl = wpComponents.TextControl,
IconButton = wpComponents.IconButton,
Button = wpComponents.Button,
Toolbar = wpComponents.Toolbar;
var AdvImage = function (_Component) {
_inherits(AdvImage, _Component);
function AdvImage() {
_classCallCheck(this, AdvImage);
var _this = _possibleConstructorReturn(this, (AdvImage.__proto__ || Object.getPrototypeOf(AdvImage)).apply(this, arguments));
_this.state = {
currentEdit: ''
};
return _this;
}
_createClass(AdvImage, [{
key: 'componentWillMount',
value: function componentWillMount() {
var _props = this.props,
attributes = _props.attributes,
setAttributes = _props.setAttributes;
var currentBlockConfig = advgbDefaultConfig['advgb-image'];
// No override attributes of blocks inserted before
if (attributes.changed !== true) {
if (currentBlockConfig !== undefined && (typeof currentBlockConfig === 'undefined' ? 'undefined' : _typeof(currentBlockConfig)) === 'object') {
Object.keys(currentBlockConfig).map(function (attribute) {
attributes[attribute] = currentBlockConfig[attribute];
});
// Finally set changed attribute to true, so we don't modify anything again
setAttributes({ changed: true });
}
}
}
}, {
key: 'handleSetup',
value: function handleSetup(editor, area) {
var _this2 = this;
editor.on('focus', function () {
return _this2.setState({ currentEdit: area });
});
}
}, {
key: 'render',
value: function render() {
var _this3 = this;
var currentEdit = this.state.currentEdit;
var _props2 = this.props,
attributes = _props2.attributes,
setAttributes = _props2.setAttributes,
isSelected = _props2.isSelected;
var openOnClick = attributes.openOnClick,
openUrl = attributes.openUrl,
imageUrl = attributes.imageUrl,
imageID = attributes.imageID,
title = attributes.title,
titleColor = attributes.titleColor,
subtitle = attributes.subtitle,
subtitleColor = attributes.subtitleColor,
overlayColor = attributes.overlayColor,
fullWidth = attributes.fullWidth,
width = attributes.width,
height = attributes.height,
vAlign = attributes.vAlign,
hAlign = attributes.hAlign;
var blockClassName = ['advgb-image-block', fullWidth && 'full-width'].filter(Boolean).join(' ');
return React.createElement(
Fragment,
null,
imageID && React.createElement(
BlockControls,
null,
React.createElement(
Toolbar,
null,
React.createElement(MediaUpload, {
allowedTypes: ['image'],
value: imageID,
onSelect: function onSelect(image) {
return setAttributes({ imageUrl: image.url, imageID: image.id });
},
render: function render(_ref) {
var open = _ref.open;
return React.createElement(IconButton, {
className: 'components-toolbar__control',
label: __('Change image'),
icon: 'edit',
onClick: open
});
}
}),
React.createElement(IconButton, {
className: 'components-toolbar__control',
label: __('Remove image'),
icon: 'no',
onClick: function onClick() {
return setAttributes({ imageUrl: undefined, imageID: undefined });
}
})
)
),
React.createElement(
InspectorControls,
null,
React.createElement(
PanelBody,
{ title: __('Advanced Image') },
React.createElement(SelectControl, {
label: __('Action on click'),
value: openOnClick,
options: [{ label: __('None'), value: 'none' }, { label: __('Open image in lightbox'), value: 'lightbox' }, { label: __('Open custom URL'), value: 'url' }],
onChange: function onChange(value) {
return setAttributes({ openOnClick: value });
}
}),
openOnClick === 'url' && React.createElement(TextControl, {
label: [__('Link URL'), openUrl && React.createElement(
'a',
{ href: openUrl || '#', key: 'advgb_image_link_url', target: '_blank', style: { float: 'right' } },
__('Preview')
)],
value: openUrl,
placeholder: __('Enter URL…'),
onChange: function onChange(text) {
return setAttributes({ openUrl: text });
}
}),
React.createElement(
PanelBody,
{ title: __('Image Size') },
React.createElement(ToggleControl, {
label: __('Full width'),
checked: fullWidth,
onChange: function onChange() {
return setAttributes({ fullWidth: !fullWidth });
}
}),
React.createElement(RangeControl, {
label: __('Height'),
value: height,
min: 100,
max: 1000,
onChange: function onChange(value) {
return setAttributes({ height: value });
}
}),
!fullWidth && React.createElement(RangeControl, {
label: __('Width'),
value: width,
min: 200,
max: 1300,
onChange: function onChange(value) {
return setAttributes({ width: value });
}
})
),
React.createElement(PanelColorSettings, {
title: __('Color Settings'),
initialOpen: false,
colorSettings: [{
label: __('Title Color'),
value: titleColor,
onChange: function onChange(value) {
return setAttributes({ titleColor: value });
}
}, {
label: __('Subtitle Color'),
value: subtitleColor,
onChange: function onChange(value) {
return setAttributes({ subtitleColor: value });
}
}, {
label: __('Overlay Color'),
value: overlayColor,
onChange: function onChange(value) {
return setAttributes({ overlayColor: value });
}
}]
}),
React.createElement(
PanelBody,
{ title: __('Text Alignment'), initialOpen: false },
React.createElement(SelectControl, {
label: __('Vertical Alignment'),
value: vAlign,
options: [{ label: __('Top'), value: 'flex-start' }, { label: __('Center'), value: 'center' }, { label: __('Bottom'), value: 'flex-end' }],
onChange: function onChange(value) {
return setAttributes({ vAlign: value });
}
}),
React.createElement(SelectControl, {
label: __('Horizontal Alignment'),
value: hAlign,
options: [{ label: __('Left'), value: 'flex-start' }, { label: __('Center'), value: 'center' }, { label: __('Right'), value: 'flex-end' }],
onChange: function onChange(value) {
return setAttributes({ hAlign: value });
}
})
)
)
),
React.createElement(
'div',
{ className: blockClassName,
style: {
backgroundImage: 'url( ' + imageUrl + ')',
height: height,
width: width,
justifyContent: vAlign,
alignItems: hAlign
}
},
React.createElement('span', { className: 'advgb-image-overlay',
style: { backgroundColor: overlayColor }
}),
!imageID && React.createElement(MediaUpload, {
allowedTypes: ['image'],
value: imageID,
onSelect: function onSelect(image) {
return setAttributes({ imageUrl: image.url, imageID: image.id });
},
render: function render(_ref2) {
var open = _ref2.open;
return React.createElement(
Button,
{
className: 'button button-large',
onClick: open
},
__('Choose image')
);
}
}),
React.createElement(RichText, {
tagName: 'h4',
className: 'advgb-image-title',
value: title,
onChange: function onChange(value) {
return setAttributes({ title: value });
},
style: { color: titleColor },
isSelected: isSelected && currentEdit === 'title',
unstableOnSetup: function unstableOnSetup(editor) {
return _this3.handleSetup(editor, 'title');
},
placeholder: __('Enter title…')
}),
React.createElement(RichText, {
tagName: 'p',
className: 'advgb-image-subtitle',
value: subtitle,
onChange: function onChange(value) {
return setAttributes({ subtitle: value });
},
style: { color: subtitleColor },
isSelected: isSelected && currentEdit === 'subtitle',
unstableOnSetup: function unstableOnSetup(editor) {
return _this3.handleSetup(editor, 'subtitle');
},
placeholder: __('Enter subtitle…')
})
)
);
}
}]);
return AdvImage;
}(Component);
var advImageBlockIcon = React.createElement(
'svg',
{ height: '20', viewBox: '2 2 22 22', width: '20', xmlns: 'http://www.w3.org/2000/svg' },
React.createElement('path', { d: 'M0 0h24v24H0V0z', fill: 'none' }),
React.createElement('path', { d: 'M1 5h2v14H1zm4 0h2v14H5zm17 0H10c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h12c.55 0 1-.45 1-1V6c0-.55-.45-1-1-1zM11 17l2.5-3.15L15.29 16l2.5-3.22L21 17H11z' })
);
registerBlockType('advgb/image', {
title: __('Advanced Image'),
description: __('Advanced image/photo block with more options and styles.'),
icon: {
src: advImageBlockIcon,
foreground: typeof advgbBlocks !== 'undefined' ? advgbBlocks.color : undefined
},
category: 'common',
keywords: [__('image'), __('photo'), __('box')],
attributes: {
openOnClick: {
type: 'string',
default: 'none'
},
openUrl: {
type: 'string'
},
imageUrl: {
type: 'string'
},
imageID: {
type: 'string'
},
title: {
type: 'string',
default: __('Image title')
},
titleColor: {
type: 'string',
default: '#fff'
},
subtitle: {
type: 'string',
default: __('Your subtitle here')
},
subtitleColor: {
type: 'string',
default: '#fff'
},
overlayColor: {
type: 'string',
default: '#2196f3'
},
fullWidth: {
type: 'boolean',
default: false
},
width: {
type: 'number',
default: 500
},
height: {
type: 'number',
default: 500
},
vAlign: {
type: 'string',
default: 'center'
},
hAlign: {
type: 'string',
default: 'center'
},
changed: {
type: 'boolean',
default: false
}
},
edit: AdvImage,
save: function save(_ref3) {
var attributes = _ref3.attributes;
var openOnClick = attributes.openOnClick,
openUrl = attributes.openUrl,
imageUrl = attributes.imageUrl,
title = attributes.title,
titleColor = attributes.titleColor,
subtitle = attributes.subtitle,
subtitleColor = attributes.subtitleColor,
overlayColor = attributes.overlayColor,
fullWidth = attributes.fullWidth,
width = attributes.width,
height = attributes.height,
vAlign = attributes.vAlign,
hAlign = attributes.hAlign;
var linkURL = openOnClick === 'url' && !!openUrl ? openUrl : undefined;
var blockClassName = ['advgb-image-block', fullWidth && 'full-width', openOnClick === 'lightbox' && !!imageUrl && 'advgb-lightbox'].filter(Boolean).join(' ');
return React.createElement(
'div',
{ className: blockClassName,
style: {
backgroundImage: 'url( ' + imageUrl + ')',
height: height,
width: width,
justifyContent: vAlign,
alignItems: hAlign
},
'data-image': imageUrl
},
React.createElement('a', { className: 'advgb-image-overlay',
style: { backgroundColor: overlayColor },
target: '_blank',
href: linkURL
}),
React.createElement(
'h4',
{ className: 'advgb-image-title', style: { color: titleColor } },
title
),
React.createElement(
'p',
{ className: 'advgb-image-subtitle', style: { color: subtitleColor } },
subtitle
)
);
}
});
})(wp.i18n, wp.blocks, wp.element, wp.editor, wp.components);
/***/ }),
/***/ "./assets/blocks/advlist/block.jsx":
/*!*****************************************!*\
!*** ./assets/blocks/advlist/block.jsx ***!
\*****************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
(function (wpI18n, wpBlocks, wpElement, wpEditor, wpComponents) {
var __ = wpI18n.__;
var Component = wpElement.Component,
Fragment = wpElement.Fragment;
var registerBlockType = wpBlocks.registerBlockType,
createBlock = wpBlocks.createBlock;
var InspectorControls = wpEditor.InspectorControls,
RichText = wpEditor.RichText,
ColorPalette = wpEditor.ColorPalette,
BlockControls = wpEditor.BlockControls;
var BaseControl = wpComponents.BaseControl,
RangeControl = wpComponents.RangeControl,
PanelBody = wpComponents.PanelBody,
IconButton = wpComponents.IconButton,
Dashicon = wpComponents.Dashicon,
Toolbar = wpComponents.Toolbar;
var AdvList = function (_Component) {
_inherits(AdvList, _Component);
function AdvList() {
_classCallCheck(this, AdvList);
var _this = _possibleConstructorReturn(this, (AdvList.__proto__ || Object.getPrototypeOf(AdvList)).apply(this, arguments));
_this.getEditorSettings = _this.getEditorSettings.bind(_this);
_this.setupEditor = _this.setupEditor.bind(_this);
_this.setNextValues = _this.setNextValues.bind(_this);
return _this;
}
_createClass(AdvList, [{
key: 'componentWillMount',
value: function componentWillMount() {
var _props = this.props,
attributes = _props.attributes,
setAttributes = _props.setAttributes;
var currentBlockConfig = advgbDefaultConfig['advgb-list'];
// No override attributes of blocks inserted before
if (attributes.changed !== true) {
if (currentBlockConfig !== undefined && (typeof currentBlockConfig === 'undefined' ? 'undefined' : _typeof(currentBlockConfig)) === 'object') {
Object.keys(currentBlockConfig).map(function (attribute) {
attributes[attribute] = currentBlockConfig[attribute];
});
// Finally set changed attribute to true, so we don't modify anything again
setAttributes({ changed: true });
}
}
}
}, {
key: 'componentDidMount',
value: function componentDidMount() {
var _props2 = this.props,
attributes = _props2.attributes,
setAttributes = _props2.setAttributes,
clientId = _props2.clientId;
if (!attributes.id) {
setAttributes({
id: 'advgblist-' + clientId
});
}
}
}, {
key: 'getEditorSettings',
value: function getEditorSettings(editorSettings) {
return _extends({}, editorSettings, {
plugins: (editorSettings.plugins || []).concat('lists'),
lists_indent_on_tab: false
});
}
}, {
key: 'setupEditor',
value: function setupEditor(editor) {
// this checks for languages that do not typically have square brackets on their keyboards
var lang = window.navigator.browserLanguage || window.navigator.language;
var keyboardHasSqBracket = !/^(?:fr|nl|sv|ru|de|es|it)/.test(lang);
if (keyboardHasSqBracket) {
// keycode 219 = '[' and keycode 221 = ']'
editor.shortcuts.add('meta+219', 'Decrease indent', 'Outdent');
editor.shortcuts.add('meta+221', 'Increase indent', 'Indent');
} else {
editor.shortcuts.add('meta+shift+m', 'Decrease indent', 'Outdent');
editor.shortcuts.add('meta+m', 'Increase indent', 'Indent');
}
this.editor = editor;
}
}, {
key: 'setNextValues',
value: function setNextValues(nextValues) {
this.props.setAttributes({ values: nextValues });
}
}, {
key: 'render',
value: function render() {
var listIcons = [{ label: __('None'), value: '' }, { label: __('Pushpin'), value: 'admin-post' }, { label: __('Configuration'), value: 'admin-generic' }, { label: __('Flag'), value: 'flag' }, { label: __('Star'), value: 'star-filled' }, { label: __('Checkmark'), value: 'yes' }, { label: __('Minus'), value: 'minus' }, { label: __('Plus'), value: 'plus' }, { label: __('Play'), value: 'controls-play' }, { label: __('Arrow right'), value: 'arrow-right-alt' }, { label: __('X Cross'), value: 'dismiss' }, { label: __('Warning'), value: 'warning' }, { label: __('Help'), value: 'editor-help' }, { label: __('Info'), value: 'info' }, { label: __('Circle'), value: 'marker' }];
var _props3 = this.props,
attributes = _props3.attributes,
isSelected = _props3.isSelected,
insertBlocksAfter = _props3.insertBlocksAfter,
mergeBlocks = _props3.mergeBlocks,
setAttributes = _props3.setAttributes,
onReplace = _props3.onReplace,
className = _props3.className,
blockID = _props3.clientId;
var id = attributes.id,
values = attributes.values,
icon = attributes.icon,
iconSize = attributes.iconSize,
iconColor = attributes.iconColor,
margin = attributes.margin,
padding = attributes.padding,
lineHeight = attributes.lineHeight,
fontSize = attributes.fontSize;
var listClassName = [className, id, icon && 'advgb-list', icon && 'advgb-list-' + icon].filter(Boolean).join(' ');
return React.createElement(
Fragment,
null,
React.createElement(
BlockControls,
null,
React.createElement(
Toolbar,
null,
React.createElement(IconButton, {
label: __('Refresh this list when it conflict with other lists styles'),
icon: 'update',
className: 'components-toolbar__control',
onClick: function onClick() {
return setAttributes({ id: 'advgblist-' + blockID });
}
})
)
),
React.createElement(
InspectorControls,
null,
React.createElement(
PanelBody,
{ title: __('Text Settings'), initialOpen: false },
React.createElement(RangeControl, {
label: __('Text size'),
value: fontSize || '',
onChange: function onChange(size) {
return setAttributes({ fontSize: size });
},
min: 10,
max: 100,
beforeIcon: 'editor-textcolor',
allowReset: true
})
),
React.createElement(
PanelBody,
{ title: __('Icon Settings') },
React.createElement(
BaseControl,
{ label: __('List icon') },
React.createElement(
'div',
{ className: 'advgb-icon-items-wrapper' },
listIcons.map(function (item, index) {
return React.createElement(
'div',
{ className: 'advgb-icon-item h20', key: index },
React.createElement(
'span',
{ onClick: function onClick() {
return setAttributes({ icon: item.value });
},
className: [item.value === icon && 'active', item.value === '' && 'remove-icon'].filter(Boolean).join(' ')
},
React.createElement(Dashicon, { icon: item.value })
)
);
})
)
),
icon && React.createElement(
Fragment,
null,
React.createElement(
PanelBody,
{
title: [__('Icon color'), React.createElement('span', { key: 'advgb-list-icon-color', className: 'dashicons dashicons-' + icon, style: { color: iconColor, marginLeft: '10px' } })],
initialOpen: false
},
React.createElement(ColorPalette, {
value: iconColor,
onChange: function onChange(color) {
return setAttributes({ iconColor: color });
}
})
),
React.createElement(RangeControl, {
label: __('Icon size'),
value: iconSize || '',
onChange: function onChange(size) {
return setAttributes({ iconSize: size });
},
min: 10,
max: 100,
allowReset: true
}),
React.createElement(RangeControl, {
label: __('Line height'),
value: lineHeight || '',
onChange: function onChange(size) {
return setAttributes({ lineHeight: size });
},
min: 0,
max: 100,
allowReset: true
}),
React.createElement(RangeControl, {
label: __('Margin'),
value: margin || '',
onChange: function onChange(size) {
return setAttributes({ margin: size });
},
min: 0,
max: 100,
allowReset: true
}),
React.createElement(RangeControl, {
label: __('Padding'),
value: padding || '',
onChange: function onChange(size) {
return setAttributes({ padding: size });
},
min: 0,
max: 100,
allowReset: true
})
)
)
),
React.createElement(RichText, {
multiline: 'li',
tagName: 'ul',
unstableGetSettings: this.getEditorSettings,
unstableOnSetup: this.setupEditor,
onChange: this.setNextValues,
value: values,
wrapperClassName: 'advgb-list-item',
className: listClassName,
placeholder: __('Write advanced list…'),
onMerge: mergeBlocks,
onSplit: insertBlocksAfter ? function (before, after) {
for (var _len = arguments.length, blocks = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
blocks[_key - 2] = arguments[_key];
}
if (!blocks.length) {
blocks.push(createBlock('core/paragraph'));
}
if (after.length) {
blocks.push(createBlock('advgb/list', _extends({}, attributes, {
values: after,
id: undefined
})));
}
setAttributes({ values: before });
insertBlocksAfter(blocks);
} : undefined,
onRemove: function onRemove() {
return onReplace([]);
},
isSelected: isSelected
}),
React.createElement(
'div',
null,
React.createElement(
'style',
null,
'.' + id + ' li { font-size: ' + fontSize + 'px }'
),
icon && React.createElement(
'style',
null,
'.' + id + ' li:before {\n font-size: ' + iconSize + 'px;\n color: ' + iconColor + ';\n line-height: ' + lineHeight + 'px;\n margin: ' + margin + 'px;\n padding: ' + padding + 'px;\n }'
)
)
);
}
}]);
return AdvList;
}(Component);
var listBlockIcon = React.createElement(
'svg',
{ height: '20', viewBox: '2 2 22 22', width: '20', xmlns: 'http://www.w3.org/2000/svg' },
React.createElement('path', { d: 'M3 13h2v-2H3v2zm0 4h2v-2H3v2zm0-8h2V7H3v2zm4 4h14v-2H7v2zm0 4h14v-2H7v2zM7 7v2h14V7H7z' }),
React.createElement('path', { d: 'M0 0h24v24H0z', fill: 'none' })
);
registerBlockType('advgb/list', {
title: __('Advanced List'),
description: __('List block with custom icons and styles.'),
icon: {
src: listBlockIcon,
foreground: typeof advgbBlocks !== 'undefined' ? advgbBlocks.color : undefined
},
category: 'common',
keywords: [__('list'), __('icon')],
attributes: {
id: {
type: 'string'
},
icon: {
type: 'string'
},
iconSize: {
type: 'number',
default: 16
},
iconColor: {
type: 'string',
default: '#000'
},
fontSize: {
type: 'number',
default: 16
},
lineHeight: {
type: 'number',
default: 18
},
margin: {
type: 'number',
default: 2
},
padding: {
type: 'number',
default: 2
},
values: {
type: 'array',
source: 'children',
selector: 'ul',
default: []
},
changed: {
type: 'boolean',
default: false
}
},
transforms: {
from: [{
type: 'block',
blocks: ['core/list'],
transform: function transform(_ref) {
var values = _ref.values;
return createBlock('advgb/list', {
values: values,
icon: 'controls-play',
iconColor: '#ff0000'
});
}
}],
to: [{
type: 'block',
blocks: ['core/list'],
transform: function transform(_ref2) {
var values = _ref2.values;
return createBlock('core/list', {
nodeName: 'UL',
values: values
});
}
}]
},
merge: function merge(attributes, attributesToMerge) {
var valuesToMerge = attributesToMerge.values || [];
// Standard text-like block attribute.
if (attributesToMerge.content) {
valuesToMerge.push(attributesToMerge.content);
}
return _extends({}, attributes, {
values: [].concat(_toConsumableArray(attributes.values), _toConsumableArray(valuesToMerge))
});
},
edit: AdvList,
save: function save(_ref3) {
var attributes = _ref3.attributes;
var id = attributes.id,
values = attributes.values,
icon = attributes.icon,
iconSize = attributes.iconSize,
iconColor = attributes.iconColor,
margin = attributes.margin,
padding = attributes.padding,
lineHeight = attributes.lineHeight,
fontSize = attributes.fontSize;
var listClassName = [id, icon && 'advgb-list', icon && 'advgb-list-' + icon].filter(Boolean).join(' ');
return React.createElement(
'div',
null,
React.createElement(
'ul',
{ className: listClassName },
values
),
React.createElement(
'style',
null,
'.' + id + ' li { font-size: ' + fontSize + 'px }'
),
icon && React.createElement(
'style',
null,
'.' + id + ' li:before {\n font-size: ' + iconSize + 'px;\n color: ' + iconColor + ';\n line-height: ' + lineHeight + 'px;\n margin: ' + margin + 'px;\n padding: ' + padding + 'px;\n }'
)
);
}
});
})(wp.i18n, wp.blocks, wp.element, wp.editor, wp.components);
/***/ }),
/***/ "./assets/blocks/advtable/block.jsx":
/*!******************************************!*\
!*** ./assets/blocks/advtable/block.jsx ***!
\******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
(function (wpI18n, wpBlocks, wpElement, wpEditor, wpComponents) {
var __ = wpI18n.__;
var Component = wpElement.Component,
Fragment = wpElement.Fragment;
var registerBlockType = wpBlocks.registerBlockType;
var InspectorControls = wpEditor.InspectorControls,
BlockControls = wpEditor.BlockControls,
RichText = wpEditor.RichText,
MediaUpload = wpEditor.MediaUpload,
BlockAlignmentToolbar = wpEditor.BlockAlignmentToolbar,
PanelColorSettings = wpEditor.PanelColorSettings;
var PanelBody = wpComponents.PanelBody,
BaseControl = wpComponents.BaseControl,
RangeControl = wpComponents.RangeControl,
SelectControl = wpComponents.SelectControl,
IconButton = wpComponents.IconButton,
Toolbar = wpComponents.Toolbar,
DropdownMenu = wpComponents.DropdownMenu,
Tooltip = wpComponents.Tooltip;
var tableBlockIcon = React.createElement(
"svg",
{ xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "2 2 22 22" },
React.createElement("path", { d: "M3 3v18h18V3H3zm8 16H5v-6h6v6zm0-8H5V5h6v6zm8 8h-6v-6h6v6zm0-8h-6V5h6v6z" }),
React.createElement("path", { d: "M0 0h24v24H0z", fill: "none" })
);
var AdvTable = function (_Component) {
_inherits(AdvTable, _Component);
function AdvTable() {
_classCallCheck(this, AdvTable);
var _this = _possibleConstructorReturn(this, (AdvTable.__proto__ || Object.getPrototypeOf(AdvTable)).apply(this, arguments));
_this.state = {
editor: null,
selectedCell: null,
selectedCellBgColor: null,
selectedCellTextColor: null,
selectedCellBorderColor: null,
selectedCellBorderStyle: '',
selectedCellBorderWidth: '',
selectedCellPaddingTop: '',
selectedCellPaddingRight: '',
selectedCellPaddingBottom: '',
selectedCellPaddingLeft: '',
selectedCellTextAlign: null,
selectedCellVerticalAlign: null
};
_this.handleSetup = _this.handleSetup.bind(_this);
return _this;
}
_createClass(AdvTable, [{
key: "componentWillMount",
value: function componentWillMount() {
var _props = this.props,
attributes = _props.attributes,
setAttributes = _props.setAttributes;
var currentBlockConfig = advgbDefaultConfig['advgb-table'];
// No override attributes of blocks inserted before
if (attributes.changed !== true) {
if (currentBlockConfig && (typeof currentBlockConfig === "undefined" ? "undefined" : _typeof(currentBlockConfig)) === 'object') {
Object.keys(currentBlockConfig).map(function (attribute) {
attributes[attribute] = currentBlockConfig[attribute];
});
// Finally set changed attribute to true, so we don't modify anything again
setAttributes({ changed: true });
}
}
}
}, {
key: "componentDidUpdate",
value: function componentDidUpdate() {
var _state = this.state,
editor = _state.editor,
selectedCell = _state.selectedCell;
if (editor && selectedCell) {
var rows = editor.dom.select('tr');
rows.forEach(function (row) {
var rowIndex = row.rowIndex;
var cells = row.getElementsByTagName('td');
for (var i = 0; i < cells.length; i++) {
var cellIndex = cells[i].cellIndex;
editor.dom.setAttrib(cells[i], 'class', "r" + rowIndex + "c" + cellIndex);
}
});
}
}
}, {
key: "handleSetup",
value: function handleSetup(editor, isSelected) {
var _this2 = this;
editor.on('init', function () {
if (isSelected) {
AdvTable.selectFirstCell(editor);
}
});
this.setState({ editor: editor });
editor.off('keydown');
editor.on('nodeChange', function () {
var selectedCell = editor.dom.getParent(editor.selection.getStart(), 'td');
var selectedCellBgColor = editor.dom.getStyle(selectedCell, 'background-color');
var selectedCellTextColor = editor.dom.getStyle(selectedCell, 'color');
var selectedCellBorderColor = editor.dom.getAttrib(selectedCell, 'data-border-color');
var selectedCellBorderStyle = editor.dom.getStyle(selectedCell, 'border-style') || 'solid';
var selectedCellBorderWidth = editor.dom.getStyle(selectedCell, 'border-width') || '1px';
selectedCellBorderWidth = parseInt(selectedCellBorderWidth.replace('px', ''));
var selectedCellPaddingTop = editor.dom.getStyle(selectedCell, 'padding-top');
var selectedCellPaddingRight = editor.dom.getStyle(selectedCell, 'padding-right');
var selectedCellPaddingBottom = editor.dom.getStyle(selectedCell, 'padding-bottom');
var selectedCellPaddingLeft = editor.dom.getStyle(selectedCell, 'padding-left');
if (selectedCellPaddingTop) selectedCellPaddingTop = selectedCellPaddingTop.replace('px', '');
if (selectedCellPaddingRight) selectedCellPaddingRight = selectedCellPaddingRight.replace('px', '');
if (selectedCellPaddingBottom) selectedCellPaddingBottom = selectedCellPaddingBottom.replace('px', '');
if (selectedCellPaddingLeft) selectedCellPaddingLeft = selectedCellPaddingLeft.replace('px', '');
var selectedCellTextAlign = editor.dom.getStyle(selectedCell, 'text-align');
var selectedCellVerticalAlign = editor.dom.getStyle(selectedCell, 'vertical-align');
return _this2.setState({
selectedCell: selectedCell,
selectedCellBgColor: selectedCellBgColor,
selectedCellTextColor: selectedCellTextColor,
selectedCellBorderColor: selectedCellBorderColor,
selectedCellBorderStyle: selectedCellBorderStyle,
selectedCellBorderWidth: selectedCellBorderWidth,
selectedCellPaddingTop: selectedCellPaddingTop,
selectedCellPaddingRight: selectedCellPaddingRight,
selectedCellPaddingBottom: selectedCellPaddingBottom,
selectedCellPaddingLeft: selectedCellPaddingLeft,
selectedCellTextAlign: selectedCellTextAlign,
selectedCellVerticalAlign: selectedCellVerticalAlign
});
});
}
}, {
key: "render",
value: function render() {
var _this3 = this;
var _props2 = this.props,
isSelected = _props2.isSelected,
attributes = _props2.attributes,
setAttributes = _props2.setAttributes,
className = _props2.className;
var content = attributes.content,
align = attributes.align,
maxWidth = attributes.maxWidth;
var _state2 = this.state,
editor = _state2.editor,
selectedCell = _state2.selectedCell,
selectedCellBgColor = _state2.selectedCellBgColor,
selectedCellTextColor = _state2.selectedCellTextColor,
selectedCellBorderColor = _state2.selectedCellBorderColor,
selectedCellBorderStyle = _state2.selectedCellBorderStyle,
selectedCellBorderWidth = _state2.selectedCellBorderWidth,
selectedCellPaddingTop = _state2.selectedCellPaddingTop,
selectedCellPaddingRight = _state2.selectedCellPaddingRight,
selectedCellPaddingBottom = _state2.selectedCellPaddingBottom,
selectedCellPaddingLeft = _state2.selectedCellPaddingLeft,
selectedCellTextAlign = _state2.selectedCellTextAlign,
selectedCellVerticalAlign = _state2.selectedCellVerticalAlign;
var TABLE_CONTROLS = [{
icon: 'table-row-before',
title: __('Add Row Before'),
onClick: AdvTable.execCommand('mceTableInsertRowBefore')
}, {
icon: 'table-row-after',
title: __('Add Row After'),
onClick: AdvTable.execCommand('mceTableInsertRowAfter')
}, {
icon: 'table-row-delete',
title: __('Delete Row'),
onClick: AdvTable.execCommand('mceTableDeleteRow')
}, {
icon: 'table-col-before',
title: __('Add Column Before'),
onClick: AdvTable.execCommand('mceTableInsertColBefore')
}, {
icon: 'table-col-after',
title: __('Add Column After'),
onClick: AdvTable.execCommand('mceTableInsertColAfter')
}, {
icon: 'table-col-delete',
title: __('Delete Column'),
onClick: AdvTable.execCommand('mceTableDeleteCol')
}, {
icon: React.createElement(
"svg",
{ width: "20", height: "20", viewBox: "4 2 18 18", className: "dashicon" },
React.createElement("path", { fill: "none", d: "M0,0h24v24H0V0z" }),
React.createElement("path", { d: "M4,5v13h17V5H4z M14,7v9h-3V7H14z M6,7h3v9H6V7z M19,16h-3V7h3V16z" })
),
title: __('Split Merged Cells'),
onClick: AdvTable.execCommand('mceTableSplitCells')
}, {
icon: React.createElement(
"svg",
{ width: "20", height: "20", className: "dashicon", viewBox: "2 2 22 22" },
React.createElement("path", { fill: "none", d: "M0,0h24v24H0V0z" }),
React.createElement("polygon", { points: "21,18 2,18 2,20 21,20 21,18" }),
React.createElement("path", { d: "M19,10v4H4v-4H19 M20,8H3C2.45,8,2,8.45,2,9v6c0,0.55,0.45,1,1,1h17c0.55,0,1-0.45,1-1V9C21,8.45,20.55,8,20,8L20,8z" }),
React.createElement("polygon", { points: "21,4 2,4 2,6 21,6 21,4" })
),
title: __('Merge Cells'),
onClick: AdvTable.execCommand('mceTableMergeCells')
}];
var BORDER_SELECT = [{
title: __('Border Top'),
icon: React.createElement(
"svg",
{ xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24" },
React.createElement("path", { d: "M7 21h2v-2H7v2zm0-8h2v-2H7v2zm4 0h2v-2h-2v2zm0 8h2v-2h-2v2zm-8-4h2v-2H3v2zm0 4h2v-2H3v2zm0-8h2v-2H3v2zm0-4h2V7H3v2zm8 8h2v-2h-2v2zm8-8h2V7h-2v2zm0 4h2v-2h-2v2zM3 3v2h18V3H3zm16 14h2v-2h-2v2zm-4 4h2v-2h-2v2zM11 9h2V7h-2v2zm8 12h2v-2h-2v2zm-4-8h2v-2h-2v2z" }),
React.createElement("path", { d: "M0 0h24v24H0z", fill: "none" })
),
onClick: function onClick() {
editor.dom.setStyles(selectedCell, {
'border-top-color': selectedCellBorderColor
});
editor.fire('change');
}
}, {
title: __('Border Right'),
icon: React.createElement(
"svg",
{ xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24" },
React.createElement("path", { d: "M7 21h2v-2H7v2zM3 5h2V3H3v2zm4 0h2V3H7v2zm0 8h2v-2H7v2zm-4 8h2v-2H3v2zm8 0h2v-2h-2v2zm-8-8h2v-2H3v2zm0 4h2v-2H3v2zm0-8h2V7H3v2zm8 8h2v-2h-2v2zm4-4h2v-2h-2v2zm4-10v18h2V3h-2zm-4 18h2v-2h-2v2zm0-16h2V3h-2v2zm-4 8h2v-2h-2v2zm0-8h2V3h-2v2zm0 4h2V7h-2v2z" }),
React.createElement("path", { d: "M0 0h24v24H0z", fill: "none" })
),
onClick: function onClick() {
editor.dom.setStyles(selectedCell, {
'border-right-color': selectedCellBorderColor
});
editor.fire('change');
}
}, {
title: __('Border Bottom'),
icon: React.createElement(
"svg",
{ xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24" },
React.createElement("path", { d: "M9 11H7v2h2v-2zm4 4h-2v2h2v-2zM9 3H7v2h2V3zm4 8h-2v2h2v-2zM5 3H3v2h2V3zm8 4h-2v2h2V7zm4 4h-2v2h2v-2zm-4-8h-2v2h2V3zm4 0h-2v2h2V3zm2 10h2v-2h-2v2zm0 4h2v-2h-2v2zM5 7H3v2h2V7zm14-4v2h2V3h-2zm0 6h2V7h-2v2zM5 11H3v2h2v-2zM3 21h18v-2H3v2zm2-6H3v2h2v-2z" }),
React.createElement("path", { d: "M0 0h24v24H0z", fill: "none" })
),
onClick: function onClick() {
editor.dom.setStyles(selectedCell, {
'border-bottom-color': selectedCellBorderColor
});
editor.fire('change');
}
}, {
title: __('Border Left'),
icon: React.createElement(
"svg",
{ xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24" },
React.createElement("path", { d: "M11 21h2v-2h-2v2zm0-4h2v-2h-2v2zm0-12h2V3h-2v2zm0 4h2V7h-2v2zm0 4h2v-2h-2v2zm-4 8h2v-2H7v2zM7 5h2V3H7v2zm0 8h2v-2H7v2zm-4 8h2V3H3v18zM19 9h2V7h-2v2zm-4 12h2v-2h-2v2zm4-4h2v-2h-2v2zm0-14v2h2V3h-2zm0 10h2v-2h-2v2zm0 8h2v-2h-2v2zm-4-8h2v-2h-2v2zm0-8h2V3h-2v2z" }),
React.createElement("path", { d: "M0 0h24v24H0z", fill: "none" })
),
onClick: function onClick() {
editor.dom.setStyles(selectedCell, {
'border-left-color': selectedCellBorderColor
});
editor.fire('change');
}
}, {
title: __('Border All'),
icon: React.createElement(
"svg",
{ xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24" },
React.createElement("path", { d: "M13 7h-2v2h2V7zm0 4h-2v2h2v-2zm4 0h-2v2h2v-2zM3 3v18h18V3H3zm16 16H5V5h14v14zm-6-4h-2v2h2v-2zm-4-4H7v2h2v-2z" }),
React.createElement("path", { d: "M0 0h24v24H0z", fill: "none" })
),
onClick: function onClick() {
editor.dom.setStyles(selectedCell, {
'border-top-color': selectedCellBorderColor,
'border-right-color': selectedCellBorderColor,
'border-bottom-color': selectedCellBorderColor,
'border-left-color': selectedCellBorderColor
});
editor.fire('change');
}
}, {
title: __('Border None'),
icon: React.createElement(
"svg",
{ xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24" },
React.createElement("path", { d: "M7 5h2V3H7v2zm0 8h2v-2H7v2zm0 8h2v-2H7v2zm4-4h2v-2h-2v2zm0 4h2v-2h-2v2zm-8 0h2v-2H3v2zm0-4h2v-2H3v2zm0-4h2v-2H3v2zm0-4h2V7H3v2zm0-4h2V3H3v2zm8 8h2v-2h-2v2zm8 4h2v-2h-2v2zm0-4h2v-2h-2v2zm0 8h2v-2h-2v2zm0-12h2V7h-2v2zm-8 0h2V7h-2v2zm8-6v2h2V3h-2zm-8 2h2V3h-2v2zm4 16h2v-2h-2v2zm0-8h2v-2h-2v2zm0-8h2V3h-2v2z" }),
React.createElement("path", { d: "M0 0h24v24H0z", fill: "none" })
),
onClick: function onClick() {
editor.dom.setStyles(selectedCell, {
'border-top-color': '',
'border-right-color': '',
'border-bottom-color': '',
'border-left-color': ''
});
editor.fire('change');
}
}];
var HORZ_ALIGNMENT_CONTROLS = [{
icon: 'editor-alignleft',
title: __('Align left'),
align: 'left'
}, {
icon: 'editor-aligncenter',
title: __('Align center'),
align: 'center'
}, {
icon: 'editor-alignright',
title: __('Align right'),
align: 'right'
}, {
icon: 'editor-justify',
title: __('Align justify'),
align: 'justify'
}];
var VERT_ALIGNMENT_CONTROLS = [{
icon: React.createElement(
"svg",
{ xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24" },
React.createElement("path", { d: "M8 11h3v10h2V11h3l-4-4-4 4zM4 3v2h16V3H4z" }),
React.createElement("path", { d: "M0 0h24v24H0z", fill: "none" })
),
title: __('Align top'),
align: 'top'
}, {
icon: React.createElement(
"svg",
{ xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24" },
React.createElement("path", { d: "M8 19h3v4h2v-4h3l-4-4-4 4zm8-14h-3V1h-2v4H8l4 4 4-4zM4 11v2h16v-2H4z" }),
React.createElement("path", { d: "M0 0h24v24H0z", fill: "none" })
),
title: __('Align middle'),
align: 'middle'
}, {
icon: React.createElement(
"svg",
{ xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24" },
React.createElement("path", { d: "M16 13h-3V3h-2v10H8l4 4 4-4zM4 19v2h16v-2H4z" }),
React.createElement("path", { d: "M0 0h24v24H0z", fill: "none" })
),
title: __('Align bottom'),
align: 'bottom'
}];
return React.createElement(
Fragment,
null,
React.createElement(
BlockControls,
null,
React.createElement(BlockAlignmentToolbar, {
value: align,
onChange: function onChange(value) {
return setAttributes({ align: value });
}
}),
React.createElement(
Toolbar,
null,
React.createElement(DropdownMenu, {
icon: "editor-table",
label: __('Edit table'),
controls: TABLE_CONTROLS.map(function (control) {
return _extends({}, control, {
onClick: function onClick() {
return control.onClick(_this3.state.editor);
}
});
})
}),
React.createElement(MediaUpload, {
allowedTypes: ["image"],
onSelect: function onSelect(media) {
return editor.execCommand('mceInsertContent', false, "");
},
render: function render(_ref) {
var open = _ref.open;
return React.createElement(IconButton, {
className: "components-icon-button components-toolbar__control",
icon: "format-image",
label: __('Insert image'),
onClick: open
});
}
})
)
),
React.createElement(
InspectorControls,
null,
React.createElement(
PanelBody,
{ title: __('Table Settings') },
React.createElement(RangeControl, {
label: __('Max width (px)'),
help: __('Set this to 0 to make max-width is 100%'),
min: 0,
max: 1999,
value: maxWidth,
onChange: function onChange(value) {
return setAttributes({ maxWidth: value });
}
})
),
React.createElement(
PanelBody,
{ title: __('Single Cell Settings') },
React.createElement(PanelColorSettings, {
title: __('Color Settings'),
initialOpen: false,
colorSettings: [{
label: __('Background Color'),
value: selectedCellBgColor,
onChange: function onChange(value) {
editor.dom.setStyle(selectedCell, 'background-color', value || '');
editor.fire('change');
_this3.setState({ selectedCellBgColor: value });
}
}, {
label: __('Text Color'),
value: selectedCellTextColor,
onChange: function onChange(value) {
editor.dom.setStyle(selectedCell, 'color', value || '');
editor.fire('change');
_this3.setState({ selectedCellTextColor: value });
}
}, {
label: __('Border Color'),
value: selectedCellBorderColor,
onChange: function onChange(value) {
editor.dom.setAttrib(selectedCell, 'data-border-color', value || '');
['top', 'right', 'bottom', 'left'].map(function (pos) {
if (editor.dom.getStyle(selectedCell, "border-" + pos + "-color")) editor.dom.setStyle(selectedCell, "border-" + pos + "-color", value || '');
});
editor.fire('change');
_this3.setState({ selectedCellBorderColor: value });
}
}]
}),
React.createElement(
PanelBody,
{ title: __('Border'), initialOpen: false },
React.createElement(SelectControl, {
label: __('Border Style'),
value: selectedCellBorderStyle,
options: [{ label: __('Solid'), value: 'solid' }, { label: __('Dashed'), value: 'dashed' }, { label: __('Dotted'), value: 'dotted' }, { label: __('None'), value: 'none' }],
onChange: function onChange(value) {
editor.dom.setStyle(selectedCell, 'border-style', value);
editor.fire('change');
_this3.setState({ selectedCellBorderStyle: value });
}
}),
React.createElement(RangeControl, {
label: __('Border width'),
value: selectedCellBorderWidth,
min: 1,
max: 10,
onChange: function onChange(value) {
editor.dom.setStyle(selectedCell, 'border-width', value);
editor.fire('change');
_this3.setState({ selectedCellBorderWidth: value });
}
}),
React.createElement(
"div",
{ className: 'advgb-border-item-wrapper' },
BORDER_SELECT.map(function (item, index) {
return React.createElement(
"div",
{ className: 'advgb-border-item', key: index },
React.createElement(
Tooltip,
{ text: item.title },
React.createElement(
"span",
{ onClick: item.onClick },
item.icon
)
)
);
})
)
),
React.createElement(
PanelBody,
{ title: __('Padding'), initialOpen: false },
React.createElement(RangeControl, {
label: __('Padding Top'),
min: 0,
max: 50,
value: selectedCellPaddingTop,
onChange: function onChange(value) {
editor.dom.setStyle(selectedCell, 'padding-top', value || '');
editor.fire('change');
_this3.setState({ selectedCellPaddingTop: value || '' });
},
allowReset: true
}),
React.createElement(RangeControl, {
label: __('Padding Bottom'),
min: 0,
max: 50,
value: selectedCellPaddingBottom,
onChange: function onChange(value) {
editor.dom.setStyle(selectedCell, 'padding-bottom', value || '');
editor.fire('change');
_this3.setState({ selectedCellPaddingBottom: value || '' });
},
allowReset: true
}),
React.createElement(RangeControl, {
label: __('Padding Left'),
min: 0,
max: 50,
value: selectedCellPaddingLeft,
onChange: function onChange(value) {
editor.dom.setStyle(selectedCell, 'padding-left', value || '');
editor.fire('change');
_this3.setState({ selectedCellPaddingLeft: value || '' });
},
allowReset: true
}),
React.createElement(RangeControl, {
label: __('Padding Right'),
min: 0,
max: 50,
value: selectedCellPaddingRight,
onChange: function onChange(value) {
editor.dom.setStyle(selectedCell, 'padding-right', value || '');
editor.fire('change');
_this3.setState({ selectedCellPaddingRight: value || '' });
},
allowReset: true
})
),
React.createElement(
PanelBody,
{ title: __('Text Alignment'), initialOpen: false },
React.createElement(
BaseControl,
{ label: __('Horizontal Align') },
React.createElement(Toolbar, {
controls: HORZ_ALIGNMENT_CONTROLS.map(function (control) {
var isActive = selectedCellTextAlign === control.align;
return _extends({}, control, {
isActive: isActive,
onClick: function onClick() {
editor.dom.setStyle(selectedCell, 'text-align', isActive ? '' : control.align);
editor.fire('change');
}
});
})
})
),
React.createElement(
BaseControl,
{ label: __('Vertical Align') },
React.createElement(Toolbar, {
controls: VERT_ALIGNMENT_CONTROLS.map(function (control) {
var isActive = selectedCellVerticalAlign === control.align;
return _extends({}, control, {
isActive: isActive,
onClick: function onClick() {
editor.dom.setStyle(selectedCell, 'vertical-align', isActive ? '' : control.align);
editor.fire('change');
}
});
})
})
)
)
)
),
React.createElement(RichText, {
tagName: "table",
wrapperClassName: className,
unstableGetSettings: function unstableGetSettings(settings) {
return _extends({}, settings, {
plugins: (settings.plugins || []).concat('table')
});
},
value: content,
unstableOnSetup: function unstableOnSetup(editor) {
return _this3.handleSetup(editor, isSelected);
},
onChange: function onChange(value) {
return setAttributes({ content: value });
},
style: { maxWidth: !!maxWidth && maxWidth + 'px' }
})
);
}
}], [{
key: "isTableSelected",
value: function isTableSelected(editor) {
return editor.dom.getParent(editor.selection.getStart(true), 'table', editor.getBody().parentNode);
}
}, {
key: "selectFirstCell",
value: function selectFirstCell(editor) {
var cell = editor.getBody().querySelector('td,th');
if (cell) {
cell.focus();
editor.selection.select(cell, true);
editor.selection.collapse(false);
}
}
}, {
key: "execCommand",
value: function execCommand(command) {
return function (editor) {
if (editor) {
if (!AdvTable.isTableSelected(editor)) {
AdvTable.selectFirstCell(editor);
}
editor.execCommand(command);
editor.fire('change');
}
};
}
}]);
return AdvTable;
}(Component);
registerBlockType('advgb/table', {
title: __('Advanced Table'),
description: __('Advanced table block with more styles and functions.'),
icon: {
src: tableBlockIcon,
foreground: typeof advgbBlocks !== 'undefined' ? advgbBlocks.color : undefined
},
category: 'formatting',
keywords: [__('table'), __('cell'), __('data')],
attributes: {
content: {
type: 'array',
source: 'children',
selector: 'table',
default: [React.createElement(
"tbody",
{ key: "a" },
React.createElement(
"tr",
null,
React.createElement(
"td",
null,
React.createElement("br", null)
),
React.createElement(
"td",
null,
React.createElement("br", null)
)
),
React.createElement(
"tr",
null,
React.createElement(
"td",
null,
React.createElement("br", null)
),
React.createElement(
"td",
null,
React.createElement("br", null)
)
)
)]
},
align: {
type: 'string'
},
maxWidth: {
type: 'number',
default: 0
},
changed: {
type: 'boolean',
default: false
}
},
edit: AdvTable,
save: function save(_ref2) {
var attributes = _ref2.attributes;
var content = attributes.content,
align = attributes.align,
maxWidth = attributes.maxWidth;
return React.createElement(RichText.Content, {
tagName: "table",
className: 'advgb-table-frontend ' + (align ? "align" + align : ''),
style: { maxWidth: !!maxWidth ? maxWidth + 'px' : undefined },
value: content
});
},
getEditWrapperProps: function getEditWrapperProps(attributes) {
var align = attributes.align;
if ('left' === align || 'right' === align || 'wide' === align || 'full' === align) {
return { 'data-align': align };
}
}
});
})(wp.i18n, wp.blocks, wp.element, wp.editor, wp.components);
/***/ }),
/***/ "./assets/blocks/advvideo/block.jsx":
/*!******************************************!*\
!*** ./assets/blocks/advvideo/block.jsx ***!
\******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
(function (wpI18n, wpBlocks, wpElement, wpEditor, wpComponents) {
var __ = wpI18n.__;
var Component = wpElement.Component,
Fragment = wpElement.Fragment;
var registerBlockType = wpBlocks.registerBlockType;
var InspectorControls = wpEditor.InspectorControls,
BlockControls = wpEditor.BlockControls,
PanelColorSettings = wpEditor.PanelColorSettings,
MediaUpload = wpEditor.MediaUpload;
var RangeControl = wpComponents.RangeControl,
PanelBody = wpComponents.PanelBody,
ToggleControl = wpComponents.ToggleControl,
BaseControl = wpComponents.BaseControl,
TextControl = wpComponents.TextControl,
Button = wpComponents.Button,
IconButton = wpComponents.IconButton,
Dashicon = wpComponents.Dashicon,
Spinner = wpComponents.Spinner,
Toolbar = wpComponents.Toolbar;
var PLAY_BUTTON_STYLE = {
normal: [React.createElement("path", { key: "x", d: "M8 5v14l11-7z" }), React.createElement("path", { key: "y", d: "M0 0h24v24H0z", fill: "none" })],
circleFill: [React.createElement("path", { key: "x", d: "M0 0h24v24H0z", fill: "none" }), React.createElement("path", { key: "y", d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 14.5v-9l6 4.5-6 4.5z" })],
circleOutline: [React.createElement("path", { key: "x", d: "M0 0h24v24H0z", fill: "none" }), React.createElement("path", { key: "y", d: "M10 16.5l6-4.5-6-4.5v9zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z" })],
videoCam: [React.createElement("path", { key: "x", d: "M0 0h24v24H0z", fill: "none" }), React.createElement("path", { key: "y", d: "M17 10.5V7c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-3.5l4 4v-11l-4 4z" })],
squareCurved: [React.createElement("path", { key: "x", d: "M20 8H4V6h16v2zm-2-6H6v2h12V2zm4 10v8c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2v-8c0-1.1.9-2 2-2h16c1.1 0 2 .9 2 2zm-6 4l-6-3.27v6.53L16 16z" }), React.createElement("path", { key: "y", fill: "none", d: "M0 0h24v24H0z" })],
starSticker: [React.createElement("path", { key: "x", d: "M0 0h24v24H0z", fill: "none" }), React.createElement("path", { key: "y", d: "M20 12c0-1.1.9-2 2-2V6c0-1.1-.9-2-2-2H4c-1.1 0-1.99.9-1.99 2v4c1.1 0 1.99.9 1.99 2s-.89 2-2 2v4c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2v-4c-1.1 0-2-.9-2-2zm-4.42 4.8L12 14.5l-3.58 2.3 1.08-4.12-3.29-2.69 4.24-.25L12 5.8l1.54 3.95 4.24.25-3.29 2.69 1.09 4.11z" })]
};
var AdvVideo = function (_Component) {
_inherits(AdvVideo, _Component);
function AdvVideo() {
_classCallCheck(this, AdvVideo);
var _this = _possibleConstructorReturn(this, (AdvVideo.__proto__ || Object.getPrototypeOf(AdvVideo)).apply(this, arguments));
_this.state = {
fetching: false
};
_this.fetchVideoInfo = _this.fetchVideoInfo.bind(_this);
return _this;
}
_createClass(AdvVideo, [{
key: "componentWillMount",
value: function componentWillMount() {
var _props = this.props,
attributes = _props.attributes,
setAttributes = _props.setAttributes;
var currentBlockConfig = advgbDefaultConfig['advgb-video'];
// No override attributes of blocks inserted before
if (attributes.changed !== true) {
if (currentBlockConfig !== undefined && (typeof currentBlockConfig === "undefined" ? "undefined" : _typeof(currentBlockConfig)) === 'object') {
Object.keys(currentBlockConfig).map(function (attribute) {
attributes[attribute] = currentBlockConfig[attribute];
});
// Finally set changed attribute to true, so we don't modify anything again
setAttributes({ changed: true });
}
}
}
}, {
key: "fetchVideoInfo",
value: function fetchVideoInfo() {
var _this2 = this;
var _props2 = this.props,
attributes = _props2.attributes,
setAttributes = _props2.setAttributes;
var videoID = attributes.videoID,
poster = attributes.poster,
posterID = attributes.posterID;
var realID = videoID;
if (!!videoID) {
this.setState({ fetching: true });
var url = '';
if (videoID.match(/^\d+$/g)) {
url = "https://vimeo.com/" + videoID;
} else {
url = "https://www.youtube.com/watch?v=" + videoID;
}
if (videoID.indexOf('http') > -1) {
url = videoID;
}
if (videoID.match(/youtube.com/)) {
realID = videoID.split('v=');
realID = realID[1];
} else if (videoID.match(/youtu.be|vimeo.com/)) {
realID = videoID.split('/');
realID = realID[realID.length - 1];
}
if (realID.indexOf('&') > -1) realID = realID.substring(0, realID.indexOf('&'));
wp.apiFetch({ path: wp.url.addQueryArgs("/oembed/1.0/proxy?url=" + encodeURIComponent(url)) }).then(function (obj) {
_this2.setState({ fetching: false });
if (!!obj.title && !!obj.provider_name) {
setAttributes({
videoTitle: obj.title,
poster: !!posterID ? poster : obj.thumbnail_url
});
switch (obj.provider_name) {
case 'YouTube':
setAttributes({
videoSourceType: 'youtube',
videoURL: "https://www.youtube.com/embed/" + realID + "?rel=0&wmode=transparent"
});
break;
case 'Vimeo':
setAttributes({
videoSourceType: 'vimeo',
videoURL: "https://player.vimeo.com/video/" + realID
});
break;
default:
break;
}
} else {
setAttributes({
videoTitle: 'ADVGB_FAIL_TO_LOAD',
poster: ''
});
}
});
}
}
}, {
key: "render",
value: function render() {
var _props3 = this.props,
isSelected = _props3.isSelected,
attributes = _props3.attributes,
setAttributes = _props3.setAttributes;
var videoURL = attributes.videoURL,
videoID = attributes.videoID,
videoSourceType = attributes.videoSourceType,
videoTitle = attributes.videoTitle,
videoFullWidth = attributes.videoFullWidth,
videoWidth = attributes.videoWidth,
videoHeight = attributes.videoHeight,
playButtonIcon = attributes.playButtonIcon,
playButtonSize = attributes.playButtonSize,
playButtonColor = attributes.playButtonColor,
overlayColor = attributes.overlayColor,
poster = attributes.poster,
posterID = attributes.posterID,
openInLightbox = attributes.openInLightbox;
var blockClassName = ['advgb-video-block', !!openInLightbox && !!videoURL && 'advgb-video-lightbox'].filter(Boolean).join(' ');
var videoWrapperClass = ['advgb-video-wrapper', !!videoFullWidth && 'full-width'].filter(Boolean).join(' ');
var videoHostIcon = {
youtube: React.createElement(
"svg",
{ id: "Social_Icons", version: "1.1", viewBox: "0 0 128 128", xmlns: "http://www.w3.org/2000/svg" },
React.createElement(
"g",
{ id: "_x34__stroke" },
React.createElement(
"g",
{ id: "Youtube_1_" },
React.createElement("rect", { clipRule: "evenodd", fill: "none", height: "128", width: "128" }),
React.createElement("path", { clipRule: "evenodd", d: "M126.72,38.224c0,0-1.252-8.883-5.088-12.794 c-4.868-5.136-10.324-5.16-12.824-5.458c-17.912-1.305-44.78-1.305-44.78-1.305h-0.056c0,0-26.868,0-44.78,1.305 c-2.504,0.298-7.956,0.322-12.828,5.458C2.528,29.342,1.28,38.224,1.28,38.224S0,48.658,0,59.087v9.781 c0,10.433,1.28,20.863,1.28,20.863s1.248,8.883,5.084,12.794c4.872,5.136,11.268,4.975,14.116,5.511 c10.24,0.991,43.52,1.297,43.52,1.297s26.896-0.04,44.808-1.345c2.5-0.302,7.956-0.326,12.824-5.462 c3.836-3.912,5.088-12.794,5.088-12.794S128,79.302,128,68.868v-9.781C128,48.658,126.72,38.224,126.72,38.224z M50.784,80.72 L50.78,44.501l34.584,18.172L50.784,80.72z", fill: "#CE1312", fillRule: "evenodd", id: "Youtube" })
)
)
),
vimeo: React.createElement(
"svg",
{ height: "25", viewBox: "0 0 32 32", width: "25", xmlns: "http://www.w3.org/2000/svg" },
React.createElement(
"g",
null,
React.createElement("circle", { cx: "16", cy: "16", id: "BG", r: "16", fill: "#5FCCFF" }),
React.createElement("path", { d: "M24,12.4c-0.1,1.6-1.2,3.7-3.3,6.4c-2.2,2.8-4,4.2-5.5,4.2 c-0.9,0-1.7-0.9-2.4-2.6c-0.4-1.6-0.9-3.2-1.3-4.7c-0.5-1.7-1-2.6-1.5-2.6c-0.1,0-0.5,0.3-1.3,0.8l-0.8-1 c0.8-0.7,1.6-1.4,2.3-2.1c1.1-0.9,1.8-1.4,2.4-1.4c1.2-0.1,2,0.7,2.3,2.5c0.3,2,0.5,3.2,0.6,3.7c0.4,1.6,0.8,2.4,1.2,2.4 c0.3,0,0.8-0.5,1.5-1.6c0.7-1.1,1-1.9,1.1-2.4c0.1-0.9-0.3-1.4-1.1-1.4c-0.4,0-0.8,0.1-1.2,0.3c0.8-2.6,2.3-3.8,4.5-3.7 C23.3,9.2,24.1,10.3,24,12.4", id: "Vimeo", fill: "#FFFFFF" })
)
),
local: React.createElement(
"svg",
{ height: "25", id: "Layer_1", version: "1.1", viewBox: "0 0 24 24", width: "25", xmlns: "http://www.w3.org/2000/svg" },
React.createElement("path", { clipRule: "evenodd", d: "M22.506,21v0.016L17,15.511V19c0,1.105-0.896,2-2,2h-1.5H3H2c-1.104,0-2-0.895-2-2 v-1l0,0V6l0,0V5c0-1.104,0.896-1.999,2-1.999h1l0,0h10.5l0,0H15c1.104,0,2,0.895,2,1.999v3.516l5.5-5.5V3.001 c0.828,0,1.5,0.671,1.5,1.499v15C24,20.327,23.331,20.996,22.506,21z", fillRule: "evenodd" })
)
};
return React.createElement(
Fragment,
null,
(!!poster && openInLightbox || !openInLightbox && videoSourceType === 'local') && React.createElement(
BlockControls,
null,
React.createElement(
Toolbar,
null,
React.createElement(MediaUpload, {
allowedTypes: ["image"],
value: posterID,
onSelect: function onSelect(image) {
return setAttributes({ poster: image.url, posterID: image.id });
},
render: function render(_ref) {
var open = _ref.open;
return React.createElement(IconButton, {
className: "components-toolbar__control",
label: __('Change image preview'),
icon: 'edit',
onClick: open
});
}
}),
React.createElement(IconButton, {
className: "components-toolbar__control",
label: __('Remove image preview'),
icon: 'no',
onClick: function onClick() {
return setAttributes({ poster: undefined, posterID: undefined });
}
})
)
),
React.createElement(
InspectorControls,
null,
React.createElement(
PanelBody,
{ title: __('Advanced Video Settings') },
React.createElement(ToggleControl, {
label: __('Open video in light box'),
help: __('Lightbox offers additional display options.'),
checked: openInLightbox,
onChange: function onChange() {
return setAttributes({ openInLightbox: !openInLightbox });
}
}),
React.createElement(ToggleControl, {
label: __('Full width'),
checked: videoFullWidth,
onChange: function onChange() {
return setAttributes({ videoFullWidth: !videoFullWidth });
}
}),
!videoFullWidth && React.createElement(RangeControl, {
label: __('Video width'),
value: videoWidth,
min: 100,
max: 1000,
onChange: function onChange(value) {
return setAttributes({ videoWidth: value });
}
}),
React.createElement(RangeControl, {
label: __('Video height'),
value: videoHeight,
min: 300,
max: 700,
onChange: function onChange(value) {
return setAttributes({ videoHeight: value });
}
}),
!!openInLightbox && React.createElement(
Fragment,
null,
React.createElement(PanelColorSettings, {
title: __('Color Settings'),
initialOpen: false,
colorSettings: [{
label: __('Overlay Color'),
value: overlayColor,
onChange: function onChange(value) {
return setAttributes({ overlayColor: value });
}
}, {
label: __('Play Button Color'),
value: playButtonColor,
onChange: function onChange(value) {
return setAttributes({ playButtonColor: value });
}
}]
}),
React.createElement(
PanelBody,
{ title: __('Play Button') },
React.createElement(
BaseControl,
{ label: __('Icon Style') },
React.createElement(
"div",
{ className: "advgb-icon-items-wrapper" },
Object.keys(PLAY_BUTTON_STYLE).map(function (key, index) {
return React.createElement(
"div",
{ className: "advgb-icon-item", key: index },
React.createElement(
"span",
{ className: key === playButtonIcon ? 'active' : '',
onClick: function onClick() {
return setAttributes({ playButtonIcon: key });
} },
React.createElement(
"svg",
{ xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24" },
PLAY_BUTTON_STYLE[key]
)
)
);
})
)
),
React.createElement(RangeControl, {
label: __('Play Button Size'),
value: playButtonSize,
min: 40,
max: 200,
onChange: function onChange(value) {
return setAttributes({ playButtonSize: value });
}
})
)
)
)
),
React.createElement(
"div",
{ className: blockClassName },
!!openInLightbox && React.createElement(
"div",
{ className: videoWrapperClass, style: { backgroundColor: overlayColor, width: videoWidth } },
React.createElement("div", { className: 'advgb-video-poster', style: { backgroundImage: "url(" + poster + ")" } }),
React.createElement(
"div",
{ className: 'advgb-button-wrapper', style: { height: videoHeight } },
!poster && React.createElement(MediaUpload, {
allowedTypes: ["image"],
onSelect: function onSelect(media) {
return setAttributes({ poster: media.url, posterID: media.id });
},
value: posterID,
render: function render(_ref2) {
var open = _ref2.open;
return React.createElement(
Button,
{
className: 'button button-large',
onClick: open
},
__('Select image preview')
);
}
}),
React.createElement(
"div",
{ className: 'advgb-play-button' },
React.createElement(
"svg",
{ xmlns: "http://www.w3.org/2000/svg",
width: playButtonSize,
height: playButtonSize,
fill: playButtonColor,
viewBox: "0 0 24 24"
},
PLAY_BUTTON_STYLE[playButtonIcon]
)
)
)
),
!openInLightbox && ((videoSourceType === 'youtube' || videoSourceType === 'vimeo') && React.createElement("iframe", { src: videoURL,
width: videoWidth,
height: videoHeight,
frameBorder: "0",
allowFullScreen: true }) || videoSourceType === 'local' && React.createElement(
"video",
{ width: videoWidth,
height: videoHeight,
poster: poster,
controls: true
},
React.createElement("source", { src: videoURL }),
__('Your browser does not support HTML5 video.')
) || !videoSourceType && React.createElement("div", { style: { width: videoWidth, height: videoHeight } })),
isSelected && React.createElement(
"div",
{ className: 'advgb-video-input-block' },
React.createElement(
"div",
{ className: 'advgb-video-input' },
React.createElement(Dashicon, { className: "advgb-video-link-icon", icon: 'admin-links' }),
React.createElement(TextControl, {
placeholder: __('Youtube/Vimeo video URL/ID…'),
value: videoID,
onChange: function onChange(value) {
setAttributes({ videoID: value, videoURL: '', videoTitle: undefined, videoSourceType: '' });
}
}),
React.createElement(
Button,
{
className: "button button-large",
disabled: !videoID || videoSourceType === 'local',
style: { height: '31px' },
onClick: this.fetchVideoInfo
},
__('Fetch')
),
React.createElement(
"span",
{ style: { margin: 'auto 10px' } },
__('or use')
),
React.createElement(MediaUpload, {
allowedTypes: ["video"],
value: videoID,
onSelect: function onSelect(video) {
return setAttributes({ videoURL: video.url, videoID: video.id, videoTitle: video.title, videoSourceType: 'local' });
},
render: function render(_ref3) {
var open = _ref3.open;
return React.createElement(
Button,
{
className: "button button-large is-primary",
onClick: open
},
__('Local video')
);
}
})
),
React.createElement(
"div",
{ className: 'advgb-current-video-desc',
style: { minWidth: '50%', margin: '10px auto', textAlign: 'center' }
},
React.createElement(
"strong",
null,
__('Current Video'),
":"
),
React.createElement(
"span",
{ title: videoSourceType,
style: {
width: '25px',
height: '25px',
display: 'inline-block',
verticalAlign: 'text-bottom',
margin: 'auto 7px' }
},
videoHostIcon[videoSourceType] || this.state.fetching && React.createElement(Spinner, null)
),
React.createElement(
"span",
null,
videoTitle === 'ADVGB_FAIL_TO_LOAD' && React.createElement(
"strong",
{ style: { color: 'red' } },
__('Wrong video URL/ID. Please try another.')
) || videoTitle || __('Not selected yet.')
)
)
)
)
);
}
}]);
return AdvVideo;
}(Component);
var advVideoBlockIcon = React.createElement(
"svg",
{ xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "2 2 22 22" },
React.createElement("path", { d: "M0 0h24v24H0z", fill: "none" }),
React.createElement("path", { d: "M10 16.5l6-4.5-6-4.5v9zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z" })
);
registerBlockType('advgb/video', {
title: __('Advanced Video'),
description: __('Powerful block for insert and embed video.'),
icon: {
src: advVideoBlockIcon,
foreground: typeof advgbBlocks !== 'undefined' ? advgbBlocks.color : undefined
},
category: 'common',
keywords: [__('video'), __('embed'), __('media')],
attributes: {
videoURL: {
type: 'string'
},
videoID: {
type: 'string'
},
videoSourceType: {
type: 'string'
},
videoTitle: {
type: 'string'
},
videoFullWidth: {
type: 'boolean',
default: true
},
videoWidth: {
type: 'number'
},
videoHeight: {
type: 'number',
default: 450
},
playButtonIcon: {
type: 'string',
default: 'normal'
},
playButtonSize: {
type: 'number',
default: 80
},
playButtonColor: {
type: 'string',
default: '#fff'
},
overlayColor: {
type: 'string',
default: '#EEEEEE'
},
poster: {
type: 'string'
},
posterID: {
type: 'number'
},
openInLightbox: {
type: 'boolean',
default: true
},
changed: {
type: 'boolean',
default: false
}
},
edit: AdvVideo,
save: function save(_ref4) {
var attributes = _ref4.attributes;
var videoURL = attributes.videoURL,
videoSourceType = attributes.videoSourceType,
videoTitle = attributes.videoTitle,
videoFullWidth = attributes.videoFullWidth,
videoWidth = attributes.videoWidth,
videoHeight = attributes.videoHeight,
playButtonIcon = attributes.playButtonIcon,
playButtonSize = attributes.playButtonSize,
playButtonColor = attributes.playButtonColor,
overlayColor = attributes.overlayColor,
poster = attributes.poster,
openInLightbox = attributes.openInLightbox;
var blockClassName = ['advgb-video-block', !!videoFullWidth && 'full-width', !!openInLightbox && !!videoURL && 'advgb-video-lightbox'].filter(Boolean).join(' ');
var videoWrapperClass = ['advgb-video-wrapper', !!videoFullWidth && 'full-width'].filter(Boolean).join(' ');
return React.createElement(
"div",
{ className: blockClassName,
"data-video": videoURL,
"data-source": videoSourceType
},
!openInLightbox && ((videoSourceType === 'youtube' || videoSourceType === 'vimeo') && React.createElement("iframe", { src: videoURL,
width: videoWidth,
height: videoHeight,
frameBorder: "0",
allowFullScreen: true }) || videoSourceType === 'local' && React.createElement(
"video",
{ className: videoFullWidth && 'full-width',
width: videoWidth,
height: videoHeight,
poster: poster,
controls: true
},
React.createElement("source", { src: videoURL }),
__('Your browser does not support HTML5 video.')
) || !videoSourceType && React.createElement("div", { style: { width: videoWidth, height: videoHeight } })),
!!openInLightbox && React.createElement(
"div",
{ className: videoWrapperClass, style: { backgroundColor: overlayColor, width: videoWidth } },
React.createElement("div", { className: 'advgb-video-poster', style: { backgroundImage: "url(" + poster + ")" } }),
React.createElement(
"div",
{ className: 'advgb-button-wrapper', style: { height: videoHeight } },
React.createElement(
"div",
{ className: 'advgb-play-button' },
React.createElement(
"svg",
{ xmlns: "http://www.w3.org/2000/svg",
width: playButtonSize,
height: playButtonSize,
fill: playButtonColor,
viewBox: "0 0 24 24"
},
PLAY_BUTTON_STYLE[playButtonIcon]
)
)
)
)
);
}
});
})(wp.i18n, wp.blocks, wp.element, wp.editor, wp.components);
/***/ }),
/***/ "./assets/blocks/count-up/block.jsx":
/*!******************************************!*\
!*** ./assets/blocks/count-up/block.jsx ***!
\******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
(function (wpI18n, wpBlocks, wpElement, wpEditor, wpComponents) {
var __ = wpI18n.__;
var Component = wpElement.Component,
Fragment = wpElement.Fragment;
var registerBlockType = wpBlocks.registerBlockType;
var InspectorControls = wpEditor.InspectorControls,
RichText = wpEditor.RichText,
PanelColorSettings = wpEditor.PanelColorSettings;
var RangeControl = wpComponents.RangeControl,
PanelBody = wpComponents.PanelBody,
TextControl = wpComponents.TextControl,
FormToggle = wpComponents.FormToggle;
var AdvCountUp = function (_Component) {
_inherits(AdvCountUp, _Component);
function AdvCountUp() {
_classCallCheck(this, AdvCountUp);
var _this = _possibleConstructorReturn(this, (AdvCountUp.__proto__ || Object.getPrototypeOf(AdvCountUp)).apply(this, arguments));
_this.state = {
currentEdit: ''
};
return _this;
}
_createClass(AdvCountUp, [{
key: 'componentWillMount',
value: function componentWillMount() {
var _props = this.props,
attributes = _props.attributes,
setAttributes = _props.setAttributes;
var currentBlockConfig = advgbDefaultConfig['advgb-count-up'];
// No override attributes of blocks inserted before
if (attributes.changed !== true) {
if (currentBlockConfig !== undefined && (typeof currentBlockConfig === 'undefined' ? 'undefined' : _typeof(currentBlockConfig)) === 'object') {
Object.keys(currentBlockConfig).map(function (attribute) {
attributes[attribute] = currentBlockConfig[attribute];
});
// Finally set changed attribute to true, so we don't modify anything again
setAttributes({ changed: true });
}
}
}
}, {
key: 'handleSetup',
value: function handleSetup(editor, area) {
var _this2 = this;
editor.on('focus', function () {
return _this2.setState({ currentEdit: area });
});
}
}, {
key: 'render',
value: function render() {
var _this3 = this;
var currentEdit = this.state.currentEdit;
var _props2 = this.props,
attributes = _props2.attributes,
setAttributes = _props2.setAttributes,
isSelected = _props2.isSelected;
var headerText = attributes.headerText,
headerText2 = attributes.headerText2,
headerText3 = attributes.headerText3,
headerTextColor = attributes.headerTextColor,
countUpNumber = attributes.countUpNumber,
countUpNumber2 = attributes.countUpNumber2,
countUpNumber3 = attributes.countUpNumber3,
countUpNumberColor = attributes.countUpNumberColor,
countUpNumberSize = attributes.countUpNumberSize,
countUpSymbol = attributes.countUpSymbol,
countUpSymbol2 = attributes.countUpSymbol2,
countUpSymbol3 = attributes.countUpSymbol3,
countUpSymbolAfter = attributes.countUpSymbolAfter,
countUpSymbolAfter2 = attributes.countUpSymbolAfter2,
countUpSymbolAfter3 = attributes.countUpSymbolAfter3,
descText = attributes.descText,
descText2 = attributes.descText2,
descText3 = attributes.descText3,
descTextColor = attributes.descTextColor,
columns = attributes.columns;
return React.createElement(
Fragment,
null,
React.createElement(
InspectorControls,
null,
React.createElement(
PanelBody,
{ title: __('Count Up Settings') },
React.createElement(PanelColorSettings, {
title: __('Color Settings'),
initialOpen: false,
colorSettings: [{
label: __('Header Color'),
value: headerTextColor,
onChange: function onChange(value) {
return setAttributes({ headerTextColor: value });
}
}, {
label: __('Count Up Color'),
value: countUpNumberColor,
onChange: function onChange(value) {
return setAttributes({ countUpNumberColor: value });
}
}, {
label: __('Description Color'),
value: descTextColor,
onChange: function onChange(value) {
return setAttributes({ descTextColor: value });
}
}]
}),
React.createElement(RangeControl, {
label: __('Columns'),
min: 1,
max: 3,
value: columns,
onChange: function onChange(value) {
return setAttributes({ columns: value });
}
}),
React.createElement(RangeControl, {
label: __('Counter Number Size'),
min: 10,
max: 100,
value: countUpNumberSize,
onChange: function onChange(value) {
return setAttributes({ countUpNumberSize: value });
}
}),
React.createElement(
'div',
null,
__('Counter Up Symbol')
),
React.createElement(
'div',
{ className: 'advgb-col-3' },
React.createElement(TextControl, {
value: countUpSymbol,
onChange: function onChange(value) {
return setAttributes({ countUpSymbol: value });
}
}),
React.createElement(FormToggle, {
checked: countUpSymbolAfter,
onChange: function onChange() {
return setAttributes({ countUpSymbolAfter: !countUpSymbolAfter });
},
title: !!countUpSymbolAfter ? __('After') : __('Before')
})
),
parseInt(columns) > 1 && React.createElement(
'div',
{ className: 'advgb-col-3' },
React.createElement(TextControl, {
value: countUpSymbol2,
onChange: function onChange(value) {
return setAttributes({ countUpSymbol2: value });
}
}),
React.createElement(FormToggle, {
checked: countUpSymbolAfter2,
onChange: function onChange() {
return setAttributes({ countUpSymbolAfter2: !countUpSymbolAfter2 });
},
title: !!countUpSymbolAfter2 ? __('After') : __('Before')
})
),
parseInt(columns) > 2 && React.createElement(
'div',
{ className: 'advgb-col-3' },
React.createElement(TextControl, {
value: countUpSymbol3,
onChange: function onChange(value) {
return setAttributes({ countUpSymbol3: value });
}
}),
React.createElement(FormToggle, {
checked: countUpSymbolAfter3,
onChange: function onChange() {
return setAttributes({ countUpSymbolAfter3: !countUpSymbolAfter3 });
},
title: !!countUpSymbolAfter3 ? __('After') : __('Before')
})
),
React.createElement(
'p',
{ className: 'components-base-control__help', style: { clear: 'both' } },
__('Use toggle buttons above to define symbol placement before/after the number (toggle on is after).')
)
)
),
React.createElement(
'div',
{ className: 'advgb-count-up advgb-column-' + columns, style: { display: 'flex' } },
React.createElement(
'div',
{ className: 'advgb-count-up-columns-one', style: { textAlign: 'center' } },
React.createElement(RichText, {
tagName: 'h4',
value: headerText,
onChange: function onChange(value) {
return setAttributes({ headerText: value });
},
isSelected: isSelected && currentEdit === 'header',
unstableOnSetup: function unstableOnSetup(editor) {
return _this3.handleSetup(editor, 'header');
},
style: { color: headerTextColor },
placeholder: __('Enter text…')
}),
React.createElement(RichText, {
tagName: 'div',
value: countUpNumber,
onChange: function onChange(value) {
return setAttributes({ countUpNumber: value });
},
isSelected: isSelected && currentEdit === 'countUp',
unstableOnSetup: function unstableOnSetup(editor) {
return _this3.handleSetup(editor, 'countUp');
},
style: { fontSize: countUpNumberSize + 'px', color: countUpNumberColor }
}),
React.createElement(RichText, {
tagName: 'p',
value: descText,
onChange: function onChange(value) {
return setAttributes({ descText: value });
},
isSelected: isSelected && currentEdit === 'desc',
unstableOnSetup: function unstableOnSetup(editor) {
return _this3.handleSetup(editor, 'desc');
},
style: { color: descTextColor },
placeholder: __('Enter text…')
})
),
React.createElement(
'div',
{ className: 'advgb-count-up-columns-two', style: { textAlign: 'center' } },
React.createElement(RichText, {
tagName: 'h4',
value: headerText2,
onChange: function onChange(value) {
return setAttributes({ headerText2: value });
},
isSelected: isSelected && currentEdit === 'header2',
unstableOnSetup: function unstableOnSetup(editor) {
return _this3.handleSetup(editor, 'header2');
},
style: { color: headerTextColor },
placeholder: __('Enter text…')
}),
React.createElement(RichText, {
tagName: 'div',
value: countUpNumber2,
onChange: function onChange(value) {
return setAttributes({ countUpNumber2: value });
},
isSelected: isSelected && currentEdit === 'countUp2',
unstableOnSetup: function unstableOnSetup(editor) {
return _this3.handleSetup(editor, 'countUp2');
},
style: { fontSize: countUpNumberSize + 'px', color: countUpNumberColor }
}),
React.createElement(RichText, {
tagName: 'p',
value: descText2,
onChange: function onChange(value) {
return setAttributes({ descText2: value });
},
isSelected: isSelected && currentEdit === 'desc2',
unstableOnSetup: function unstableOnSetup(editor) {
return _this3.handleSetup(editor, 'desc2');
},
style: { color: descTextColor },
placeholder: __('Enter text…')
})
),
React.createElement(
'div',
{ className: 'advgb-count-up-columns-three', style: { textAlign: 'center' } },
React.createElement(RichText, {
tagName: 'h4',
value: headerText3,
onChange: function onChange(value) {
return setAttributes({ headerText3: value });
},
isSelected: isSelected && currentEdit === 'header3',
unstableOnSetup: function unstableOnSetup(editor) {
return _this3.handleSetup(editor, 'header3');
},
style: { color: headerTextColor },
placeholder: __('Enter text…')
}),
React.createElement(RichText, {
tagName: 'div',
value: countUpNumber3,
onChange: function onChange(value) {
return setAttributes({ countUpNumber3: value });
},
isSelected: isSelected && currentEdit === 'countUp3',
unstableOnSetup: function unstableOnSetup(editor) {
return _this3.handleSetup(editor, 'countUp3');
},
style: { fontSize: countUpNumberSize + 'px', color: countUpNumberColor }
}),
React.createElement(RichText, {
tagName: 'p',
value: descText3,
onChange: function onChange(value) {
return setAttributes({ descText3: value });
},
isSelected: isSelected && currentEdit === 'desc3',
unstableOnSetup: function unstableOnSetup(editor) {
return _this3.handleSetup(editor, 'desc3');
},
style: { color: descTextColor },
placeholder: __('Enter text…')
})
)
)
);
}
}]);
return AdvCountUp;
}(Component);
function AdvCountUpSave(_ref) {
var attributes = _ref.attributes;
var headerText = attributes.headerText,
headerText2 = attributes.headerText2,
headerText3 = attributes.headerText3,
headerTextColor = attributes.headerTextColor,
countUpNumber = attributes.countUpNumber,
countUpNumber2 = attributes.countUpNumber2,
countUpNumber3 = attributes.countUpNumber3,
countUpNumberColor = attributes.countUpNumberColor,
countUpNumberSize = attributes.countUpNumberSize,
countUpSymbol = attributes.countUpSymbol,
countUpSymbol2 = attributes.countUpSymbol2,
countUpSymbol3 = attributes.countUpSymbol3,
countUpSymbolAfter = attributes.countUpSymbolAfter,
countUpSymbolAfter2 = attributes.countUpSymbolAfter2,
countUpSymbolAfter3 = attributes.countUpSymbolAfter3,
descText = attributes.descText,
descText2 = attributes.descText2,
descText3 = attributes.descText3,
descTextColor = attributes.descTextColor,
columns = attributes.columns;
var countSymbolElm = countUpSymbol ? React.createElement(
'span',
{ className: 'advgb-counter-symbol' },
countUpSymbol
) : '';
var countSymbolElm2 = countUpSymbol2 ? React.createElement(
'span',
{ className: 'advgb-counter-symbol' },
countUpSymbol2
) : '';
var countSymbolElm3 = countUpSymbol3 ? React.createElement(
'span',
{ className: 'advgb-counter-symbol' },
countUpSymbol3
) : '';
return React.createElement(
'div',
{ className: 'advgb-count-up', style: { display: 'flex' } },
React.createElement(
'div',
{ className: 'advgb-count-up-columns-one', style: { textAlign: 'center' } },
React.createElement(
'h4',
{ className: 'advgb-count-up-header', style: { color: headerTextColor } },
headerText
),
React.createElement(
'div',
{ className: 'advgb-counter',
style: { color: countUpNumberColor, fontSize: countUpNumberSize + 'px' }
},
!countUpSymbolAfter && countSymbolElm,
React.createElement(
'span',
{ className: 'advgb-counter-number' },
countUpNumber
),
!!countUpSymbolAfter && countSymbolElm
),
React.createElement(
'p',
{ className: 'advgb-count-up-desc', style: { color: descTextColor } },
descText
)
),
parseInt(columns) > 1 && React.createElement(
'div',
{ className: 'advgb-count-up-columns-two', style: { textAlign: 'center' } },
React.createElement(
'h4',
{ className: 'advgb-count-up-header', style: { color: headerTextColor } },
headerText2
),
React.createElement(
'div',
{ className: 'advgb-counter',
style: { color: countUpNumberColor, fontSize: countUpNumberSize + 'px' }
},
!countUpSymbolAfter2 && countSymbolElm2,
React.createElement(
'span',
{ className: 'advgb-counter-number' },
countUpNumber2
),
!!countUpSymbolAfter2 && countSymbolElm2
),
React.createElement(
'p',
{ className: 'advgb-count-up-desc', style: { color: descTextColor } },
descText2
)
),
parseInt(columns) > 2 && React.createElement(
'div',
{ className: 'advgb-count-up-columns-three', style: { textAlign: 'center' } },
React.createElement(
'h4',
{ className: 'advgb-count-up-header', style: { color: headerTextColor } },
headerText3
),
React.createElement(
'div',
{ className: 'advgb-counter',
style: { color: countUpNumberColor, fontSize: countUpNumberSize + 'px' }
},
!countUpSymbolAfter3 && countSymbolElm3,
React.createElement(
'span',
{ className: 'advgb-counter-number' },
countUpNumber3
),
!!countUpSymbolAfter3 && countSymbolElm3
),
React.createElement(
'p',
{ className: 'advgb-count-up-desc', style: { color: descTextColor } },
descText3
)
)
);
}
var countUpBlockIcon = React.createElement(
'svg',
{ height: '20', viewBox: '2 2 22 22', width: '20', xmlns: 'http://www.w3.org/2000/svg' },
React.createElement('path', { d: 'M0 0h24v24H0zm0 0h24v24H0z', fill: 'none' }),
React.createElement('path', { d: 'M16.05 16.29l2.86-3.07c.38-.39.72-.79 1.04-1.18.32-.39.59-.78.82-1.17.23-.39.41-.78.54-1.17.13-.39.19-.79.19-1.18 0-.53-.09-1.02-.27-1.46-.18-.44-.44-.81-.78-1.11-.34-.31-.77-.54-1.26-.71-.51-.16-1.08-.24-1.72-.24-.69 0-1.31.11-1.85.32-.54.21-1 .51-1.36.88-.37.37-.65.8-.84 1.3-.18.47-.27.97-.28 1.5h2.14c.01-.31.05-.6.13-.87.09-.29.23-.54.4-.75.18-.21.41-.37.68-.49.27-.12.6-.18.96-.18.31 0 .58.05.81.15.23.1.43.25.59.43.16.18.28.4.37.65.08.25.13.52.13.81 0 .22-.03.43-.08.65-.06.22-.15.45-.29.7-.14.25-.32.53-.56.83-.23.3-.52.65-.88 1.03l-4.17 4.55V18H22v-1.71h-5.95zM8 7H6v4H2v2h4v4h2v-4h4v-2H8V7z' })
);
registerBlockType('advgb/count-up', {
title: __('Count Up'),
description: __('Make a block with animate counting numbers.'),
icon: {
src: countUpBlockIcon,
foreground: typeof advgbBlocks !== 'undefined' ? advgbBlocks.color : undefined
},
category: 'common',
keywords: [__('numbers'), __('count'), __('increase')],
attributes: {
headerText: {
type: 'string',
default: __('Header text')
},
headerText2: {
type: 'string',
default: __('Header text')
},
headerText3: {
type: 'string',
default: __('Header text')
},
headerTextColor: {
type: 'string'
},
countUpNumber: {
type: 'string',
default: '56789'
},
countUpNumber2: {
type: 'string',
default: '56789'
},
countUpNumber3: {
type: 'string',
default: '56789'
},
countUpNumberColor: {
type: 'string'
},
countUpNumberSize: {
type: 'number',
default: 55
},
countUpSymbol: {
type: 'string'
},
countUpSymbol2: {
type: 'string'
},
countUpSymbol3: {
type: 'string'
},
countUpSymbolAfter: {
type: 'boolean',
default: false
},
countUpSymbolAfter2: {
type: 'boolean',
default: false
},
countUpSymbolAfter3: {
type: 'boolean',
default: false
},
descText: {
type: 'string',
default: __('and description')
},
descText2: {
type: 'string',
default: __('and description')
},
descText3: {
type: 'string',
default: __('and description')
},
descTextColor: {
type: 'string'
},
columns: {
type: 'number',
default: 1
},
changed: {
type: 'boolean',
default: false
}
},
edit: AdvCountUp,
save: AdvCountUpSave
});
})(wp.i18n, wp.blocks, wp.element, wp.editor, wp.components);
/***/ }),
/***/ "./assets/blocks/custom-columns/columns.jsx":
/*!**************************************************!*\
!*** ./assets/blocks/custom-columns/columns.jsx ***!
\**************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
(function (wpI18n, wpHooks, wpElement, wpEditor, wpComponents) {
var addFilter = wpHooks.addFilter;
var __ = wpI18n.__;
var Fragment = wpElement.Fragment;
var InspectorControls = wpEditor.InspectorControls;
var RangeControl = wpComponents.RangeControl;
// Register extra attributes
addFilter('blocks.registerBlockType', 'advgb/registerExtraColumnsAttrs', function (settings) {
if (settings.name === 'core/text-columns' || settings.name === 'core/columns') {
settings.attributes = _extends(settings.attributes, {
colMargin: {
type: 'number'
},
colPadding: {
type: 'number'
},
blockID: {
type: 'string'
}
});
}
return settings;
});
// Add options to edit in backend
addFilter('editor.BlockEdit', 'advgb/editColumnsAttrs', function (BlockEdit) {
return function (props) {
if (props.name === "core/text-columns" || props.name === "core/columns") {
var isSelected = props.isSelected,
attributes = props.attributes,
setAttributes = props.setAttributes,
clientId = props.clientId;
var colMargin = attributes.colMargin,
colPadding = attributes.colPadding,
blockID = attributes.blockID;
return [React.createElement(BlockEdit, _extends({ key: 'block-edit-custom-columns' }, props)), isSelected && React.createElement(
InspectorControls,
{ key: 'inspector-custom-columns' },
React.createElement(RangeControl, {
label: __('Columns margin'),
value: colMargin,
min: 0,
max: 200,
onChange: function onChange(value) {
if (!blockID) setAttributes({ blockID: 'columns-' + clientId });
return setAttributes({ colMargin: value });
}
}),
React.createElement(RangeControl, {
label: __('Columns padding'),
value: colPadding,
min: 0,
max: 100,
onChange: function onChange(value) {
if (!blockID) setAttributes({ blockID: 'columns-' + clientId });
return setAttributes({ colPadding: value });
}
})
), props.name === 'core/columns' && (!!colMargin || !!colPadding) && React.createElement(
'style',
{ key: 'custom-columns-styles' },
'#block-' + clientId + ' .wp-block-columns .editor-block-list__block:not(:first-child) {margin-left: ' + colMargin + 'px;}',
'#block-' + clientId + ' .wp-block-columns .editor-block-list__block-edit {padding: ' + colPadding + 'px;}'
), props.name === 'core/text-columns' && (!!colMargin || !!colPadding) && React.createElement(
'style',
{ key: 'custom-text-columns-styles' },
'#block-' + clientId + ' .wp-block-column:not(:first-child) {margin-left: ' + colMargin + 'px;}',
'#block-' + clientId + ' .wp-block-column {padding: ' + colPadding + 'px;}'
)];
}
return React.createElement(BlockEdit, props);
};
});
// Save options to show in frontend
addFilter('blocks.getSaveContent.extraProps', 'advgb/saveColumnsAttrs', function (extraProps, blockType, attributes) {
var blockID = attributes.blockID;
if (blockType.name === 'core/text-columns' || blockType.name === 'core/columns') {
extraProps = _extends(extraProps, {
id: blockID
});
}
return extraProps;
});
// Save option to show in frontend
addFilter('blocks.getSaveElement', 'advgb/saveTextColumnsElm', function (SaveElm, blockType, attributes) {
if (blockType.name === 'core/text-columns' || blockType.name === 'core/columns') {
var colMargin = attributes.colMargin,
colPadding = attributes.colPadding,
blockID = attributes.blockID;
return React.createElement(
Fragment,
null,
SaveElm,
blockID && (!!colMargin || !!colPadding) && React.createElement(
'style',
null,
'#' + blockID + ' .wp-block-column:not(:first-child) {\n margin-left: ' + colMargin + 'px;\n }\n #' + blockID + ' .wp-block-column {\n padding: ' + colPadding + 'px;\n }'
)
);
}
return SaveElm;
});
})(wp.i18n, wp.hooks, wp.element, wp.editor, wp.components);
/***/ }),
/***/ "./assets/blocks/custom-separator/separator.jsx":
/*!******************************************************!*\
!*** ./assets/blocks/custom-separator/separator.jsx ***!
\******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
(function (wpI18n, wpHooks, wpEditor, wpComponents) {
var addFilter = wpHooks.addFilter;
var __ = wpI18n.__;
var InspectorControls = wpEditor.InspectorControls,
PanelColorSettings = wpEditor.PanelColorSettings;
var SelectControl = wpComponents.SelectControl,
PanelBody = wpComponents.PanelBody,
RangeControl = wpComponents.RangeControl;
// Register extra attributes to separator blocks
addFilter('blocks.registerBlockType', 'advgb/registerExtraSeparatorAttrs', function (settings) {
if (settings.name === 'core/separator') {
settings.attributes = _extends(settings.attributes, {
borderColor: {
type: 'string'
},
borderSize: {
type: 'number'
},
borderStyle: {
type: 'string'
},
borderWidth: {
type: 'number'
}
});
}
return settings;
});
// Add option to select styles for separator
addFilter('editor.BlockEdit', 'advgb/customSeparatorStyles', function (BlockEdit) {
return function (props) {
if (props.name === "core/separator") {
var isSelected = props.isSelected,
attributes = props.attributes,
setAttributes = props.setAttributes,
clientId = props.clientId;
var borderColor = attributes.borderColor,
borderSize = attributes.borderSize,
borderStyle = attributes.borderStyle,
borderWidth = attributes.borderWidth;
return [React.createElement(BlockEdit, _extends({ key: 'block-edit-custom-separator' }, props)), isSelected && React.createElement(
InspectorControls,
{ key: 'inspector-custom-separator' },
React.createElement(
PanelBody,
{ title: __('Separator Settings') },
React.createElement(PanelColorSettings, {
title: __('Color Settings'),
initialOpen: false,
colorSettings: [{
label: __('Color'),
value: borderColor,
onChange: function onChange(value) {
return setAttributes({ borderColor: value });
}
}]
}),
React.createElement(SelectControl, {
label: __('Styles'),
value: borderStyle,
options: [{ label: __('Solid'), value: 'solid' }, { label: __('Dotted'), value: 'dotted' }, { label: __('Dashed'), value: 'dashed' }, { label: __('Double'), value: 'double' }],
onChange: function onChange(value) {
return setAttributes({ borderStyle: value });
}
}),
React.createElement(RangeControl, {
label: __('Thick'),
value: borderWidth,
min: 1,
max: 20,
onChange: function onChange(value) {
return setAttributes({ borderWidth: value });
}
}),
React.createElement(RangeControl, {
label: __('Width'),
value: borderSize,
min: 50,
max: 1000,
onChange: function onChange(value) {
return setAttributes({ borderSize: value });
}
})
)
), React.createElement(
'style',
{ key: 'custom-separator-styles' },
'#block-' + clientId + ' hr {\n border-bottom-color: ' + borderColor + ';\n border-bottom-style: ' + borderStyle + ';\n border-bottom-width: ' + borderWidth + 'px;\n max-width: ' + borderSize + 'px;\n }'
)];
}
return React.createElement(BlockEdit, props);
};
});
// Apply custom styles on front-end
addFilter('blocks.getSaveContent.extraProps', 'advgb/saveSeparatorStyles', function (extraProps, blockType, attributes) {
if (blockType.name === 'core/separator') {
var borderColor = attributes.borderColor,
borderSize = attributes.borderSize,
borderStyle = attributes.borderStyle,
borderWidth = attributes.borderWidth;
extraProps = _extends(extraProps, {
style: {
borderBottomColor: borderColor,
borderBottomWidth: borderWidth ? borderWidth + 'px' : undefined,
borderBottomStyle: borderStyle,
maxWidth: borderSize ? borderSize + 'px' : undefined
}
});
}
return extraProps;
});
})(wp.i18n, wp.hooks, wp.editor, wp.components);
/***/ }),
/***/ "./assets/blocks/customstyles/custom-styles.jsx":
/*!******************************************************!*\
!*** ./assets/blocks/customstyles/custom-styles.jsx ***!
\******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
(function (wpI18n, wpHooks, wpBlocks, wpEditor, wpComponents) {
var addFilter = wpHooks.addFilter;
var __ = wpI18n.__;
var hasBlockSupport = wpBlocks.hasBlockSupport;
var InspectorControls = wpEditor.InspectorControls;
var SelectControl = wpComponents.SelectControl;
// Register custom styles to blocks attributes
addFilter('blocks.registerBlockType', 'advgb/registerCustomStyleClass', function (settings) {
if (settings.name === 'core/paragraph') {
settings.attributes = _extends(settings.attributes, {
customStyle: {
type: 'string'
},
identifyColor: {
type: 'string'
}
});
}
return settings;
});
// Add option to return to default style
if (typeof advGb_CS !== 'undefined' && advGb_CS) {
advGb_CS.unshift({
id: 0,
label: __('Paragraph'),
value: '',
identifyColor: ''
});
}
// Add option to select custom styles for paragraph blocks
addFilter('editor.BlockEdit', 'advgb/customStyles', function (BlockEdit) {
return function (props) {
return [React.createElement(BlockEdit, _extends({ key: 'block-edit-custom-class-name' }, props)), props.isSelected && props.name === "core/paragraph" && React.createElement(
InspectorControls,
{ key: 'advgb-custom-controls' },
React.createElement(SelectControl, {
label: [__('Custom styles'), React.createElement('span', { className: 'components-panel__color-area',
key: 'customstyle-identify',
style: {
background: props.attributes.identifyColor,
verticalAlign: 'text-bottom',
borderRadius: '50%',
border: 'none',
width: '16px',
height: '16px'
} })],
help: __('This option let you add custom style for current paragraph. (Front-end only!)'),
value: props.attributes.customStyle,
options: advGb_CS.map(function (cstyle, index) {
if (cstyle.title) advGb_CS[index].label = cstyle.title;
if (cstyle.name) advGb_CS[index].value = cstyle.name;
return cstyle;
}),
onChange: function onChange(cstyle) {
var identifyColor = advGb_CS.filter(function (style) {
return style.value === cstyle;
})[0].identifyColor;
props.setAttributes({
customStyle: cstyle,
identifyColor: identifyColor,
backgroundColor: undefined,
textColor: undefined,
fontSize: undefined
});
}
})
)];
};
});
// Apply custom styles on front-end
addFilter('blocks.getSaveContent.extraProps', 'advgb/loadFrontendCustomStyles', function (extraProps, blockType, attributes) {
if (hasBlockSupport(blockType, 'customStyle', true) && attributes.customStyle) {
if (typeof extraProps.className === 'undefined') {
extraProps.className = attributes.customStyle;
} else {
extraProps.className += ' ' + attributes.customStyle;
extraProps.className = extraProps.className.trim();
}
}
return extraProps;
});
})(wp.i18n, wp.hooks, wp.blocks, wp.editor, wp.components);
/***/ }),
/***/ "./assets/blocks/map/block.jsx":
/*!*************************************!*\
!*** ./assets/blocks/map/block.jsx ***!
\*************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
(function (wpI18n, wpBlocks, wpElement, wpEditor, wpComponents) {
var __ = wpI18n.__;
var Component = wpElement.Component,
Fragment = wpElement.Fragment;
var registerBlockType = wpBlocks.registerBlockType;
var InspectorControls = wpEditor.InspectorControls,
MediaUpload = wpEditor.MediaUpload;
var PanelBody = wpComponents.PanelBody,
TextControl = wpComponents.TextControl,
TextareaControl = wpComponents.TextareaControl,
RangeControl = wpComponents.RangeControl,
BaseControl = wpComponents.BaseControl,
Button = wpComponents.Button,
Placeholder = wpComponents.Placeholder,
Spinner = wpComponents.Spinner;
var mapBlockIcon = React.createElement(
"svg",
{ xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "2 2 22 22" },
React.createElement("path", { d: "M20.5 3l-.16.03L15 5.1 9 3 3.36 4.9c-.21.07-.36.25-.36.48V20.5c0 .28.22.5.5.5l.16-.03L9 18.9l6 2.1 5.64-1.9c.21-.07.36-.25.36-.48V3.5c0-.28-.22-.5-.5-.5zM15 19l-6-2.11V5l6 2.11V19z" }),
React.createElement("path", { d: "M0 0h24v24H0z", fill: "none" })
);
var mapWillUpdate = null;
var AdvMap = function (_Component) {
_inherits(AdvMap, _Component);
function AdvMap() {
_classCallCheck(this, AdvMap);
var _this = _possibleConstructorReturn(this, (AdvMap.__proto__ || Object.getPrototypeOf(AdvMap)).apply(this, arguments));
_this.state = {
currentAddress: '',
currentMap: null,
currentMarker: null,
currentInfo: null,
fetching: false
};
_this.initMap = _this.initMap.bind(_this);
_this.fetchLocation = _this.fetchLocation.bind(_this);
return _this;
}
_createClass(AdvMap, [{
key: "componentWillMount",
value: function componentWillMount() {
var _props = this.props,
attributes = _props.attributes,
setAttributes = _props.setAttributes;
var currentBlockConfig = advgbDefaultConfig['advgb-map'];
// No override attributes of blocks inserted before
if (attributes.changed !== true) {
if (currentBlockConfig !== undefined && (typeof currentBlockConfig === "undefined" ? "undefined" : _typeof(currentBlockConfig)) === 'object') {
Object.keys(currentBlockConfig).map(function (attribute) {
attributes[attribute] = currentBlockConfig[attribute];
});
// Finally set changed attribute to true, so we don't modify anything again
setAttributes({ changed: true });
}
}
}
}, {
key: "componentDidMount",
value: function componentDidMount() {
var _props2 = this.props,
attributes = _props2.attributes,
setAttributes = _props2.setAttributes,
clientId = _props2.clientId;
if (!attributes.mapID) {
setAttributes({ mapID: 'advgbmap-' + clientId });
}
this.initMap();
}
}, {
key: "componentDidUpdate",
value: function componentDidUpdate(prevProps, prevState) {
var _prevProps$attributes = prevProps.attributes,
prevAddr = _prevProps$attributes.address,
prevUseLatLng = _prevProps$attributes.useLatLng;
var _props$attributes = this.props.attributes,
address = _props$attributes.address,
useLatLng = _props$attributes.useLatLng;
if (prevAddr !== address || prevUseLatLng !== useLatLng || prevState !== this.state) return null;
if (prevProps.attributes !== this.props.attributes) {
clearTimeout(mapWillUpdate);
mapWillUpdate = setTimeout(this.initMap, 1000);
}
}
}, {
key: "initMap",
value: function initMap() {
if (typeof google === "undefined" || !this.props.attributes.mapID) return null;
var DEFAULT_MARKER = 'https://maps.gstatic.com/mapfiles/api-3/images/spotlight-poi2.png';
var _state = this.state,
currentMap = _state.currentMap,
currentMarker = _state.currentMarker,
currentInfo = _state.currentInfo;
var _props$attributes2 = this.props.attributes,
mapID = _props$attributes2.mapID,
lat = _props$attributes2.lat,
lng = _props$attributes2.lng,
zoom = _props$attributes2.zoom,
markerTitle = _props$attributes2.markerTitle,
markerIcon = _props$attributes2.markerIcon,
markerDesc = _props$attributes2.markerDesc;
var location = { lat: parseFloat(lat), lng: parseFloat(lng) };
var that = this;
var formattedDesc = markerDesc.replace(/\n/g, '
');
var map = currentMap;
var marker = currentMarker;
var infoWindow = currentInfo;
if (!map) {
map = new google.maps.Map(document.getElementById(mapID), {
zoom: zoom,
center: location,
gestureHandling: 'cooperative'
});
this.setState({ currentMap: map });
}
map.setCenter(location);
map.setZoom(zoom);
if (!infoWindow) {
infoWindow = new google.maps.InfoWindow({
content: "
" + (formattedDesc || '') + "
\n" + (formattedDesc || '') + "
\n" + (formattedDesc || '') + "