@gravity-ui/page-constructor 3.8.2 → 3.9.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 +15 -0
- package/README.md +22 -0
- package/build/cjs/blocks/Banner/schema.d.ts +9 -3
- package/build/cjs/blocks/CardLayout/schema.d.ts +6 -2
- package/build/cjs/blocks/Companies/schema.d.ts +3 -1
- package/build/cjs/blocks/ContentLayout/schema.d.ts +3 -1
- package/build/cjs/blocks/ExtendedFeatures/schema.d.ts +6 -2
- package/build/cjs/blocks/FilterBlock/schema.d.ts +6 -2
- package/build/cjs/blocks/Header/schema.d.ts +3 -1
- package/build/cjs/blocks/HeaderSlider/schema.d.ts +3 -1
- package/build/cjs/blocks/Icons/schema.d.ts +6 -2
- package/build/cjs/blocks/Info/schema.d.ts +3 -1
- package/build/cjs/blocks/Map/schema.d.ts +3 -1
- package/build/cjs/blocks/Media/schema.d.ts +6 -2
- package/build/cjs/blocks/PromoFeaturesBlock/schema.d.ts +3 -1
- package/build/cjs/blocks/Questions/schema.d.ts +3 -1
- package/build/cjs/blocks/Share/schema.d.ts +3 -1
- package/build/cjs/blocks/Slider/schema.d.ts +3 -1
- package/build/cjs/blocks/Table/schema.d.ts +6 -2
- package/build/cjs/blocks/Tabs/schema.d.ts +6 -2
- package/build/cjs/components/Author/schema.d.ts +3 -1
- package/build/cjs/editor/components/AddBlock/AddBlock.css +1 -1
- package/build/cjs/editor/components/BlockForm/BlockForm.js +2 -2
- package/build/cjs/editor/components/ControlPanel/ControlPanel.css +2 -1
- package/build/cjs/editor/components/EditBlock/EditBlock.css +6 -6
- package/build/cjs/editor/components/Layout/Layout.css +4 -1
- package/build/cjs/editor/components/Layout/Layout.js +3 -1
- package/build/cjs/editor/containers/Editor/Editor.js +5 -5
- package/build/cjs/editor/containers/Form/Form.css +36 -18
- package/build/cjs/editor/containers/Form/Form.js +8 -7
- package/build/cjs/editor/dynamic-forms-custom/components/OneOfCustom/OneOfCustom.css +1 -1
- package/build/cjs/editor/types/index.d.ts +4 -1
- package/build/cjs/schema/constants.d.ts +18 -6
- package/build/cjs/schema/validators/common.d.ts +9 -3
- package/build/cjs/schema/validators/common.js +3 -1
- package/build/cjs/sub-blocks/BackgroundCard/schema.d.ts +3 -1
- package/build/cjs/sub-blocks/BasicCard/schema.d.ts +3 -1
- package/build/cjs/sub-blocks/Divider/schema.d.ts +3 -1
- package/build/cjs/sub-blocks/LayoutItem/schema.d.ts +3 -1
- package/build/cjs/sub-blocks/MediaCard/schema.d.ts +3 -1
- package/build/cjs/sub-blocks/PriceDetailed/schema.d.ts +3 -1
- package/build/cjs/sub-blocks/Quote/schema.d.ts +3 -1
- package/build/cjs/text-transform/filter.d.ts +20 -0
- package/build/cjs/text-transform/filter.js +61 -0
- package/build/cjs/text-transform/index.d.ts +1 -0
- package/build/cjs/text-transform/index.js +1 -0
- package/build/cjs/text-transform/transformers.d.ts +2 -0
- package/build/cjs/text-transform/transformers.js +3 -2
- package/build/esm/blocks/Banner/schema.d.ts +9 -3
- package/build/esm/blocks/CardLayout/schema.d.ts +6 -2
- package/build/esm/blocks/Companies/schema.d.ts +3 -1
- package/build/esm/blocks/ContentLayout/schema.d.ts +3 -1
- package/build/esm/blocks/ExtendedFeatures/schema.d.ts +6 -2
- package/build/esm/blocks/FilterBlock/schema.d.ts +6 -2
- package/build/esm/blocks/Header/schema.d.ts +3 -1
- package/build/esm/blocks/HeaderSlider/schema.d.ts +3 -1
- package/build/esm/blocks/Icons/schema.d.ts +6 -2
- package/build/esm/blocks/Info/schema.d.ts +3 -1
- package/build/esm/blocks/Map/schema.d.ts +3 -1
- package/build/esm/blocks/Media/schema.d.ts +6 -2
- package/build/esm/blocks/PromoFeaturesBlock/schema.d.ts +3 -1
- package/build/esm/blocks/Questions/schema.d.ts +3 -1
- package/build/esm/blocks/Share/schema.d.ts +3 -1
- package/build/esm/blocks/Slider/schema.d.ts +3 -1
- package/build/esm/blocks/Table/schema.d.ts +6 -2
- package/build/esm/blocks/Tabs/schema.d.ts +6 -2
- package/build/esm/components/Author/schema.d.ts +3 -1
- package/build/esm/editor/components/AddBlock/AddBlock.css +1 -1
- package/build/esm/editor/components/BlockForm/BlockForm.js +3 -3
- package/build/esm/editor/components/ControlPanel/ControlPanel.css +2 -1
- package/build/esm/editor/components/EditBlock/EditBlock.css +6 -6
- package/build/esm/editor/components/Layout/Layout.css +4 -1
- package/build/esm/editor/components/Layout/Layout.js +3 -1
- package/build/esm/editor/containers/Editor/Editor.js +5 -5
- package/build/esm/editor/containers/Form/Form.css +36 -18
- package/build/esm/editor/containers/Form/Form.js +8 -7
- package/build/esm/editor/dynamic-forms-custom/components/OneOfCustom/OneOfCustom.css +1 -1
- package/build/esm/editor/types/index.d.ts +4 -1
- package/build/esm/schema/constants.d.ts +18 -6
- package/build/esm/schema/validators/common.d.ts +9 -3
- package/build/esm/schema/validators/common.js +3 -1
- package/build/esm/sub-blocks/BackgroundCard/schema.d.ts +3 -1
- package/build/esm/sub-blocks/BasicCard/schema.d.ts +3 -1
- package/build/esm/sub-blocks/Divider/schema.d.ts +3 -1
- package/build/esm/sub-blocks/LayoutItem/schema.d.ts +3 -1
- package/build/esm/sub-blocks/MediaCard/schema.d.ts +3 -1
- package/build/esm/sub-blocks/PriceDetailed/schema.d.ts +3 -1
- package/build/esm/sub-blocks/Quote/schema.d.ts +3 -1
- package/build/esm/text-transform/filter.d.ts +20 -0
- package/build/esm/text-transform/filter.js +56 -0
- package/build/esm/text-transform/index.d.ts +1 -0
- package/build/esm/text-transform/index.js +1 -0
- package/build/esm/text-transform/transformers.d.ts +2 -0
- package/build/esm/text-transform/transformers.js +3 -2
- package/package.json +1 -1
- package/server/text-transform/filter.d.ts +20 -0
- package/server/text-transform/filter.js +63 -0
- package/server/text-transform/index.d.ts +1 -0
- package/server/text-transform/index.js +1 -0
- package/server/text-transform/transformers.d.ts +2 -0
- package/server/text-transform/transformers.js +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [3.9.0](https://github.com/gravity-ui/page-constructor/compare/v3.8.3...v3.9.0) (2023-06-27)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add content filtration utils ([6cf8038](https://github.com/gravity-ui/page-constructor/commit/6cf803818a222eed964f5e24960ad99a567adc1e))
|
|
9
|
+
* add transform when variables handling ([#427](https://github.com/gravity-ui/page-constructor/issues/427)) ([6cf8038](https://github.com/gravity-ui/page-constructor/commit/6cf803818a222eed964f5e24960ad99a567adc1e))
|
|
10
|
+
|
|
11
|
+
## [3.8.3](https://github.com/gravity-ui/page-constructor/compare/v3.8.2...v3.8.3) (2023-06-27)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* editor form style indent ([#428](https://github.com/gravity-ui/page-constructor/issues/428)) ([3fc6da7](https://github.com/gravity-ui/page-constructor/commit/3fc6da73f7e724aaa4e8f22a45228f1a2cc4dc81))
|
|
17
|
+
|
|
3
18
|
## [3.8.2](https://github.com/gravity-ui/page-constructor/compare/v3.8.1...v3.8.2) (2023-06-23)
|
|
4
19
|
|
|
5
20
|
|
package/README.md
CHANGED
|
@@ -366,3 +366,25 @@ If you want to release a new version in previous major after commit it to the ma
|
|
|
366
366
|
6. Wait until robot creates a PR with a new version of the package and information about your changes in CHANGELOG.md. You can see the process on [the Actions tab](https://github.com/gravity-ui/page-constructor/actions).
|
|
367
367
|
7. Check your changes in CHANGELOG.md and approve robot's PR.
|
|
368
368
|
8. Squash and merge PR. You can see release process on [the Actions tab](https://github.com/gravity-ui/page-constructor/actions).
|
|
369
|
+
|
|
370
|
+
## Page constructor editor
|
|
371
|
+
|
|
372
|
+
Editor provides user interface for page content management with realtime preview.
|
|
373
|
+
|
|
374
|
+
How to use:
|
|
375
|
+
|
|
376
|
+
```tsx
|
|
377
|
+
import {PageConstructor} from '@gravity-ui/page-constructor';
|
|
378
|
+
import {Editor} from '@gravity-ui/page-constructor/editor';
|
|
379
|
+
|
|
380
|
+
interface MyAppEditorProps {
|
|
381
|
+
initialContent: PageContent;
|
|
382
|
+
onChange: (content: PageContent) => void;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
export const MyAppEditor = ({initialContent, onChange}: MyAppEditorProps) => (
|
|
386
|
+
<Editor onChange={onChange} content={initialContent}>
|
|
387
|
+
{(props) => <PageConstructor {...props} />}
|
|
388
|
+
</Editor>
|
|
389
|
+
);
|
|
390
|
+
```
|
|
@@ -288,7 +288,9 @@ export declare const BannerCardProps: {
|
|
|
288
288
|
type: string;
|
|
289
289
|
};
|
|
290
290
|
type: {};
|
|
291
|
-
when: {
|
|
291
|
+
when: {
|
|
292
|
+
type: string;
|
|
293
|
+
};
|
|
292
294
|
};
|
|
293
295
|
};
|
|
294
296
|
export declare const BannerBlock: {
|
|
@@ -582,7 +584,9 @@ export declare const BannerBlock: {
|
|
|
582
584
|
type: string;
|
|
583
585
|
};
|
|
584
586
|
type: {};
|
|
585
|
-
when: {
|
|
587
|
+
when: {
|
|
588
|
+
type: string;
|
|
589
|
+
};
|
|
586
590
|
};
|
|
587
591
|
};
|
|
588
592
|
};
|
|
@@ -877,7 +881,9 @@ export declare const BannerCard: {
|
|
|
877
881
|
type: string;
|
|
878
882
|
};
|
|
879
883
|
type: {};
|
|
880
|
-
when: {
|
|
884
|
+
when: {
|
|
885
|
+
type: string;
|
|
886
|
+
};
|
|
881
887
|
};
|
|
882
888
|
};
|
|
883
889
|
};
|
|
@@ -73,7 +73,9 @@ export declare const CardLayoutProps: {
|
|
|
73
73
|
type: string;
|
|
74
74
|
};
|
|
75
75
|
type: {};
|
|
76
|
-
when: {
|
|
76
|
+
when: {
|
|
77
|
+
type: string;
|
|
78
|
+
};
|
|
77
79
|
};
|
|
78
80
|
};
|
|
79
81
|
export declare const CardLayoutBlock: {
|
|
@@ -152,7 +154,9 @@ export declare const CardLayoutBlock: {
|
|
|
152
154
|
type: string;
|
|
153
155
|
};
|
|
154
156
|
type: {};
|
|
155
|
-
when: {
|
|
157
|
+
when: {
|
|
158
|
+
type: string;
|
|
159
|
+
};
|
|
156
160
|
};
|
|
157
161
|
};
|
|
158
162
|
};
|
|
@@ -123,7 +123,9 @@ export declare const ExtendedFeaturesItem: {
|
|
|
123
123
|
})[];
|
|
124
124
|
};
|
|
125
125
|
type: {};
|
|
126
|
-
when: {
|
|
126
|
+
when: {
|
|
127
|
+
type: string;
|
|
128
|
+
};
|
|
127
129
|
};
|
|
128
130
|
};
|
|
129
131
|
icon: {
|
|
@@ -233,7 +235,9 @@ export declare const ExtendedFeaturesBlock: {
|
|
|
233
235
|
type: string;
|
|
234
236
|
};
|
|
235
237
|
type: {};
|
|
236
|
-
when: {
|
|
238
|
+
when: {
|
|
239
|
+
type: string;
|
|
240
|
+
};
|
|
237
241
|
};
|
|
238
242
|
};
|
|
239
243
|
};
|
|
@@ -126,7 +126,9 @@ export declare const FilterProps: {
|
|
|
126
126
|
type: string;
|
|
127
127
|
};
|
|
128
128
|
type: {};
|
|
129
|
-
when: {
|
|
129
|
+
when: {
|
|
130
|
+
type: string;
|
|
131
|
+
};
|
|
130
132
|
};
|
|
131
133
|
};
|
|
132
134
|
export declare const FilterBlock: {
|
|
@@ -231,7 +233,9 @@ export declare const FilterBlock: {
|
|
|
231
233
|
type: string;
|
|
232
234
|
};
|
|
233
235
|
type: {};
|
|
234
|
-
when: {
|
|
236
|
+
when: {
|
|
237
|
+
type: string;
|
|
238
|
+
};
|
|
235
239
|
};
|
|
236
240
|
};
|
|
237
241
|
};
|
|
@@ -59,7 +59,9 @@ export declare const IconsProps: {
|
|
|
59
59
|
type: string;
|
|
60
60
|
};
|
|
61
61
|
type: {};
|
|
62
|
-
when: {
|
|
62
|
+
when: {
|
|
63
|
+
type: string;
|
|
64
|
+
};
|
|
63
65
|
};
|
|
64
66
|
};
|
|
65
67
|
export declare const IconsBlock: {
|
|
@@ -124,7 +126,9 @@ export declare const IconsBlock: {
|
|
|
124
126
|
type: string;
|
|
125
127
|
};
|
|
126
128
|
type: {};
|
|
127
|
-
when: {
|
|
129
|
+
when: {
|
|
130
|
+
type: string;
|
|
131
|
+
};
|
|
128
132
|
};
|
|
129
133
|
};
|
|
130
134
|
};
|
|
@@ -570,7 +570,9 @@ export declare const MediaBlockBaseProps: {
|
|
|
570
570
|
type: string;
|
|
571
571
|
};
|
|
572
572
|
type: {};
|
|
573
|
-
when: {
|
|
573
|
+
when: {
|
|
574
|
+
type: string;
|
|
575
|
+
};
|
|
574
576
|
};
|
|
575
577
|
export declare const MediaBlock: {
|
|
576
578
|
'media-block': {
|
|
@@ -1158,7 +1160,9 @@ export declare const MediaBlock: {
|
|
|
1158
1160
|
type: string;
|
|
1159
1161
|
};
|
|
1160
1162
|
type: {};
|
|
1161
|
-
when: {
|
|
1163
|
+
when: {
|
|
1164
|
+
type: string;
|
|
1165
|
+
};
|
|
1162
1166
|
};
|
|
1163
1167
|
};
|
|
1164
1168
|
};
|
|
@@ -43,7 +43,9 @@ export declare const TableBlock: {
|
|
|
43
43
|
enum: string[];
|
|
44
44
|
};
|
|
45
45
|
type: {};
|
|
46
|
-
when: {
|
|
46
|
+
when: {
|
|
47
|
+
type: string;
|
|
48
|
+
};
|
|
47
49
|
};
|
|
48
50
|
};
|
|
49
51
|
anchor: {
|
|
@@ -71,7 +73,9 @@ export declare const TableBlock: {
|
|
|
71
73
|
type: string;
|
|
72
74
|
};
|
|
73
75
|
type: {};
|
|
74
|
-
when: {
|
|
76
|
+
when: {
|
|
77
|
+
type: string;
|
|
78
|
+
};
|
|
75
79
|
};
|
|
76
80
|
};
|
|
77
81
|
};
|
|
@@ -353,7 +353,9 @@ export declare const tabsItem: {
|
|
|
353
353
|
})[];
|
|
354
354
|
};
|
|
355
355
|
type: {};
|
|
356
|
-
when: {
|
|
356
|
+
when: {
|
|
357
|
+
type: string;
|
|
358
|
+
};
|
|
357
359
|
};
|
|
358
360
|
};
|
|
359
361
|
image: {
|
|
@@ -535,7 +537,9 @@ export declare const TabsBlock: {
|
|
|
535
537
|
type: string;
|
|
536
538
|
};
|
|
537
539
|
type: {};
|
|
538
|
-
when: {
|
|
540
|
+
when: {
|
|
541
|
+
type: string;
|
|
542
|
+
};
|
|
539
543
|
};
|
|
540
544
|
};
|
|
541
545
|
};
|
|
@@ -14,9 +14,9 @@ exports.BlockForm = (0, react_1.memo)((_a) => {
|
|
|
14
14
|
const prevContent = (0, usePreviousValue_1.default)(content);
|
|
15
15
|
const spec = (0, react_1.useMemo)(() => (Object.assign(Object.assign({}, specRaw), { viewSpec: Object.assign(Object.assign({}, specRaw.viewSpec), { layoutOpen: active }) })), [specRaw, active]);
|
|
16
16
|
if (!active) {
|
|
17
|
-
return (react_1.default.createElement(dynamic_forms_1.SimpleVerticalAccordeon, { open: false, name: type, title: spec.viewSpec.layoutTitle || type, onOpenChange: onSelect },
|
|
17
|
+
return (react_1.default.createElement(dynamic_forms_1.SimpleVerticalAccordeon, { open: false, name: type, title: spec.viewSpec.layoutTitle || type, onOpenChange: onSelect }, ' '));
|
|
18
18
|
}
|
|
19
|
-
return (react_1.default.createElement(react_final_form_1.Form, { initialValues: initialValues, onSubmit: lodash_1.default.noop }, () => (react_1.default.createElement(
|
|
19
|
+
return (react_1.default.createElement(react_final_form_1.Form, { initialValues: initialValues, onSubmit: lodash_1.default.noop }, () => (react_1.default.createElement(react_1.Fragment, null,
|
|
20
20
|
react_1.default.createElement(react_final_form_1.FormSpy, { onChange: ({ values }) => {
|
|
21
21
|
// fix for FormSpy onChange called twice without content changes
|
|
22
22
|
if (!lodash_1.default.isEqual(values.content, prevContent)) {
|
|
@@ -7,7 +7,8 @@ unpredictable css rules order in build */
|
|
|
7
7
|
height: var(--editor-header-height);
|
|
8
8
|
padding: 8px 20px;
|
|
9
9
|
background-color: var(--yc-color-base-background);
|
|
10
|
-
border
|
|
10
|
+
border: 1px var(--yc-color-line-generic);
|
|
11
|
+
border-style: solid none;
|
|
11
12
|
}
|
|
12
13
|
.pc-control-panel__icon {
|
|
13
14
|
display: flex;
|
|
@@ -10,7 +10,7 @@ unpredictable css rules order in build */
|
|
|
10
10
|
height: calc(100% + 40px);
|
|
11
11
|
top: -20px;
|
|
12
12
|
left: -20px;
|
|
13
|
-
border-radius:
|
|
13
|
+
border-radius: var(--pc-border-radius);
|
|
14
14
|
z-index: 100;
|
|
15
15
|
}
|
|
16
16
|
.pc-edit-block__controls_isHeader {
|
|
@@ -25,7 +25,7 @@ unpredictable css rules order in build */
|
|
|
25
25
|
.pc-edit-block__controls-content {
|
|
26
26
|
display: flex;
|
|
27
27
|
position: absolute;
|
|
28
|
-
bottom: -
|
|
28
|
+
bottom: -40px;
|
|
29
29
|
left: 50%;
|
|
30
30
|
transform: translateX(-50%);
|
|
31
31
|
}
|
|
@@ -34,14 +34,14 @@ unpredictable css rules order in build */
|
|
|
34
34
|
justify-content: center;
|
|
35
35
|
align-items: center;
|
|
36
36
|
transition: transform 0.2s;
|
|
37
|
-
width:
|
|
38
|
-
height:
|
|
39
|
-
border-radius:
|
|
37
|
+
width: 48px;
|
|
38
|
+
height: 32px;
|
|
39
|
+
border-radius: 8px;
|
|
40
40
|
background-color: var(--yc-color-promo-highlight-neon);
|
|
41
41
|
}
|
|
42
42
|
.pc-edit-block__control:hover {
|
|
43
43
|
transform: scale(1.1);
|
|
44
44
|
}
|
|
45
45
|
.pc-edit-block__control:not(:first-child) {
|
|
46
|
-
margin-left:
|
|
46
|
+
margin-left: 4px;
|
|
47
47
|
}
|
|
@@ -29,11 +29,14 @@ unpredictable css rules order in build */
|
|
|
29
29
|
}
|
|
30
30
|
.pc-editor-layout__left {
|
|
31
31
|
flex: 0 0 auto;
|
|
32
|
-
padding:
|
|
32
|
+
padding: 24px 16px;
|
|
33
33
|
width: var(--editor-left-column-width);
|
|
34
34
|
border-right: var(--editor-divider-width) solid var(--yc-color-line-generic);
|
|
35
35
|
overflow-x: auto;
|
|
36
36
|
}
|
|
37
37
|
.pc-editor-layout__right {
|
|
38
38
|
width: 100%;
|
|
39
|
+
}
|
|
40
|
+
.pc-editor-layout__right_editing {
|
|
41
|
+
padding-bottom: 200px;
|
|
39
42
|
}
|
|
@@ -3,12 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
5
|
const utils_1 = require("../../../utils");
|
|
6
|
+
const types_1 = require("../../types");
|
|
6
7
|
const ControlPanel_1 = tslib_1.__importDefault(require("../ControlPanel/ControlPanel"));
|
|
7
8
|
const b = (0, utils_1.block)('editor-layout');
|
|
8
9
|
const Left = () => null;
|
|
9
10
|
const Right = () => null;
|
|
10
11
|
const Layout = ({ children, mode, onModeChange }) => {
|
|
11
12
|
let left, right;
|
|
13
|
+
const isEditingMode = mode === types_1.ViewModeItem.Edititng;
|
|
12
14
|
function handleChild(child) {
|
|
13
15
|
switch (child === null || child === void 0 ? void 0 : child.type) {
|
|
14
16
|
case Left:
|
|
@@ -27,7 +29,7 @@ const Layout = ({ children, mode, onModeChange }) => {
|
|
|
27
29
|
react_1.default.createElement("div", { className: b('container') },
|
|
28
30
|
react_1.default.createElement(react_1.Fragment, null,
|
|
29
31
|
left && react_1.default.createElement("div", { className: b('left') }, left),
|
|
30
|
-
right && react_1.default.createElement("div", { className: b('right') }, right)))));
|
|
32
|
+
right && react_1.default.createElement("div", { className: b('right', { editing: isEditingMode }) }, right)))));
|
|
31
33
|
};
|
|
32
34
|
Layout.Left = Left;
|
|
33
35
|
Layout.Right = Right;
|
|
@@ -15,8 +15,9 @@ const Form_1 = require("../Form/Form");
|
|
|
15
15
|
const Editor = (_a) => {
|
|
16
16
|
var { children, customSchema, onChange } = _a, rest = tslib_1.__rest(_a, ["children", "customSchema", "onChange"]);
|
|
17
17
|
const { content, activeBlockIndex, errorBoundaryState, viewMode, onContentUpdate, onViewModeUpdate, onAdd, onSelect, injectEditBlockProps, } = (0, store_1.useEditorState)(rest);
|
|
18
|
+
const formSpecs = (0, useFormSpec_1.default)(customSchema);
|
|
18
19
|
const isEditingMode = viewMode === types_1.ViewModeItem.Edititng;
|
|
19
|
-
const
|
|
20
|
+
const outgoingProps = (0, react_1.useMemo)(() => {
|
|
20
21
|
const custom = isEditingMode
|
|
21
22
|
? (0, utils_1.addCustomDecorator)([
|
|
22
23
|
(props) => (react_1.default.createElement(EditBlock_1.default, Object.assign({}, injectEditBlockProps(props)))),
|
|
@@ -24,17 +25,16 @@ const Editor = (_a) => {
|
|
|
24
25
|
(props) => (react_1.default.createElement(ErrorBoundary_1.ErrorBoundary, Object.assign({}, props, { key: `${(0, utils_1.getBlockId)(props)}-${errorBoundaryState}` }))),
|
|
25
26
|
], rest.custom)
|
|
26
27
|
: rest.custom;
|
|
27
|
-
return { content, custom };
|
|
28
|
-
}, [injectEditBlockProps, content, errorBoundaryState, isEditingMode, rest.custom]);
|
|
28
|
+
return { content, custom, viewMode };
|
|
29
|
+
}, [injectEditBlockProps, content, errorBoundaryState, isEditingMode, viewMode, rest.custom]);
|
|
29
30
|
(0, react_1.useEffect)(() => {
|
|
30
31
|
onChange === null || onChange === void 0 ? void 0 : onChange(content);
|
|
31
32
|
}, [content, onChange]);
|
|
32
|
-
const formSpecs = (0, useFormSpec_1.default)(customSchema);
|
|
33
33
|
return (react_1.default.createElement(Layout_1.default, { mode: viewMode, onModeChange: onViewModeUpdate },
|
|
34
34
|
isEditingMode && (react_1.default.createElement(Layout_1.default.Left, null,
|
|
35
35
|
react_1.default.createElement(Form_1.Form, { content: content, onChange: onContentUpdate, activeBlockIndex: activeBlockIndex, onSelect: onSelect, spec: formSpecs }))),
|
|
36
36
|
react_1.default.createElement(Layout_1.default.Right, null,
|
|
37
|
-
react_1.default.createElement(ErrorBoundary_1.ErrorBoundary, { key: errorBoundaryState }, children(
|
|
37
|
+
react_1.default.createElement(ErrorBoundary_1.ErrorBoundary, { key: errorBoundaryState }, children(outgoingProps)),
|
|
38
38
|
isEditingMode && react_1.default.createElement(AddBlock_1.default, { onAdd: onAdd }))));
|
|
39
39
|
};
|
|
40
40
|
exports.Editor = Editor;
|
|
@@ -3,14 +3,14 @@ unpredictable css rules order in build */
|
|
|
3
3
|
.pc-editor-form {
|
|
4
4
|
--top-level-font-size: var(--yc-text-display-2-font-size);
|
|
5
5
|
--top-level-line-height: var(--yc-text-display-2-line-height);
|
|
6
|
-
--block-propery-font-size: var(--yc-text-body-3-font-size);
|
|
7
|
-
--block-property-line-height: var(--yc-text-body-3-line-height);
|
|
8
|
-
--
|
|
9
|
-
--
|
|
10
|
-
--
|
|
11
|
-
--
|
|
6
|
+
--block-level-complex-propery-font-size: var(--yc-text-body-3-font-size);
|
|
7
|
+
--block-level-complex-property-line-height: var(--yc-text-body-3-line-height);
|
|
8
|
+
--complex-property-font-size: var(--yc-text-body-2-font-size);
|
|
9
|
+
--complex-property-line-height: var(--yc-text-body-2-line-height);
|
|
10
|
+
--property-font-size: var(--yc-text-body-1-font-size);
|
|
11
|
+
--property-line-height: var(--yc-text-body-1-line-height);
|
|
12
12
|
--input-min-width: 150px;
|
|
13
|
-
--property-title-width:
|
|
13
|
+
--property-title-width: 96px;
|
|
14
14
|
--button-height: 48px;
|
|
15
15
|
--icon-size: 32px;
|
|
16
16
|
--icon-margin: 42px;
|
|
@@ -24,20 +24,23 @@ unpredictable css rules order in build */
|
|
|
24
24
|
--button-height: 32px;
|
|
25
25
|
--icon-size: 20px;
|
|
26
26
|
--icon-margin: 30px;
|
|
27
|
-
--header-text-size: var(--block-propery-font-size);
|
|
28
|
-
--header-line-height: var(--block-property-line-height);
|
|
29
|
-
--text-size: var(--
|
|
30
|
-
--line-height: var(--
|
|
27
|
+
--header-text-size: var(--block-level-complex-propery-font-size);
|
|
28
|
+
--header-line-height: var(--block-level-complex-property-line-height);
|
|
29
|
+
--text-size: var(--property-font-size);
|
|
30
|
+
--line-height: var(--property-line-height);
|
|
31
|
+
--property-font-weight: 400;
|
|
31
32
|
}
|
|
32
33
|
.pc-editor-form .df-use-search .df-use-search .df-use-search {
|
|
33
34
|
--button-height: 28px;
|
|
34
35
|
--icon-size: 16px;
|
|
35
36
|
--icon-margin: 25px;
|
|
36
37
|
--property-font-weight: 400;
|
|
37
|
-
--header-text-size: var(--complex-
|
|
38
|
-
--header-line-height: var(--complex-
|
|
39
|
-
--text-size: var(--
|
|
40
|
-
--line-height: var(--
|
|
38
|
+
--header-text-size: var(--complex-property-font-size);
|
|
39
|
+
--header-line-height: var(--complex-property-line-height);
|
|
40
|
+
--text-size: var(--property-font-size);
|
|
41
|
+
--line-height: var(--property-line-height);
|
|
42
|
+
--oneof-text-size: var(--complex-propery-font-size);
|
|
43
|
+
--oneof-line-height: var(--complex-property-line-height);
|
|
41
44
|
}
|
|
42
45
|
.pc-editor-form .df-row {
|
|
43
46
|
width: inherit;
|
|
@@ -73,17 +76,29 @@ unpredictable css rules order in build */
|
|
|
73
76
|
.pc-editor-form .df-simple-vertical-accordeon__header .yc-button .yc-button__icon_side_right ~ .yc-button__text {
|
|
74
77
|
margin-right: var(--icon-margin);
|
|
75
78
|
}
|
|
79
|
+
.pc-editor-form .df-simple-vertical-accordeon__body {
|
|
80
|
+
margin-top: 0px;
|
|
81
|
+
padding-top: 12px;
|
|
82
|
+
}
|
|
83
|
+
.pc-editor-form .df-use-search {
|
|
84
|
+
margin: 4px 0;
|
|
85
|
+
}
|
|
76
86
|
.pc-editor-form .df-simple-vertical-accordeon__body,
|
|
77
87
|
.pc-editor-form .df-group-indent > .df-use-search {
|
|
78
88
|
margin-top: 0;
|
|
79
89
|
margin-left: 1px;
|
|
80
|
-
padding-top:
|
|
81
|
-
padding-
|
|
90
|
+
padding-top: 4px;
|
|
91
|
+
padding-bottom: 4px;
|
|
92
|
+
padding-left: 12px;
|
|
82
93
|
border-left: 1px solid var(--yc-color-line-generic-accent);
|
|
83
94
|
}
|
|
95
|
+
.pc-editor-form .df-simple-vertical-accordeon_branch .df-simple-vertical-accordeon__body {
|
|
96
|
+
padding-left: 12px;
|
|
97
|
+
}
|
|
84
98
|
.pc-editor-form .g-select,
|
|
85
99
|
.pc-editor-form .yc-text-input {
|
|
86
|
-
width: var(--input-min-width);
|
|
100
|
+
min-width: var(--input-min-width);
|
|
101
|
+
width: 100%;
|
|
87
102
|
}
|
|
88
103
|
.pc-editor-form + .pc-editor-form {
|
|
89
104
|
margin-top: 12px;
|
|
@@ -91,4 +106,7 @@ unpredictable css rules order in build */
|
|
|
91
106
|
.pc-editor-form__tabs {
|
|
92
107
|
--yc-color-base-special: var(--yc-color-promo-base-neon);
|
|
93
108
|
margin-bottom: 20px;
|
|
109
|
+
}
|
|
110
|
+
.pc-editor-form__block-form {
|
|
111
|
+
margin-bottom: 16px;
|
|
94
112
|
}
|
|
@@ -30,13 +30,14 @@ exports.Form = (0, react_1.memo)(({ content, onChange, activeBlockIndex, onSelec
|
|
|
30
30
|
break;
|
|
31
31
|
}
|
|
32
32
|
case FormTab.Blocks: {
|
|
33
|
-
form = (react_1.default.createElement(react_1.Fragment, null, blocks.map((blockData, index) => blocksSpec[blockData.type] ? (react_1.default.createElement(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
form = (react_1.default.createElement(react_1.Fragment, null, blocks.map((blockData, index) => blocksSpec[blockData.type] ? (react_1.default.createElement("div", { className: b('block-form') },
|
|
34
|
+
react_1.default.createElement(BlockForm_1.BlockForm, { spec: blocksSpec[blockData.type], key: (0, utils_1.getBlockKey)(blockData, index), data: blockData, active: activeBlockIndex === index, onChange: (data) => {
|
|
35
|
+
onChange(Object.assign(Object.assign({}, content), { blocks: [
|
|
36
|
+
...blocks.slice(0, index),
|
|
37
|
+
data,
|
|
38
|
+
...blocks.slice(index + 1),
|
|
39
|
+
] }));
|
|
40
|
+
}, onSelect: () => onSelect(index) }))) : null)));
|
|
40
41
|
break;
|
|
41
42
|
}
|
|
42
43
|
}
|
|
@@ -4,8 +4,11 @@ import { BlockDecorationProps, PageContent } from '../../models';
|
|
|
4
4
|
import { SchemaCustomConfig } from '../../schema';
|
|
5
5
|
import { EditBlockActions } from '../components/EditBlock/EditBlock';
|
|
6
6
|
export type EditorBlockId = number | string;
|
|
7
|
+
export interface EditorOutgoingProps extends Partial<PageConstructorProps> {
|
|
8
|
+
viewMode: ViewModeItem;
|
|
9
|
+
}
|
|
7
10
|
export interface EditorProps extends Required<Pick<PageConstructorProps, 'content'>>, Partial<Omit<PageConstructorProps, 'content'>> {
|
|
8
|
-
children: (props:
|
|
11
|
+
children: (props: EditorOutgoingProps) => React.ReactNode;
|
|
9
12
|
onChange?: (data: PageContent) => void;
|
|
10
13
|
customSchema?: SchemaCustomConfig;
|
|
11
14
|
}
|