diff --git a/_graphql/mutations.yml b/_graphql/mutations.yml index 48ecba4d..f2d44911 100644 --- a/_graphql/mutations.yml +++ b/_graphql/mutations.yml @@ -7,3 +7,6 @@ 'sortBlock(id: ID!, afterBlockID: ID!)': model: DNADesign\Elemental\Models\BaseElement description: Changes the sort position of an element +'moveBlock(id: ID!)': + model: DNADesign\Elemental\Models\BaseElement + description: Move an element to another page diff --git a/client/dist/js/bundle.js b/client/dist/js/bundle.js index 2591017d..0ebd992e 100644 --- a/client/dist/js/bundle.js +++ b/client/dist/js/bundle.js @@ -1 +1,4819 @@ -!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="./client/src/bundles/bundle.js")}({"./client/src/boot/index.js":function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var o=n("./client/src/boot/registerComponents.js"),a=r(o),i=n("./client/src/boot/registerTransforms.js"),l=r(i);window.document.addEventListener("DOMContentLoaded",function(){(0,a.default)(),(0,l.default)()})},"./client/src/boot/registerComponents.js":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(3),a=r(o),i=n("./client/src/components/ElementEditor/Element.js"),l=r(i),u=n("./client/src/components/ElementEditor/ElementActions.js"),c=r(u),s=n("./client/src/components/ElementEditor/ElementEditor.js"),d=r(s),f=n("./client/src/components/ElementEditor/ElementList.js"),p=r(f),m=n("./client/src/components/ElementEditor/Toolbar.js"),b=r(m),y=n("./client/src/components/ElementEditor/AddNewButton.js"),v=r(y),h=n("./client/src/components/ElementEditor/Header.js"),g=r(h),E=n("./client/src/components/ElementEditor/Content.js"),_=r(E),O=n("./client/src/components/ElementEditor/Summary.js"),j=r(O),T=n("./client/src/components/ElementEditor/InlineEditForm.js"),k=r(T),w=n("./client/src/components/ElementEditor/AddElementPopover.js"),I=r(w),S=n("./client/src/components/ElementEditor/HoverBar.js"),A=r(S),P=n("./client/src/components/ElementEditor/DragPositionIndicator.js"),D=r(P),C=n("./client/src/components/TextCheckboxGroupField/TextCheckboxGroupField.js"),N=r(C);t.default=function(){a.default.component.registerMany({ElementEditor:d.default,ElementToolbar:b.default,ElementAddNewButton:v.default,ElementList:p.default,Element:l.default,ElementActions:c.default,ElementHeader:g.default,ElementContent:_.default,ElementSummary:j.default,ElementInlineEditForm:k.default,AddElementPopover:I.default,HoverBar:A.default,DragPositionIndicator:D.default,TextCheckboxGroupField:N.default})}},"./client/src/boot/registerTransforms.js":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(3),a=r(o),i=n("./client/src/state/history/readOneBlockQuery.js"),l=r(i),u=n("./client/src/components/HistoricElementView/HistoricElementView.js"),c=r(u),s=n("./client/src/state/history/revertToBlockVersionMutation.js"),d=r(s),f=n("./client/src/state/editor/readBlocksForAreaQuery.js"),p=r(f),m=n("./client/src/state/editor/addElementMutation.js"),b=r(m),y=n("./client/src/components/ElementActions/ArchiveAction.js"),v=r(y),h=n("./client/src/components/ElementActions/DuplicateAction.js"),g=r(h),E=n("./client/src/components/ElementActions/PublishAction.js"),_=r(E),O=n("./client/src/components/ElementActions/SaveAction.js"),j=r(O),T=n("./client/src/components/ElementActions/UnpublishAction.js"),k=r(T);t.default=function(){a.default.transform("elemental-fieldgroup",function(e){e.component("FieldGroup.HistoryViewer.VersionDetail",c.default,"HistoricElement")},{after:"field-holders"}),a.default.transform("elements-history",function(e){e.component("HistoryViewer.Form_ItemEditForm",l.default,"ElementHistoryViewer")}),a.default.transform("blocks-history-revert",function(e){e.component("HistoryViewerToolbar.VersionedAdmin.HistoryViewer.Element.HistoryViewerVersionDetail",d.default,"BlockRevertMutation")}),a.default.transform("cms-element-editor",function(e){e.component("ElementList",p.default,"PageElements")}),a.default.transform("cms-element-adder",function(e){e.component("AddElementPopover",b.default,"ElementAddButton")}),a.default.transform("element-actions",function(e){e.component("ElementActions",j.default,"ElementActionsWithSave"),e.component("ElementActions",_.default,"ElementActionsWithPublish"),e.component("ElementActions",k.default,"ElementActionsWithUnpublish"),e.component("ElementActions",g.default,"ElementActionsWithDuplicate"),e.component("ElementActions",v.default,"ElementActionsWithArchive")})}},"./client/src/bundles/bundle.js":function(e,t,n){"use strict";n("./client/src/legacy/ElementEditor/entwine.js"),n("./client/src/boot/index.js")},"./client/src/components/ElementActions/AbstractAction.js":function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=!!e&&e.id;this.setState({dragTargetElementId:n,dragSpot:!1===t?"bottom":"top"})}},{key:"handleDragEnd",value:function(e,t){var n=this.props;(0,n.actions.handleSortBlock)(e,t,n.areaId).then(function(){var e=window.jQuery(".cms-preview");e.entwine("ss.preview")._loadUrl(e.find("iframe").attr("src"))}),this.setState({dragTargetElementId:null,dragSpot:null})}},{key:"render",value:function(){var e=this.props,t=e.fieldName,n=e.formState,r=e.ToolbarComponent,o=e.ListComponent,a=e.areaId,i=e.elementTypes,l=e.isDraggingOver,u=e.connectDropTarget,c=e.allowedElements,s=this.state,d=s.dragTargetElementId,p=s.dragSpot,m=c.map(function(e){return i.find(function(t){return t.class===e})});return u(f.default.createElement("div",{className:"element-editor"},f.default.createElement(r,{elementTypes:m,areaId:a,onDragOver:this.handleDragOver}),f.default.createElement(o,{allowedElementTypes:m,elementTypes:i,areaId:a,onDragOver:this.handleDragOver,onDragStart:this.handleDragStart,onDragEnd:this.handleDragEnd,dragSpot:p,isDraggingOver:l,dragTargetElementId:d}),f.default.createElement(T.default,{elementTypes:i}),f.default.createElement("input",{name:t,type:"hidden",value:JSON.stringify(n)||"",className:"no-change-track"})))}}]),t}(d.PureComponent);I.propTypes={fieldName:m.default.string,elementTypes:m.default.arrayOf(v.elementTypeType).isRequired,allowedElements:m.default.arrayOf(m.default.string).isRequired,areaId:m.default.number.isRequired,actions:m.default.shape({handleSortBlock:m.default.func})},t.Component=I,t.default=(0,y.compose)(w.default,(0,E.DropTarget)("element",{},function(e,t){return{connectDropTarget:e.dropTarget(),isDraggingOver:t.isOver()}}),(0,h.connect)(u),(0,b.inject)(["ElementToolbar","ElementList"],function(e,t){return{ToolbarComponent:e,ListComponent:t}},function(){return"ElementEditor"}),O.default)(I)},"./client/src/components/ElementEditor/ElementList.js":function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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}),t.Component=void 0;var l=Object.assign||function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:null,n=e.blockSchema.typeName,r=Array.isArray(t)?t:a().elementTypes,o=r.find(function(e){return e.class===n||e.name===n});return e.obsoleteClassName&&(o=Object.assign({obsoleteClassName:e.obsoleteClassName},o),Object.preventExtensions(o)),o}},"./client/src/state/editor/loadElementFormStateName.js":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.loadElementFormStateName=void 0;var r=n(12),o=function(e){return e&&e.__esModule?e:{default:e}}(r);t.loadElementFormStateName=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=o.default.getSection("DNADesign\\Elemental\\Controllers\\ElementalAreaController"),n=t.form.elementForm.formNameTemplate;return e?n.replace("{id}",e):n}},"./client/src/state/editor/loadElementSchemaValue.js":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.loadElementSchemaValue=void 0;var r=n(12),o=function(e){return e&&e.__esModule?e:{default:e}}(r);t.loadElementSchemaValue=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=o.default.getSection("DNADesign\\Elemental\\Controllers\\ElementalAreaController"),r=n.form.elementForm[e]||"";return t?r+"/"+t:r}},"./client/src/state/editor/publishBlockMutation.js":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.config=t.mutation=void 0;var r=Object.assign||function(e){for(var t=1;t 0 && arguments[0] !== undefined ? arguments[0] : null; + var isOverTop = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + + var id = element ? element.id : false; + + this.setState({ + dragTargetElementId: id, + dragSpot: isOverTop === false ? 'bottom' : 'top' + }); + } + }, { + key: 'handleDragEnd', + value: function handleDragEnd(sourceId, afterId) { + var _props = this.props, + handleSortBlock = _props.actions.handleSortBlock, + areaId = _props.areaId; + + + handleSortBlock(sourceId, afterId, areaId).then(function () { + var preview = window.jQuery('.cms-preview'); + preview.entwine('ss.preview')._loadUrl(preview.find('iframe').attr('src')); + }); + + this.setState({ + dragTargetElementId: null, + dragSpot: null + }); + } + }, { + key: 'render', + value: function render() { + var _props2 = this.props, + fieldName = _props2.fieldName, + formState = _props2.formState, + ToolbarComponent = _props2.ToolbarComponent, + ListComponent = _props2.ListComponent, + areaId = _props2.areaId, + elementTypes = _props2.elementTypes, + isDraggingOver = _props2.isDraggingOver, + connectDropTarget = _props2.connectDropTarget, + allowedElements = _props2.allowedElements; + var _state = this.state, + dragTargetElementId = _state.dragTargetElementId, + dragSpot = _state.dragSpot; + + var allowedElementTypes = allowedElements.map(function (className) { + return elementTypes.find(function (type) { + return type.class === className; + }); + }); + + return connectDropTarget(_react2.default.createElement( + 'div', + { className: 'element-editor' }, + _react2.default.createElement(ToolbarComponent, { + elementTypes: allowedElementTypes, + areaId: areaId, + onDragOver: this.handleDragOver + }), + _react2.default.createElement(ListComponent, { + allowedElementTypes: allowedElementTypes, + elementTypes: elementTypes, + areaId: areaId, + onDragOver: this.handleDragOver, + onDragStart: this.handleDragStart, + onDragEnd: this.handleDragEnd, + dragSpot: dragSpot, + isDraggingOver: isDraggingOver, + dragTargetElementId: dragTargetElementId + }), + _react2.default.createElement(_ElementDragPreview2.default, { elementTypes: elementTypes }), + _react2.default.createElement('input', { + name: fieldName, + type: 'hidden', + value: JSON.stringify(formState) || '', + className: 'no-change-track' + }) + )); + } + }]); + + return ElementEditor; +}(_react.PureComponent); + +ElementEditor.propTypes = { + fieldName: _propTypes2.default.string, + elementTypes: _propTypes2.default.arrayOf(_elementTypeType.elementTypeType).isRequired, + allowedElements: _propTypes2.default.arrayOf(_propTypes2.default.string).isRequired, + areaId: _propTypes2.default.number.isRequired, + actions: _propTypes2.default.shape({ + handleSortBlock: _propTypes2.default.func + }) +}; + +function mapStateToProps(state) { + var formNamePattern = (0, _loadElementFormStateName.loadElementFormStateName)('[0-9]+'); + var elementFormState = state.form.formState.element; + + if (!elementFormState) { + return {}; + } + + var formState = Object.keys(elementFormState).filter(function (key) { + return key.match(formNamePattern); + }).reduce(function (accumulator, key) { + return _extends({}, accumulator, _defineProperty({}, key, elementFormState[key].values)); + }, {}); + + return { formState: formState }; +} + +exports.Component = ElementEditor; +exports.default = (0, _redux.compose)(_withDragDropContext2.default, (0, _reactDnd.DropTarget)('element', {}, function (connector, monitor) { + return { + connectDropTarget: connector.dropTarget(), + isDraggingOver: monitor.isOver() }; +}), (0, _reactRedux.connect)(mapStateToProps), (0, _Injector.inject)(['ElementToolbar', 'ElementList'], function (ToolbarComponent, ListComponent) { + return { + ToolbarComponent: ToolbarComponent, + ListComponent: ListComponent + }; +}, function () { + return 'ElementEditor'; +}), _sortBlockMutation2.default)(ElementEditor); + +/***/ }), + +/***/ "./client/src/components/ElementEditor/ElementList.js": +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.Component = 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 _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__(0); + +var _react2 = _interopRequireDefault(_react); + +var _propTypes = __webpack_require__(1); + +var _propTypes2 = _interopRequireDefault(_propTypes); + +var _elementType = __webpack_require__("./client/src/types/elementType.js"); + +var _elementTypeType = __webpack_require__("./client/src/types/elementTypeType.js"); + +var _redux = __webpack_require__(4); + +var _Injector = __webpack_require__(3); + +var _classnames = __webpack_require__(7); + +var _classnames2 = _interopRequireDefault(_classnames); + +var _i18n = __webpack_require__(2); + +var _i18n2 = _interopRequireDefault(_i18n); + +var _reactDnd = __webpack_require__(9); + +var _dragHelpers = __webpack_require__("./client/src/lib/dragHelpers.js"); + +var _elementConfig = __webpack_require__("./client/src/state/editor/elementConfig.js"); + +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 ElementList = function (_Component) { + _inherits(ElementList, _Component); + + function ElementList() { + _classCallCheck(this, ElementList); + + return _possibleConstructorReturn(this, (ElementList.__proto__ || Object.getPrototypeOf(ElementList)).apply(this, arguments)); + } + + _createClass(ElementList, [{ + key: 'getDragIndicatorIndex', + value: function getDragIndicatorIndex() { + var _props = this.props, + dragTargetElementId = _props.dragTargetElementId, + draggedItem = _props.draggedItem, + blocks = _props.blocks, + dragSpot = _props.dragSpot; + + return (0, _dragHelpers.getDragIndicatorIndex)(blocks.map(function (element) { + return element.id; + }), dragTargetElementId, draggedItem && draggedItem.id, dragSpot); + } + }, { + key: 'renderBlocks', + value: function renderBlocks() { + var _props2 = this.props, + ElementComponent = _props2.ElementComponent, + HoverBarComponent = _props2.HoverBarComponent, + DragIndicatorComponent = _props2.DragIndicatorComponent, + blocks = _props2.blocks, + allowedElementTypes = _props2.allowedElementTypes, + elementTypes = _props2.elementTypes, + areaId = _props2.areaId, + onDragEnd = _props2.onDragEnd, + onDragOver = _props2.onDragOver, + onDragStart = _props2.onDragStart, + isDraggingOver = _props2.isDraggingOver; + + if (!blocks) { + return null; + } + + if (blocks && !blocks.length) { + return _react2.default.createElement( + 'div', + null, + _i18n2.default._t('ElementList.ADD_BLOCKS', 'Add blocks to place your content') + ); + } + + var output = blocks.map(function (element) { + return _react2.default.createElement( + 'div', + { key: element.id }, + _react2.default.createElement(ElementComponent, { + element: element, + areaId: areaId, + type: (0, _elementConfig.getElementTypeConfig)(element, elementTypes), + link: element.blockSchema.actions.edit, + onDragOver: onDragOver, + onDragEnd: onDragEnd, + onDragStart: onDragStart + }), + isDraggingOver || _react2.default.createElement(HoverBarComponent, { + key: 'create-after-' + element.id, + areaId: areaId, + elementId: element.id, + elementTypes: allowedElementTypes + }) + ); + }); + + if (!isDraggingOver) { + output = [_react2.default.createElement(HoverBarComponent, { + key: 0, + areaId: areaId, + elementId: 0, + elementTypes: allowedElementTypes + })].concat(output); + } + + var dragIndicatorIndex = this.getDragIndicatorIndex(); + if (isDraggingOver && dragIndicatorIndex !== null) { + output.splice(dragIndicatorIndex, 0, _react2.default.createElement(DragIndicatorComponent, { key: 'DropIndicator' })); + } + + return output; + } + }, { + key: 'renderLoading', + value: function renderLoading() { + var _props3 = this.props, + loading = _props3.loading, + LoadingComponent = _props3.LoadingComponent; + + + if (loading) { + return _react2.default.createElement(LoadingComponent, null); + } + return null; + } + }, { + key: 'render', + value: function render() { + var blocks = this.props.blocks; + + var listClassNames = (0, _classnames2.default)('elemental-editor-list', { 'elemental-editor-list--empty': !blocks || !blocks.length }); + + return this.props.connectDropTarget(_react2.default.createElement( + 'div', + { className: listClassNames }, + this.renderLoading(), + this.renderBlocks() + )); + } + }]); + + return ElementList; +}(_react.Component); + +ElementList.propTypes = { + blocks: _propTypes2.default.arrayOf(_elementType.elementType), + elementTypes: _propTypes2.default.arrayOf(_elementTypeType.elementTypeType).isRequired, + allowedElementTypes: _propTypes2.default.arrayOf(_elementTypeType.elementTypeType).isRequired, + loading: _propTypes2.default.bool, + areaId: _propTypes2.default.number.isRequired, + dragTargetElementId: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.bool]), + onDragOver: _propTypes2.default.func, + onDragStart: _propTypes2.default.func, + onDragEnd: _propTypes2.default.func +}; + +ElementList.defaultProps = { + blocks: [], + loading: false +}; + +exports.Component = ElementList; + + +var elementListTarget = { + drop: function drop(props, monitor) { + var blocks = props.blocks; + + var elementTargetDropResult = monitor.getDropResult(); + + if (!elementTargetDropResult) { + return {}; + } + + var dropIndex = (0, _dragHelpers.getDragIndicatorIndex)(blocks.map(function (element) { + return element.id; + }), elementTargetDropResult.target, monitor.getItem(), elementTargetDropResult.dropSpot); + var dropAfterID = blocks[dropIndex - 1] ? blocks[dropIndex - 1].id : '0'; + + return _extends({}, elementTargetDropResult, { + dropAfterID: dropAfterID + }); + } +}; + +exports.default = (0, _redux.compose)((0, _reactDnd.DropTarget)('element', elementListTarget, function (connector, monitor) { + return { + connectDropTarget: connector.dropTarget(), + draggedItem: monitor.getItem() + }; +}), (0, _Injector.inject)(['Element', 'Loading', 'HoverBar', 'DragPositionIndicator'], function (ElementComponent, LoadingComponent, HoverBarComponent, DragIndicatorComponent) { + return { + ElementComponent: ElementComponent, + LoadingComponent: LoadingComponent, + HoverBarComponent: HoverBarComponent, + DragIndicatorComponent: DragIndicatorComponent + }; +}, function () { + return 'ElementEditor.ElementList'; +}))(ElementList); + +/***/ }), + +/***/ "./client/src/components/ElementEditor/Header.js": +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.Component = undefined; + +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__(0); + +var _react2 = _interopRequireDefault(_react); + +var _propTypes = __webpack_require__(1); + +var _propTypes2 = _interopRequireDefault(_propTypes); + +var _reactstrap = __webpack_require__(10); + +var _elementType = __webpack_require__("./client/src/types/elementType.js"); + +var _elementTypeType = __webpack_require__("./client/src/types/elementTypeType.js"); + +var _redux = __webpack_require__(4); + +var _reactRedux = __webpack_require__(8); + +var _Injector = __webpack_require__(3); + +var _i18n = __webpack_require__(2); + +var _i18n2 = _interopRequireDefault(_i18n); + +var _classnames = __webpack_require__(7); + +var _classnames2 = _interopRequireDefault(_classnames); + +var _loadElementFormStateName = __webpack_require__("./client/src/state/editor/loadElementFormStateName.js"); + +var _reduxForm = __webpack_require__(11); + +var _reactDnd = __webpack_require__(9); + +var _getFormState = __webpack_require__(16); + +var _getFormState2 = _interopRequireDefault(_getFormState); + +var _dragHelpers = __webpack_require__("./client/src/lib/dragHelpers.js"); + +var _reactDndHtml5Backend = __webpack_require__(14); + +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 Header = function (_Component) { + _inherits(Header, _Component); + + function Header(props) { + _classCallCheck(this, Header); + + var _this = _possibleConstructorReturn(this, (Header.__proto__ || Object.getPrototypeOf(Header)).call(this, props)); + + _this.toggle = _this.toggle.bind(_this); + + _this.state = { + tooltipOpen: false + }; + return _this; + } + + _createClass(Header, [{ + key: 'componentDidMount', + value: function componentDidMount() { + var connectDragPreview = this.props.connectDragPreview; + + if (connectDragPreview) { + connectDragPreview((0, _reactDndHtml5Backend.getEmptyImage)(), { + captureDraggingState: true + }); + } + } + }, { + key: 'componentDidUpdate', + value: function componentDidUpdate() { + var tooltipOpen = this.state.tooltipOpen; + var disableTooltip = this.props.disableTooltip; + + + if (tooltipOpen && disableTooltip) { + this.setState({ + tooltipOpen: false + }); + } + } + }, { + key: 'getBlockTitle', + value: function getBlockTitle(element, type) { + if (type.broken) { + return _i18n2.default.inject(_i18n2.default._t('ElementHeader.BROKEN', 'This element is of obsolete type {type}.'), { type: type.obsoleteClassName }); + } + if (element.title) { + return element.title; + } + return _i18n2.default.inject(_i18n2.default._t('ElementHeader.NOTITLE', 'Untitled {type} block'), { type: type.title }); + } + }, { + key: 'toggle', + value: function toggle() { + this.setState({ + tooltipOpen: !this.state.tooltipOpen + }); + } + }, { + key: 'renderVersionedStateMessage', + value: function renderVersionedStateMessage() { + var _props = this.props, + _props$element = _props.element, + isLiveVersion = _props$element.isLiveVersion, + isPublished = _props$element.isPublished, + formDirty = _props.formDirty; + + if (!formDirty && isPublished && isLiveVersion) { + return null; + } + + var versionStateButtonTitle = ''; + var stateClassNames = ['element-editor-header__version-state']; + + if (formDirty) { + versionStateButtonTitle = _i18n2.default._t('ElementHeader.STATE_UNSAVED', 'Item has unsaved changes'); + stateClassNames.push('element-editor-header__version-state--unsaved'); + } else if (!isPublished) { + versionStateButtonTitle = _i18n2.default._t('ElementHeader.STATE_DRAFT', 'Item has not been published yet'); + stateClassNames.push('element-editor-header__version-state--draft'); + } else if (!isLiveVersion) { + versionStateButtonTitle = _i18n2.default._t('ElementHeader.STATE_MODIFIED', 'Item has unpublished changes'); + stateClassNames.push('element-editor-header__version-state--modified'); + } + + return _react2.default.createElement('span', { + className: (0, _classnames2.default)(stateClassNames), + title: versionStateButtonTitle + }); + } + }, { + key: 'render', + value: function render() { + var _props2 = this.props, + connectDragSource = _props2.connectDragSource, + element = _props2.element, + type = _props2.type, + areaId = _props2.areaId, + previewExpanded = _props2.previewExpanded, + simple = _props2.simple, + disableTooltip = _props2.disableTooltip, + activeTab = _props2.activeTab, + expandable = _props2.expandable, + ElementActionsComponent = _props2.ElementActionsComponent, + handleEditTabsClick = _props2.handleEditTabsClick; + + + var title = this.getBlockTitle(element, type); + var titleClasses = (0, _classnames2.default)({ + 'element-editor-header__title': true, + 'element-editor-header__title--none': !element.title + }); + var expandTitle = _i18n2.default._t('ElementHeader.EXPAND', 'Show editable fields'); + var containerClasses = (0, _classnames2.default)('element-editor-header', { + 'element-editor-header--simple': simple + }); + var iconContainerClasses = (0, _classnames2.default)('element-editor-header__icon-container', { + 'element-editor-header__icon-container--broken': type.broken + }); + var expandCaretClasses = (0, _classnames2.default)('element-editor-header__expand', { + 'font-icon-right-open-big': !expandable, + 'font-icon-up-open-big': expandable && previewExpanded, + 'font-icon-down-open-big': expandable && !previewExpanded + }); + var blockIconId = 'element-icon-' + element.id; + + var content = _react2.default.createElement( + 'div', + { className: containerClasses }, + _react2.default.createElement( + 'div', + { className: 'element-editor-header__drag-handle' }, + _react2.default.createElement('i', { className: 'font-icon-drag-handle' }) + ), + _react2.default.createElement( + 'div', + { className: 'element-editor-header__info' }, + _react2.default.createElement( + 'div', + { className: iconContainerClasses }, + _react2.default.createElement('i', { className: type.icon, id: blockIconId }), + this.renderVersionedStateMessage(), + !type.broken && !simple && _react2.default.createElement( + _reactstrap.Tooltip, + { + placement: 'top', + isOpen: this.state.tooltipOpen && !disableTooltip, + target: blockIconId, + toggle: this.toggle + }, + type.title + ) + ), + _react2.default.createElement( + 'h3', + { className: titleClasses }, + title + ) + ), + !simple && _react2.default.createElement( + 'div', + { className: 'element-editor-header__actions' }, + _react2.default.createElement( + 'div', + { role: 'none', onClick: function onClick(event) { + return event.stopPropagation(); + } }, + _react2.default.createElement(ElementActionsComponent, { + element: element, + type: type, + areaId: areaId, + activeTab: activeTab, + editTabs: type.editTabs, + handleEditTabsClick: handleEditTabsClick, + expandable: expandable + }) + ), + !type.broken && _react2.default.createElement('i', { className: expandCaretClasses, title: expandTitle }) + ) + ); + + if (previewExpanded) { + return connectDragSource(content); + } + + return content; + } + }]); + + return Header; +}(_react.Component); + +Header.propTypes = { + element: _elementType.elementType.isRequired, + type: _elementTypeType.elementTypeType.isRequired, + areaId: _propTypes2.default.number, + activeTab: _propTypes2.default.string, + simple: _propTypes2.default.bool, + ElementActionsComponent: _propTypes2.default.oneOfType([_propTypes2.default.node, _propTypes2.default.func]), + previewExpanded: _propTypes2.default.bool, + disableTooltip: _propTypes2.default.bool, + formDirty: _propTypes2.default.bool, + connectDragSource: _propTypes2.default.func.isRequired, + connectDragPreview: _propTypes2.default.func.isRequired, + onDragEnd: _propTypes2.default.func }; + +Header.defaultProps = { + expandable: true +}; + +function mapStateToProps(state, ownProps) { + var formName = (0, _loadElementFormStateName.loadElementFormStateName)(ownProps.element.id); + + return { + formDirty: (0, _reduxForm.isDirty)('element.' + formName, _getFormState2.default)(state) + }; +} + +exports.Component = Header; +exports.default = (0, _redux.compose)((0, _reactDnd.DragSource)('element', _dragHelpers.elementDragSource, function (connector) { + return { + connectDragSource: connector.dragSource(), + connectDragPreview: connector.dragPreview() + }; +}), (0, _reactRedux.connect)(mapStateToProps), (0, _Injector.inject)(['ElementActions'], function (ElementActionsComponent) { + return { + ElementActionsComponent: ElementActionsComponent + }; +}, function () { + return 'ElementEditor.ElementList.Element'; +}))(Header); + +/***/ }), + +/***/ "./client/src/components/ElementEditor/HoverBar.js": +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.Component = 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 _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__(0); + +var _react2 = _interopRequireDefault(_react); + +var _propTypes = __webpack_require__(1); + +var _propTypes2 = _interopRequireDefault(_propTypes); + +var _prefixClassNames = __webpack_require__("./client/src/lib/prefixClassNames.js"); + +var _prefixClassNames2 = _interopRequireDefault(_prefixClassNames); + +var _Injector = __webpack_require__(3); + +var _elementTypeType = __webpack_require__("./client/src/types/elementTypeType.js"); + +var _i18n = __webpack_require__(2); + +var _i18n2 = _interopRequireDefault(_i18n); + +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 classNames = (0, _prefixClassNames2.default)('element-editor__hover-bar'); + +function StatelessHoverBar(_ref) { + var AddElementPopoverComponent = _ref.AddElementPopoverComponent, + elementTypes = _ref.elementTypes, + elementId = _ref.elementId, + areaId = _ref.areaId, + popoverOpen = _ref.popoverOpen, + onToggle = _ref.onToggle; + + var lineClasses = classNames('-line') + ' font-icon-plus-circled'; + var label = _i18n2.default._t('ElementAddNewButton.ADD_BLOCK', 'Add block'); + var btnProps = { + className: classNames('-area', { '-area--focus': popoverOpen }), + onClick: onToggle, + 'aria-label': label, + title: label, + id: 'AddBlockHoverBarArea_' + areaId + '_' + elementId + }; + + return _react2.default.createElement( + 'div', + { className: classNames(''), id: 'AddBlockHoverBar_' + areaId + '_' + elementId }, + _react2.default.createElement( + 'button', + btnProps, + _react2.default.createElement( + 'span', + { className: classNames('-area-inner') }, + _react2.default.createElement('span', { className: lineClasses }) + ) + ), + _react2.default.createElement(AddElementPopoverComponent, { + placement: 'bottom', + target: 'AddBlockHoverBarArea_' + areaId + '_' + elementId, + isOpen: popoverOpen, + elementTypes: elementTypes, + toggle: onToggle, + container: '#AddBlockHoverBar_' + areaId + '_' + elementId, + areaId: areaId, + insertAfterElement: elementId + }) + ); +} + +var HoverBar = function (_Component) { + _inherits(HoverBar, _Component); + + function HoverBar(props) { + _classCallCheck(this, HoverBar); + + var _this = _possibleConstructorReturn(this, (HoverBar.__proto__ || Object.getPrototypeOf(HoverBar)).call(this, props)); + + _this.toggle = _this.toggle.bind(_this); + _this.state = { + popoverOpen: false + }; + return _this; + } + + _createClass(HoverBar, [{ + key: 'toggle', + value: function toggle() { + this.setState({ + popoverOpen: !this.state.popoverOpen + }); + } + }, { + key: 'render', + value: function render() { + var props = _extends({}, this.state, this.props, { + onToggle: this.toggle + }); + return _react2.default.createElement(StatelessHoverBar, props); + } + }]); + + return HoverBar; +}(_react.Component); + +HoverBar.propTypes = { + elementTypes: _propTypes2.default.arrayOf(_elementTypeType.elementTypeType).isRequired, + elementId: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]).isRequired, + areaId: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string]).isRequired +}; +exports.Component = HoverBar; +exports.default = (0, _Injector.inject)(['AddElementPopover'], function (AddElementPopoverComponent) { + return { + AddElementPopoverComponent: AddElementPopoverComponent + }; +}, function () { + return 'ElementEditor.ElementList.HoverBar'; +})(HoverBar); + +/***/ }), + +/***/ "./client/src/components/ElementEditor/InlineEditForm.js": +/***/ (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__(0); + +var _react2 = _interopRequireDefault(_react); + +var _propTypes = __webpack_require__(1); + +var _propTypes2 = _interopRequireDefault(_propTypes); + +var _classnames = __webpack_require__(7); + +var _classnames2 = _interopRequireDefault(_classnames); + +var _FormBuilderLoader = __webpack_require__(18); + +var _FormBuilderLoader2 = _interopRequireDefault(_FormBuilderLoader); + +var _loadElementSchemaValue = __webpack_require__("./client/src/state/editor/loadElementSchemaValue.js"); + +var _i18n = __webpack_require__(2); + +var _i18n2 = _interopRequireDefault(_i18n); + +var _loadElementFormStateName = __webpack_require__("./client/src/state/editor/loadElementFormStateName.js"); + +var _reactRedux = __webpack_require__(8); + +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 InlineEditForm = function (_PureComponent) { + _inherits(InlineEditForm, _PureComponent); + + function InlineEditForm(props) { + _classCallCheck(this, InlineEditForm); + + var _this = _possibleConstructorReturn(this, (InlineEditForm.__proto__ || Object.getPrototypeOf(InlineEditForm)).call(this, props)); + + _this.handleLoadingError = _this.handleLoadingError.bind(_this); + + _this.state = { + loadingError: null + }; + return _this; + } + + _createClass(InlineEditForm, [{ + key: 'handleLoadingError', + value: function handleLoadingError() { + var _window = window, + $ = _window.jQuery; + var handleLoadingError = this.props.handleLoadingError; + + + this.setState({ + loadingError: true + }); + + $.noticeAdd({ + text: _i18n2.default.inject(_i18n2.default._t('ElementEditForm.ERROR_NOTIFICATION', 'Error displaying the edit form for this block')), + stay: true, + type: 'notice' + }); + + handleLoadingError(); + } + }, { + key: 'render', + value: function render() { + var _props = this.props, + elementId = _props.elementId, + extraClass = _props.extraClass, + onClick = _props.onClick, + onFormInit = _props.onFormInit, + formHasState = _props.formHasState; + var loadingError = this.state.loadingError; + + + var classNames = (0, _classnames2.default)('element-editor-editform', extraClass); + var schemaUrl = (0, _loadElementSchemaValue.loadElementSchemaValue)('schemaUrl', elementId); + + var formProps = { + formTag: 'div', + schemaUrl: schemaUrl, + identifier: 'element', + refetchSchemaOnMount: !formHasState, + onLoadingError: this.handleLoadingError + }; + + if (loadingError) { + formProps.loading = false; + } + + if (typeof onFormInit === 'function') { + formProps.onReduxFormInit = onFormInit; + } + + return _react2.default.createElement( + 'div', + { className: classNames, onClick: onClick, role: 'presentation' }, + _react2.default.createElement(_FormBuilderLoader2.default, formProps) + ); + } + }]); + + return InlineEditForm; +}(_react.PureComponent); + +InlineEditForm.propTypes = { + extraClass: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.object]), + onClick: _propTypes2.default.func, + elementId: _propTypes2.default.string, + handleLoadingError: _propTypes2.default.func +}; + +function mapStateToProps(state, ownProps) { + var formName = (0, _loadElementFormStateName.loadElementFormStateName)(ownProps.elementId); + + return { + formHasState: state.form.formState && state.form.formState.element && !!state.form.formState.element[formName] + }; +} + +exports.default = (0, _reactRedux.connect)(mapStateToProps)(InlineEditForm); + +/***/ }), + +/***/ "./client/src/components/ElementEditor/Summary.js": +/***/ (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__(0); + +var _react2 = _interopRequireDefault(_react); + +var _propTypes = __webpack_require__(1); + +var _propTypes2 = _interopRequireDefault(_propTypes); + +var _classnames = __webpack_require__(7); + +var _classnames2 = _interopRequireDefault(_classnames); + +var _i18n = __webpack_require__(2); + +var _i18n2 = _interopRequireDefault(_i18n); + +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 Summary = function (_PureComponent) { + _inherits(Summary, _PureComponent); + + function Summary() { + _classCallCheck(this, Summary); + + return _possibleConstructorReturn(this, (Summary.__proto__ || Object.getPrototypeOf(Summary)).apply(this, arguments)); + } + + _createClass(Summary, [{ + key: 'render', + value: function render() { + var _props = this.props, + fileUrl = _props.fileUrl, + fileTitle = _props.fileTitle, + content = _props.content, + broken = _props.broken; + + var noContent = _i18n2.default._t('ElementSummary.NO_PREVIEW', 'No preview available'); + + var summaryClassNames = (0, _classnames2.default)('element-editor-summary__content', { + 'element-editor-summary__content--broken': broken + }); + + return _react2.default.createElement( + 'div', + { className: 'element-editor-summary' }, + fileUrl && _react2.default.createElement('img', { + className: 'element-editor-summary__thumbnail-image', + src: fileUrl, + alt: fileTitle + }), + (content || !fileUrl) && _react2.default.createElement( + 'p', + { className: summaryClassNames }, + content || noContent + ) + ); + } + }]); + + return Summary; +}(_react.PureComponent); + +Summary.defaultProps = {}; + +Summary.propTypes = { + content: _propTypes2.default.string, + fileUrl: _propTypes2.default.string, + fileTitle: _propTypes2.default.string, + broken: _propTypes2.default.bool +}; + +exports.default = Summary; + +/***/ }), + +/***/ "./client/src/components/ElementEditor/Toolbar.js": +/***/ (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__(0); + +var _react2 = _interopRequireDefault(_react); + +var _propTypes = __webpack_require__(1); + +var _propTypes2 = _interopRequireDefault(_propTypes); + +var _Injector = __webpack_require__(3); + +var _elementTypeType = __webpack_require__("./client/src/types/elementTypeType.js"); + +var _reactDnd = __webpack_require__(9); + +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 Toolbar = function (_PureComponent) { + _inherits(Toolbar, _PureComponent); + + function Toolbar() { + _classCallCheck(this, Toolbar); + + return _possibleConstructorReturn(this, (Toolbar.__proto__ || Object.getPrototypeOf(Toolbar)).apply(this, arguments)); + } + + _createClass(Toolbar, [{ + key: 'render', + value: function render() { + var _props = this.props, + AddNewButtonComponent = _props.AddNewButtonComponent, + elementTypes = _props.elementTypes, + areaId = _props.areaId, + connectDropTarget = _props.connectDropTarget; + + return connectDropTarget(_react2.default.createElement( + 'div', + { className: 'element-editor__toolbar' }, + _react2.default.createElement(AddNewButtonComponent, { + elementTypes: elementTypes, + areaId: areaId + }) + )); + } + }]); + + return Toolbar; +}(_react.PureComponent); + +Toolbar.defaultProps = {}; +Toolbar.propTypes = { + elementTypes: _propTypes2.default.arrayOf(_elementTypeType.elementTypeType).isRequired, + areaId: _propTypes2.default.number.isRequired, + AddNewButtonComponent: _propTypes2.default.oneOfType([_propTypes2.default.node, _propTypes2.default.func]).isRequired, + connectDropTarget: _propTypes2.default.func.isRequired, + onDragOver: _propTypes2.default.func, + onDragDrop: _propTypes2.default.func }; + +var toolbarTarget = { + hover: function hover(props) { + var onDragOver = props.onDragOver; + + if (onDragOver) { + onDragOver(); + } + } +}; + +exports.default = (0, _reactDnd.DropTarget)('element', toolbarTarget, function (connect) { + return { + connectDropTarget: connect.dropTarget() + }; +})((0, _Injector.inject)(['ElementAddNewButton'], function (AddNewButtonComponent) { + return { + AddNewButtonComponent: AddNewButtonComponent + }; +}, function () { + return 'ElementEditor.ElementToolbar'; +})(Toolbar)); + +/***/ }), + +/***/ "./client/src/components/HistoricElementView/HistoricElementView.js": +/***/ (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__(0); + +var _react2 = _interopRequireDefault(_react); + +var _i18n = __webpack_require__(2); + +var _i18n2 = _interopRequireDefault(_i18n); + +var _classnames = __webpack_require__(7); + +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 }, + _react2.default.createElement( + 'span', + { className: 'elemental-preview__link-text' }, + _i18n2.default._t('HistoricElementView.VIEW_BLOCK_HISTORY', 'Block history') + ), + _react2.default.createElement('i', { className: 'font-icon-angle-right btn--icon-lg elemental-preview__link-caret' }) + ), + _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; + +/***/ }), + +/***/ "./client/src/components/TextCheckboxGroupField/TextCheckboxGroupField.js": +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _react = __webpack_require__(0); + +var _react2 = _interopRequireDefault(_react); + +var _reactstrap = __webpack_require__(10); + +var _FieldHolder = __webpack_require__(17); + +var _FieldHolder2 = _interopRequireDefault(_FieldHolder); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var TextCheckboxGroupField = function TextCheckboxGroupField(props) { + var children = props.children; + + var childrenWithProps = _react2.default.Children.toArray(_react2.default.Children.map(children, function (child, index) { + var additionalProps = { noHolder: true }; + + if (index === 0) { + additionalProps.id = props.id; + } + + return _react2.default.cloneElement(child, additionalProps); + })); + + if (props.readOnly) { + return _react2.default.createElement( + 'div', + { className: 'text-checkbox-group-field--read-only' }, + childrenWithProps + ); + } + + if (childrenWithProps.length === 1) { + return childrenWithProps[0]; + } + + return _react2.default.createElement( + _reactstrap.InputGroup, + { className: 'text-checkbox-group-field' }, + childrenWithProps[0], + _react2.default.createElement( + _reactstrap.InputGroupAddon, + { addonType: 'append' }, + _react2.default.createElement( + _reactstrap.InputGroupText, + null, + childrenWithProps[1] + ) + ) + ); +}; + +exports.default = (0, _FieldHolder2.default)(TextCheckboxGroupField); + +/***/ }), + +/***/ "./client/src/legacy/ElementEditor/entwine.js": +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _jquery = __webpack_require__(20); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _react = __webpack_require__(0); + +var _react2 = _interopRequireDefault(_react); + +var _reactDom = __webpack_require__(15); + +var _reactDom2 = _interopRequireDefault(_reactDom); + +var _Injector = __webpack_require__(3); + +var _elementConfig = __webpack_require__("./client/src/state/editor/elementConfig.js"); + +var _reduxForm = __webpack_require__(11); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +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); } } + +var resetStores = function resetStores() { + window.ss.apolloClient.resetStore(); + + setTimeout(function () { + var store = window.ss.store; + + + if (!store) { + return; + } + + store.dispatch(_reduxForm.destroy.apply(undefined, _toConsumableArray(Object.keys(store.getState().form.formState.element || {}).map(function (name) { + return 'element.' + name; + })))); + }, 0); +}; + +_jquery2.default.entwine('ss', function ($) { + $('.js-injector-boot .element-editor__container').entwine({ + onmatch: function onmatch() { + var context = {}; + var ElementEditorComponent = (0, _Injector.loadComponent)('ElementEditor', context); + var schemaData = this.data('schema'); + var elementTypes = (0, _elementConfig.getConfig)().elementTypes; + + var props = { + fieldName: this.attr('name'), + areaId: schemaData['elemental-area-id'], + allowedElements: schemaData['allowed-elements'], + elementTypes: elementTypes + }; + + _reactDom2.default.render(_react2.default.createElement(ElementEditorComponent, props), this[0]); + }, + onunmatch: function onunmatch() { + resetStores(); + _reactDom2.default.unmountComponentAtNode(this[0]); + }, + + 'from .cms-edit-form': { + onaftersubmitform: function onaftersubmitform() { + resetStores(); + } + } + }); + + $('.js-injector-boot .element-editor__container .element-form-dirty-state').entwine({ + onmatch: function onmatch() { + $('.cms-edit-form').trigger('change'); + }, + onunmatch: function onunmatch() { + $('.cms-edit-form').trigger('change'); + } + }); + + $('.cms-edit-form').entwine({ + getChangeTrackerOptions: function getChangeTrackerOptions() { + var isDefault = this.entwineData('ChangeTrackerOptions') === undefined; + + var opts = this._super(); + + if (isDefault) { + opts = $.extend({}, opts); + + opts.ignoreFieldSelector += ', .elementalarea :input:not(.element-form-dirty-state)'; + + this.setChangeTrackerOptions(opts); + } + + return opts; + } + }); +}); + +/***/ }), + +/***/ "./client/src/lib/dragHelpers.js": +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.elementDragSource = exports.getDragIndicatorIndex = exports.isOverTop = undefined; + +var _reactDom = __webpack_require__(15); + +var isOverTop = exports.isOverTop = function isOverTop(monitor, component) { + var clientOffset = monitor.getClientOffset(); + var componentRect = (0, _reactDom.findDOMNode)(component).getBoundingClientRect(); + + return clientOffset.y < componentRect.y + componentRect.height / 2; +}; + +var getDragIndicatorIndex = exports.getDragIndicatorIndex = function getDragIndicatorIndex(items, dragTarget, draggedItem, dragSpot) { + if (dragTarget === null || !draggedItem) { + return null; + } + + var targetIndex = dragTarget ? items.findIndex(function (element) { + return element === dragTarget; + }) : 0; + var sourceIndex = items.findIndex(function (item) { + return item === draggedItem; + }); + + if (dragSpot === 'bottom') { + targetIndex += 1; + } + + if (sourceIndex === targetIndex || sourceIndex + 1 === targetIndex) { + return null; + } + + return targetIndex; +}; + +var elementDragSource = exports.elementDragSource = { + beginDrag: function beginDrag(props) { + return props.element; + }, + endDrag: function endDrag(props, monitor) { + var onDragEnd = props.onDragEnd; + + var dropResult = monitor.getDropResult(); + + if (!onDragEnd || !dropResult || !dropResult.dropAfterID) { + return; + } + + var itemID = monitor.getItem().id; + var dropAfterID = dropResult.dropAfterID; + + if (itemID !== dropAfterID) { + onDragEnd(itemID, dropAfterID); + } + } +}; + +/***/ }), + +/***/ "./client/src/lib/prefixClassNames.js": +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); + +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 _classnames = __webpack_require__(7); + +var _classnames2 = _interopRequireDefault(_classnames); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +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 _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +var prefixClassNames = function prefixClassNames(cssPrefix) { + return function () { + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + var prefix = function prefix(str) { + return '' + cssPrefix + str; + }; + + var prefixArgs = args.map(function (arg) { + if (!arg && arg !== '') { + return false; + } + + if ((typeof arg === 'undefined' ? 'undefined' : _typeof(arg)) === 'object') { + return Array.isArray(arg) ? arg.map(prefix) : Object.entries(arg).reduce(function (accumulator, _ref) { + var _ref2 = _slicedToArray(_ref, 2), + key = _ref2[0], + value = _ref2[1]; + + return Object.assign({}, accumulator, _defineProperty({}, prefix(key), value)); + }, {}); + } + + return prefix(arg); + }); + + return _classnames2.default.apply(undefined, _toConsumableArray(prefixArgs)); + }; +}; + +exports.default = prefixClassNames; + +/***/ }), + +/***/ "./client/src/state/editor/addElementMutation.js": +/***/ (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 AddElementToArea($className: String!, $elementalAreaID: ID!, $afterElementID: ID) {\n addElementToArea(\n className: $className,\n elementalAreaID: $elementalAreaID,\n afterElementID: $afterElementID\n ) {\n id\n }\n}\n'], ['\nmutation AddElementToArea($className: String!, $elementalAreaID: ID!, $afterElementID: ID) {\n addElementToArea(\n className: $className,\n elementalAreaID: $elementalAreaID,\n afterElementID: $afterElementID\n ) {\n id\n }\n}\n']); + +var _reactApollo = __webpack_require__(6); + +var _graphqlTag = __webpack_require__(5); + +var _graphqlTag2 = _interopRequireDefault(_graphqlTag); + +var _readBlocksForAreaQuery = __webpack_require__("./client/src/state/editor/readBlocksForAreaQuery.js"); + +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, + _ref$ownProps = _ref.ownProps, + actions = _ref$ownProps.actions, + areaId = _ref$ownProps.areaId; + + var handleAddElementToArea = function handleAddElementToArea(className, afterElementID) { + return mutate({ + variables: { className: className, elementalAreaID: areaId, afterElementID: afterElementID } + }); + }; + + return { + actions: _extends({}, actions, { + handleAddElementToArea: handleAddElementToArea + }) + }; + }, + options: function options(_ref2) { + var areaId = _ref2.areaId; + return { + refetchQueries: [{ + query: _readBlocksForAreaQuery.query, + variables: _readBlocksForAreaQuery.config.options({ areaId: areaId }).variables + }] + }; + } +}; + +exports.mutation = mutation; +exports.config = config; +exports.default = (0, _reactApollo.graphql)(mutation, config); + +/***/ }), + +/***/ "./client/src/state/editor/archiveBlockMutation.js": +/***/ (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 ArchiveBlock($blockId: ID!) {\n deleteBlocks(ids: [$blockId])\n}\n'], ['\nmutation ArchiveBlock($blockId: ID!) {\n deleteBlocks(ids: [$blockId])\n}\n']); + +var _reactApollo = __webpack_require__(6); + +var _graphqlTag = __webpack_require__(5); + +var _graphqlTag2 = _interopRequireDefault(_graphqlTag); + +var _readBlocksForAreaQuery = __webpack_require__("./client/src/state/editor/readBlocksForAreaQuery.js"); + +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 handleArchiveBlock = function handleArchiveBlock(blockId) { + return mutate({ + variables: { blockId: blockId } + }); + }; + + return { + actions: _extends({}, actions, { + handleArchiveBlock: handleArchiveBlock + }) + }; + }, + options: function options(_ref2) { + var areaId = _ref2.areaId; + return { + refetchQueries: [{ + query: _readBlocksForAreaQuery.query, + variables: _readBlocksForAreaQuery.config.options({ areaId: areaId }).variables + }] + }; + } +}; + +exports.mutation = mutation; +exports.config = config; +exports.default = (0, _reactApollo.graphql)(mutation, config); + +/***/ }), + +/***/ "./client/src/state/editor/duplicateBlockMutation.js": +/***/ (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 DuplicateBlock($blockId: ID!) {\n duplicateBlock(id: $blockId) {\n id\n }\n}\n'], ['\nmutation DuplicateBlock($blockId: ID!) {\n duplicateBlock(id: $blockId) {\n id\n }\n}\n']); + +var _reactApollo = __webpack_require__(6); + +var _graphqlTag = __webpack_require__(5); + +var _graphqlTag2 = _interopRequireDefault(_graphqlTag); + +var _readBlocksForAreaQuery = __webpack_require__("./client/src/state/editor/readBlocksForAreaQuery.js"); + +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 handleDuplicateBlock = function handleDuplicateBlock(blockId) { + return mutate({ + variables: { blockId: blockId } + }); + }; + + return { + actions: _extends({}, actions, { + handleDuplicateBlock: handleDuplicateBlock + }) + }; + }, + options: function options(_ref2) { + var areaId = _ref2.areaId; + return { + refetchQueries: [{ + query: _readBlocksForAreaQuery.query, + variables: _readBlocksForAreaQuery.config.options({ areaId: areaId }).variables + }] + }; + } +}; + +exports.mutation = mutation; +exports.config = config; +exports.default = (0, _reactApollo.graphql)(mutation, config); + +/***/ }), + +/***/ "./client/src/state/editor/elementConfig.js": +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getElementTypeConfig = exports.getConfig = undefined; + +var _Config = __webpack_require__(12); + +var _Config2 = _interopRequireDefault(_Config); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var getConfig = exports.getConfig = function getConfig() { + return _Config2.default.getSection('DNADesign\\Elemental\\Controllers\\ElementalAreaController'); +}; + +var getElementTypeConfig = exports.getElementTypeConfig = function getElementTypeConfig(element) { + var typeConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + + var elementType = element.blockSchema.typeName; + var types = Array.isArray(typeConfig) ? typeConfig : getConfig().elementTypes; + + var type = types.find(function (value) { + return value.class === elementType || value.name === elementType; + }); + if (element.obsoleteClassName) { + type = Object.assign({ obsoleteClassName: element.obsoleteClassName }, type); + Object.preventExtensions(type); + } + return type; +}; + +/***/ }), + +/***/ "./client/src/state/editor/loadElementFormStateName.js": +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.loadElementFormStateName = undefined; + +var _Config = __webpack_require__(12); + +var _Config2 = _interopRequireDefault(_Config); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var loadElementFormStateName = exports.loadElementFormStateName = function loadElementFormStateName() { + var elementId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + + var sectionKey = 'DNADesign\\Elemental\\Controllers\\ElementalAreaController'; + var section = _Config2.default.getSection(sectionKey); + var formNameTemplate = section.form.elementForm.formNameTemplate; + + if (elementId) { + return formNameTemplate.replace('{id}', elementId); + } + return formNameTemplate; +}; + +/***/ }), + +/***/ "./client/src/state/editor/loadElementSchemaValue.js": +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.loadElementSchemaValue = undefined; + +var _Config = __webpack_require__(12); + +var _Config2 = _interopRequireDefault(_Config); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var loadElementSchemaValue = exports.loadElementSchemaValue = function loadElementSchemaValue(key) { + var elementId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + + var sectionKey = 'DNADesign\\Elemental\\Controllers\\ElementalAreaController'; + var section = _Config2.default.getSection(sectionKey); + var schemaValue = section.form.elementForm[key] || ''; + + if (elementId) { + return schemaValue + '/' + elementId; + } + return schemaValue; +}; + +/***/ }), + +/***/ "./client/src/state/editor/moveBlockMutation.js": +/***/ (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 MoveBlock($blockId:ID!) {\n moveBlock(\n id: $blockId\n ) {\n id\n }\n}\n'], ['\nmutation MoveBlock($blockId:ID!) {\n moveBlock(\n id: $blockId\n ) {\n id\n }\n}\n']); + +var _reactApollo = __webpack_require__(6); + +var _graphqlTag = __webpack_require__(5); + +var _graphqlTag2 = _interopRequireDefault(_graphqlTag); + +var _readBlocksForAreaQuery = __webpack_require__("./client/src/state/editor/readBlocksForAreaQuery.js"); + +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 handleMoveBlock = function handleMoveBlock(blockId) { + return mutate({ + variables: { + blockId: blockId + } + }); + }; + + return { + actions: _extends({}, actions, { + handleMoveBlock: handleMoveBlock + }) + }; + }, + options: function options(_ref2) { + var areaId = _ref2.areaId; + return { + refetchQueries: [{ + query: _readBlocksForAreaQuery.query, + variables: _readBlocksForAreaQuery.config.options({ areaId: areaId }).variables + }] + }; + } +}; + +exports.mutation = mutation; +exports.config = config; +exports.default = (0, _reactApollo.graphql)(mutation, config); + +/***/ }), + +/***/ "./client/src/state/editor/publishBlockMutation.js": +/***/ (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 PublishBlock($blockId:ID!) {\n publishBlock(id: $blockId) {\n id\n }\n}\n'], ['\nmutation PublishBlock($blockId:ID!) {\n publishBlock(id: $blockId) {\n id\n }\n}\n']); + +var _reactApollo = __webpack_require__(6); + +var _graphqlTag = __webpack_require__(5); + +var _graphqlTag2 = _interopRequireDefault(_graphqlTag); + +var _readBlocksForAreaQuery = __webpack_require__("./client/src/state/editor/readBlocksForAreaQuery.js"); + +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 handlePublishBlock = function handlePublishBlock(blockId) { + return mutate({ + variables: { + blockId: blockId + } + }); + }; + + return { + actions: _extends({}, actions, { + handlePublishBlock: handlePublishBlock + }) + }; + }, + options: function options(_ref2) { + var areaId = _ref2.areaId; + return { + refetchQueries: [{ + query: _readBlocksForAreaQuery.query, + variables: _readBlocksForAreaQuery.config.options({ areaId: areaId }).variables + }] + }; + } +}; + +exports.mutation = mutation; +exports.config = config; +exports.default = (0, _reactApollo.graphql)(mutation, config); + +/***/ }), + +/***/ "./client/src/state/editor/readBlocksForAreaQuery.js": +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.config = exports.query = undefined; + +var _templateObject = _taggedTemplateLiteral(['\nquery ReadBlocksForArea($id:ID!) {\n readOneElementalArea(filter: { id: { eq: $id } }, versioning: {\n mode: DRAFT\n }){\n elements {\n id\n title\n blockSchema\n obsoleteClassName\n isLiveVersion\n isPublished\n version\n canCreate\n canPublish\n canUnpublish\n canDelete\n }\n }\n}\n'], ['\nquery ReadBlocksForArea($id:ID!) {\n readOneElementalArea(filter: { id: { eq: $id } }, versioning: {\n mode: DRAFT\n }){\n elements {\n id\n title\n blockSchema\n obsoleteClassName\n isLiveVersion\n isPublished\n version\n canCreate\n canPublish\n canUnpublish\n canDelete\n }\n }\n}\n']); + +var _reactApollo = __webpack_require__(6); + +var _graphqlTag = __webpack_require__(5); + +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 areaId = _ref.areaId; + + return { + variables: { + id: areaId + } + }; + }, + props: function props(_ref2) { + var _ref2$data = _ref2.data, + error = _ref2$data.error, + readOneElementalArea = _ref2$data.readOneElementalArea, + networkLoading = _ref2$data.loading; + + var blocks = null; + if (readOneElementalArea) { + blocks = readOneElementalArea.elements; + } + + var errors = error && error.graphQLErrors && error.graphQLErrors.map(function (graphQLError) { + return graphQLError.message; + }); + + return { + loading: networkLoading || !blocks, + blocks: blocks, + graphQLErrors: errors + }; + } +}; + +exports.query = query; +exports.config = config; +exports.default = (0, _reactApollo.graphql)(query, config); + +/***/ }), + +/***/ "./client/src/state/editor/sortBlockMutation.js": +/***/ (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 _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); + +var _templateObject = _taggedTemplateLiteral(['\nmutation SortBlockMutation($blockId:ID!, $afterBlockId:ID!) {\n sortBlock(\n id: $blockId\n afterBlockID: $afterBlockId\n ) {\n id\n isLiveVersion\n isPublished\n }\n}\n'], ['\nmutation SortBlockMutation($blockId:ID!, $afterBlockId:ID!) {\n sortBlock(\n id: $blockId\n afterBlockID: $afterBlockId\n ) {\n id\n isLiveVersion\n isPublished\n }\n}\n']); + +var _reactApollo = __webpack_require__(6); + +var _graphqlTag = __webpack_require__(5); + +var _graphqlTag2 = _interopRequireDefault(_graphqlTag); + +var _readBlocksForAreaQuery = __webpack_require__("./client/src/state/editor/readBlocksForAreaQuery.js"); + +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 handleSortBlock = function handleSortBlock(blockId, afterBlockId, areaId) { + return mutate({ + variables: { + blockId: blockId, + afterBlockId: afterBlockId + }, + optimisticResponse: { + sortBlock: { + id: blockId, + liveVersion: false, + __typename: 'Block' + } + }, + update: function update(store, _ref2) { + var updatedElementData = _ref2.data.sortBlock; + + var variables = _readBlocksForAreaQuery.config.options({ areaId: areaId }).variables; + var cachedData = store.readQuery({ query: _readBlocksForAreaQuery.query, variables: variables }); + + var newData = JSON.parse(JSON.stringify(cachedData)); + var blocks = newData.readOneElementalArea.elements; + + var movedBlockIndex = blocks.findIndex(function (block) { + return block.id === blockId; + }); + + var movedBlock = blocks[movedBlockIndex]; + + Object.entries(updatedElementData).forEach(function (_ref3) { + var _ref4 = _slicedToArray(_ref3, 2), + key = _ref4[0], + value = _ref4[1]; + + if (key === '__typename') { + return; + } + + movedBlock[key] = value; + }); + + blocks.splice(movedBlockIndex, 1); + + if (afterBlockId === '0') { + blocks.unshift(movedBlock); + } else { + var targetBlockIndex = blocks.findIndex(function (block) { + return block.id === afterBlockId; + }); + + if (targetBlockIndex === -1) { + targetBlockIndex = movedBlockIndex - 1; + } + + var end = blocks.slice(targetBlockIndex + 1); + blocks = blocks.slice(0, targetBlockIndex + 1); + blocks.push(movedBlock); + blocks = blocks.concat(end); + } + + newData.readOneElementalArea.elements = blocks; + store.writeQuery({ query: _readBlocksForAreaQuery.query, data: newData, variables: variables }); + } + }); + }; + return { + actions: _extends({}, actions, { + handleSortBlock: handleSortBlock + }) + }; + } +}; + +exports.mutation = mutation; +exports.config = config; +exports.default = (0, _reactApollo.graphql)(mutation, config); + +/***/ }), + +/***/ "./client/src/state/editor/unpublishBlockMutation.js": +/***/ (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 UnpublishBlock($blockId:ID!) {\n unpublishBlock(\n id: $blockId\n ) {\n id\n }\n}\n'], ['\nmutation UnpublishBlock($blockId:ID!) {\n unpublishBlock(\n id: $blockId\n ) {\n id\n }\n}\n']); + +var _reactApollo = __webpack_require__(6); + +var _graphqlTag = __webpack_require__(5); + +var _graphqlTag2 = _interopRequireDefault(_graphqlTag); + +var _readBlocksForAreaQuery = __webpack_require__("./client/src/state/editor/readBlocksForAreaQuery.js"); + +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 handleUnpublishBlock = function handleUnpublishBlock(blockId, fromStage, toStage, fromVersion) { + return mutate({ + variables: { + blockId: blockId, + fromStage: fromStage, + toStage: toStage, + fromVersion: fromVersion + } + }); + }; + + return { + actions: _extends({}, actions, { + handleUnpublishBlock: handleUnpublishBlock + }) + }; + }, + options: function options(_ref2) { + var areaId = _ref2.areaId; + return { + refetchQueries: [{ + query: _readBlocksForAreaQuery.query, + variables: _readBlocksForAreaQuery.config.options({ areaId: areaId }).variables + }] + }; + } +}; + +exports.mutation = mutation; +exports.config = config; +exports.default = (0, _reactApollo.graphql)(mutation, config); + +/***/ }), + +/***/ "./client/src/state/history/readOneBlockQuery.js": +/***/ (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 filter: { id: { eq: $block_id } }\n ) {\n id\n versions (limit: $limit, offset: $offset, sort: { version: DESC }) {\n pageInfo {\n totalCount\n }\n nodes {\n version\n absoluteLink\n author {\n firstName\n surname\n }\n publisher {\n firstName\n surname\n }\n published\n liveVersion\n latestDraftVersion\n lastEdited\n }\n }\n }\n}\n'], ['\nquery ReadHistoryViewerBlock ($block_id: ID!, $limit: Int!, $offset: Int!) {\n readOneBlock(\n versioning: {\n mode: LATEST\n },\n filter: { id: { eq: $block_id } }\n ) {\n id\n versions (limit: $limit, offset: $offset, sort: { version: DESC }) {\n pageInfo {\n totalCount\n }\n nodes {\n version\n absoluteLink\n author {\n firstName\n surname\n }\n publisher {\n firstName\n surname\n }\n published\n liveVersion\n latestDraftVersion\n lastEdited\n }\n }\n }\n}\n']); + +var _reactApollo = __webpack_require__(6); + +var _graphqlTag = __webpack_require__(5); + +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); + +/***/ }), + +/***/ "./client/src/state/history/revertToBlockVersionMutation.js": +/***/ (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__(6); + +var _graphqlTag = __webpack_require__(5); + +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); + +/***/ }), + +/***/ "./client/src/types/elementType.js": +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.elementType = undefined; + +var _propTypes = __webpack_require__(1); + +var _propTypes2 = _interopRequireDefault(_propTypes); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var elementType = _propTypes2.default.shape({ + id: _propTypes2.default.string.isRequired, + title: _propTypes2.default.string, + blockSchema: _propTypes2.default.object, + inlineEditable: _propTypes2.default.bool, + published: _propTypes2.default.bool, + liveVersion: _propTypes2.default.bool, + version: _propTypes2.default.number +}); + +exports.elementType = elementType; + +/***/ }), + +/***/ "./client/src/types/elementTypeType.js": +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.elementTypeType = undefined; + +var _propTypes = __webpack_require__(1); + +var _propTypes2 = _interopRequireDefault(_propTypes); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var elementTypeType = _propTypes2.default.shape({ + name: _propTypes2.default.string, + + title: _propTypes2.default.string, + + icon: _propTypes2.default.string, + + inlineEditable: _propTypes2.default.boolean, + + editTabs: _propTypes2.default.arrayOf(_propTypes2.default.shape({ + title: _propTypes2.default.string, + name: _propTypes2.default.string + })), + + config: _propTypes2.default.object +}); + +exports.elementTypeType = elementTypeType; + +/***/ }), + +/***/ 0: +/***/ (function(module, exports) { + +module.exports = React; + +/***/ }), + +/***/ 1: +/***/ (function(module, exports) { + +module.exports = PropTypes; + +/***/ }), + +/***/ 10: +/***/ (function(module, exports) { + +module.exports = Reactstrap; + +/***/ }), + +/***/ 11: +/***/ (function(module, exports) { + +module.exports = ReduxForm; + +/***/ }), + +/***/ 12: +/***/ (function(module, exports) { + +module.exports = Config; + +/***/ }), + +/***/ 13: +/***/ (function(module, exports) { + +module.exports = Backend; + +/***/ }), + +/***/ 14: +/***/ (function(module, exports) { + +module.exports = ReactDNDHtml5Backend; + +/***/ }), + +/***/ 15: +/***/ (function(module, exports) { + +module.exports = ReactDom; + +/***/ }), + +/***/ 16: +/***/ (function(module, exports) { + +module.exports = getFormState; + +/***/ }), + +/***/ 17: +/***/ (function(module, exports) { + +module.exports = FieldHolder; + +/***/ }), + +/***/ 18: +/***/ (function(module, exports) { + +module.exports = FormBuilderLoader; + +/***/ }), + +/***/ 19: +/***/ (function(module, exports) { + +module.exports = TabsActions; + +/***/ }), + +/***/ 2: +/***/ (function(module, exports) { + +module.exports = i18n; + +/***/ }), + +/***/ 20: +/***/ (function(module, exports) { + +module.exports = jQuery; + +/***/ }), + +/***/ 21: +/***/ (function(module, exports) { + +module.exports = withDragDropContext; + +/***/ }), + +/***/ 3: +/***/ (function(module, exports) { + +module.exports = Injector; + +/***/ }), + +/***/ 4: +/***/ (function(module, exports) { + +module.exports = Redux; + +/***/ }), + +/***/ 5: +/***/ (function(module, exports) { + +module.exports = GraphQLTag; + +/***/ }), + +/***/ 6: +/***/ (function(module, exports) { + +module.exports = ReactApollo; + +/***/ }), + +/***/ 7: +/***/ (function(module, exports) { + +module.exports = classnames; + +/***/ }), + +/***/ 8: +/***/ (function(module, exports) { + +module.exports = ReactRedux; + +/***/ }), + +/***/ 9: +/***/ (function(module, exports) { + +module.exports = ReactDND; + +/***/ }) + +/******/ }); +//# sourceMappingURL=bundle.js.map \ No newline at end of file diff --git a/client/dist/styles/bundle.css b/client/dist/styles/bundle.css index c2b39c01..2773765b 100644 --- a/client/dist/styles/bundle.css +++ b/client/dist/styles/bundle.css @@ -1 +1,2 @@ -.elemental-edit{display:-webkit-box;display:-webkit-flex;display:flex;color:inherit}.elemental-edit:focus,.elemental-edit:hover{text-decoration:none;color:inherit}.elemental-editor .col-EditorPreview{padding-left:0}.elemental-preview__detail{display:inline-block;margin-left:.76925rem;margin-top:1px}.elemental-preview__detail h3{font-weight:400;line-height:26px;margin:0;-webkit-font-smoothing:antialiased}.elemental-preview__detail p{-webkit-box-align:center;-webkit-align-items:center;align-items:center;display:-webkit-box;display:-webkit-flex;display:flex;margin-bottom:0;margin-top:6px}.elemental-preview__detail small{color:#566b8d;font-size:13px}.elemental-preview__thumbnail-image{margin-right:.76925rem}.elemental-preview__thumbnail-image img{border-radius:.192rem}.elemental-preview__thumbnail-image--placeholder{border-radius:0;height:36px;margin-left:-4px}.elemental-preview__icon{color:#566b8d;display:inline-block;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-webkit-flex-direction:row;flex-direction:row;font-size:2.3rem;width:28px;vertical-align:top;margin-top:-1px}.ss-gridfield-orderable.elemental-editor .col-reorder .handle{opacity:.5;padding:22px 0 0}.ss-gridfield-orderable.elemental-editor .col-reorder .handle .icon{font-size:1.3em}.elemental-editor .ss-gridfield-item:hover .handle{opacity:1}.elemental-editor .grid-field__table{margin-bottom:12px}@media (max-width:991.98px){.elemental-editor .grid-field__table .col-EditorPreview{display:table-cell}}.elemental-report__grid-field .element-editor-header__version-state{bottom:9px;left:14px}.element-editor .form-group:nth-child(1n){display:block}@media (min-width:992px){.element-editor .form-group:nth-child(1n) .form__field-holder,.element-editor .form-group:nth-child(1n) .form__field-label{-webkit-box-flex:0;-webkit-flex:0 0 83.33333%;flex:0 0 83.33333%;max-width:83.33333%;margin-left:0}}.elemental-block__history-tab{margin-top:-1.5385rem}.cms-edit-form .fieldgroup.elemental-area__element--historic{margin-left:0;margin-right:0}.cms-edit-form .fieldgroup.elemental-area__element--historic.form-group{border-top:1px solid #dbe0e9}.cms-edit-form .fieldgroup.elemental-area__element--historic .form__field-holder{-webkit-box-flex:0;-webkit-flex:0 0 100%;flex:0 0 100%;max-width:100%}.elemental-preview{line-height:20px}.elemental-preview--historic{margin-bottom:1rem}.elemental-preview__link{float:right;margin-top:4px}.elemental-preview__link:hover{text-decoration:none}.elemental-preview__link:hover .elemental-preview__link-text{text-decoration:underline}.elemental-preview__link-caret{display:block;float:right;margin-top:-2px;margin-left:2px}div.elemental-area__element--historic.elemental-area__element--historic-inner{background:transparent;border:0;padding-left:0;padding-right:0;padding-top:1.5385rem}.elemental-area--read-only{border-bottom:1px solid #dbe0e9;margin:2.30775rem -1.5385rem}.history-viewer__version-detail fieldset{overflow:visible}.elemental-report__grid-field .ss-gridfield-item td:first-child{width:1px}.elemental-report__grid-field .col-Icon{font-size:1.5rem}.elemental-report__grid-field .element-item--draft,.elemental-report__grid-field .element-item--modified{bottom:8px;left:14px;height:6px;width:6px}.textcheckboxgroup .input-group-append .form-check-input{margin-left:0;position:relative}.element-editor .action-menu .dropdown-item.disabled{font-style:italic;pointer-events:auto;cursor:not-allowed;color:#6f84a7}.elemental-editor__add-new-block-control{width:20rem}.elemental-editor__add-new-block-control a{line-height:1.85em}.element-editor__element{border-bottom:1px solid #dbe0e9;color:inherit;cursor:pointer;min-height:8rem;padding:.9231rem 1.5385rem 1.8462rem}.element-editor__element:focus,.element-editor__element:hover{-webkit-box-shadow:0 2px 5px 0 rgba(0,0,0,.1),0 2px 10px 0 rgba(0,0,0,.1);box-shadow:0 2px 5px 0 rgba(0,0,0,.1),0 2px 10px 0 rgba(0,0,0,.1);outline-width:0}.element-editor__element:hover .element-editor-header__drag-handle{display:block}.element-editor__element--broken{cursor:default}.element-editor__element--dragging{opacity:.3;cursor:grabbing;cursor:-webkit-grabbing}.elemental-editor-list{background-color:#fff;border-top:1px solid #dbe0e9;margin-left:-1.5385rem;margin-right:-1.5385rem;min-height:calc(8rem + 1px);position:relative;margin-bottom:1.5385rem}.elemental-editor-list--empty{border-bottom:1px solid #dbe0e9;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center}.element-editor-editform{margin-top:.76925rem;cursor:auto;margin-bottom:-1rem}.element-editor-editform .mce-tinymce{-webkit-box-sizing:border-box;box-sizing:border-box}.element-editor-editform__form{width:100%}.element-editor-editform .element-editor-editform__form .form-group .form__field-holder{-webkit-box-flex:1;-webkit-flex:1 0 100%;flex:1 0 100%;max-width:900px}.element-editor-header{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:justify;-webkit-justify-content:space-between;justify-content:space-between}.element-editor-header__title{font-size:15px;font-weight:400;margin:0 0 0 .76925rem;-webkit-font-smoothing:antialiased;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.element-editor-header__title--none{font-style:italic;color:#6f84a7}.element-editor-header__actions,.element-editor-header__info{-webkit-box-align:center;-webkit-align-items:center;align-items:center;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-flex:1;-webkit-flex-grow:1;flex-grow:1}.element-editor-header__info{max-width:calc(100% - 60px)}.element-editor-header__actions{-webkit-box-pack:end;-webkit-justify-content:flex-end;justify-content:flex-end}.element-editor-header__actions-toggle{padding-top:3px;padding-bottom:3px}.element-editor-header__icon-container{margin-left:-2px;color:#566b8d;font-size:2.154rem;height:28px;line-height:1.5rem}.element-editor-header__icon-container--broken{color:#da273b}.element-editor-header__expand{font-size:1.1rem;margin-left:3px;width:unset}.element-editor-header__version-state{border:1px solid #cf3f00;border-radius:100%;bottom:6px;-webkit-box-shadow:0 0 1px .5px #fff;box-shadow:0 0 1px .5px #fff;display:block;height:8px;left:22px;position:relative;width:8px;z-index:1}.element-editor-header__version-state--unsaved{background-color:#0071c4;border:1px solid #0062ab}.element-editor-header__version-state--draft{background-color:#ff7f22}.element-editor-header__version-state--modified{background-color:#fff7f0}.element-editor-header__drag-handle{display:none;position:absolute;left:5px;cursor:grab;cursor:-webkit-grab}.element-editor-header--simple .element-editor-header__drag-handle{display:block}.element-editor-header--simple .element-editor-header__info{width:460px}.element-editor-header .dropdown-item.active{cursor:default}.element-editor-summary{display:-webkit-box;display:-webkit-flex;display:flex;margin-top:.9231rem;margin-left:36px;-webkit-box-align:center;-webkit-align-items:center;align-items:center;min-height:2em}.element-editor-summary__thumbnail-image{border-radius:.1536rem;height:36px;margin:-.6154rem .9231rem -.6154rem 0}.element-editor-summary__content{color:#566b8d;line-height:1.3;margin-bottom:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.element-editor-summary__content--broken{overflow:visible;white-space:normal}.element-editor__toolbar{margin-bottom:1rem}.element-editor__hover-bar{height:0;display:-webkit-box;display:-webkit-flex;display:flex;width:100%;position:relative;-webkit-box-align:center;-webkit-align-items:center;align-items:center}.element-editor__hover-bar-area{background-color:transparent;min-height:1.8462rem;width:100%;margin:0;padding:0;border:none;outline:none;-webkit-transition:all .2s ease;-o-transition:all ease .2s;transition:all .2s ease;position:relative}.element-editor__hover-bar-area--focus,.element-editor__hover-bar-area:focus,.element-editor__hover-bar-area:hover{outline:none}.element-editor__hover-bar-area--focus .element-editor__hover-bar-area-inner,.element-editor__hover-bar-area:focus .element-editor__hover-bar-area-inner,.element-editor__hover-bar-area:hover .element-editor__hover-bar-area-inner{margin:0 20px}.element-editor__hover-bar-area--focus .element-editor__hover-bar-line,.element-editor__hover-bar-area:focus .element-editor__hover-bar-line,.element-editor__hover-bar-area:hover .element-editor__hover-bar-line{opacity:1;border-radius:5px;max-height:5px}.element-editor__hover-bar-area--focus .element-editor__hover-bar-line:before,.element-editor__hover-bar-area:focus .element-editor__hover-bar-line:before,.element-editor__hover-bar-area:hover .element-editor__hover-bar-line:before{-webkit-transform:translateY(calc(3px + -50%)) scale(1);-o-transform:translateY(calc(3px + -50%)) scale(1);transform:translateY(calc(3px + -50%)) scale(1)}.element-editor__hover-bar-area-inner{margin:0;display:block;position:relative}.element-editor__hover-bar-area-inner,.element-editor__hover-bar-line{-webkit-transition:all .2s ease;-o-transition:all ease .2s;transition:all .2s ease}.element-editor__hover-bar-line{background-color:#005a93;opacity:0;-webkit-align-self:center;align-self:center;width:100%;border:0;position:absolute;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-pack:end;-webkit-justify-content:flex-end;justify-content:flex-end;padding:0;top:50%;-webkit-transform:translateY(-66%);-o-transform:translateY(-66%);transform:translateY(-66%);max-height:0;border-radius:0}.element-editor__hover-bar-line:before{font-size:1.5rem;background-image:-webkit-radial-gradient(#fff 50%,transparent 0);background-image:-o-radial-gradient(#fff 50%,transparent 50%);background-image:radial-gradient(#fff 50%,transparent 0);position:relative;z-index:2;margin-right:50%;right:-.5em;display:block;height:1em;-webkit-transform:translateY(-35%);-o-transform:translateY(-35%);transform:translateY(-35%);-webkit-transform:translateY(calc(-1px + -50%)) scale(0);-o-transform:translateY(calc(-1px + -50%)) scale(0);transform:translateY(calc(-1px + -50%)) scale(0);-webkit-transition:all .2s ease;-o-transition:all ease .2s;transition:all .2s ease;color:#005a93}.elemental-editor-drag-indicator{height:3px;margin:-2px 0 -1px;background-color:#29abe2}.elemental-editor-drag-indicator__ball{position:relative;height:7px;width:7px;top:-2px;left:-3px;border-radius:3.5px;background-color:#29abe2}.element-editor--dragging{cursor:-webkit-grabbing;cursor:grabbing}.element-editor-drag-preview{top:0;left:0;position:fixed;pointer-events:none;z-index:100;background-color:#fff;border:1px solid #ced5e1;padding:.9231rem 1.5385rem;-webkit-box-shadow:0 2px 5px 0 rgba(0,0,0,.1),0 2px 10px 0 rgba(0,0,0,.1);box-shadow:0 2px 5px 0 rgba(0,0,0,.1),0 2px 10px 0 rgba(0,0,0,.1)}.text-checkbox-group-field .form-check{display:inline;padding-left:0;margin-bottom:0}.text-checkbox-group-field--read-only{display:-webkit-box;display:-webkit-flex;display:flex}.text-checkbox-group-field--read-only :first-child{-webkit-box-flex:1;-webkit-flex:1;flex:1}.text-checkbox-group-field--read-only .show-title{font-style:italic} \ No newline at end of file +.elemental-edit{display:-webkit-box;display:-webkit-flex;display:flex;color:inherit}.elemental-edit:focus,.elemental-edit:hover{text-decoration:none;color:inherit}.elemental-editor .col-EditorPreview{padding-left:0}.elemental-preview__detail{display:inline-block;margin-left:.76925rem;margin-top:1px}.elemental-preview__detail h3{font-weight:400;line-height:26px;margin:0;-webkit-font-smoothing:antialiased}.elemental-preview__detail p{-webkit-box-align:center;-webkit-align-items:center;align-items:center;display:-webkit-box;display:-webkit-flex;display:flex;margin-bottom:0;margin-top:6px}.elemental-preview__detail small{color:#566b8d;font-size:13px}.elemental-preview__thumbnail-image{margin-right:.76925rem}.elemental-preview__thumbnail-image img{border-radius:.192rem}.elemental-preview__thumbnail-image--placeholder{border-radius:0;height:36px;margin-left:-4px}.elemental-preview__icon{color:#566b8d;display:inline-block;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-webkit-flex-direction:row;flex-direction:row;font-size:2.3rem;width:28px;vertical-align:top;margin-top:-1px}.ss-gridfield-orderable.elemental-editor .col-reorder .handle{opacity:.5;padding:22px 0 0}.ss-gridfield-orderable.elemental-editor .col-reorder .handle .icon{font-size:1.3em}.elemental-editor .ss-gridfield-item:hover .handle{opacity:1}.elemental-editor .grid-field__table{margin-bottom:12px}@media (max-width:991.98px){.elemental-editor .grid-field__table .col-EditorPreview{display:table-cell}}.elemental-report__grid-field .element-editor-header__version-state{bottom:9px;left:14px}.element-editor .form-group:nth-child(1n){display:block}@media (min-width:992px){.element-editor .form-group:nth-child(1n) .form__field-holder,.element-editor .form-group:nth-child(1n) .form__field-label{-webkit-box-flex:0;-webkit-flex:0 0 83.33333%;flex:0 0 83.33333%;max-width:83.33333%;margin-left:0}}.elemental-block__history-tab{margin-top:-1.5385rem}.cms-edit-form .fieldgroup.elemental-area__element--historic{margin-left:0;margin-right:0}.cms-edit-form .fieldgroup.elemental-area__element--historic.form-group{border-top:1px solid #dbe0e9}.cms-edit-form .fieldgroup.elemental-area__element--historic .form__field-holder{-webkit-box-flex:0;-webkit-flex:0 0 100%;flex:0 0 100%;max-width:100%}.elemental-preview{line-height:20px}.elemental-preview--historic{margin-bottom:1rem}.elemental-preview__link{float:right;margin-top:4px}.elemental-preview__link:hover{text-decoration:none}.elemental-preview__link:hover .elemental-preview__link-text{text-decoration:underline}.elemental-preview__link-caret{display:block;float:right;margin-top:-2px;margin-left:2px}div.elemental-area__element--historic.elemental-area__element--historic-inner{background:transparent;border:0;padding-left:0;padding-right:0;padding-top:1.5385rem}.elemental-area--read-only{border-bottom:1px solid #dbe0e9;margin:2.30775rem -1.5385rem}.history-viewer__version-detail fieldset{overflow:visible}.elemental-report__grid-field .ss-gridfield-item td:first-child{width:1px}.elemental-report__grid-field .col-Icon{font-size:1.5rem}.elemental-report__grid-field .element-item--draft,.elemental-report__grid-field .element-item--modified{bottom:8px;left:14px;height:6px;width:6px}.textcheckboxgroup .input-group-append .form-check-input{margin-left:0;position:relative}.element-editor .action-menu .dropdown-item.disabled{font-style:italic;pointer-events:auto;cursor:not-allowed;color:#6f84a7}.elemental-editor__add-new-block-control{width:20rem}.elemental-editor__add-new-block-control a{line-height:1.85em}.element-editor__element{border-bottom:1px solid #dbe0e9;color:inherit;cursor:pointer;min-height:8rem;padding:.9231rem 1.5385rem 1.8462rem}.element-editor__element:focus,.element-editor__element:hover{-webkit-box-shadow:0 2px 5px 0 rgba(0,0,0,.1),0 2px 10px 0 rgba(0,0,0,.1);box-shadow:0 2px 5px 0 rgba(0,0,0,.1),0 2px 10px 0 rgba(0,0,0,.1);outline-width:0}.element-editor__element:hover .element-editor-header__drag-handle{display:block}.element-editor__element--broken{cursor:default}.element-editor__element--dragging{opacity:.3;cursor:grabbing;cursor:-webkit-grabbing}.elemental-editor-list{background-color:#fff;border-top:1px solid #dbe0e9;margin-left:-1.5385rem;margin-right:-1.5385rem;min-height:calc(8rem + 1px);position:relative;margin-bottom:1.5385rem}.elemental-editor-list--empty{border-bottom:1px solid #dbe0e9;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center}.element-editor-editform{margin-top:.76925rem;cursor:auto;margin-bottom:-1rem}.element-editor-editform .mce-tinymce{-webkit-box-sizing:border-box;box-sizing:border-box}.element-editor-editform__form{width:100%}.element-editor-editform .element-editor-editform__form .form-group .form__field-holder{-webkit-box-flex:1;-webkit-flex:1 0 100%;flex:1 0 100%;max-width:900px}.element-editor-header{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:justify;-webkit-justify-content:space-between;justify-content:space-between}.element-editor-header__title{font-size:15px;font-weight:400;margin:0 0 0 .76925rem;-webkit-font-smoothing:antialiased;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.element-editor-header__title--none{font-style:italic;color:#6f84a7}.element-editor-header__actions,.element-editor-header__info{-webkit-box-align:center;-webkit-align-items:center;align-items:center;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-flex:1;-webkit-flex-grow:1;flex-grow:1}.element-editor-header__info{max-width:calc(100% - 60px)}.element-editor-header__actions{-webkit-box-pack:end;-webkit-justify-content:flex-end;justify-content:flex-end}.element-editor-header__actions-toggle{padding-top:3px;padding-bottom:3px}.element-editor-header__icon-container{margin-left:-2px;color:#566b8d;font-size:2.154rem;height:28px;line-height:1.5rem}.element-editor-header__icon-container--broken{color:#da273b}.element-editor-header__expand{font-size:1.1rem;margin-left:3px;width:unset}.element-editor-header__version-state{border:1px solid #cf3f00;border-radius:100%;bottom:6px;-webkit-box-shadow:0 0 1px .5px #fff;box-shadow:0 0 1px .5px #fff;display:block;height:8px;left:22px;position:relative;width:8px;z-index:1}.element-editor-header__version-state--unsaved{background-color:#0071c4;border:1px solid #0062ab}.element-editor-header__version-state--draft{background-color:#ff7f22}.element-editor-header__version-state--modified{background-color:#fff7f0}.element-editor-header__drag-handle{display:none;position:absolute;left:5px;cursor:grab;cursor:-webkit-grab}.element-editor-header--simple .element-editor-header__drag-handle{display:block}.element-editor-header--simple .element-editor-header__info{width:460px}.element-editor-header .dropdown-item.active{cursor:default}.element-editor-summary{display:-webkit-box;display:-webkit-flex;display:flex;margin-top:.9231rem;margin-left:36px;-webkit-box-align:center;-webkit-align-items:center;align-items:center;min-height:2em}.element-editor-summary__thumbnail-image{border-radius:.1536rem;height:36px;margin:-.6154rem .9231rem -.6154rem 0}.element-editor-summary__content{color:#566b8d;line-height:1.3;margin-bottom:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.element-editor-summary__content--broken{overflow:visible;white-space:normal}.element-editor__toolbar{margin-bottom:1rem}.element-editor__hover-bar{height:0;display:-webkit-box;display:-webkit-flex;display:flex;width:100%;position:relative;-webkit-box-align:center;-webkit-align-items:center;align-items:center}.element-editor__hover-bar-area{background-color:transparent;min-height:1.8462rem;width:100%;margin:0;padding:0;border:none;outline:none;-webkit-transition:all .2s ease;-o-transition:all ease .2s;transition:all .2s ease;position:relative}.element-editor__hover-bar-area--focus,.element-editor__hover-bar-area:focus,.element-editor__hover-bar-area:hover{outline:none}.element-editor__hover-bar-area--focus .element-editor__hover-bar-area-inner,.element-editor__hover-bar-area:focus .element-editor__hover-bar-area-inner,.element-editor__hover-bar-area:hover .element-editor__hover-bar-area-inner{margin:0 20px}.element-editor__hover-bar-area--focus .element-editor__hover-bar-line,.element-editor__hover-bar-area:focus .element-editor__hover-bar-line,.element-editor__hover-bar-area:hover .element-editor__hover-bar-line{opacity:1;border-radius:5px;max-height:5px}.element-editor__hover-bar-area--focus .element-editor__hover-bar-line:before,.element-editor__hover-bar-area:focus .element-editor__hover-bar-line:before,.element-editor__hover-bar-area:hover .element-editor__hover-bar-line:before{-webkit-transform:translateY(calc(3px + -50%)) scale(1);-o-transform:translateY(calc(3px + -50%)) scale(1);transform:translateY(calc(3px + -50%)) scale(1)}.element-editor__hover-bar-area-inner{margin:0;display:block;position:relative}.element-editor__hover-bar-area-inner,.element-editor__hover-bar-line{-webkit-transition:all .2s ease;-o-transition:all ease .2s;transition:all .2s ease}.element-editor__hover-bar-line{background-color:#005a93;opacity:0;-webkit-align-self:center;align-self:center;width:100%;border:0;position:absolute;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-pack:end;-webkit-justify-content:flex-end;justify-content:flex-end;padding:0;top:50%;-webkit-transform:translateY(-66%);-o-transform:translateY(-66%);transform:translateY(-66%);max-height:0;border-radius:0}.element-editor__hover-bar-line:before{font-size:1.5rem;background-image:-webkit-radial-gradient(#fff 50%,transparent 0);background-image:-o-radial-gradient(#fff 50%,transparent 50%);background-image:radial-gradient(#fff 50%,transparent 0);position:relative;z-index:2;margin-right:50%;right:-.5em;display:block;height:1em;-webkit-transform:translateY(-35%);-o-transform:translateY(-35%);transform:translateY(-35%);-webkit-transform:translateY(calc(-1px + -50%)) scale(0);-o-transform:translateY(calc(-1px + -50%)) scale(0);transform:translateY(calc(-1px + -50%)) scale(0);-webkit-transition:all .2s ease;-o-transition:all ease .2s;transition:all .2s ease;color:#005a93}.elemental-editor-drag-indicator{height:3px;margin:-2px 0 -1px;background-color:#29abe2}.elemental-editor-drag-indicator__ball{position:relative;height:7px;width:7px;top:-2px;left:-3px;border-radius:3.5px;background-color:#29abe2}.element-editor--dragging{cursor:-webkit-grabbing;cursor:grabbing}.element-editor-drag-preview{top:0;left:0;position:fixed;pointer-events:none;z-index:100;background-color:#fff;border:1px solid #ced5e1;padding:.9231rem 1.5385rem;-webkit-box-shadow:0 2px 5px 0 rgba(0,0,0,.1),0 2px 10px 0 rgba(0,0,0,.1);box-shadow:0 2px 5px 0 rgba(0,0,0,.1),0 2px 10px 0 rgba(0,0,0,.1)}.text-checkbox-group-field .form-check{display:inline;padding-left:0;margin-bottom:0}.text-checkbox-group-field--read-only{display:-webkit-box;display:-webkit-flex;display:flex}.text-checkbox-group-field--read-only :first-child{-webkit-box-flex:1;-webkit-flex:1;flex:1}.text-checkbox-group-field--read-only .show-title{font-style:italic} +/*# sourceMappingURL=bundle.css.map*/ \ No newline at end of file diff --git a/client/src/boot/registerTransforms.js b/client/src/boot/registerTransforms.js index e42c9b4e..673d06da 100644 --- a/client/src/boot/registerTransforms.js +++ b/client/src/boot/registerTransforms.js @@ -9,6 +9,7 @@ import DuplicateAction from 'components/ElementActions/DuplicateAction'; import PublishAction from 'components/ElementActions/PublishAction'; import SaveAction from 'components/ElementActions/SaveAction'; import UnpublishAction from 'components/ElementActions/UnpublishAction'; +import MoveAction from 'components/ElementActions/MoveAction'; export default () => { Injector.transform( @@ -79,6 +80,7 @@ export default () => { updater.component('ElementActions', PublishAction, 'ElementActionsWithPublish'); updater.component('ElementActions', UnpublishAction, 'ElementActionsWithUnpublish'); updater.component('ElementActions', DuplicateAction, 'ElementActionsWithDuplicate'); + updater.component('ElementActions', MoveAction, 'ElementActionsWithMove'); updater.component('ElementActions', ArchiveAction, 'ElementActionsWithArchive'); }); }; diff --git a/client/src/components/ElementActions/MoveAction.js b/client/src/components/ElementActions/MoveAction.js new file mode 100644 index 00000000..fb0bfda7 --- /dev/null +++ b/client/src/components/ElementActions/MoveAction.js @@ -0,0 +1,73 @@ +/* global window */ +import React, { useState } from 'react'; +import { loadComponent } from 'lib/Injector'; +import { compose } from 'redux'; +import AbstractAction from 'components/ElementActions/AbstractAction'; +import moveBlockMutation from 'state/editor/moveBlockMutation'; +import { getConfig } from 'state/editor/elementConfig'; +import i18n from 'i18n'; + +/** + * Adds the elemental menu action to move a block of any state + */ +const MoveAction = (MenuComponent) => (props) => { + const FormBuilderModal = loadComponent('FormBuilderModal'); + const [modalOpen, setModalOpen] = useState(false); + const { element: { id }, actions: { handleMoveBlock } } = props; + + const handleClick = (event) => { + event.stopPropagation(); + + setModalOpen(true); + }; + + const closeModal = () => { + if (handleMoveBlock) { + handleMoveBlock(id).then(() => { + const preview = window.jQuery('.cms-preview'); + preview.entwine('ss.preview')._loadUrl(preview.find('iframe').attr('src')); + }); + } + + setModalOpen(false); + }; + + // Allow user to move to another page if they have create permissions + const disabled = props.element.canCreate !== undefined && !props.element.canCreate; + const label = i18n._t('ElementMoveAction.MOVE', 'Move'); + const title = disabled + ? i18n._t('ElementMoveAction.MOVE_PERMISSION_DENY', 'Move, insufficient permissions') + : label; + const newProps = { + label, + title, + disabled, + className: 'element-editor__actions-move', + onClick: handleClick, + toggle: props.toggle, + }; + + const modalSchemaUrl = `${getConfig().form.elementForm.moveModalSchemaUrl}/${id}`; + + // Todo: Render modal once per area rather than once per block + return ( + + {props.children} + + + + ); +}; + +export { MoveAction as Component }; + +export default compose(moveBlockMutation, MoveAction); diff --git a/client/src/state/editor/moveBlockMutation.js b/client/src/state/editor/moveBlockMutation.js new file mode 100644 index 00000000..4d98cbc0 --- /dev/null +++ b/client/src/state/editor/moveBlockMutation.js @@ -0,0 +1,42 @@ +import { graphql } from 'react-apollo'; +import gql from 'graphql-tag'; +import { config as readBlocksConfig, query as readBlocksQuery } from './readBlocksForAreaQuery'; + +// GraphQL query for moving a specific block +const mutation = gql` +mutation MoveBlock($blockId:ID!) { + moveBlock( + id: $blockId + ) { + id + } +} +`; + +const config = { + props: ({ mutate, ownProps: { actions } }) => { + const handleMoveBlock = (blockId) => mutate({ + variables: { + blockId, + }, + }); + + return { + actions: { + ...actions, + handleMoveBlock, + }, + }; + }, + options: ({ areaId }) => ({ + // Refetch versions after mutation is completed + refetchQueries: [{ + query: readBlocksQuery, + variables: readBlocksConfig.options({ areaId }).variables + }] + }), +}; + +export { mutation, config }; + +export default graphql(mutation, config); diff --git a/src/Controllers/ElementalAreaController.php b/src/Controllers/ElementalAreaController.php index d8c79a27..d7bfa013 100644 --- a/src/Controllers/ElementalAreaController.php +++ b/src/Controllers/ElementalAreaController.php @@ -3,17 +3,20 @@ namespace DNADesign\Elemental\Controllers; use DNADesign\Elemental\Forms\EditFormFactory; +use DNADesign\Elemental\Forms\MoveElementHandler; use DNADesign\Elemental\Models\BaseElement; use DNADesign\Elemental\Services\ElementTypeRegistry; use Exception; use Psr\Log\LoggerInterface; use SilverStripe\CMS\Controllers\CMSMain; +use SilverStripe\Control\Controller; use SilverStripe\Control\HTTPRequest; use SilverStripe\Control\HTTPResponse; use SilverStripe\Control\HTTPResponse_Exception; use SilverStripe\Core\Convert; use SilverStripe\Core\Injector\Injector; use SilverStripe\Forms\Form; +use SilverStripe\ORM\ValidationResult; use SilverStripe\Security\SecurityToken; /** @@ -38,6 +41,7 @@ class ElementalAreaController extends CMSMain 'schema', 'apiSaveForm', 'formAction', + 'moveElementForm', ]; public function getClientConfig() @@ -45,6 +49,7 @@ public function getClientConfig() $clientConfig = parent::getClientConfig(); $clientConfig['form']['elementForm'] = [ 'schemaUrl' => $this->Link('schema/elementForm'), + 'moveModalSchemaUrl' => $this->Link('schema/moveElementForm'), 'saveUrl' => $this->Link('api/saveForm'), 'saveMethod' => 'post', 'payloadFormat' => 'json', @@ -185,15 +190,57 @@ public function formAction(HTTPRequest $request) { $formName = $request->param('FormName'); - // Get the element ID from the form name - $id = substr($formName ?? '', strlen(sprintf(self::FORM_NAME_TEMPLATE ?? '', ''))); - $form = $this->getElementForm($id); + if (substr($formName, 0, 15) === 'MoveElementForm') { + // Get the element ID from the form name + $id = substr($formName, strlen(sprintf('MoveElementForm_%s', ''))); + $form = $this->getMoveElementForm($id); + } else { + // Get the element ID from the form name + $id = substr($formName, strlen(sprintf(self::FORM_NAME_TEMPLATE, ''))); + $form = $this->getElementForm($id); + } $field = $form->getRequestHandler()->handleField($request); return $field->handleRequest($request); } + public function moveElementForm(HTTPRequest $request) + { + $elementID = $request->param('ElementID'); + return $this->getMoveElementForm($elementID); + } + + public function getMoveElementForm($elementID) + { + $handler = MoveElementHandler::create($this); + $form = $handler->Form($elementID); + + $form->setValidationResponseCallback(function (ValidationResult $errors) use ($form, $elementID) { + $schemaId = Controller::join_links($this->Link('schema/moveElementForm'), $elementID); + return $this->getSchemaResponse($schemaId, $form, $errors); + }); + + return $form; + } + + public function moveelement($data, $form) + { + $id = $data['ElementID']; + $record = BaseElement::get()->byID($id); + $handler = MoveElementHandler::create($this); + $results = $handler->moveElement($record, $data); + + if (!isset($results)) { + return null; + } + + // Send extra "message" data with schema response + $extraData = ['message' => $results]; + $schemaId = Controller::join_links($this->Link('schema/moveElementForm'), $id); + return $this->getSchemaResponse($schemaId, $form, null, $extraData); + } + /** * Remove the pseudo namespaces that were added to form fields by the form factory * diff --git a/src/Forms/MoveElementHandler.php b/src/Forms/MoveElementHandler.php new file mode 100644 index 00000000..2e2bd561 --- /dev/null +++ b/src/Forms/MoveElementHandler.php @@ -0,0 +1,150 @@ +controller = $controller; + } + + public function Form($elementID) + { + $fields = FieldList::create([ + LiteralField::create( + 'MoveWarning', + '

