diff --git a/Resources/Private/JavaScript/CkStyles/src/BlockStyleCommand.js b/Resources/Private/JavaScript/CkStyles/src/BlockStyleCommand.js index 0df80b9..f3cb42f 100644 --- a/Resources/Private/JavaScript/CkStyles/src/BlockStyleCommand.js +++ b/Resources/Private/JavaScript/CkStyles/src/BlockStyleCommand.js @@ -40,9 +40,12 @@ export default class BlockStyleCommand extends Command { const blocksToChange = Array.from(doc.selection.getSelectedBlocks()); this.value = this._getValueFromBlockNode(); + this.isEnabled = false; + for (const block of blocksToChange) { if (model.schema.checkAttribute(block, this.attributeKey)) { this.isEnabled = true; + break; } } } diff --git a/Resources/Private/JavaScript/CkStyles/src/components/BlockStyleSelector.js b/Resources/Private/JavaScript/CkStyles/src/components/BlockStyleSelector.js index 73c9e8f..453da48 100644 --- a/Resources/Private/JavaScript/CkStyles/src/components/BlockStyleSelector.js +++ b/Resources/Private/JavaScript/CkStyles/src/components/BlockStyleSelector.js @@ -9,7 +9,7 @@ import * as CkEditorApi from '@neos-project/neos-ui-ckeditor5-bindings'; @connect( state => ({ - formattingUnderCursor: selectors.CR.Nodes.focusedNodePathSelector(state), + formattingUnderCursor: selectors.UI.ContentCanvas.formattingUnderCursor(state), }) ) export default class BlockStyleSelector extends PureComponent { diff --git a/Resources/Private/JavaScript/CkStyles/src/components/InlineStyleSelector.js b/Resources/Private/JavaScript/CkStyles/src/components/InlineStyleSelector.js index 807279c..4d1a381 100644 --- a/Resources/Private/JavaScript/CkStyles/src/components/InlineStyleSelector.js +++ b/Resources/Private/JavaScript/CkStyles/src/components/InlineStyleSelector.js @@ -9,7 +9,7 @@ import * as CkEditorApi from '@neos-project/neos-ui-ckeditor5-bindings'; @connect( state => ({ - formattingUnderCursor: selectors.CR.Nodes.focusedNodePathSelector(state), + formattingUnderCursor: selectors.UI.ContentCanvas.formattingUnderCursor(state), }) ) export default class InlineStyleSelector extends PureComponent { diff --git a/Resources/Public/JavaScript/CkStyles/Plugin.js b/Resources/Public/JavaScript/CkStyles/Plugin.js index fbcebf7..e4a2327 100644 --- a/Resources/Public/JavaScript/CkStyles/Plugin.js +++ b/Resources/Public/JavaScript/CkStyles/Plugin.js @@ -286,7 +286,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n}); /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = undefined;\n\nvar _ckeditor5Exports = __webpack_require__(/*! ckeditor5-exports */ \"./node_modules/@neos-project/neos-ui-extensibility/dist/shims/vendor/ckeditor5-exports/index.js\");\n\n/**\n * Set a key-value block style; e.g. \"fontColor=red\".\n */\n\nvar BlockStyleCommand = class BlockStyleCommand extends _ckeditor5Exports.Command {\n /**\n * @param {module:core/editor/editor~Editor} editor\n * @param {String} attributeKey Attribute that will be set by the command.\n */\n constructor(editor, attributeKey) {\n super(editor);\n\n /**\n * The attribute that will be set by the command.\n *\n * @readonly\n * @member {String}\n */\n this.attributeKey = attributeKey;\n\n /**\n * Flag indicating whether the command is active. The command is active when the\n * {@link module:engine/model/selection~Selection#hasAttribute selection has the attribute} which means that:\n *\n * @observable\n * @readonly\n * @member {Boolean} #value\n */\n }\n\n /**\n * Updates the command's {@link #value} and {@link #isEnabled}.\n */\n refresh() {\n var model = this.editor.model;\n var doc = model.document;\n var blocksToChange = Array.from(doc.selection.getSelectedBlocks());\n\n this.value = this._getValueFromBlockNode();\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = blocksToChange[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var block = _step.value;\n\n if (model.schema.checkAttribute(block, this.attributeKey)) {\n this.isEnabled = true;\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n }\n\n /**\n * Executes the command — sets the attribute to the desired value. If there is no desired valued, removes the\n * attribute on each block.\n *\n * @fires execute\n * @param {Object} [options] Command options.\n * @param {String} [options.value] The value to be set; if null or not existing, the attribute will be removed.\n */\n execute() {\n var _this = this;\n\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n var model = this.editor.model;\n var doc = model.document;\n var selection = doc.selection;\n var value = options.value;\n var blocksToChange = Array.from(selection.getSelectedBlocks());\n model.change(function (writer) {\n var _iteratorNormalCompletion2 = true;\n var _didIteratorError2 = false;\n var _iteratorError2 = undefined;\n\n try {\n for (var _iterator2 = blocksToChange[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n var block = _step2.value;\n\n if (value) {\n writer.setAttribute(_this.attributeKey, value, block);\n } else {\n writer.removeAttribute(_this.attributeKey, block);\n }\n }\n } catch (err) {\n _didIteratorError2 = true;\n _iteratorError2 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion2 && _iterator2.return) {\n _iterator2.return();\n }\n } finally {\n if (_didIteratorError2) {\n throw _iteratorError2;\n }\n }\n }\n });\n }\n\n /**\n * Checks the attribute value of the parent block node(s)\n *\n * @private\n * @returns {String} The attribute value.\n */\n _getValueFromBlockNode() {\n var model = this.editor.model;\n var schema = model.schema;\n var selection = model.document.selection;\n var blocks = Array.from(selection.getSelectedBlocks());\n\n var _iteratorNormalCompletion3 = true;\n var _didIteratorError3 = false;\n var _iteratorError3 = undefined;\n\n try {\n for (var _iterator3 = blocks[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {\n var block = _step3.value;\n\n if (schema.checkAttribute(block, this.attributeKey)) {\n return block.getAttribute(this.attributeKey);\n }\n }\n } catch (err) {\n _didIteratorError3 = true;\n _iteratorError3 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion3 && _iterator3.return) {\n _iterator3.return();\n }\n } finally {\n if (_didIteratorError3) {\n throw _iteratorError3;\n }\n }\n }\n\n return undefined;\n }\n}; // Originally taken from https://raw.githubusercontent.com/ckeditor/ckeditor5/master/packages/ckeditor5-basic-styles/src/attributecommand.js and adjusted\n\nexports.default = BlockStyleCommand;\n\n//# sourceURL=webpack:///./src/BlockStyleCommand.js?"); +eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = undefined;\n\nvar _ckeditor5Exports = __webpack_require__(/*! ckeditor5-exports */ \"./node_modules/@neos-project/neos-ui-extensibility/dist/shims/vendor/ckeditor5-exports/index.js\");\n\n/**\n * Set a key-value block style; e.g. \"fontColor=red\".\n */\n\nvar BlockStyleCommand = class BlockStyleCommand extends _ckeditor5Exports.Command {\n /**\n * @param {module:core/editor/editor~Editor} editor\n * @param {String} attributeKey Attribute that will be set by the command.\n */\n constructor(editor, attributeKey) {\n super(editor);\n\n /**\n * The attribute that will be set by the command.\n *\n * @readonly\n * @member {String}\n */\n this.attributeKey = attributeKey;\n\n /**\n * Flag indicating whether the command is active. The command is active when the\n * {@link module:engine/model/selection~Selection#hasAttribute selection has the attribute} which means that:\n *\n * @observable\n * @readonly\n * @member {Boolean} #value\n */\n }\n\n /**\n * Updates the command's {@link #value} and {@link #isEnabled}.\n */\n refresh() {\n var model = this.editor.model;\n var doc = model.document;\n var blocksToChange = Array.from(doc.selection.getSelectedBlocks());\n\n this.value = this._getValueFromBlockNode();\n this.isEnabled = false;\n\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = blocksToChange[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var block = _step.value;\n\n if (model.schema.checkAttribute(block, this.attributeKey)) {\n this.isEnabled = true;\n break;\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n }\n\n /**\n * Executes the command — sets the attribute to the desired value. If there is no desired valued, removes the\n * attribute on each block.\n *\n * @fires execute\n * @param {Object} [options] Command options.\n * @param {String} [options.value] The value to be set; if null or not existing, the attribute will be removed.\n */\n execute() {\n var _this = this;\n\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n var model = this.editor.model;\n var doc = model.document;\n var selection = doc.selection;\n var value = options.value;\n var blocksToChange = Array.from(selection.getSelectedBlocks());\n model.change(function (writer) {\n var _iteratorNormalCompletion2 = true;\n var _didIteratorError2 = false;\n var _iteratorError2 = undefined;\n\n try {\n for (var _iterator2 = blocksToChange[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n var block = _step2.value;\n\n if (value) {\n writer.setAttribute(_this.attributeKey, value, block);\n } else {\n writer.removeAttribute(_this.attributeKey, block);\n }\n }\n } catch (err) {\n _didIteratorError2 = true;\n _iteratorError2 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion2 && _iterator2.return) {\n _iterator2.return();\n }\n } finally {\n if (_didIteratorError2) {\n throw _iteratorError2;\n }\n }\n }\n });\n }\n\n /**\n * Checks the attribute value of the parent block node(s)\n *\n * @private\n * @returns {String} The attribute value.\n */\n _getValueFromBlockNode() {\n var model = this.editor.model;\n var schema = model.schema;\n var selection = model.document.selection;\n var blocks = Array.from(selection.getSelectedBlocks());\n\n var _iteratorNormalCompletion3 = true;\n var _didIteratorError3 = false;\n var _iteratorError3 = undefined;\n\n try {\n for (var _iterator3 = blocks[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {\n var block = _step3.value;\n\n if (schema.checkAttribute(block, this.attributeKey)) {\n return block.getAttribute(this.attributeKey);\n }\n }\n } catch (err) {\n _didIteratorError3 = true;\n _iteratorError3 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion3 && _iterator3.return) {\n _iterator3.return();\n }\n } finally {\n if (_didIteratorError3) {\n throw _iteratorError3;\n }\n }\n }\n\n return undefined;\n }\n}; // Originally taken from https://raw.githubusercontent.com/ckeditor/ckeditor5/master/packages/ckeditor5-basic-styles/src/attributecommand.js and adjusted\n\nexports.default = BlockStyleCommand;\n\n//# sourceURL=webpack:///./src/BlockStyleCommand.js?"); /***/ }), @@ -346,7 +346,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n}); /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = undefined;\n\nvar _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\"); } }; }();\n\nvar _dec, _class, _class2, _temp;\n\nvar _react = __webpack_require__(/*! react */ \"./node_modules/@neos-project/neos-ui-extensibility/dist/shims/vendor/react/index.js\");\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _propTypes = __webpack_require__(/*! prop-types */ \"./node_modules/@neos-project/neos-ui-extensibility/dist/shims/vendor/prop-types/index.js\");\n\nvar _propTypes2 = _interopRequireDefault(_propTypes);\n\nvar _reactUiComponents = __webpack_require__(/*! @neos-project/react-ui-components */ \"./node_modules/@neos-project/neos-ui-extensibility/dist/shims/neosProjectPackages/react-ui-components/index.js\");\n\nvar _reactRedux = __webpack_require__(/*! react-redux */ \"./node_modules/@neos-project/neos-ui-extensibility/dist/shims/vendor/react-redux/index.js\");\n\nvar _PresetType = __webpack_require__(/*! ../PresetType */ \"./src/PresetType.js\");\n\nvar _PresetType2 = _interopRequireDefault(_PresetType);\n\nvar _neosUiReduxStore = __webpack_require__(/*! @neos-project/neos-ui-redux-store */ \"./node_modules/@neos-project/neos-ui-extensibility/dist/shims/neosProjectPackages/neos-ui-redux-store/index.js\");\n\nvar _neosUiCkeditor5Bindings = __webpack_require__(/*! @neos-project/neos-ui-ckeditor5-bindings */ \"./node_modules/@neos-project/neos-ui-extensibility/dist/shims/neosProjectPackages/neos-ui-ckeditor5-bindings/index.js\");\n\nvar CkEditorApi = _interopRequireWildcard(_neosUiCkeditor5Bindings);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar BlockStyleSelector = (_dec = (0, _reactRedux.connect)(function (state) {\n return {\n formattingUnderCursor: _neosUiReduxStore.selectors.CR.Nodes.focusedNodePathSelector(state)\n };\n}), _dec(_class = (_temp = _class2 = class BlockStyleSelector extends _react.PureComponent {\n\n constructor() {\n super(...arguments);\n\n this.handleOnSelect = this.handleOnSelect.bind(this);\n }\n\n render() {\n var optionsForSelect = Object.entries(this.props.presetConfiguration.options).map(function (_ref) {\n var _ref2 = _slicedToArray(_ref, 2),\n optionIdentifier = _ref2[0],\n optionConfiguration = _ref2[1];\n\n return {\n value: optionIdentifier,\n label: optionConfiguration.label\n };\n });\n\n if (optionsForSelect.length === 0) {\n return null;\n }\n\n var currentValue = this.props.formattingUnderCursor['blockStyles:' + this.props.presetIdentifier];\n\n return _react2.default.createElement(_reactUiComponents.SelectBox, {\n options: optionsForSelect,\n value: currentValue,\n allowEmpty: true,\n placeholder: this.props.presetConfiguration.label,\n onValueChange: this.handleOnSelect\n });\n }\n\n handleOnSelect(optionIdentifier) {\n CkEditorApi.executeCommand('blockStyles:' + this.props.presetIdentifier, { value: optionIdentifier });\n }\n}, _class2.propTypes = {\n // from outside props\n presetIdentifier: _propTypes2.default.string.isRequired,\n presetConfiguration: _PresetType2.default.isRequired,\n\n // from @connect\n formattingUnderCursor: _propTypes2.default.object\n}, _temp)) || _class);\nexports.default = BlockStyleSelector;\n\n//# sourceURL=webpack:///./src/components/BlockStyleSelector.js?"); +eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\nexports.default = undefined;\n\nvar _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\"); } }; }();\n\nvar _dec, _class, _class2, _temp;\n\nvar _react = __webpack_require__(/*! react */ \"./node_modules/@neos-project/neos-ui-extensibility/dist/shims/vendor/react/index.js\");\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _propTypes = __webpack_require__(/*! prop-types */ \"./node_modules/@neos-project/neos-ui-extensibility/dist/shims/vendor/prop-types/index.js\");\n\nvar _propTypes2 = _interopRequireDefault(_propTypes);\n\nvar _reactUiComponents = __webpack_require__(/*! @neos-project/react-ui-components */ \"./node_modules/@neos-project/neos-ui-extensibility/dist/shims/neosProjectPackages/react-ui-components/index.js\");\n\nvar _reactRedux = __webpack_require__(/*! react-redux */ \"./node_modules/@neos-project/neos-ui-extensibility/dist/shims/vendor/react-redux/index.js\");\n\nvar _PresetType = __webpack_require__(/*! ../PresetType */ \"./src/PresetType.js\");\n\nvar _PresetType2 = _interopRequireDefault(_PresetType);\n\nvar _neosUiReduxStore = __webpack_require__(/*! @neos-project/neos-ui-redux-store */ \"./node_modules/@neos-project/neos-ui-extensibility/dist/shims/neosProjectPackages/neos-ui-redux-store/index.js\");\n\nvar _neosUiCkeditor5Bindings = __webpack_require__(/*! @neos-project/neos-ui-ckeditor5-bindings */ \"./node_modules/@neos-project/neos-ui-extensibility/dist/shims/neosProjectPackages/neos-ui-ckeditor5-bindings/index.js\");\n\nvar CkEditorApi = _interopRequireWildcard(_neosUiCkeditor5Bindings);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar BlockStyleSelector = (_dec = (0, _reactRedux.connect)(function (state) {\n\treturn {\n\t\tformattingUnderCursor: _neosUiReduxStore.selectors.UI.ContentCanvas.formattingUnderCursor(state)\n\t};\n}), _dec(_class = (_temp = _class2 = class BlockStyleSelector extends _react.PureComponent {\n\n\tconstructor() {\n\t\tsuper(...arguments);\n\n\t\tthis.handleOnSelect = this.handleOnSelect.bind(this);\n\t}\n\n\trender() {\n\t\tvar optionsForSelect = Object.entries(this.props.presetConfiguration.options).map(function (_ref) {\n\t\t\tvar _ref2 = _slicedToArray(_ref, 2),\n\t\t\t optionIdentifier = _ref2[0],\n\t\t\t optionConfiguration = _ref2[1];\n\n\t\t\treturn {\n\t\t\t\tvalue: optionIdentifier,\n\t\t\t\tlabel: optionConfiguration.label\n\t\t\t};\n\t\t});\n\n\t\tif (optionsForSelect.length === 0) {\n\t\t\treturn null;\n\t\t}\n\n\t\tvar currentValue = this.props.formattingUnderCursor['blockStyles:' + this.props.presetIdentifier];\n\n\t\treturn _react2.default.createElement(_reactUiComponents.SelectBox, {\n\t\t\toptions: optionsForSelect,\n\t\t\tvalue: currentValue,\n\t\t\tallowEmpty: true,\n\t\t\tplaceholder: this.props.presetConfiguration.label,\n\t\t\tonValueChange: this.handleOnSelect\n\t\t});\n\t}\n\n\thandleOnSelect(optionIdentifier) {\n\t\tCkEditorApi.executeCommand('blockStyles:' + this.props.presetIdentifier, { value: optionIdentifier });\n\t}\n}, _class2.propTypes = {\n\t// from outside props\n\tpresetIdentifier: _propTypes2.default.string.isRequired,\n\tpresetConfiguration: _PresetType2.default.isRequired,\n\n\t// from @connect\n\tformattingUnderCursor: _propTypes2.default.object\n}, _temp)) || _class);\nexports.default = BlockStyleSelector;\n\n//# sourceURL=webpack:///./src/components/BlockStyleSelector.js?"); /***/ }), @@ -358,7 +358,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n}); /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = undefined;\n\nvar _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\"); } }; }();\n\nvar _dec, _class, _class2, _temp;\n\nvar _react = __webpack_require__(/*! react */ \"./node_modules/@neos-project/neos-ui-extensibility/dist/shims/vendor/react/index.js\");\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _propTypes = __webpack_require__(/*! prop-types */ \"./node_modules/@neos-project/neos-ui-extensibility/dist/shims/vendor/prop-types/index.js\");\n\nvar _propTypes2 = _interopRequireDefault(_propTypes);\n\nvar _reactUiComponents = __webpack_require__(/*! @neos-project/react-ui-components */ \"./node_modules/@neos-project/neos-ui-extensibility/dist/shims/neosProjectPackages/react-ui-components/index.js\");\n\nvar _reactRedux = __webpack_require__(/*! react-redux */ \"./node_modules/@neos-project/neos-ui-extensibility/dist/shims/vendor/react-redux/index.js\");\n\nvar _PresetType = __webpack_require__(/*! ../PresetType */ \"./src/PresetType.js\");\n\nvar _PresetType2 = _interopRequireDefault(_PresetType);\n\nvar _neosUiReduxStore = __webpack_require__(/*! @neos-project/neos-ui-redux-store */ \"./node_modules/@neos-project/neos-ui-extensibility/dist/shims/neosProjectPackages/neos-ui-redux-store/index.js\");\n\nvar _neosUiCkeditor5Bindings = __webpack_require__(/*! @neos-project/neos-ui-ckeditor5-bindings */ \"./node_modules/@neos-project/neos-ui-extensibility/dist/shims/neosProjectPackages/neos-ui-ckeditor5-bindings/index.js\");\n\nvar CkEditorApi = _interopRequireWildcard(_neosUiCkeditor5Bindings);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar InlineStyleSelector = (_dec = (0, _reactRedux.connect)(function (state) {\n return {\n formattingUnderCursor: _neosUiReduxStore.selectors.CR.Nodes.focusedNodePathSelector(state)\n };\n}), _dec(_class = (_temp = _class2 = class InlineStyleSelector extends _react.PureComponent {\n\n constructor() {\n super(...arguments);\n\n this.handleOnSelect = this.handleOnSelect.bind(this);\n }\n\n render() {\n var optionsForSelect = Object.entries(this.props.presetConfiguration.options).map(function (_ref) {\n var _ref2 = _slicedToArray(_ref, 2),\n optionIdentifier = _ref2[0],\n optionConfiguration = _ref2[1];\n\n return {\n value: optionIdentifier,\n label: optionConfiguration.label\n };\n });\n\n if (optionsForSelect.length === 0) {\n return null;\n }\n\n var currentValue = this.props.formattingUnderCursor['inlineStyles:' + this.props.presetIdentifier];\n\n return _react2.default.createElement(_reactUiComponents.SelectBox, {\n options: optionsForSelect,\n value: currentValue,\n allowEmpty: true,\n placeholder: this.props.presetConfiguration.label,\n onValueChange: this.handleOnSelect\n });\n }\n\n handleOnSelect(optionIdentifier) {\n CkEditorApi.executeCommand('inlineStyles:' + this.props.presetIdentifier, { value: optionIdentifier });\n }\n}, _class2.propTypes = {\n // from outside props\n presetIdentifier: _propTypes2.default.string.isRequired,\n presetConfiguration: _PresetType2.default.isRequired,\n\n // from @connect\n formattingUnderCursor: _propTypes2.default.object\n}, _temp)) || _class);\nexports.default = InlineStyleSelector;\n\n//# sourceURL=webpack:///./src/components/InlineStyleSelector.js?"); +eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\nexports.default = undefined;\n\nvar _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\"); } }; }();\n\nvar _dec, _class, _class2, _temp;\n\nvar _react = __webpack_require__(/*! react */ \"./node_modules/@neos-project/neos-ui-extensibility/dist/shims/vendor/react/index.js\");\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _propTypes = __webpack_require__(/*! prop-types */ \"./node_modules/@neos-project/neos-ui-extensibility/dist/shims/vendor/prop-types/index.js\");\n\nvar _propTypes2 = _interopRequireDefault(_propTypes);\n\nvar _reactUiComponents = __webpack_require__(/*! @neos-project/react-ui-components */ \"./node_modules/@neos-project/neos-ui-extensibility/dist/shims/neosProjectPackages/react-ui-components/index.js\");\n\nvar _reactRedux = __webpack_require__(/*! react-redux */ \"./node_modules/@neos-project/neos-ui-extensibility/dist/shims/vendor/react-redux/index.js\");\n\nvar _PresetType = __webpack_require__(/*! ../PresetType */ \"./src/PresetType.js\");\n\nvar _PresetType2 = _interopRequireDefault(_PresetType);\n\nvar _neosUiReduxStore = __webpack_require__(/*! @neos-project/neos-ui-redux-store */ \"./node_modules/@neos-project/neos-ui-extensibility/dist/shims/neosProjectPackages/neos-ui-redux-store/index.js\");\n\nvar _neosUiCkeditor5Bindings = __webpack_require__(/*! @neos-project/neos-ui-ckeditor5-bindings */ \"./node_modules/@neos-project/neos-ui-extensibility/dist/shims/neosProjectPackages/neos-ui-ckeditor5-bindings/index.js\");\n\nvar CkEditorApi = _interopRequireWildcard(_neosUiCkeditor5Bindings);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar InlineStyleSelector = (_dec = (0, _reactRedux.connect)(function (state) {\n\treturn {\n\t\tformattingUnderCursor: _neosUiReduxStore.selectors.UI.ContentCanvas.formattingUnderCursor(state)\n\t};\n}), _dec(_class = (_temp = _class2 = class InlineStyleSelector extends _react.PureComponent {\n\n\tconstructor() {\n\t\tsuper(...arguments);\n\n\t\tthis.handleOnSelect = this.handleOnSelect.bind(this);\n\t}\n\n\trender() {\n\t\tvar optionsForSelect = Object.entries(this.props.presetConfiguration.options).map(function (_ref) {\n\t\t\tvar _ref2 = _slicedToArray(_ref, 2),\n\t\t\t optionIdentifier = _ref2[0],\n\t\t\t optionConfiguration = _ref2[1];\n\n\t\t\treturn {\n\t\t\t\tvalue: optionIdentifier,\n\t\t\t\tlabel: optionConfiguration.label\n\t\t\t};\n\t\t});\n\n\t\tif (optionsForSelect.length === 0) {\n\t\t\treturn null;\n\t\t}\n\n\t\tvar currentValue = this.props.formattingUnderCursor['inlineStyles:' + this.props.presetIdentifier];\n\n\t\treturn _react2.default.createElement(_reactUiComponents.SelectBox, {\n\t\t\toptions: optionsForSelect,\n\t\t\tvalue: currentValue,\n\t\t\tallowEmpty: true,\n\t\t\tplaceholder: this.props.presetConfiguration.label,\n\t\t\tonValueChange: this.handleOnSelect\n\t\t});\n\t}\n\n\thandleOnSelect(optionIdentifier) {\n\t\tCkEditorApi.executeCommand('inlineStyles:' + this.props.presetIdentifier, { value: optionIdentifier });\n\t}\n}, _class2.propTypes = {\n\t// from outside props\n\tpresetIdentifier: _propTypes2.default.string.isRequired,\n\tpresetConfiguration: _PresetType2.default.isRequired,\n\n\t// from @connect\n\tformattingUnderCursor: _propTypes2.default.object\n}, _temp)) || _class);\nexports.default = InlineStyleSelector;\n\n//# sourceURL=webpack:///./src/components/InlineStyleSelector.js?"); /***/ }),