@gravity-ui/page-constructor 3.9.2 → 3.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/build/cjs/components/BlockBase/BlockBase.d.ts +2 -2
- package/build/cjs/components/BlockBase/BlockBase.js +3 -5
- package/build/cjs/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.d.ts +2 -3
- package/build/cjs/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.js +7 -3
- package/build/cjs/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js +2 -1
- package/build/cjs/customization/BlockDecoration.js +4 -5
- package/build/cjs/editor/components/EditBlock/EditBlock.css +15 -7
- package/build/cjs/editor/components/EditBlock/EditBlock.d.ts +1 -1
- package/build/cjs/editor/components/EditBlock/EditBlock.js +7 -3
- package/build/cjs/editor/components/NotFoundBlock/NotFoundBlock.css +21 -0
- package/build/cjs/editor/components/NotFoundBlock/NotFoundBlock.d.ts +2 -0
- package/build/cjs/editor/components/NotFoundBlock/NotFoundBlock.js +12 -0
- package/build/cjs/editor/components/NotFoundBlock/i18n/en.json +3 -0
- package/build/cjs/editor/components/NotFoundBlock/i18n/index.d.ts +2 -0
- package/build/cjs/editor/components/NotFoundBlock/i18n/index.js +8 -0
- package/build/cjs/editor/components/NotFoundBlock/i18n/ru.json +3 -0
- package/build/cjs/editor/containers/Editor/Editor.js +2 -0
- package/build/cjs/editor/data/templates/banner-block.json +1 -1
- package/build/cjs/editor/data/templates/questions-block.json +10 -10
- package/build/cjs/editor/store/index.d.ts +1 -1
- package/build/cjs/editor/store/index.js +5 -6
- package/build/cjs/models/customization.d.ts +2 -2
- package/build/cjs/utils/imageCompress.js +1 -1
- package/build/esm/components/BlockBase/BlockBase.d.ts +2 -2
- package/build/esm/components/BlockBase/BlockBase.js +3 -5
- package/build/esm/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.d.ts +2 -3
- package/build/esm/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.js +7 -3
- package/build/esm/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js +2 -1
- package/build/esm/customization/BlockDecoration.js +4 -5
- package/build/esm/editor/components/EditBlock/EditBlock.css +15 -7
- package/build/esm/editor/components/EditBlock/EditBlock.d.ts +1 -1
- package/build/esm/editor/components/EditBlock/EditBlock.js +7 -3
- package/build/esm/editor/components/NotFoundBlock/NotFoundBlock.css +21 -0
- package/build/esm/editor/components/NotFoundBlock/NotFoundBlock.d.ts +3 -0
- package/build/esm/editor/components/NotFoundBlock/NotFoundBlock.js +8 -0
- package/build/esm/editor/components/NotFoundBlock/i18n/en.json +3 -0
- package/build/esm/editor/components/NotFoundBlock/i18n/index.d.ts +2 -0
- package/build/esm/editor/components/NotFoundBlock/i18n/index.js +5 -0
- package/build/esm/editor/components/NotFoundBlock/i18n/ru.json +3 -0
- package/build/esm/editor/containers/Editor/Editor.js +2 -0
- package/build/esm/editor/data/templates/banner-block.json +1 -1
- package/build/esm/editor/data/templates/questions-block.json +10 -10
- package/build/esm/editor/store/index.d.ts +1 -1
- package/build/esm/editor/store/index.js +5 -6
- package/build/esm/models/customization.d.ts +2 -2
- package/build/esm/utils/imageCompress.js +1 -1
- package/package.json +1 -1
- package/server/models/customization.d.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [3.10.0](https://github.com/gravity-ui/page-constructor/compare/v3.9.2...v3.10.0) (2023-07-04)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add not found block dummy and refactor ([#435](https://github.com/gravity-ui/page-constructor/issues/435)) ([610df6a](https://github.com/gravity-ui/page-constructor/commit/610df6a65a307d357a3e2f39d401972ed595974a))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* fix extention extraction for image isCompressible util ([#401](https://github.com/gravity-ui/page-constructor/issues/401)) ([5eea616](https://github.com/gravity-ui/page-constructor/commit/5eea6162854f507e7402dd943ebb8b111dcac53d))
|
|
14
|
+
|
|
3
15
|
## [3.9.2](https://github.com/gravity-ui/page-constructor/compare/v3.9.1...v3.9.2) (2023-06-28)
|
|
4
16
|
|
|
5
17
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { BlockBaseProps,
|
|
3
|
-
export type BlockBaseFullProps = BlockBaseProps &
|
|
2
|
+
import { BlockBaseProps, ClassNameProps } from '../../models';
|
|
3
|
+
export type BlockBaseFullProps = BlockBaseProps & ClassNameProps & PropsWithChildren;
|
|
4
4
|
declare const BlockBase: (props: BlockBaseFullProps) => JSX.Element;
|
|
5
5
|
export default BlockBase;
|
|
@@ -2,16 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
|
-
const BlockDecoration_1 = require("../../customization/BlockDecoration");
|
|
6
5
|
const grid_1 = require("../../grid");
|
|
7
6
|
const utils_1 = require("../../utils");
|
|
8
7
|
const Anchor_1 = tslib_1.__importDefault(require("../Anchor/Anchor"));
|
|
9
8
|
const b = (0, utils_1.block)('block-base');
|
|
10
9
|
const BlockBase = (props) => {
|
|
11
|
-
const { anchor, visible, children, className, resetPaddings, qa
|
|
10
|
+
const { anchor, visible, children, className, resetPaddings, qa } = props;
|
|
12
11
|
return (react_1.default.createElement(grid_1.Col, { className: b({ ['reset-paddings']: resetPaddings }, className), visible: visible, reset: true, dataQa: qa },
|
|
13
|
-
react_1.default.createElement(
|
|
14
|
-
|
|
15
|
-
children)));
|
|
12
|
+
anchor && react_1.default.createElement(Anchor_1.default, { id: anchor.url, className: b('anchor') }),
|
|
13
|
+
children));
|
|
16
14
|
};
|
|
17
15
|
exports.default = BlockBase;
|
package/build/cjs/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
interface ConstructorBlockProps extends Pick<BlockBaseFullProps, 'index'> {
|
|
2
|
+
import { Block, BlockDecorationProps, WithChildren } from '../../../../models';
|
|
3
|
+
interface ConstructorBlockProps extends Pick<BlockDecorationProps, 'index'> {
|
|
5
4
|
data: Block;
|
|
6
5
|
}
|
|
7
6
|
export declare const ConstructorBlock: React.FC<WithChildren<ConstructorBlockProps>>;
|
package/build/cjs/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.js
CHANGED
|
@@ -2,12 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ConstructorBlock = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const react_1 = tslib_1.
|
|
5
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
6
7
|
const BlockBase_1 = tslib_1.__importDefault(require("../../../../components/BlockBase/BlockBase"));
|
|
8
|
+
const BlockDecoration_1 = require("../../../../customization/BlockDecoration");
|
|
7
9
|
const utils_1 = require("../../../../utils");
|
|
8
10
|
const b = (0, utils_1.block)('constructor-block');
|
|
9
11
|
const ConstructorBlock = ({ index = 0, data, children, }) => {
|
|
10
|
-
const {
|
|
11
|
-
|
|
12
|
+
const { type } = data;
|
|
13
|
+
const blockBaseProps = (0, react_1.useMemo)(() => lodash_1.default.pick(data, ['anchor', 'visible', 'resetPaddings']), [data]);
|
|
14
|
+
return (react_1.default.createElement(BlockDecoration_1.BlockDecoration, Object.assign({ type: type, index: index }, blockBaseProps),
|
|
15
|
+
react_1.default.createElement(BlockBase_1.default, Object.assign({ className: b({ type }) }, blockBaseProps), children)));
|
|
12
16
|
};
|
|
13
17
|
exports.ConstructorBlock = ConstructorBlock;
|
package/build/cjs/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js
CHANGED
|
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
6
|
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
7
7
|
const innerContext_1 = require("../../../../context/innerContext");
|
|
8
|
+
const BlockDecoration_1 = require("../../../../customization/BlockDecoration");
|
|
8
9
|
const utils_1 = require("../../../../utils");
|
|
9
10
|
const ConstructorBlock_1 = require("../ConstructorBlock/ConstructorBlock");
|
|
10
11
|
const ConstructorItem_1 = require("../ConstructorItem");
|
|
@@ -13,7 +14,7 @@ const ConstructorBlocks = ({ items }) => {
|
|
|
13
14
|
const { blockTypes, loadables, itemMap, shouldRenderBlock } = (0, react_1.useContext)(innerContext_1.InnerContext);
|
|
14
15
|
const renderer = (parentId = '', item, index) => {
|
|
15
16
|
if (!itemMap[item.type]) {
|
|
16
|
-
return null;
|
|
17
|
+
return parentId ? null : (react_1.default.createElement(BlockDecoration_1.BlockDecoration, { type: item.type, index: index }, null));
|
|
17
18
|
}
|
|
18
19
|
let itemElement;
|
|
19
20
|
const key = (0, utils_1.getBlockKey)(item, index);
|
|
@@ -7,11 +7,10 @@ const innerContext_1 = require("../context/innerContext");
|
|
|
7
7
|
const BlockDecoration = (_a) => {
|
|
8
8
|
var _b, _c;
|
|
9
9
|
var { children: blockChildren } = _a, rest = tslib_1.__rest(_a, ["children"]);
|
|
10
|
-
const block = react_1.default.createElement(react_1.Fragment, null, blockChildren);
|
|
11
10
|
const blockDecorators = (_c = (_b = (0, react_1.useContext)(innerContext_1.InnerContext).customization) === null || _b === void 0 ? void 0 : _b.decorators) === null || _c === void 0 ? void 0 : _c.block;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return
|
|
11
|
+
const content = blockDecorators
|
|
12
|
+
? blockDecorators.reduce((children, decorator) => decorator(Object.assign({ children }, rest)), blockChildren)
|
|
13
|
+
: blockChildren;
|
|
14
|
+
return react_1.default.createElement(react_1.Fragment, null, content);
|
|
16
15
|
};
|
|
17
16
|
exports.BlockDecoration = BlockDecoration;
|
|
@@ -3,15 +3,22 @@ unpredictable css rules order in build */
|
|
|
3
3
|
.pc-edit-block {
|
|
4
4
|
cursor: pointer;
|
|
5
5
|
position: relative;
|
|
6
|
+
z-index: 10;
|
|
7
|
+
}
|
|
8
|
+
.pc-edit-block_active {
|
|
9
|
+
z-index: 11;
|
|
10
|
+
}
|
|
11
|
+
.pc-edit-block_active .pc-edit-block__controls {
|
|
12
|
+
border: 4px solid var(--yc-color-promo-base-neon);
|
|
6
13
|
}
|
|
7
14
|
.pc-edit-block__controls {
|
|
8
15
|
position: absolute;
|
|
9
|
-
width: calc(100% +
|
|
10
|
-
height: calc(100% +
|
|
11
|
-
top: -
|
|
12
|
-
left: -
|
|
16
|
+
width: calc(100% + 96px);
|
|
17
|
+
height: calc(100% + 48px);
|
|
18
|
+
top: -48px;
|
|
19
|
+
left: -48px;
|
|
13
20
|
border-radius: var(--pc-border-radius);
|
|
14
|
-
z-index:
|
|
21
|
+
z-index: 10;
|
|
15
22
|
}
|
|
16
23
|
.pc-edit-block__controls_isHeader {
|
|
17
24
|
width: 100%;
|
|
@@ -19,8 +26,9 @@ unpredictable css rules order in build */
|
|
|
19
26
|
top: 0;
|
|
20
27
|
left: 0;
|
|
21
28
|
}
|
|
22
|
-
.pc-edit-
|
|
23
|
-
|
|
29
|
+
.pc-edit-block__controls_reset-paddings {
|
|
30
|
+
top: 0;
|
|
31
|
+
height: 100%;
|
|
24
32
|
}
|
|
25
33
|
.pc-edit-block__controls-content {
|
|
26
34
|
display: flex;
|
|
@@ -9,5 +9,5 @@ export declare enum EditBlockControls {
|
|
|
9
9
|
export type EditBlockActions = {
|
|
10
10
|
[key in EditBlockControls]?: () => void;
|
|
11
11
|
};
|
|
12
|
-
declare const _default: React.MemoExoticComponent<({ actions, isActive, onSelect, isHeader, children }: EditBlockProps) => JSX.Element>;
|
|
12
|
+
declare const _default: React.MemoExoticComponent<({ actions, isActive, onSelect, isHeader, children, resetPaddings, }: EditBlockProps) => JSX.Element>;
|
|
13
13
|
export default _default;
|
|
@@ -25,7 +25,7 @@ const editBlockControlsIcons = {
|
|
|
25
25
|
[EditBlockControls.Copy]: icons_1.Copy,
|
|
26
26
|
[EditBlockControls.Delete]: icons_1.TrashBin,
|
|
27
27
|
};
|
|
28
|
-
const EditBlock = ({ actions, isActive, onSelect, isHeader, children }) => {
|
|
28
|
+
const EditBlock = ({ actions, isActive, onSelect, isHeader, children, resetPaddings, }) => {
|
|
29
29
|
const ref = (0, react_1.useRef)(null);
|
|
30
30
|
(0, react_1.useEffect)(() => {
|
|
31
31
|
if (isActive && ref.current) {
|
|
@@ -33,8 +33,12 @@ const EditBlock = ({ actions, isActive, onSelect, isHeader, children }) => {
|
|
|
33
33
|
ref.current.scrollIntoView({ block: 'center' });
|
|
34
34
|
}
|
|
35
35
|
}, [isActive]);
|
|
36
|
-
return (react_1.default.createElement("div", { className: b(), onClick: onSelect, ref: ref },
|
|
37
|
-
react_1.default.createElement("div", { className: b('controls', {
|
|
36
|
+
return (react_1.default.createElement("div", { className: b({ active: isActive }), onClick: onSelect, ref: ref },
|
|
37
|
+
react_1.default.createElement("div", { className: b('controls', {
|
|
38
|
+
active: isActive,
|
|
39
|
+
isHeader,
|
|
40
|
+
'reset-paddings': resetPaddings,
|
|
41
|
+
}) }, isActive && (react_1.default.createElement("div", { className: b('controls-content'), onClick: (e) => e.stopPropagation() }, actionsOrder.map((action) => {
|
|
38
42
|
const Icon = editBlockControlsIcons[action];
|
|
39
43
|
return actions[action] ? (react_1.default.createElement("div", { key: action, className: b('control'), onClick: actions[action] },
|
|
40
44
|
react_1.default.createElement(Icon, null))) : null;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.pc-not-found-block {
|
|
2
|
+
box-shadow: 0px 4px 24px var(--pc-color-sfx-shadow), 0px 2px 8px var(--pc-color-sfx-shadow);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.pc-not-found-block:hover {
|
|
6
|
+
box-shadow: 0px 4px 24px var(--yc-color-sfx-shadow), 0px 2px 8px var(--yc-color-sfx-shadow);
|
|
7
|
+
cursor: pointer;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/* use this for style redefinitions to awoid problems with
|
|
11
|
+
unpredictable css rules order in build */
|
|
12
|
+
.pc-not-found-block {
|
|
13
|
+
font-size: var(--yc-text-display-1-font-size);
|
|
14
|
+
line-height: var(--yc-text-display-1-line-height);
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
height: 200px;
|
|
19
|
+
background-color: var(--yc-color-promo-highlight-silver);
|
|
20
|
+
border-radius: var(--pc-border-radius);
|
|
21
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NotFoundBlock = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
const components_1 = require("../../../components");
|
|
7
|
+
const utils_1 = require("../../../utils");
|
|
8
|
+
const i18n_1 = tslib_1.__importDefault(require("./i18n"));
|
|
9
|
+
const b = (0, utils_1.block)('not-found-block');
|
|
10
|
+
const NotFoundBlock = ({ type, children }) => children ? (react_1.default.createElement(react_1.Fragment, null, children)) : (react_1.default.createElement(components_1.BlockBase, null,
|
|
11
|
+
react_1.default.createElement("div", { className: b() }, (0, i18n_1.default)('message', { type }))));
|
|
12
|
+
exports.NotFoundBlock = NotFoundBlock;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const registerKeyset_1 = require("../../../../utils/registerKeyset");
|
|
5
|
+
const en_json_1 = tslib_1.__importDefault(require("./en.json"));
|
|
6
|
+
const ru_json_1 = tslib_1.__importDefault(require("./ru.json"));
|
|
7
|
+
const COMPONENT = 'NotFoundBlock';
|
|
8
|
+
exports.default = (0, registerKeyset_1.registerKeyset)({ en: en_json_1.default, ru: ru_json_1.default }, COMPONENT);
|
|
@@ -7,6 +7,7 @@ const AddBlock_1 = tslib_1.__importDefault(require("../../components/AddBlock/Ad
|
|
|
7
7
|
const EditBlock_1 = tslib_1.__importDefault(require("../../components/EditBlock/EditBlock"));
|
|
8
8
|
const ErrorBoundary_1 = require("../../components/ErrorBoundary/ErrorBoundary");
|
|
9
9
|
const Layout_1 = tslib_1.__importDefault(require("../../components/Layout/Layout"));
|
|
10
|
+
const NotFoundBlock_1 = require("../../components/NotFoundBlock/NotFoundBlock");
|
|
10
11
|
const useFormSpec_1 = tslib_1.__importDefault(require("../../hooks/useFormSpec"));
|
|
11
12
|
const store_1 = require("../../store");
|
|
12
13
|
const types_1 = require("../../types");
|
|
@@ -20,6 +21,7 @@ const Editor = (_a) => {
|
|
|
20
21
|
const outgoingProps = (0, react_1.useMemo)(() => {
|
|
21
22
|
const custom = isEditingMode
|
|
22
23
|
? (0, utils_1.addCustomDecorator)([
|
|
24
|
+
(props) => react_1.default.createElement(NotFoundBlock_1.NotFoundBlock, Object.assign({}, props)),
|
|
23
25
|
(props) => (react_1.default.createElement(EditBlock_1.default, Object.assign({}, injectEditBlockProps(props)))),
|
|
24
26
|
// need errorBoundaryState flag to reset error on content update
|
|
25
27
|
(props) => (react_1.default.createElement(ErrorBoundary_1.ErrorBoundary, Object.assign({}, props, { key: `${(0, utils_1.getBlockId)(props)}-${errorBoundaryState}` }))),
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"theme": "light",
|
|
4
4
|
"type": "banner-block",
|
|
5
5
|
"title": "Lorem ipsum dolor sit amet, consectetur adipiscing elit",
|
|
6
|
-
"subtitle": "
|
|
6
|
+
"subtitle": "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
|
|
7
7
|
"image": {
|
|
8
8
|
"light": "https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/img_8-12_light.png",
|
|
9
9
|
"dark": "https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/img_8-12_dark.png"
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"template": {
|
|
3
3
|
"type": "questions-block",
|
|
4
4
|
"title": "Lorem ipsum",
|
|
5
|
-
"text": "
|
|
6
|
-
"additionalInfo": "
|
|
5
|
+
"text": "Dolor sit amet, consectetur adipiscing elit [sed do eiusmod](https://example.com) tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
|
|
6
|
+
"additionalInfo": "Dolor sit **amet** [sed do eiusmod](https://example.com) Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
|
|
7
7
|
"links": [
|
|
8
8
|
{
|
|
9
9
|
"url": "/security",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"items": [
|
|
23
23
|
{
|
|
24
24
|
"title": "Lorem ipsum dolor sit amet 0",
|
|
25
|
-
"text": "
|
|
25
|
+
"text": "Consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
|
26
26
|
"link": {
|
|
27
27
|
"url": "#",
|
|
28
28
|
"text": "Documentation",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
"title": "Ut enim ad minim veniam, quis nostrud exercitation ullamco? 1",
|
|
35
|
-
"text": "
|
|
35
|
+
"text": "laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
|
|
36
36
|
"link": {
|
|
37
37
|
"url": "#",
|
|
38
38
|
"text": "Documentation",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
44
|
"title": "Lorem ipsum dolor sit amet 2",
|
|
45
|
-
"text": "
|
|
45
|
+
"text": "Consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
|
46
46
|
"link": {
|
|
47
47
|
"url": "#",
|
|
48
48
|
"text": "Documentation",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
54
|
"title": "Ut enim ad minim veniam, quis nostrud exercitation ullamco? 3",
|
|
55
|
-
"text": "
|
|
55
|
+
"text": "laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
|
|
56
56
|
"link": {
|
|
57
57
|
"url": "#",
|
|
58
58
|
"text": "Documentation",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
64
|
"title": "Lorem ipsum dolor sit amet 4",
|
|
65
|
-
"text": "
|
|
65
|
+
"text": "Consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
|
66
66
|
"link": {
|
|
67
67
|
"url": "#",
|
|
68
68
|
"text": "Documentation",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
},
|
|
73
73
|
{
|
|
74
74
|
"title": "Ut enim ad minim veniam, quis nostrud exercitation ullamco? 5",
|
|
75
|
-
"text": "
|
|
75
|
+
"text": "laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
|
|
76
76
|
"link": {
|
|
77
77
|
"url": "#",
|
|
78
78
|
"text": "Documentation",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
},
|
|
83
83
|
{
|
|
84
84
|
"title": "Lorem ipsum dolor sit amet 6",
|
|
85
|
-
"text": "
|
|
85
|
+
"text": "Consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
|
86
86
|
"link": {
|
|
87
87
|
"url": "#",
|
|
88
88
|
"text": "Documentation",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
},
|
|
93
93
|
{
|
|
94
94
|
"title": "Ut enim ad minim veniam, quis nostrud exercitation ullamco? 7",
|
|
95
|
-
"text": "
|
|
95
|
+
"text": "laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
|
|
96
96
|
"link": {
|
|
97
97
|
"url": "#",
|
|
98
98
|
"text": "Documentation",
|
|
@@ -6,7 +6,7 @@ export declare function useEditorState({ content: intialContent, custom }: Omit<
|
|
|
6
6
|
content: PageContent;
|
|
7
7
|
errorBoundaryState: number;
|
|
8
8
|
viewMode: ViewModeItem;
|
|
9
|
-
injectEditBlockProps: ({ type, index: relativeIndex, children, }: BlockDecorationProps) => EditBlockProps;
|
|
9
|
+
injectEditBlockProps: ({ type, index: relativeIndex, children, ...rest }: BlockDecorationProps) => EditBlockProps;
|
|
10
10
|
onAdd: (block: Block) => void;
|
|
11
11
|
onSelect: (index: number) => void;
|
|
12
12
|
onContentUpdate: (newContent: PageContent) => void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useEditorState = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const react_1 = require("react");
|
|
5
6
|
const models_1 = require("../../models");
|
|
6
7
|
const utils_1 = require("../../utils");
|
|
@@ -36,7 +37,8 @@ function useEditorState({ content: intialContent, custom }) {
|
|
|
36
37
|
const onSelect = (index) => dispatch({ type: reducer_1.SELECT_BLOCK, payload: index });
|
|
37
38
|
const onContentUpdate = (newContent) => dispatch({ type: reducer_1.UPDATE_CONTENT, payload: newContent });
|
|
38
39
|
const onViewModeUpdate = (newViewMode) => dispatch({ type: reducer_1.UPDATE_VIEW_MODE, payload: newViewMode });
|
|
39
|
-
const injectEditBlockProps = (
|
|
40
|
+
const injectEditBlockProps = (_a) => {
|
|
41
|
+
var { type, index: relativeIndex = 0, children } = _a, rest = tslib_1.__rest(_a, ["type", "index", "children"]);
|
|
40
42
|
const orderedBlocksStartIndex = contentHasHeader ? 1 : 0;
|
|
41
43
|
const isHeader = checkIsHeader(type);
|
|
42
44
|
const index = isHeader ? 0 : relativeIndex + orderedBlocksStartIndex;
|
|
@@ -59,13 +61,10 @@ function useEditorState({ content: intialContent, custom }) {
|
|
|
59
61
|
});
|
|
60
62
|
}
|
|
61
63
|
}
|
|
62
|
-
return {
|
|
63
|
-
children,
|
|
64
|
+
return Object.assign({ children,
|
|
64
65
|
isHeader,
|
|
65
66
|
isActive,
|
|
66
|
-
actions,
|
|
67
|
-
onSelect: () => onSelect(index),
|
|
68
|
-
};
|
|
67
|
+
actions, onSelect: () => onSelect(index) }, rest);
|
|
69
68
|
};
|
|
70
69
|
return {
|
|
71
70
|
activeBlockIndex,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { BlockType } from './constructor-items';
|
|
3
|
-
export interface BlockDecorationProps extends PropsWithChildren {
|
|
2
|
+
import { BlockBaseProps, BlockType } from './constructor-items';
|
|
3
|
+
export interface BlockDecorationProps extends PropsWithChildren, BlockBaseProps {
|
|
4
4
|
type: BlockType;
|
|
5
5
|
index?: number;
|
|
6
6
|
}
|
|
@@ -7,5 +7,5 @@ var AvailableForCompressExtension;
|
|
|
7
7
|
AvailableForCompressExtension["JPG"] = "jpg";
|
|
8
8
|
AvailableForCompressExtension["JPEG"] = "jpeg";
|
|
9
9
|
})(AvailableForCompressExtension = exports.AvailableForCompressExtension || (exports.AvailableForCompressExtension = {}));
|
|
10
|
-
const isCompressible = (fileName) => Object.
|
|
10
|
+
const isCompressible = (fileName) => Object.values(AvailableForCompressExtension).some((ext) => fileName.toLowerCase().endsWith(`.${ext}`));
|
|
11
11
|
exports.isCompressible = isCompressible;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { BlockBaseProps,
|
|
2
|
+
import { BlockBaseProps, ClassNameProps } from '../../models';
|
|
3
3
|
import './BlockBase.css';
|
|
4
|
-
export type BlockBaseFullProps = BlockBaseProps &
|
|
4
|
+
export type BlockBaseFullProps = BlockBaseProps & ClassNameProps & PropsWithChildren;
|
|
5
5
|
declare const BlockBase: (props: BlockBaseFullProps) => JSX.Element;
|
|
6
6
|
export default BlockBase;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { BlockDecoration } from '../../customization/BlockDecoration';
|
|
3
2
|
import { Col } from '../../grid';
|
|
4
3
|
import { block } from '../../utils';
|
|
5
4
|
import Anchor from '../Anchor/Anchor';
|
|
6
5
|
import './BlockBase.css';
|
|
7
6
|
const b = block('block-base');
|
|
8
7
|
const BlockBase = (props) => {
|
|
9
|
-
const { anchor, visible, children, className, resetPaddings, qa
|
|
8
|
+
const { anchor, visible, children, className, resetPaddings, qa } = props;
|
|
10
9
|
return (React.createElement(Col, { className: b({ ['reset-paddings']: resetPaddings }, className), visible: visible, reset: true, dataQa: qa },
|
|
11
|
-
React.createElement(
|
|
12
|
-
|
|
13
|
-
children)));
|
|
10
|
+
anchor && React.createElement(Anchor, { id: anchor.url, className: b('anchor') }),
|
|
11
|
+
children));
|
|
14
12
|
};
|
|
15
13
|
export default BlockBase;
|
package/build/esm/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
interface ConstructorBlockProps extends Pick<BlockBaseFullProps, 'index'> {
|
|
2
|
+
import { Block, BlockDecorationProps, WithChildren } from '../../../../models';
|
|
3
|
+
interface ConstructorBlockProps extends Pick<BlockDecorationProps, 'index'> {
|
|
5
4
|
data: Block;
|
|
6
5
|
}
|
|
7
6
|
export declare const ConstructorBlock: React.FC<WithChildren<ConstructorBlockProps>>;
|
package/build/esm/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import _ from 'lodash';
|
|
2
3
|
import BlockBase from '../../../../components/BlockBase/BlockBase';
|
|
4
|
+
import { BlockDecoration } from '../../../../customization/BlockDecoration';
|
|
3
5
|
import { block } from '../../../../utils';
|
|
4
6
|
const b = block('constructor-block');
|
|
5
7
|
export const ConstructorBlock = ({ index = 0, data, children, }) => {
|
|
6
|
-
const {
|
|
7
|
-
|
|
8
|
+
const { type } = data;
|
|
9
|
+
const blockBaseProps = useMemo(() => _.pick(data, ['anchor', 'visible', 'resetPaddings']), [data]);
|
|
10
|
+
return (React.createElement(BlockDecoration, Object.assign({ type: type, index: index }, blockBaseProps),
|
|
11
|
+
React.createElement(BlockBase, Object.assign({ className: b({ type }) }, blockBaseProps), children)));
|
|
8
12
|
};
|
package/build/esm/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { Fragment, useContext } from 'react';
|
|
2
2
|
import _ from 'lodash';
|
|
3
3
|
import { InnerContext } from '../../../../context/innerContext';
|
|
4
|
+
import { BlockDecoration } from '../../../../customization/BlockDecoration';
|
|
4
5
|
import { getBlockKey } from '../../../../utils';
|
|
5
6
|
import { ConstructorBlock } from '../ConstructorBlock/ConstructorBlock';
|
|
6
7
|
import { ConstructorItem } from '../ConstructorItem';
|
|
@@ -9,7 +10,7 @@ export const ConstructorBlocks = ({ items }) => {
|
|
|
9
10
|
const { blockTypes, loadables, itemMap, shouldRenderBlock } = useContext(InnerContext);
|
|
10
11
|
const renderer = (parentId = '', item, index) => {
|
|
11
12
|
if (!itemMap[item.type]) {
|
|
12
|
-
return null;
|
|
13
|
+
return parentId ? null : (React.createElement(BlockDecoration, { type: item.type, index: index }, null));
|
|
13
14
|
}
|
|
14
15
|
let itemElement;
|
|
15
16
|
const key = getBlockKey(item, index);
|
|
@@ -4,10 +4,9 @@ import { InnerContext } from '../context/innerContext';
|
|
|
4
4
|
export const BlockDecoration = (_a) => {
|
|
5
5
|
var _b, _c;
|
|
6
6
|
var { children: blockChildren } = _a, rest = __rest(_a, ["children"]);
|
|
7
|
-
const block = React.createElement(Fragment, null, blockChildren);
|
|
8
7
|
const blockDecorators = (_c = (_b = useContext(InnerContext).customization) === null || _b === void 0 ? void 0 : _b.decorators) === null || _c === void 0 ? void 0 : _c.block;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return
|
|
8
|
+
const content = blockDecorators
|
|
9
|
+
? blockDecorators.reduce((children, decorator) => decorator(Object.assign({ children }, rest)), blockChildren)
|
|
10
|
+
: blockChildren;
|
|
11
|
+
return React.createElement(Fragment, null, content);
|
|
13
12
|
};
|
|
@@ -3,15 +3,22 @@ unpredictable css rules order in build */
|
|
|
3
3
|
.pc-edit-block {
|
|
4
4
|
cursor: pointer;
|
|
5
5
|
position: relative;
|
|
6
|
+
z-index: 10;
|
|
7
|
+
}
|
|
8
|
+
.pc-edit-block_active {
|
|
9
|
+
z-index: 11;
|
|
10
|
+
}
|
|
11
|
+
.pc-edit-block_active .pc-edit-block__controls {
|
|
12
|
+
border: 4px solid var(--yc-color-promo-base-neon);
|
|
6
13
|
}
|
|
7
14
|
.pc-edit-block__controls {
|
|
8
15
|
position: absolute;
|
|
9
|
-
width: calc(100% +
|
|
10
|
-
height: calc(100% +
|
|
11
|
-
top: -
|
|
12
|
-
left: -
|
|
16
|
+
width: calc(100% + 96px);
|
|
17
|
+
height: calc(100% + 48px);
|
|
18
|
+
top: -48px;
|
|
19
|
+
left: -48px;
|
|
13
20
|
border-radius: var(--pc-border-radius);
|
|
14
|
-
z-index:
|
|
21
|
+
z-index: 10;
|
|
15
22
|
}
|
|
16
23
|
.pc-edit-block__controls_isHeader {
|
|
17
24
|
width: 100%;
|
|
@@ -19,8 +26,9 @@ unpredictable css rules order in build */
|
|
|
19
26
|
top: 0;
|
|
20
27
|
left: 0;
|
|
21
28
|
}
|
|
22
|
-
.pc-edit-
|
|
23
|
-
|
|
29
|
+
.pc-edit-block__controls_reset-paddings {
|
|
30
|
+
top: 0;
|
|
31
|
+
height: 100%;
|
|
24
32
|
}
|
|
25
33
|
.pc-edit-block__controls-content {
|
|
26
34
|
display: flex;
|
|
@@ -10,5 +10,5 @@ export declare enum EditBlockControls {
|
|
|
10
10
|
export type EditBlockActions = {
|
|
11
11
|
[key in EditBlockControls]?: () => void;
|
|
12
12
|
};
|
|
13
|
-
declare const _default: React.MemoExoticComponent<({ actions, isActive, onSelect, isHeader, children }: EditBlockProps) => JSX.Element>;
|
|
13
|
+
declare const _default: React.MemoExoticComponent<({ actions, isActive, onSelect, isHeader, children, resetPaddings, }: EditBlockProps) => JSX.Element>;
|
|
14
14
|
export default _default;
|
|
@@ -22,7 +22,7 @@ const editBlockControlsIcons = {
|
|
|
22
22
|
[EditBlockControls.Copy]: CopyIcon,
|
|
23
23
|
[EditBlockControls.Delete]: TrashBin,
|
|
24
24
|
};
|
|
25
|
-
const EditBlock = ({ actions, isActive, onSelect, isHeader, children }) => {
|
|
25
|
+
const EditBlock = ({ actions, isActive, onSelect, isHeader, children, resetPaddings, }) => {
|
|
26
26
|
const ref = useRef(null);
|
|
27
27
|
useEffect(() => {
|
|
28
28
|
if (isActive && ref.current) {
|
|
@@ -30,8 +30,12 @@ const EditBlock = ({ actions, isActive, onSelect, isHeader, children }) => {
|
|
|
30
30
|
ref.current.scrollIntoView({ block: 'center' });
|
|
31
31
|
}
|
|
32
32
|
}, [isActive]);
|
|
33
|
-
return (React.createElement("div", { className: b(), onClick: onSelect, ref: ref },
|
|
34
|
-
React.createElement("div", { className: b('controls', {
|
|
33
|
+
return (React.createElement("div", { className: b({ active: isActive }), onClick: onSelect, ref: ref },
|
|
34
|
+
React.createElement("div", { className: b('controls', {
|
|
35
|
+
active: isActive,
|
|
36
|
+
isHeader,
|
|
37
|
+
'reset-paddings': resetPaddings,
|
|
38
|
+
}) }, isActive && (React.createElement("div", { className: b('controls-content'), onClick: (e) => e.stopPropagation() }, actionsOrder.map((action) => {
|
|
35
39
|
const Icon = editBlockControlsIcons[action];
|
|
36
40
|
return actions[action] ? (React.createElement("div", { key: action, className: b('control'), onClick: actions[action] },
|
|
37
41
|
React.createElement(Icon, null))) : null;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.pc-not-found-block {
|
|
2
|
+
box-shadow: 0px 4px 24px var(--pc-color-sfx-shadow), 0px 2px 8px var(--pc-color-sfx-shadow);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.pc-not-found-block:hover {
|
|
6
|
+
box-shadow: 0px 4px 24px var(--yc-color-sfx-shadow), 0px 2px 8px var(--yc-color-sfx-shadow);
|
|
7
|
+
cursor: pointer;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/* use this for style redefinitions to awoid problems with
|
|
11
|
+
unpredictable css rules order in build */
|
|
12
|
+
.pc-not-found-block {
|
|
13
|
+
font-size: var(--yc-text-display-1-font-size);
|
|
14
|
+
line-height: var(--yc-text-display-1-line-height);
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
height: 200px;
|
|
19
|
+
background-color: var(--yc-color-promo-highlight-silver);
|
|
20
|
+
border-radius: var(--pc-border-radius);
|
|
21
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
|
+
import { BlockBase } from '../../../components';
|
|
3
|
+
import { block } from '../../../utils';
|
|
4
|
+
import i18n from './i18n';
|
|
5
|
+
import './NotFoundBlock.css';
|
|
6
|
+
const b = block('not-found-block');
|
|
7
|
+
export const NotFoundBlock = ({ type, children }) => children ? (React.createElement(Fragment, null, children)) : (React.createElement(BlockBase, null,
|
|
8
|
+
React.createElement("div", { className: b() }, i18n('message', { type }))));
|
|
@@ -4,6 +4,7 @@ import AddBlock from '../../components/AddBlock/AddBlock';
|
|
|
4
4
|
import EditBlock from '../../components/EditBlock/EditBlock';
|
|
5
5
|
import { ErrorBoundary } from '../../components/ErrorBoundary/ErrorBoundary';
|
|
6
6
|
import Layout from '../../components/Layout/Layout';
|
|
7
|
+
import { NotFoundBlock } from '../../components/NotFoundBlock/NotFoundBlock';
|
|
7
8
|
import useFormSpec from '../../hooks/useFormSpec';
|
|
8
9
|
import { useEditorState } from '../../store';
|
|
9
10
|
import { ViewModeItem } from '../../types';
|
|
@@ -17,6 +18,7 @@ export const Editor = (_a) => {
|
|
|
17
18
|
const outgoingProps = useMemo(() => {
|
|
18
19
|
const custom = isEditingMode
|
|
19
20
|
? addCustomDecorator([
|
|
21
|
+
(props) => React.createElement(NotFoundBlock, Object.assign({}, props)),
|
|
20
22
|
(props) => (React.createElement(EditBlock, Object.assign({}, injectEditBlockProps(props)))),
|
|
21
23
|
// need errorBoundaryState flag to reset error on content update
|
|
22
24
|
(props) => (React.createElement(ErrorBoundary, Object.assign({}, props, { key: `${getBlockId(props)}-${errorBoundaryState}` }))),
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"theme": "light",
|
|
4
4
|
"type": "banner-block",
|
|
5
5
|
"title": "Lorem ipsum dolor sit amet, consectetur adipiscing elit",
|
|
6
|
-
"subtitle": "
|
|
6
|
+
"subtitle": "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
|
|
7
7
|
"image": {
|
|
8
8
|
"light": "https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/img_8-12_light.png",
|
|
9
9
|
"dark": "https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/img_8-12_dark.png"
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"template": {
|
|
3
3
|
"type": "questions-block",
|
|
4
4
|
"title": "Lorem ipsum",
|
|
5
|
-
"text": "
|
|
6
|
-
"additionalInfo": "
|
|
5
|
+
"text": "Dolor sit amet, consectetur adipiscing elit [sed do eiusmod](https://example.com) tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
|
|
6
|
+
"additionalInfo": "Dolor sit **amet** [sed do eiusmod](https://example.com) Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
|
|
7
7
|
"links": [
|
|
8
8
|
{
|
|
9
9
|
"url": "/security",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"items": [
|
|
23
23
|
{
|
|
24
24
|
"title": "Lorem ipsum dolor sit amet 0",
|
|
25
|
-
"text": "
|
|
25
|
+
"text": "Consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
|
26
26
|
"link": {
|
|
27
27
|
"url": "#",
|
|
28
28
|
"text": "Documentation",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
"title": "Ut enim ad minim veniam, quis nostrud exercitation ullamco? 1",
|
|
35
|
-
"text": "
|
|
35
|
+
"text": "laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
|
|
36
36
|
"link": {
|
|
37
37
|
"url": "#",
|
|
38
38
|
"text": "Documentation",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
44
|
"title": "Lorem ipsum dolor sit amet 2",
|
|
45
|
-
"text": "
|
|
45
|
+
"text": "Consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
|
46
46
|
"link": {
|
|
47
47
|
"url": "#",
|
|
48
48
|
"text": "Documentation",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
54
|
"title": "Ut enim ad minim veniam, quis nostrud exercitation ullamco? 3",
|
|
55
|
-
"text": "
|
|
55
|
+
"text": "laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
|
|
56
56
|
"link": {
|
|
57
57
|
"url": "#",
|
|
58
58
|
"text": "Documentation",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
64
|
"title": "Lorem ipsum dolor sit amet 4",
|
|
65
|
-
"text": "
|
|
65
|
+
"text": "Consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
|
66
66
|
"link": {
|
|
67
67
|
"url": "#",
|
|
68
68
|
"text": "Documentation",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
},
|
|
73
73
|
{
|
|
74
74
|
"title": "Ut enim ad minim veniam, quis nostrud exercitation ullamco? 5",
|
|
75
|
-
"text": "
|
|
75
|
+
"text": "laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
|
|
76
76
|
"link": {
|
|
77
77
|
"url": "#",
|
|
78
78
|
"text": "Documentation",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
},
|
|
83
83
|
{
|
|
84
84
|
"title": "Lorem ipsum dolor sit amet 6",
|
|
85
|
-
"text": "
|
|
85
|
+
"text": "Consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
|
86
86
|
"link": {
|
|
87
87
|
"url": "#",
|
|
88
88
|
"text": "Documentation",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
},
|
|
93
93
|
{
|
|
94
94
|
"title": "Ut enim ad minim veniam, quis nostrud exercitation ullamco? 7",
|
|
95
|
-
"text": "
|
|
95
|
+
"text": "laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
|
|
96
96
|
"link": {
|
|
97
97
|
"url": "#",
|
|
98
98
|
"text": "Documentation",
|
|
@@ -6,7 +6,7 @@ export declare function useEditorState({ content: intialContent, custom }: Omit<
|
|
|
6
6
|
content: PageContent;
|
|
7
7
|
errorBoundaryState: number;
|
|
8
8
|
viewMode: ViewModeItem;
|
|
9
|
-
injectEditBlockProps: ({ type, index: relativeIndex, children, }: BlockDecorationProps) => EditBlockProps;
|
|
9
|
+
injectEditBlockProps: ({ type, index: relativeIndex, children, ...rest }: BlockDecorationProps) => EditBlockProps;
|
|
10
10
|
onAdd: (block: Block) => void;
|
|
11
11
|
onSelect: (index: number) => void;
|
|
12
12
|
onContentUpdate: (newContent: PageContent) => void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
1
2
|
import { useMemo, useReducer } from 'react';
|
|
2
3
|
import { HeaderBlockTypes } from '../../models';
|
|
3
4
|
import { getCustomHeaderTypes, getHeaderBlock } from '../../utils';
|
|
@@ -33,7 +34,8 @@ export function useEditorState({ content: intialContent, custom }) {
|
|
|
33
34
|
const onSelect = (index) => dispatch({ type: SELECT_BLOCK, payload: index });
|
|
34
35
|
const onContentUpdate = (newContent) => dispatch({ type: UPDATE_CONTENT, payload: newContent });
|
|
35
36
|
const onViewModeUpdate = (newViewMode) => dispatch({ type: UPDATE_VIEW_MODE, payload: newViewMode });
|
|
36
|
-
const injectEditBlockProps = (
|
|
37
|
+
const injectEditBlockProps = (_a) => {
|
|
38
|
+
var { type, index: relativeIndex = 0, children } = _a, rest = __rest(_a, ["type", "index", "children"]);
|
|
37
39
|
const orderedBlocksStartIndex = contentHasHeader ? 1 : 0;
|
|
38
40
|
const isHeader = checkIsHeader(type);
|
|
39
41
|
const index = isHeader ? 0 : relativeIndex + orderedBlocksStartIndex;
|
|
@@ -56,13 +58,10 @@ export function useEditorState({ content: intialContent, custom }) {
|
|
|
56
58
|
});
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
|
-
return {
|
|
60
|
-
children,
|
|
61
|
+
return Object.assign({ children,
|
|
61
62
|
isHeader,
|
|
62
63
|
isActive,
|
|
63
|
-
actions,
|
|
64
|
-
onSelect: () => onSelect(index),
|
|
65
|
-
};
|
|
64
|
+
actions, onSelect: () => onSelect(index) }, rest);
|
|
66
65
|
};
|
|
67
66
|
return {
|
|
68
67
|
activeBlockIndex,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { BlockType } from './constructor-items';
|
|
3
|
-
export interface BlockDecorationProps extends PropsWithChildren {
|
|
2
|
+
import { BlockBaseProps, BlockType } from './constructor-items';
|
|
3
|
+
export interface BlockDecorationProps extends PropsWithChildren, BlockBaseProps {
|
|
4
4
|
type: BlockType;
|
|
5
5
|
index?: number;
|
|
6
6
|
}
|
|
@@ -4,4 +4,4 @@ export var AvailableForCompressExtension;
|
|
|
4
4
|
AvailableForCompressExtension["JPG"] = "jpg";
|
|
5
5
|
AvailableForCompressExtension["JPEG"] = "jpeg";
|
|
6
6
|
})(AvailableForCompressExtension || (AvailableForCompressExtension = {}));
|
|
7
|
-
export const isCompressible = (fileName) => Object.
|
|
7
|
+
export const isCompressible = (fileName) => Object.values(AvailableForCompressExtension).some((ext) => fileName.toLowerCase().endsWith(`.${ext}`));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { BlockType } from './constructor-items';
|
|
3
|
-
export interface BlockDecorationProps extends PropsWithChildren {
|
|
2
|
+
import { BlockBaseProps, BlockType } from './constructor-items';
|
|
3
|
+
export interface BlockDecorationProps extends PropsWithChildren, BlockBaseProps {
|
|
4
4
|
type: BlockType;
|
|
5
5
|
index?: number;
|
|
6
6
|
}
|