From 066223261840f2c1d8d8fa0ecac2b3141e5cec4c Mon Sep 17 00:00:00 2001 From: Yahil Madakiya Date: Thu, 13 Dec 2018 18:42:34 +0530 Subject: [PATCH 1/4] Add support for Gutenberg Notice component --- dist/middleware.js | 101 ++++++++++++++++++++++------ dist/middleware.min.js | 2 +- examples/all-fields-block/blocks.js | 5 ++ middleware/fields/index.js | 1 + middleware/fields/notice/index.js | 21 ++++++ middleware/index.js | 3 + 6 files changed, 112 insertions(+), 21 deletions(-) create mode 100644 middleware/fields/notice/index.js diff --git a/dist/middleware.js b/dist/middleware.js index ab86236..938ad5c 100644 --- a/dist/middleware.js +++ b/dist/middleware.js @@ -255,7 +255,7 @@ var Field = function (_Component) { /* 2 */ /***/ (function(module, exports) { -var core = module.exports = { version: '2.5.7' }; +var core = module.exports = { version: '2.6.0' }; if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef @@ -1591,6 +1591,9 @@ var GutenbergFieldsMiddleWare = function () { case 'media-icon': field = fields.mediaIcon(props, config, defaultConfig, attributeKey, this); break; + case 'notice': + field = fields.notice(props, config, defaultConfig, attributeKey, this); + break; case 'dropdown-menu': field = fields.dropDownMenu(props, config, defaultConfig, attributeKey, this); break; @@ -1658,7 +1661,7 @@ var GutenbergFieldsMiddleWare = function () { BlockControls, { key: 'block-controls', __source: { fileName: _jsxFileName, - lineNumber: 254 + lineNumber: 257 } }, _.isEmpty(fields) && __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_keys___default()(this.blockControlFields).map(function (key) { @@ -1688,7 +1691,7 @@ var GutenbergFieldsMiddleWare = function () { InspectorControls, { key: 'inspector-control', __source: { fileName: _jsxFileName, - lineNumber: 275 + lineNumber: 278 } }, _.isEmpty(fields) && __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_keys___default()(this.inspectorControlFields).map(function (key) { @@ -1846,7 +1849,7 @@ var GutenbergFieldsMiddleWare = function () { 'div', { key: props.className, __source: { fileName: _jsxFileName, - lineNumber: 427 + lineNumber: 430 } }, __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_keys___default()(this.fields).map(function (key) { @@ -2124,22 +2127,25 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "link", function() { return __WEBPACK_IMPORTED_MODULE_13__link__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__media_upload__ = __webpack_require__(130); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "mediaUpload", function() { return __WEBPACK_IMPORTED_MODULE_14__media_upload__["a"]; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__radio__ = __webpack_require__(140); -/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "radio", function() { return __WEBPACK_IMPORTED_MODULE_15__radio__["a"]; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__range__ = __webpack_require__(141); -/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "range", function() { return __WEBPACK_IMPORTED_MODULE_16__range__["a"]; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__rich_text__ = __webpack_require__(142); -/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "richText", function() { return __WEBPACK_IMPORTED_MODULE_17__rich_text__["a"]; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__select__ = __webpack_require__(144); -/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "select", function() { return __WEBPACK_IMPORTED_MODULE_18__select__["a"]; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__text__ = __webpack_require__(145); -/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "text", function() { return __WEBPACK_IMPORTED_MODULE_19__text__["a"]; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__textarea__ = __webpack_require__(146); -/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "textarea", function() { return __WEBPACK_IMPORTED_MODULE_20__textarea__["a"]; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__tree_select__ = __webpack_require__(148); -/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "treeSelect", function() { return __WEBPACK_IMPORTED_MODULE_21__tree_select__["a"]; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__url_input_button__ = __webpack_require__(149); -/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "urlInputButton", function() { return __WEBPACK_IMPORTED_MODULE_22__url_input_button__["a"]; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__notice__ = __webpack_require__(151); +/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "notice", function() { return __WEBPACK_IMPORTED_MODULE_15__notice__["a"]; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__radio__ = __webpack_require__(140); +/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "radio", function() { return __WEBPACK_IMPORTED_MODULE_16__radio__["a"]; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__range__ = __webpack_require__(141); +/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "range", function() { return __WEBPACK_IMPORTED_MODULE_17__range__["a"]; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__rich_text__ = __webpack_require__(142); +/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "richText", function() { return __WEBPACK_IMPORTED_MODULE_18__rich_text__["a"]; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__select__ = __webpack_require__(144); +/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "select", function() { return __WEBPACK_IMPORTED_MODULE_19__select__["a"]; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__text__ = __webpack_require__(145); +/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "text", function() { return __WEBPACK_IMPORTED_MODULE_20__text__["a"]; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__textarea__ = __webpack_require__(146); +/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "textarea", function() { return __WEBPACK_IMPORTED_MODULE_21__textarea__["a"]; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__tree_select__ = __webpack_require__(148); +/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "treeSelect", function() { return __WEBPACK_IMPORTED_MODULE_22__tree_select__["a"]; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__url_input_button__ = __webpack_require__(149); +/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "urlInputButton", function() { return __WEBPACK_IMPORTED_MODULE_23__url_input_button__["a"]; }); + @@ -4996,5 +5002,60 @@ function urlInputButton(props, config, defaultConfig, attributeKey) { ); } +/***/ }), +/* 150 */, +/* 151 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (immutable) */ __webpack_exports__["a"] = notice; +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends__ = __webpack_require__(0); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__components_field__ = __webpack_require__(1); + +var _jsxFileName = "/Users/yahilmadakiya/Local Sites/wp50/app/public/wp-content/plugins/gutenberg-fields-middleware/middleware/fields/notice/index.js"; +/** + * Notice field. + */ + +var Notice = wp.components.Notice; + + + +function notice(props, config, defaultConfig, attributeKey, middleware) { + + var fieldAttributes = _.extend(defaultConfig, config); + + delete fieldAttributes.type; + + return wp.element.createElement( + __WEBPACK_IMPORTED_MODULE_1__components_field__["a" /* default */], + __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends___default()({}, config, { + __source: { + fileName: _jsxFileName, + lineNumber: 15 + } + }), + wp.element.createElement( + Notice, + { status: "error", isDismissible: false, __source: { + fileName: _jsxFileName, + lineNumber: 16 + } + }, + wp.element.createElement( + "p", + { + __source: { + fileName: _jsxFileName, + lineNumber: 17 + } + }, + "An error occurred: " + ) + ) + ); +} + /***/ }) /******/ ]); \ No newline at end of file diff --git a/dist/middleware.min.js b/dist/middleware.min.js index caf79a9..77922a7 100644 --- a/dist/middleware.min.js +++ b/dist/middleware.min.js @@ -1 +1 @@ -!function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=57)}([function(e,t,n){"use strict";t.__esModule=!0;var r=n(65),i=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=i.default||function(e){for(var t=1;t=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t,n){var r=n(32)("keys"),i=n(24);e.exports=function(e){return r[e]||(r[e]=i(e))}},function(e,t,n){var r=n(2),i=n(4),o=i["__core-js_shared__"]||(i["__core-js_shared__"]={});(e.exports=function(e,t){return o[e]||(o[e]=void 0!==t?t:{})})("versions",[]).push({version:r.version,mode:n(23)?"pure":"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){var r=n(64);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){var r=n(12);e.exports=function(e,t){if(!r(e))return e;var n,i;if(t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;if("function"==typeof(n=e.valueOf)&&!r(i=n.call(e)))return i;if(!t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,n){var r=n(8),i=n(80),o=n(33),a=n(31)("IE_PROTO"),l=function(){},u=function(){var e,t=n(47)("iframe"),r=o.length;for(t.style.display="none",n(81).appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write("