diff --git a/client/dist/js/bundle.js b/client/dist/js/bundle.js index ea631477..0910645e 100644 --- a/client/dist/js/bundle.js +++ b/client/dist/js/bundle.js @@ -1,1503 +1 @@ -/******/ (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; -/******/ -/******/ // identity function for calling harmony imports with the correct context -/******/ __webpack_require__.i = function(value) { return value; }; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { -/******/ configurable: false, -/******/ enumerable: true, -/******/ get: getter -/******/ }); -/******/ } -/******/ }; -/******/ -/******/ // 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 = 12); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports) { - -module.exports = Injector; - -/***/ }), -/* 1 */ -/***/ (function(module, exports) { - -module.exports = React; - -/***/ }), -/* 2 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * - */ - -function makeEmptyFunction(arg) { - return function () { - return arg; - }; -} - -/** - * This function accepts and discards inputs; it has no side effects. This is - * primarily useful idiomatically for overridable function endpoints which - * always need to be callable, since JS lacks a null-call idiom ala Cocoa. - */ -var emptyFunction = function emptyFunction() {}; - -emptyFunction.thatReturns = makeEmptyFunction; -emptyFunction.thatReturnsFalse = makeEmptyFunction(false); -emptyFunction.thatReturnsTrue = makeEmptyFunction(true); -emptyFunction.thatReturnsNull = makeEmptyFunction(null); -emptyFunction.thatReturnsThis = function () { - return this; -}; -emptyFunction.thatReturnsArgument = function (arg) { - return arg; -}; - -module.exports = emptyFunction; - -/***/ }), -/* 3 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ - - - -/** - * Use invariant() to assert state which your program assumes to be true. - * - * Provide sprintf-style format (only %s is supported) and arguments - * to provide information about what broke and what you were - * expecting. - * - * The invariant message will be stripped in production, but the invariant - * will remain to ensure logic does not differ in production. - */ - -var validateFormat = function validateFormat(format) {}; - -if (true) { - validateFormat = function validateFormat(format) { - if (format === undefined) { - throw new Error('invariant requires an error message argument'); - } - }; -} - -function invariant(condition, format, a, b, c, d, e, f) { - validateFormat(format); - - if (!condition) { - var error; - if (format === undefined) { - error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); - } else { - var args = [a, b, c, d, e, f]; - var argIndex = 0; - error = new Error(format.replace(/%s/g, function () { - return args[argIndex++]; - })); - error.name = 'Invariant Violation'; - } - - error.framesToPop = 1; // we don't care about invariant's own frame - throw error; - } -} - -module.exports = invariant; - -/***/ }), -/* 4 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (c) 2014-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ - - - -var emptyFunction = __webpack_require__(2); - -/** - * Similar to invariant but only logs a warning if the condition is not met. - * This can be used to log issues in development environments in critical - * paths. Removing the logging code for production environments will keep the - * same logic and follow the same code paths. - */ - -var warning = emptyFunction; - -if (true) { - var printWarning = function printWarning(format) { - for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } - - var argIndex = 0; - var message = 'Warning: ' + format.replace(/%s/g, function () { - return args[argIndex++]; - }); - if (typeof console !== 'undefined') { - console.error(message); - } - try { - // --- Welcome to debugging React --- - // This error was thrown as a convenience so that you can use this stack - // to find the callsite that caused this warning to fire. - throw new Error(message); - } catch (x) {} - }; - - warning = function warning(condition, format) { - if (format === undefined) { - throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); - } - - if (format.indexOf('Failed Composite propType: ') === 0) { - return; // Ignore CompositeComponent proptype check. - } - - if (!condition) { - for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { - args[_key2 - 2] = arguments[_key2]; - } - - printWarning.apply(undefined, [format].concat(args)); - } - }; -} - -module.exports = warning; - -/***/ }), -/* 5 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - - - -var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; - -module.exports = ReactPropTypesSecret; - - -/***/ }), -/* 6 */ -/***/ (function(module, exports) { - -module.exports = GraphQLTag; - -/***/ }), -/* 7 */ -/***/ (function(module, exports) { - -module.exports = ReactApollo; - -/***/ }), -/* 8 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var _registerComponents = __webpack_require__(10); - -var _registerComponents2 = _interopRequireDefault(_registerComponents); - -var _registerTransforms = __webpack_require__(11); - -var _registerTransforms2 = _interopRequireDefault(_registerTransforms); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -window.document.addEventListener('DOMContentLoaded', function () { - (0, _registerComponents2.default)(); - (0, _registerTransforms2.default)(); -}); - -/***/ }), -/* 9 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var _jquery = __webpack_require__(24); - -var _jquery2 = _interopRequireDefault(_jquery); - -var _react = __webpack_require__(1); - -var _react2 = _interopRequireDefault(_react); - -var _reactDom = __webpack_require__(21); - -var _reactDom2 = _interopRequireDefault(_reactDom); - -var _Injector = __webpack_require__(0); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -_jquery2.default.entwine('ss', function ($) { - $('.js-injector-boot .element-editor__container').entwine({ - onmatch: function onmatch() { - var context = {}; - var ElementEditorComponent = (0, _Injector.loadComponent)('ElementEditor', context); - - _reactDom2.default.render(_react2.default.createElement(ElementEditorComponent, null), this[0]); - }, - onunmatch: function onunmatch() { - _reactDom2.default.unmountComponentAtNode(this[0]); - } - }); -}); - -/***/ }), -/* 10 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _Injector = __webpack_require__(0); - -var _Injector2 = _interopRequireDefault(_Injector); - -var _ElementEditor = __webpack_require__(13); - -var _ElementEditor2 = _interopRequireDefault(_ElementEditor); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -exports.default = function () { - _Injector2.default.component.registerMany({ - ElementEditor: _ElementEditor2.default - }); -}; - -/***/ }), -/* 11 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _Injector = __webpack_require__(0); - -var _Injector2 = _interopRequireDefault(_Injector); - -var _readOneBlockQuery = __webpack_require__(15); - -var _readOneBlockQuery2 = _interopRequireDefault(_readOneBlockQuery); - -var _HistoricElementView = __webpack_require__(14); - -var _HistoricElementView2 = _interopRequireDefault(_HistoricElementView); - -var _revertToBlockVersionMutation = __webpack_require__(16); - -var _revertToBlockVersionMutation2 = _interopRequireDefault(_revertToBlockVersionMutation); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -exports.default = function () { - _Injector2.default.transform('elemental-fieldgroup', function (updater) { - updater.component('FieldGroup.HistoryViewer.VersionDetail', _HistoricElementView2.default, 'HistoricElement'); - }, { - after: 'field-holders' - }); - - _Injector2.default.transform('elements-history', function (updater) { - updater.component('HistoryViewer.Form_ItemEditForm', _readOneBlockQuery2.default, 'ElementHistoryViewer'); - }); - - _Injector2.default.transform('blocks-history-revert', function (updater) { - updater.component('HistoryViewerToolbar.VersionedAdmin.HistoryViewer.Element.HistoryViewerVersionDetail', _revertToBlockVersionMutation2.default, 'BlockRevertMutation'); - }); -}; - -/***/ }), -/* 12 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -__webpack_require__(9); -__webpack_require__(8); - -/***/ }), -/* 13 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -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; }; }(); - -var _react = __webpack_require__(1); - -var _react2 = _interopRequireDefault(_react); - -var _propTypes = __webpack_require__(20); - -var _propTypes2 = _interopRequireDefault(_propTypes); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -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; } - -var ElementEditor = function (_PureComponent) { - _inherits(ElementEditor, _PureComponent); - - function ElementEditor() { - _classCallCheck(this, ElementEditor); - - return _possibleConstructorReturn(this, (ElementEditor.__proto__ || Object.getPrototypeOf(ElementEditor)).apply(this, arguments)); - } - - _createClass(ElementEditor, [{ - key: 'render', - value: function render() { - return _react2.default.createElement('div', null); - } - }]); - - return ElementEditor; -}(_react.PureComponent); - -ElementEditor.defaultProps = {}; -ElementEditor.propTypes = {}; - -exports.default = ElementEditor; - -/***/ }), -/* 14 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -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; }; }(); - -var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - -var _react = __webpack_require__(1); - -var _react2 = _interopRequireDefault(_react); - -var _i18n = __webpack_require__(23); - -var _i18n2 = _interopRequireDefault(_i18n); - -var _classnames = __webpack_require__(22); - -var _classnames2 = _interopRequireDefault(_classnames); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -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; } - -var ElementalAreaHistoryFactory = function ElementalAreaHistoryFactory(FieldGroup) { - return function (_FieldGroup) { - _inherits(HistoricElementView, _FieldGroup); - - function HistoricElementView() { - _classCallCheck(this, HistoricElementView); - - return _possibleConstructorReturn(this, (HistoricElementView.__proto__ || Object.getPrototypeOf(HistoricElementView)).apply(this, arguments)); - } - - _createClass(HistoricElementView, [{ - key: 'getClassName', - value: function getClassName() { - var classlist = [_get(HistoricElementView.prototype.__proto__ || Object.getPrototypeOf(HistoricElementView.prototype), 'getClassName', this).call(this)]; - if (this.props.data.ElementID) { - classlist.unshift('elemental-area__element--historic-inner'); - } - return (0, _classnames2.default)(classlist); - } - }, { - key: 'render', - value: function render() { - var legend = this.getLegend(); - var Tag = this.props.data.tag || 'div'; - var classNames = this.getClassName(); - var data = this.props.data; - - - if (!data.ElementID) { - return _get(HistoricElementView.prototype.__proto__ || Object.getPrototypeOf(HistoricElementView.prototype), 'render', this).call(this); - } - - return _react2.default.createElement( - Tag, - { className: classNames }, - legend, - _react2.default.createElement( - 'div', - { className: 'elemental-preview elemental-preview--historic' }, - data.ElementEditLink && _react2.default.createElement( - 'a', - { className: 'elemental-preview__link', href: data.ElementEditLink }, - _i18n2.default._t('HistoricElementView.BLOCK_HISTORY', 'View block'), - _react2.default.createElement('i', { className: 'font-icon-angle-right' }) - ), - _react2.default.createElement( - 'div', - { className: 'elemental-preview__icon' }, - _react2.default.createElement('i', { className: data.ElementIcon }) - ), - _react2.default.createElement( - 'div', - { className: 'elemental-preview__detail' }, - _react2.default.createElement( - 'h3', - null, - data.ElementTitle, - ' ', - _react2.default.createElement( - 'small', - null, - data.ElementType - ) - ) - ) - ), - this.props.children - ); - } - }]); - - return HistoricElementView; - }(FieldGroup); -}; - -exports.default = ElementalAreaHistoryFactory; - -/***/ }), -/* 15 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.config = exports.query = undefined; - -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 _templateObject = _taggedTemplateLiteral(['\nquery ReadHistoryViewerBlock ($block_id: ID!, $limit: Int!, $offset: Int!) {\n readOneBlock(\n Versioning: {\n Mode: LATEST\n },\n ID: $block_id\n ) {\n ID\n Versions (limit: $limit, offset: $offset) {\n pageInfo {\n totalCount\n }\n edges {\n node {\n Version\n AbsoluteLink\n Author {\n FirstName\n Surname\n }\n Publisher {\n FirstName\n Surname\n }\n Published\n LiveVersion\n LastEdited\n }\n }\n }\n }\n}\n'], ['\nquery ReadHistoryViewerBlock ($block_id: ID!, $limit: Int!, $offset: Int!) {\n readOneBlock(\n Versioning: {\n Mode: LATEST\n },\n ID: $block_id\n ) {\n ID\n Versions (limit: $limit, offset: $offset) {\n pageInfo {\n totalCount\n }\n edges {\n node {\n Version\n AbsoluteLink\n Author {\n FirstName\n Surname\n }\n Publisher {\n FirstName\n Surname\n }\n Published\n LiveVersion\n LastEdited\n }\n }\n }\n }\n}\n']); - -var _reactApollo = __webpack_require__(7); - -var _graphqlTag = __webpack_require__(6); - -var _graphqlTag2 = _interopRequireDefault(_graphqlTag); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } - -var query = (0, _graphqlTag2.default)(_templateObject); - -var config = { - options: function options(_ref) { - var recordId = _ref.recordId, - limit = _ref.limit, - page = _ref.page; - - return { - variables: { - limit: limit, - offset: ((page || 1) - 1) * limit, - block_id: recordId - } - }; - }, - props: function props(_ref2) { - var _ref2$data = _ref2.data, - error = _ref2$data.error, - refetch = _ref2$data.refetch, - readOneBlock = _ref2$data.readOneBlock, - networkLoading = _ref2$data.loading, - _ref2$ownProps = _ref2.ownProps, - _ref2$ownProps$action = _ref2$ownProps.actions, - actions = _ref2$ownProps$action === undefined ? { - versions: {} - } : _ref2$ownProps$action, - limit = _ref2$ownProps.limit, - recordId = _ref2$ownProps.recordId; - - var versions = readOneBlock || null; - - var errors = error && error.graphQLErrors && error.graphQLErrors.map(function (graphQLError) { - return graphQLError.message; - }); - - return { - loading: networkLoading || !versions, - versions: versions, - graphQLErrors: errors, - actions: _extends({}, actions, { - versions: _extends({}, versions, { - goToPage: function goToPage(page) { - refetch({ - offset: ((page || 1) - 1) * limit, - limit: limit, - block_id: recordId - }); - } - }) - }) - }; - } -}; - -exports.query = query; -exports.config = config; -exports.default = (0, _reactApollo.graphql)(query, config); - -/***/ }), -/* 16 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.config = exports.mutation = undefined; - -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 _templateObject = _taggedTemplateLiteral(['\nmutation revertBlockToVersion($id:ID!, $fromStage:VersionedStage!, $toStage:VersionedStage!, $fromVersion:Int!) {\n copyBlockToStage(Input: {\n ID: $id\n FromVersion: $fromVersion\n FromStage: $fromStage\n ToStage: $toStage\n }) {\n ID\n }\n}\n'], ['\nmutation revertBlockToVersion($id:ID!, $fromStage:VersionedStage!, $toStage:VersionedStage!, $fromVersion:Int!) {\n copyBlockToStage(Input: {\n ID: $id\n FromVersion: $fromVersion\n FromStage: $fromStage\n ToStage: $toStage\n }) {\n ID\n }\n}\n']); - -var _reactApollo = __webpack_require__(7); - -var _graphqlTag = __webpack_require__(6); - -var _graphqlTag2 = _interopRequireDefault(_graphqlTag); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } - -var mutation = (0, _graphqlTag2.default)(_templateObject); - -var config = { - props: function props(_ref) { - var mutate = _ref.mutate, - actions = _ref.ownProps.actions; - - var revertToVersion = function revertToVersion(id, fromVersion, fromStage, toStage) { - return mutate({ - variables: { - id: id, - fromVersion: fromVersion, - fromStage: fromStage, - toStage: toStage - } - }); - }; - - return { - actions: _extends({}, actions, { - revertToVersion: revertToVersion - }) - }; - }, - options: { - refetchQueries: ['ReadHistoryViewerBlock'] - } -}; - -exports.mutation = mutation; -exports.config = config; -exports.default = (0, _reactApollo.graphql)(mutation, config); - -/***/ }), -/* 17 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* -object-assign -(c) Sindre Sorhus -@license MIT -*/ - - -/* eslint-disable no-unused-vars */ -var getOwnPropertySymbols = Object.getOwnPropertySymbols; -var hasOwnProperty = Object.prototype.hasOwnProperty; -var propIsEnumerable = Object.prototype.propertyIsEnumerable; - -function toObject(val) { - if (val === null || val === undefined) { - throw new TypeError('Object.assign cannot be called with null or undefined'); - } - - return Object(val); -} - -function shouldUseNative() { - try { - if (!Object.assign) { - return false; - } - - // Detect buggy property enumeration order in older V8 versions. - - // https://bugs.chromium.org/p/v8/issues/detail?id=4118 - var test1 = new String('abc'); // eslint-disable-line no-new-wrappers - test1[5] = 'de'; - if (Object.getOwnPropertyNames(test1)[0] === '5') { - return false; - } - - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test2 = {}; - for (var i = 0; i < 10; i++) { - test2['_' + String.fromCharCode(i)] = i; - } - var order2 = Object.getOwnPropertyNames(test2).map(function (n) { - return test2[n]; - }); - if (order2.join('') !== '0123456789') { - return false; - } - - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test3 = {}; - 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { - test3[letter] = letter; - }); - if (Object.keys(Object.assign({}, test3)).join('') !== - 'abcdefghijklmnopqrst') { - return false; - } - - return true; - } catch (err) { - // We don't expect any of the above to throw, but better to be safe. - return false; - } -} - -module.exports = shouldUseNative() ? Object.assign : function (target, source) { - var from; - var to = toObject(target); - var symbols; - - for (var s = 1; s < arguments.length; s++) { - from = Object(arguments[s]); - - for (var key in from) { - if (hasOwnProperty.call(from, key)) { - to[key] = from[key]; - } - } - - if (getOwnPropertySymbols) { - symbols = getOwnPropertySymbols(from); - for (var i = 0; i < symbols.length; i++) { - if (propIsEnumerable.call(from, symbols[i])) { - to[symbols[i]] = from[symbols[i]]; - } - } - } - } - - return to; -}; - - -/***/ }), -/* 18 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - - - -if (true) { - var invariant = __webpack_require__(3); - var warning = __webpack_require__(4); - var ReactPropTypesSecret = __webpack_require__(5); - var loggedTypeFailures = {}; -} - -/** - * Assert that the values match with the type specs. - * Error messages are memorized and will only be shown once. - * - * @param {object} typeSpecs Map of name to a ReactPropType - * @param {object} values Runtime values that need to be type-checked - * @param {string} location e.g. "prop", "context", "child context" - * @param {string} componentName Name of the component for error messages. - * @param {?Function} getStack Returns the component stack. - * @private - */ -function checkPropTypes(typeSpecs, values, location, componentName, getStack) { - if (true) { - for (var typeSpecName in typeSpecs) { - if (typeSpecs.hasOwnProperty(typeSpecName)) { - var error; - // Prop type validation may throw. In case they do, we don't want to - // fail the render phase where it didn't fail before. So we log it. - // After these have been cleaned up, we'll let them throw. - try { - // This is intentionally an invariant that gets caught. It's the same - // behavior as without this statement except with a better message. - invariant(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'the `prop-types` package, but received `%s`.', componentName || 'React class', location, typeSpecName, typeof typeSpecs[typeSpecName]); - error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); - } catch (ex) { - error = ex; - } - warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error); - if (error instanceof Error && !(error.message in loggedTypeFailures)) { - // Only monitor this failure once because there tends to be a lot of the - // same error. - loggedTypeFailures[error.message] = true; - - var stack = getStack ? getStack() : ''; - - warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : ''); - } - } - } - } -} - -module.exports = checkPropTypes; - - -/***/ }), -/* 19 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - - - -var emptyFunction = __webpack_require__(2); -var invariant = __webpack_require__(3); -var warning = __webpack_require__(4); -var assign = __webpack_require__(17); - -var ReactPropTypesSecret = __webpack_require__(5); -var checkPropTypes = __webpack_require__(18); - -module.exports = function(isValidElement, throwOnDirectAccess) { - /* global Symbol */ - var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; - var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. - - /** - * Returns the iterator method function contained on the iterable object. - * - * Be sure to invoke the function with the iterable as context: - * - * var iteratorFn = getIteratorFn(myIterable); - * if (iteratorFn) { - * var iterator = iteratorFn.call(myIterable); - * ... - * } - * - * @param {?object} maybeIterable - * @return {?function} - */ - function getIteratorFn(maybeIterable) { - var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); - if (typeof iteratorFn === 'function') { - return iteratorFn; - } - } - - /** - * Collection of methods that allow declaration and validation of props that are - * supplied to React components. Example usage: - * - * var Props = require('ReactPropTypes'); - * var MyArticle = React.createClass({ - * propTypes: { - * // An optional string prop named "description". - * description: Props.string, - * - * // A required enum prop named "category". - * category: Props.oneOf(['News','Photos']).isRequired, - * - * // A prop named "dialog" that requires an instance of Dialog. - * dialog: Props.instanceOf(Dialog).isRequired - * }, - * render: function() { ... } - * }); - * - * A more formal specification of how these methods are used: - * - * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) - * decl := ReactPropTypes.{type}(.isRequired)? - * - * Each and every declaration produces a function with the same signature. This - * allows the creation of custom validation functions. For example: - * - * var MyLink = React.createClass({ - * propTypes: { - * // An optional string or URI prop named "href". - * href: function(props, propName, componentName) { - * var propValue = props[propName]; - * if (propValue != null && typeof propValue !== 'string' && - * !(propValue instanceof URI)) { - * return new Error( - * 'Expected a string or an URI for ' + propName + ' in ' + - * componentName - * ); - * } - * } - * }, - * render: function() {...} - * }); - * - * @internal - */ - - var ANONYMOUS = '<>'; - - // Important! - // Keep this list in sync with production version in `./factoryWithThrowingShims.js`. - var ReactPropTypes = { - array: createPrimitiveTypeChecker('array'), - bool: createPrimitiveTypeChecker('boolean'), - func: createPrimitiveTypeChecker('function'), - number: createPrimitiveTypeChecker('number'), - object: createPrimitiveTypeChecker('object'), - string: createPrimitiveTypeChecker('string'), - symbol: createPrimitiveTypeChecker('symbol'), - - any: createAnyTypeChecker(), - arrayOf: createArrayOfTypeChecker, - element: createElementTypeChecker(), - instanceOf: createInstanceTypeChecker, - node: createNodeChecker(), - objectOf: createObjectOfTypeChecker, - oneOf: createEnumTypeChecker, - oneOfType: createUnionTypeChecker, - shape: createShapeTypeChecker, - exact: createStrictShapeTypeChecker, - }; - - /** - * inlined Object.is polyfill to avoid requiring consumers ship their own - * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is - */ - /*eslint-disable no-self-compare*/ - function is(x, y) { - // SameValue algorithm - if (x === y) { - // Steps 1-5, 7-10 - // Steps 6.b-6.e: +0 != -0 - return x !== 0 || 1 / x === 1 / y; - } else { - // Step 6.a: NaN == NaN - return x !== x && y !== y; - } - } - /*eslint-enable no-self-compare*/ - - /** - * We use an Error-like object for backward compatibility as people may call - * PropTypes directly and inspect their output. However, we don't use real - * Errors anymore. We don't inspect their stack anyway, and creating them - * is prohibitively expensive if they are created too often, such as what - * happens in oneOfType() for any type before the one that matched. - */ - function PropTypeError(message) { - this.message = message; - this.stack = ''; - } - // Make `instanceof Error` still work for returned errors. - PropTypeError.prototype = Error.prototype; - - function createChainableTypeChecker(validate) { - if (true) { - var manualPropTypeCallCache = {}; - var manualPropTypeWarningCount = 0; - } - function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { - componentName = componentName || ANONYMOUS; - propFullName = propFullName || propName; - - if (secret !== ReactPropTypesSecret) { - if (throwOnDirectAccess) { - // New behavior only for users of `prop-types` package - invariant( - false, - 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + - 'Use `PropTypes.checkPropTypes()` to call them. ' + - 'Read more at http://fb.me/use-check-prop-types' - ); - } else if ("development" !== 'production' && typeof console !== 'undefined') { - // Old behavior for people using React.PropTypes - var cacheKey = componentName + ':' + propName; - if ( - !manualPropTypeCallCache[cacheKey] && - // Avoid spamming the console because they are often not actionable except for lib authors - manualPropTypeWarningCount < 3 - ) { - warning( - false, - 'You are manually calling a React.PropTypes validation ' + - 'function for the `%s` prop on `%s`. This is deprecated ' + - 'and will throw in the standalone `prop-types` package. ' + - 'You may be seeing this warning due to a third-party PropTypes ' + - 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.', - propFullName, - componentName - ); - manualPropTypeCallCache[cacheKey] = true; - manualPropTypeWarningCount++; - } - } - } - if (props[propName] == null) { - if (isRequired) { - if (props[propName] === null) { - return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.')); - } - return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.')); - } - return null; - } else { - return validate(props, propName, componentName, location, propFullName); - } - } - - var chainedCheckType = checkType.bind(null, false); - chainedCheckType.isRequired = checkType.bind(null, true); - - return chainedCheckType; - } - - function createPrimitiveTypeChecker(expectedType) { - function validate(props, propName, componentName, location, propFullName, secret) { - var propValue = props[propName]; - var propType = getPropType(propValue); - if (propType !== expectedType) { - // `propValue` being instance of, say, date/regexp, pass the 'object' - // check, but we can offer a more precise error message here rather than - // 'of type `object`'. - var preciseType = getPreciseType(propValue); - - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); - } - return null; - } - return createChainableTypeChecker(validate); - } - - function createAnyTypeChecker() { - return createChainableTypeChecker(emptyFunction.thatReturnsNull); - } - - function createArrayOfTypeChecker(typeChecker) { - function validate(props, propName, componentName, location, propFullName) { - if (typeof typeChecker !== 'function') { - return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.'); - } - var propValue = props[propName]; - if (!Array.isArray(propValue)) { - var propType = getPropType(propValue); - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); - } - for (var i = 0; i < propValue.length; i++) { - var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret); - if (error instanceof Error) { - return error; - } - } - return null; - } - return createChainableTypeChecker(validate); - } - - function createElementTypeChecker() { - function validate(props, propName, componentName, location, propFullName) { - var propValue = props[propName]; - if (!isValidElement(propValue)) { - var propType = getPropType(propValue); - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.')); - } - return null; - } - return createChainableTypeChecker(validate); - } - - function createInstanceTypeChecker(expectedClass) { - function validate(props, propName, componentName, location, propFullName) { - if (!(props[propName] instanceof expectedClass)) { - var expectedClassName = expectedClass.name || ANONYMOUS; - var actualClassName = getClassName(props[propName]); - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); - } - return null; - } - return createChainableTypeChecker(validate); - } - - function createEnumTypeChecker(expectedValues) { - if (!Array.isArray(expectedValues)) { - true ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0; - return emptyFunction.thatReturnsNull; - } - - function validate(props, propName, componentName, location, propFullName) { - var propValue = props[propName]; - for (var i = 0; i < expectedValues.length; i++) { - if (is(propValue, expectedValues[i])) { - return null; - } - } - - var valuesString = JSON.stringify(expectedValues); - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); - } - return createChainableTypeChecker(validate); - } - - function createObjectOfTypeChecker(typeChecker) { - function validate(props, propName, componentName, location, propFullName) { - if (typeof typeChecker !== 'function') { - return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); - } - var propValue = props[propName]; - var propType = getPropType(propValue); - if (propType !== 'object') { - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); - } - for (var key in propValue) { - if (propValue.hasOwnProperty(key)) { - var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); - if (error instanceof Error) { - return error; - } - } - } - return null; - } - return createChainableTypeChecker(validate); - } - - function createUnionTypeChecker(arrayOfTypeCheckers) { - if (!Array.isArray(arrayOfTypeCheckers)) { - true ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; - return emptyFunction.thatReturnsNull; - } - - for (var i = 0; i < arrayOfTypeCheckers.length; i++) { - var checker = arrayOfTypeCheckers[i]; - if (typeof checker !== 'function') { - warning( - false, - 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + - 'received %s at index %s.', - getPostfixForTypeWarning(checker), - i - ); - return emptyFunction.thatReturnsNull; - } - } - - function validate(props, propName, componentName, location, propFullName) { - for (var i = 0; i < arrayOfTypeCheckers.length; i++) { - var checker = arrayOfTypeCheckers[i]; - if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) { - return null; - } - } - - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); - } - return createChainableTypeChecker(validate); - } - - function createNodeChecker() { - function validate(props, propName, componentName, location, propFullName) { - if (!isNode(props[propName])) { - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); - } - return null; - } - return createChainableTypeChecker(validate); - } - - function createShapeTypeChecker(shapeTypes) { - function validate(props, propName, componentName, location, propFullName) { - var propValue = props[propName]; - var propType = getPropType(propValue); - if (propType !== 'object') { - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); - } - for (var key in shapeTypes) { - var checker = shapeTypes[key]; - if (!checker) { - continue; - } - var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); - if (error) { - return error; - } - } - return null; - } - return createChainableTypeChecker(validate); - } - - function createStrictShapeTypeChecker(shapeTypes) { - function validate(props, propName, componentName, location, propFullName) { - var propValue = props[propName]; - var propType = getPropType(propValue); - if (propType !== 'object') { - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); - } - // We need to check all keys in case some are required but missing from - // props. - var allKeys = assign({}, props[propName], shapeTypes); - for (var key in allKeys) { - var checker = shapeTypes[key]; - if (!checker) { - return new PropTypeError( - 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + - '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + - '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ') - ); - } - var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); - if (error) { - return error; - } - } - return null; - } - - return createChainableTypeChecker(validate); - } - - function isNode(propValue) { - switch (typeof propValue) { - case 'number': - case 'string': - case 'undefined': - return true; - case 'boolean': - return !propValue; - case 'object': - if (Array.isArray(propValue)) { - return propValue.every(isNode); - } - if (propValue === null || isValidElement(propValue)) { - return true; - } - - var iteratorFn = getIteratorFn(propValue); - if (iteratorFn) { - var iterator = iteratorFn.call(propValue); - var step; - if (iteratorFn !== propValue.entries) { - while (!(step = iterator.next()).done) { - if (!isNode(step.value)) { - return false; - } - } - } else { - // Iterator will provide entry [k,v] tuples rather than values. - while (!(step = iterator.next()).done) { - var entry = step.value; - if (entry) { - if (!isNode(entry[1])) { - return false; - } - } - } - } - } else { - return false; - } - - return true; - default: - return false; - } - } - - function isSymbol(propType, propValue) { - // Native Symbol. - if (propType === 'symbol') { - return true; - } - - // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' - if (propValue['@@toStringTag'] === 'Symbol') { - return true; - } - - // Fallback for non-spec compliant Symbols which are polyfilled. - if (typeof Symbol === 'function' && propValue instanceof Symbol) { - return true; - } - - return false; - } - - // Equivalent of `typeof` but with special handling for array and regexp. - function getPropType(propValue) { - var propType = typeof propValue; - if (Array.isArray(propValue)) { - return 'array'; - } - if (propValue instanceof RegExp) { - // Old webkits (at least until Android 4.0) return 'function' rather than - // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ - // passes PropTypes.object. - return 'object'; - } - if (isSymbol(propType, propValue)) { - return 'symbol'; - } - return propType; - } - - // This handles more types than `getPropType`. Only used for error messages. - // See `createPrimitiveTypeChecker`. - function getPreciseType(propValue) { - if (typeof propValue === 'undefined' || propValue === null) { - return '' + propValue; - } - var propType = getPropType(propValue); - if (propType === 'object') { - if (propValue instanceof Date) { - return 'date'; - } else if (propValue instanceof RegExp) { - return 'regexp'; - } - } - return propType; - } - - // Returns a string that is postfixed to a warning about an invalid type. - // For example, "undefined" or "of type array" - function getPostfixForTypeWarning(value) { - var type = getPreciseType(value); - switch (type) { - case 'array': - case 'object': - return 'an ' + type; - case 'boolean': - case 'date': - case 'regexp': - return 'a ' + type; - default: - return type; - } - } - - // Returns class name of the object, if any. - function getClassName(propValue) { - if (!propValue.constructor || !propValue.constructor.name) { - return ANONYMOUS; - } - return propValue.constructor.name; - } - - ReactPropTypes.checkPropTypes = checkPropTypes; - ReactPropTypes.PropTypes = ReactPropTypes; - - return ReactPropTypes; -}; - - -/***/ }), -/* 20 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -if (true) { - var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' && - Symbol.for && - Symbol.for('react.element')) || - 0xeac7; - - var isValidElement = function(object) { - return typeof object === 'object' && - object !== null && - object.$$typeof === REACT_ELEMENT_TYPE; - }; - - // By explicitly using `prop-types` you are opting into new development behavior. - // http://fb.me/prop-types-in-prod - var throwOnDirectAccess = true; - module.exports = __webpack_require__(19)(isValidElement, throwOnDirectAccess); -} else { - // By explicitly using `prop-types` you are opting into new production behavior. - // http://fb.me/prop-types-in-prod - module.exports = require('./factoryWithThrowingShims')(); -} - - -/***/ }), -/* 21 */ -/***/ (function(module, exports) { - -module.exports = ReactDom; - -/***/ }), -/* 22 */ -/***/ (function(module, exports) { - -module.exports = classnames; - -/***/ }), -/* 23 */ -/***/ (function(module, exports) { - -module.exports = i18n; - -/***/ }), -/* 24 */ -/***/ (function(module, exports) { - -module.exports = jQuery; - -/***/ }) -/******/ ]); -//# sourceMappingURL=bundle.js.map \ No newline at end of file +!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.i=function(e){return e},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=9)}([function(e,t){e.exports=React},function(e,t){e.exports=Injector},function(e,t){e.exports=GraphQLTag},function(e,t){e.exports=ReactApollo},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.elementType=void 0;var r=n(0),o={ID:r.PropTypes.number.isRequired,Title:r.PropTypes.string,Summary:r.PropTypes.string};t.elementType=o},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var o=n(7),i=r(o),a=n(8),u=r(a);window.document.addEventListener("DOMContentLoaded",function(){(0,i.default)(),(0,u.default)()})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var o=n(21),i=r(o),a=n(0),u=r(a),l=n(18),c=r(l),s=n(1);i.default.entwine("ss",function(e){e(".js-injector-boot .element-editor__container").entwine({onmatch:function(){var e={},t=(0,s.loadComponent)("ElementEditor",e),n=this.data("schema"),r={pageId:n["page-id"]};c.default.render(u.default.createElement(t,r),this[0])},onunmatch:function(){c.default.unmountComponentAtNode(this[0])}})})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),i=r(o),a=n(10),u=r(a),l=n(11),c=r(l),s=n(12),f=r(s),p=n(13),d=r(p);t.default=function(){i.default.component.registerMany({ElementEditor:c.default,ElementToolbar:d.default,ElementList:f.default,Element:u.default})}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),i=r(o),a=n(16),u=r(a),l=n(14),c=r(l),s=n(17),f=r(s),p=n(15),d=r(p);t.default=function(){i.default.transform("elemental-fieldgroup",function(e){e.component("FieldGroup.HistoryViewer.VersionDetail",c.default,"HistoricElement")},{after:"field-holders"}),i.default.transform("elements-history",function(e){e.component("HistoryViewer.Form_ItemEditForm",u.default,"ElementHistoryViewer")}),i.default.transform("blocks-history-revert",function(e){e.component("HistoryViewerToolbar.VersionedAdmin.HistoryViewer.Element.HistoryViewerVersionDetail",f.default,"BlockRevertMutation")}),i.default.transform("cms-element-editor",function(e){e.component("ElementList",d.default,"PageElements")})}},function(e,t,n){"use strict";n(6),n(5)},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n { Injector.component.registerMany({ - ElementEditor + ElementEditor, + ElementToolbar: Toolbar, + ElementList, + Element, }); }; diff --git a/client/src/boot/registerTransforms.js b/client/src/boot/registerTransforms.js index 4e2a2fbc..ea2b450a 100644 --- a/client/src/boot/registerTransforms.js +++ b/client/src/boot/registerTransforms.js @@ -1,7 +1,8 @@ import Injector from 'lib/Injector'; -import readOneBlockQuery from '../state/history/readOneBlockQuery'; -import HistoricElementViewFactory from '../components/HistoricElementView/HistoricElementView'; -import revertToBlockVersionMutation from '../state/history/revertToBlockVersionMutation'; +import readOneBlockQuery from 'state/history/readOneBlockQuery'; +import HistoricElementViewFactory from 'components/HistoricElementView/HistoricElementView'; +import revertToBlockVersionMutation from 'state/history/revertToBlockVersionMutation'; +import readBlocksForPageQuery from 'state/editor/readBlocksForPageQuery'; export default () => { Injector.transform( @@ -41,4 +42,16 @@ export default () => { ); } ); + + Injector.transform( + 'cms-element-editor', + (updater) => { + // Add GraphQL query for reading elements on a page for the ElementEditor + updater.component( + 'ElementList', + readBlocksForPageQuery, + 'PageElements' + ); + } + ); }; diff --git a/client/src/components/ElementEditor/Element.js b/client/src/components/ElementEditor/Element.js index eeec92e1..a8e759a3 100644 --- a/client/src/components/ElementEditor/Element.js +++ b/client/src/components/ElementEditor/Element.js @@ -1,14 +1,33 @@ -import React, { Component, PropTypes } from 'react'; +import React, { PureComponent } from 'react'; +import { elementType } from 'types/elementType'; -class Element extends Component { +/** + * The Element component used in the context of an ElementEditor shows the summary + * of an element's details when used in the CMS, including ID, Title and Summary. + */ +class Element extends PureComponent { render() { + const { element: { ID, Title, Summary } } = this.props; + + if (!ID) { + return null; + } + return ( -
+
+

#{ID}: {Title}

+

{Summary}

+
); } } -Element.defaultProps = {}; -Element.propTypes = {}; +Element.propTypes = { + element: elementType, +}; + +Element.defaultProps = { + element: null, +}; export default Element; diff --git a/client/src/components/ElementEditor/ElementEditor.js b/client/src/components/ElementEditor/ElementEditor.js index fba098c6..149aba5e 100644 --- a/client/src/components/ElementEditor/ElementEditor.js +++ b/client/src/components/ElementEditor/ElementEditor.js @@ -1,14 +1,34 @@ -import React, { Component, PropTypes } from 'react'; +import React, { PureComponent, PropTypes } from 'react'; +import { inject } from 'lib/Injector'; -class ElementEditor extends Component { +/** + * The ElementEditor is used in the CMS to manage a list or nested lists of + * elements for a page or other DataObject. + */ +class ElementEditor extends PureComponent { render() { + const { ToolbarComponent, ListComponent, pageId } = this.props; + return ( -
+
+ + +
); } } +ElementEditor.propTypes = { + pageId: PropTypes.number.isRequired, +}; + ElementEditor.defaultProps = {}; -ElementEditor.propTypes = {}; -export default ElementEditor; +export default inject( + ['ElementToolbar', 'ElementList'], + (ToolbarComponent, ListComponent) => ({ + ToolbarComponent, + ListComponent, + }), + () => 'ElementEditor' +)(ElementEditor); diff --git a/client/src/components/ElementEditor/ElementList.js b/client/src/components/ElementEditor/ElementList.js index 7b059190..5b8b0eaa 100644 --- a/client/src/components/ElementEditor/ElementList.js +++ b/client/src/components/ElementEditor/ElementList.js @@ -1,14 +1,50 @@ import React, { Component, PropTypes } from 'react'; +import { elementType } from 'types/elementType'; +import { inject } from 'lib/Injector'; class ElementList extends Component { + /** + * Renders a list of Element components, each with an elementType object + * of data mapped into it. The data is provided by a GraphQL HOC registered + * in registerTransforms.js. + */ + renderBlocks() { + const { ElementComponent, blocks } = this.props; + + if (!blocks) { + return null; + } + + return blocks.map((element) => ( + + )); + } + render() { return ( -
+
+ {this.renderBlocks()} +
); } } -ElementList.defaultProps = {}; -ElementList.propTypes = {}; +ElementList.propTypes = { + // @todo support either ElementList or Element children in an array (or both) + blocks: PropTypes.arrayOf(elementType), +}; + +ElementList.defaultProps = { + blocks: [], +}; -export default ElementList; +export default inject( + ['Element'], + (ElementComponent) => ({ + ElementComponent, + }), + () => 'ElementEditor.ElementList' +)(ElementList); diff --git a/client/src/components/ElementEditor/Toolbar.js b/client/src/components/ElementEditor/Toolbar.js index 52b9e48c..5797a8e4 100644 --- a/client/src/components/ElementEditor/Toolbar.js +++ b/client/src/components/ElementEditor/Toolbar.js @@ -1,6 +1,7 @@ -import React, { Component, PropTypes } from 'react'; +import React, { PureComponent } from 'react'; -class Toolbar extends Component { +// eslint-disable-next-line react/prefer-stateless-function +class Toolbar extends PureComponent { render() { return (
diff --git a/client/src/legacy/ElementEditor/entwine.js b/client/src/legacy/ElementEditor/entwine.js index 076c72e6..638fee64 100644 --- a/client/src/legacy/ElementEditor/entwine.js +++ b/client/src/legacy/ElementEditor/entwine.js @@ -12,9 +12,14 @@ jQuery.entwine('ss', ($) => { onmatch() { const context = {}; const ElementEditorComponent = loadComponent('ElementEditor', context); + const schemaData = this.data('schema'); + + const props = { + pageId: schemaData['page-id'], + }; ReactDOM.render( - , + , this[0] ); }, diff --git a/client/src/state/editor/readBlocksForPageQuery.js b/client/src/state/editor/readBlocksForPageQuery.js index 07b76d34..04cd2995 100644 --- a/client/src/state/editor/readBlocksForPageQuery.js +++ b/client/src/state/editor/readBlocksForPageQuery.js @@ -5,7 +5,7 @@ import gql from 'graphql-tag'; // ElementalArea. The results of the query must be set to the "blocks" prop on // the component that this HOC is applied to for binding implementation. const query = gql` -query readBlocksForPage($id:ID!) { +query ReadBlocksForPage($id:ID!) { readOnePage(ID: $id, Versioning: { Mode: LATEST }){ @@ -40,12 +40,16 @@ const config = { { data: { error, - readBlocksForPage, + readOnePage, loading: networkLoading, }, } ) { - const blocks = readBlocksForPage || null; + let blocks = null; + if (readOnePage) { + // Remove the GraphQL pagination keys + blocks = readOnePage.ElementalArea.Elements.edges.map((element) => element.node); + } const errors = error && error.graphQLErrors && error.graphQLErrors.map((graphQLError) => graphQLError.message); diff --git a/client/src/types/elementType.js b/client/src/types/elementType.js new file mode 100644 index 00000000..299e2567 --- /dev/null +++ b/client/src/types/elementType.js @@ -0,0 +1,10 @@ +import { PropTypes } from 'react'; + +// Describes the structure of an element coming in via GraphQL +const elementType = { + ID: PropTypes.number.isRequired, + Title: PropTypes.string, + Summary: PropTypes.string, +}; + +export { elementType }; diff --git a/src/ElementalEditor.php b/src/ElementalEditor.php index fee41691..d0d15d4d 100644 --- a/src/ElementalEditor.php +++ b/src/ElementalEditor.php @@ -61,4 +61,11 @@ public function getArea() { return $this->area; } + + public function getSchemaDataDefaults() + { + $schemaData = parent::getSchemaDataDefaults(); + $schemaData['page-id'] = $this->getArea()->getOwnerPage()->ID; + return $schemaData; + } } diff --git a/templates/DNADesign/Elemental/ElementalEditor.ss b/templates/DNADesign/Elemental/ElementalEditor.ss deleted file mode 100644 index c9df0c5d..00000000 --- a/templates/DNADesign/Elemental/ElementalEditor.ss +++ /dev/null @@ -1,3 +0,0 @@ -
- -
diff --git a/templates/DNADesign/Elemental/ElementalEditor_holder.ss b/templates/DNADesign/Elemental/ElementalEditor_holder.ss new file mode 100644 index 00000000..4b54e5c2 --- /dev/null +++ b/templates/DNADesign/Elemental/ElementalEditor_holder.ss @@ -0,0 +1,3 @@ +
+ <%-- Field is rendered by React components --%> +