' . + 'Note: All published blocks will change to draft state once moved. ' . + 'If you would like to copy this block to another page, duplicate this block and then ' . + 'move the duplicate.' . + '

' + ), + HiddenField::create( + 'ElementID', + null, + $elementID + ), + $pageField = TreeDropdownField::create( + 'PageID', + 'Select a page', + SiteTree::class + ) + // TODO add check if there's multiple elemental areas on the selected page + ]); + $actions = FieldList::create([ + FormAction::create('moveelement', 'Move') + ->addExtraClass('btn btn-primary') + ]); + + $pageField->setDisableFunction(function ($page) { + return !$page->hasExtension(ElementalPageExtension::class); + }); + + $form = Form::create( + $this->controller, + sprintf('MoveElementForm_%s', $elementID), + $fields, + $actions + ); + + // Todo: make this dynamic + $form->setFormAction('admin/elemental-area/MoveElementForm/'); + $form->addExtraClass('form--no-dividers'); + + return $form; + } + + public function moveElement($element, $formData) + { + $page = SiteTree::get()->byId($formData['PageID']); + + // if ElementalAreaNotFound + if (!$page->ElementalArea()->exists()) { + throw $this->validationResult(_t( + __CLASS__ . '.ElementalAreaNotFound', + 'Could not find an elemental area on {PageName} to move ' . + '{BlockName} to', + [ + 'PageName' => $page->Title, + 'BlockName' => $element->Title + ] + )); + } + + if (!$page->canEdit() || !$element->canEdit()) { + throw $this->validationResult(_t( + __CLASS__ . '.InsufficientPermissions', + 'Can not move {PageName} to {BlockName} due to ' . + 'insufficient permissions', + [ + 'PageName' => $page->Title, + 'BlockName' => $element->Title + ] + )); + } + + // TODO: Error handling + // TODO: pages with multiple element areas + // TODO: How does this work with sort? + $page->ElementalArea()->Elements()->add($element->ID); + + $request = $this->controller->getRequest(); + $message = _t( + __CLASS__ . '.Success', + 'Successfully moved {BlockName} to {PageName}.', + [ + 'BlockName' => $element->Title, + 'BlockEditLink' => $element->MovedElementCMSLink(true, $element->ID), + 'PageName' => $page->Title, + 'PageEditLink' => $page->CMSEditLink(), + ] + ); + if ($request->getHeader('X-Formschema-Request')) { + return $message; + } elseif (Director::is_ajax()) { + $response = new HTTPResponse($message, 200); + + $response->addHeader('Content-Type', 'text/html; charset=utf-8'); + return $response; + } else { + return $this->controller->redirectBack(); + } + } + + /** + * Raise validation error + * + * @param string $message + * @param string $field + * @return ValidationException + */ + protected function validationResult($message, $field = null) + { + $error = ValidationResult::create() + ->addFieldError($field, $message); + return new ValidationException($error); + } +} diff --git a/src/Models/BaseElement.php b/src/Models/BaseElement.php index 191d95d7..26fe39f2 100644 --- a/src/Models/BaseElement.php +++ b/src/Models/BaseElement.php @@ -826,14 +826,43 @@ public function CMSEditLink($directLink = false) return $link; } + /** + * @param boolean $directLink + * @param integer|null $elementID + * @return void + * @throws \SilverStripe\ORM\ValidationException + */ + public function MovedElementCMSLink(bool $directLink, int $elementID = null) + { + // Allow for repeated calls to be returned from cache + if (isset($this->cacheData['cms_edit_link'])) { + return $this->cacheData['cms_edit_link']; + } + + $link = $this->getElementCMSLink($directLink, $elementID); + $this->extend('updateCMSEditLink', $link); + + if ($link) { + $this->cacheData['cms_edit_link'] = $link; + } + + return $link; + } + /** * @param bool $directLink + * @param int $elementID * @return null|string */ - private function getElementCMSLink(bool $directLink) + private function getElementCMSLink(bool $directLink, int $elementID = null) { $relationName = $this->getAreaRelationName(); - $page = $this->getPage(); + if ($elementID) { + $element = BaseElement::get_by_id($elementID); + $page = $element->getPage(); + } else { + $page = $this->getPage(); + } $link = null;