@gravity-ui/page-constructor 4.40.6 → 4.41.1-alpha.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/build/cjs/components/Author/Author.css +4 -2
- package/build/cjs/components/Author/Author.js +2 -2
- package/build/cjs/editor/components/CodeEditor/CodeEditor.css +56 -0
- package/build/cjs/editor/components/CodeEditor/CodeEditor.d.ts +12 -0
- package/build/cjs/editor/components/CodeEditor/CodeEditor.js +31 -0
- package/build/cjs/editor/components/CodeEditor/constants.d.ts +2 -0
- package/build/cjs/editor/components/CodeEditor/constants.js +20 -0
- package/build/cjs/editor/components/Layout/Layout.css +2 -1
- package/build/cjs/editor/containers/Editor/Editor.js +9 -5
- package/build/cjs/editor/containers/Form/Form.css +5 -2
- package/build/cjs/editor/containers/Form/Form.d.ts +10 -3
- package/build/cjs/editor/containers/Form/Form.js +12 -16
- package/build/cjs/editor/hooks/useCodeValidator.d.ts +4 -0
- package/build/cjs/editor/hooks/useCodeValidator.js +10 -0
- package/build/cjs/editor/hooks/useFormSpec.d.ts +2 -2
- package/build/cjs/editor/hooks/useFormSpec.js +2 -6
- package/build/cjs/editor/store/main/index.d.ts +12 -0
- package/build/cjs/editor/store/{index.js → main/index.js} +10 -16
- package/build/cjs/editor/store/{reducer.d.ts → main/reducer.d.ts} +5 -15
- package/build/cjs/editor/store/{reducer.js → main/reducer.js} +1 -7
- package/build/cjs/editor/store/{utils.d.ts → main/utils.d.ts} +3 -3
- package/build/cjs/editor/store/settings/index.d.ts +12 -0
- package/build/cjs/editor/store/settings/index.js +21 -0
- package/build/cjs/editor/store/settings/reducer.d.ts +37 -0
- package/build/cjs/editor/store/settings/reducer.js +32 -0
- package/build/cjs/editor/styles/root.css +2 -1
- package/build/cjs/editor/types/index.d.ts +5 -0
- package/build/cjs/editor/types/index.js +7 -1
- package/build/cjs/editor/utils/code.d.ts +6 -0
- package/build/cjs/editor/utils/code.js +11 -0
- package/build/cjs/editor/utils/validation.d.ts +13 -0
- package/build/cjs/editor/utils/validation.js +57 -0
- package/build/cjs/models/constructor-items/common.d.ts +1 -0
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +12 -1
- package/build/cjs/schema/constants.d.ts +4 -0
- package/build/cjs/sub-blocks/Quote/Quote.css +11 -18
- package/build/cjs/sub-blocks/Quote/Quote.js +7 -6
- package/build/cjs/sub-blocks/Quote/schema.d.ts +4 -0
- package/build/cjs/sub-blocks/Quote/schema.js +4 -1
- package/build/cjs/text-transform/config.js +10 -4
- package/build/esm/components/Author/Author.css +4 -2
- package/build/esm/components/Author/Author.js +2 -2
- package/build/esm/editor/components/CodeEditor/CodeEditor.css +56 -0
- package/build/esm/editor/components/CodeEditor/CodeEditor.d.ts +13 -0
- package/build/esm/editor/components/CodeEditor/CodeEditor.js +27 -0
- package/build/esm/editor/components/CodeEditor/constants.d.ts +2 -0
- package/build/esm/editor/components/CodeEditor/constants.js +17 -0
- package/build/esm/editor/components/Layout/Layout.css +2 -1
- package/build/esm/editor/containers/Editor/Editor.js +9 -5
- package/build/esm/editor/containers/Form/Form.css +5 -2
- package/build/esm/editor/containers/Form/Form.d.ts +10 -3
- package/build/esm/editor/containers/Form/Form.js +9 -13
- package/build/esm/editor/hooks/useCodeValidator.d.ts +4 -0
- package/build/esm/editor/hooks/useCodeValidator.js +6 -0
- package/build/esm/editor/hooks/useFormSpec.d.ts +2 -2
- package/build/esm/editor/hooks/useFormSpec.js +2 -6
- package/build/esm/editor/store/main/index.d.ts +12 -0
- package/build/esm/editor/store/{index.js → main/index.js} +9 -15
- package/build/esm/editor/store/{reducer.d.ts → main/reducer.d.ts} +5 -15
- package/build/esm/editor/store/{reducer.js → main/reducer.js} +0 -6
- package/build/esm/editor/store/{utils.d.ts → main/utils.d.ts} +3 -3
- package/build/esm/editor/store/settings/index.d.ts +12 -0
- package/build/esm/editor/store/settings/index.js +17 -0
- package/build/esm/editor/store/settings/reducer.d.ts +37 -0
- package/build/esm/editor/store/settings/reducer.js +28 -0
- package/build/esm/editor/styles/root.css +2 -1
- package/build/esm/editor/types/index.d.ts +5 -0
- package/build/esm/editor/types/index.js +6 -0
- package/build/esm/editor/utils/code.d.ts +6 -0
- package/build/esm/editor/utils/code.js +6 -0
- package/build/esm/editor/utils/validation.d.ts +13 -0
- package/build/esm/editor/utils/validation.js +51 -0
- package/build/esm/models/constructor-items/common.d.ts +1 -0
- package/build/esm/models/constructor-items/sub-blocks.d.ts +12 -1
- package/build/esm/schema/constants.d.ts +4 -0
- package/build/esm/sub-blocks/Quote/Quote.css +11 -18
- package/build/esm/sub-blocks/Quote/Quote.js +8 -7
- package/build/esm/sub-blocks/Quote/schema.d.ts +4 -0
- package/build/esm/sub-blocks/Quote/schema.js +4 -1
- package/build/esm/text-transform/config.js +10 -4
- package/package.json +4 -1
- package/server/models/constructor-items/common.d.ts +1 -0
- package/server/models/constructor-items/sub-blocks.d.ts +12 -1
- package/server/text-transform/config.js +10 -4
- package/styles/styles.css +1 -0
- package/styles/styles.scss +1 -0
- package/styles/variables.scss +2 -0
- package/widget/index.js +1 -1
- package/build/cjs/editor/components/YamlEditor/YamlEditor.css +0 -12
- package/build/cjs/editor/components/YamlEditor/YamlEditor.d.ts +0 -6
- package/build/cjs/editor/components/YamlEditor/YamlEditor.js +0 -34
- package/build/cjs/editor/store/index.d.ts +0 -16
- package/build/esm/editor/components/YamlEditor/YamlEditor.css +0 -12
- package/build/esm/editor/components/YamlEditor/YamlEditor.d.ts +0 -7
- package/build/esm/editor/components/YamlEditor/YamlEditor.js +0 -30
- package/build/esm/editor/store/index.d.ts +0 -16
- /package/build/cjs/editor/store/{utils.js → main/utils.js} +0 -0
- /package/build/esm/editor/store/{utils.js → main/utils.js} +0 -0
|
@@ -5,7 +5,6 @@ unpredictable css rules order in build */
|
|
|
5
5
|
line-height: var(--g-text-body-3-line-height);
|
|
6
6
|
display: flex;
|
|
7
7
|
flex-direction: column;
|
|
8
|
-
color: var(--g-color-text-secondary);
|
|
9
8
|
}
|
|
10
9
|
.pc-author__avatar {
|
|
11
10
|
width: 80px;
|
|
@@ -25,11 +24,11 @@ unpredictable css rules order in build */
|
|
|
25
24
|
.pc-author__name {
|
|
26
25
|
font-size: var(--g-text-body-3-font-size);
|
|
27
26
|
line-height: var(--g-text-body-3-line-height);
|
|
28
|
-
color: var(--g-color-text-primary);
|
|
29
27
|
}
|
|
30
28
|
.pc-author__description {
|
|
31
29
|
font-size: var(--g-text-body-2-font-size);
|
|
32
30
|
line-height: var(--g-text-body-2-line-height);
|
|
31
|
+
color: var(--g-color-text-secondary);
|
|
33
32
|
padding-top: 4px;
|
|
34
33
|
}
|
|
35
34
|
.pc-author__label:not(:first-child) {
|
|
@@ -53,4 +52,7 @@ unpredictable css rules order in build */
|
|
|
53
52
|
}
|
|
54
53
|
.pc-author_type_line .pc-author__label:not(:first-child) {
|
|
55
54
|
margin-left: 16px;
|
|
55
|
+
}
|
|
56
|
+
.pc-author_theme_dark .pc-author__description {
|
|
57
|
+
color: var(--g-color-text-light-secondary);
|
|
56
58
|
}
|
|
@@ -8,7 +8,7 @@ const utils_2 = require("../Media/Image/utils");
|
|
|
8
8
|
const index_1 = require("../index");
|
|
9
9
|
const b = (0, utils_1.block)('author');
|
|
10
10
|
const Author = (props) => {
|
|
11
|
-
const { author, className, authorContainerClassName, type = models_1.AuthorType.Column, qa } = props;
|
|
11
|
+
const { author, className, authorContainerClassName, type = models_1.AuthorType.Column, qa, theme, } = props;
|
|
12
12
|
const { firstName, secondName, description, avatar } = author;
|
|
13
13
|
const name = secondName ? `${firstName} ${secondName}` : firstName;
|
|
14
14
|
const isAvatarJSX = react_1.default.isValidElement(avatar);
|
|
@@ -16,7 +16,7 @@ const Author = (props) => {
|
|
|
16
16
|
if (!isAvatarJSX && avatar) {
|
|
17
17
|
avatarProps = (0, utils_2.getMediaImage)(avatar);
|
|
18
18
|
}
|
|
19
|
-
return (react_1.default.createElement("div", { className: b({ type }, className), "data-qa": qa },
|
|
19
|
+
return (react_1.default.createElement("div", { className: b({ type, theme }, className), "data-qa": qa },
|
|
20
20
|
avatar && (react_1.default.createElement("div", { className: b('avatar', authorContainerClassName) }, isAvatarJSX ? avatar : react_1.default.createElement(index_1.Image, Object.assign({}, avatarProps)))),
|
|
21
21
|
react_1.default.createElement("div", { className: b('label') },
|
|
22
22
|
react_1.default.createElement("div", { className: b('name') }, name),
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
.pc-code-editor {
|
|
2
|
+
height: 100%;
|
|
3
|
+
position: relative;
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
}
|
|
6
|
+
.pc-code-editor_fullscreen {
|
|
7
|
+
position: fixed;
|
|
8
|
+
top: 0;
|
|
9
|
+
left: 0;
|
|
10
|
+
width: 100%;
|
|
11
|
+
height: 100vh;
|
|
12
|
+
z-index: 1000;
|
|
13
|
+
background: var(--g-color-base-background);
|
|
14
|
+
}
|
|
15
|
+
.pc-code-editor_fullscreen .pc-code-editor__header {
|
|
16
|
+
margin-top: var(--pc-editor-header-height);
|
|
17
|
+
}
|
|
18
|
+
.pc-code-editor__code {
|
|
19
|
+
width: 100%;
|
|
20
|
+
height: 100%;
|
|
21
|
+
}
|
|
22
|
+
.pc-code-editor__header, .pc-code-editor__footer {
|
|
23
|
+
padding: 0 20px;
|
|
24
|
+
background: var(--g-color-base-background);
|
|
25
|
+
}
|
|
26
|
+
.pc-code-editor__header {
|
|
27
|
+
display: flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
justify-content: flex-end;
|
|
30
|
+
height: var(--pc-editor-code-header-height);
|
|
31
|
+
border-bottom: 1px solid var(--g-color-line-generic);
|
|
32
|
+
}
|
|
33
|
+
.pc-code-editor__footer {
|
|
34
|
+
position: absolute;
|
|
35
|
+
left: 0;
|
|
36
|
+
bottom: 0;
|
|
37
|
+
width: 100%;
|
|
38
|
+
min-height: var(--pc-editor-code-header-height);
|
|
39
|
+
border-top: 1px solid var(--g-color-line-generic);
|
|
40
|
+
}
|
|
41
|
+
.pc-code-editor__message-container {
|
|
42
|
+
max-height: 140px;
|
|
43
|
+
padding: 12px;
|
|
44
|
+
overflow-y: auto;
|
|
45
|
+
font-family: Menlo, Monaco, "Courier New", monospace;
|
|
46
|
+
white-space: pre-wrap;
|
|
47
|
+
}
|
|
48
|
+
.pc-code-editor__message_status_success {
|
|
49
|
+
color: var(--g-color-text-positive);
|
|
50
|
+
}
|
|
51
|
+
.pc-code-editor__message_status_warning {
|
|
52
|
+
color: var(--g-color-text-warning-heavy);
|
|
53
|
+
}
|
|
54
|
+
.pc-code-editor__message_status_error {
|
|
55
|
+
color: var(--g-color-text-danger);
|
|
56
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PageContent } from '../../../models';
|
|
2
|
+
import { CodeEditorMessageProps } from '../../utils/validation';
|
|
3
|
+
interface CodeEditorProps {
|
|
4
|
+
content: PageContent;
|
|
5
|
+
fullscreenModeOn: boolean;
|
|
6
|
+
validator: (code: string) => CodeEditorMessageProps;
|
|
7
|
+
onFullscreenModeOnUpdate: (fullscreenModeOn: boolean) => void;
|
|
8
|
+
onChange: (content: PageContent) => void;
|
|
9
|
+
message?: CodeEditorMessageProps;
|
|
10
|
+
}
|
|
11
|
+
export declare const CodeEditor: ({ content, onChange, validator, fullscreenModeOn, onFullscreenModeOnUpdate, }: CodeEditorProps) => JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CodeEditor = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
const icons_1 = require("@gravity-ui/icons");
|
|
7
|
+
const uikit_1 = require("@gravity-ui/uikit");
|
|
8
|
+
const js_yaml_1 = tslib_1.__importDefault(require("js-yaml"));
|
|
9
|
+
const react_monaco_editor_1 = tslib_1.__importDefault(require("react-monaco-editor"));
|
|
10
|
+
const utils_1 = require("../../../utils");
|
|
11
|
+
const code_1 = require("../../utils/code");
|
|
12
|
+
const constants_1 = require("./constants");
|
|
13
|
+
const b = (0, utils_1.block)('code-editor');
|
|
14
|
+
const CodeEditor = ({ content, onChange, validator, fullscreenModeOn, onFullscreenModeOnUpdate, }) => {
|
|
15
|
+
const value = (0, react_1.useMemo)(() => js_yaml_1.default.dump(content), [content]);
|
|
16
|
+
const [message, setMessage] = (0, react_1.useState)(() => validator(value));
|
|
17
|
+
const onChangeWithValidation = (0, react_1.useCallback)((code) => {
|
|
18
|
+
const validationResult = validator(code);
|
|
19
|
+
setMessage(validationResult);
|
|
20
|
+
onChange((0, code_1.parseCode)(code));
|
|
21
|
+
}, [onChange, validator]);
|
|
22
|
+
return (react_1.default.createElement("div", { className: b({ fullscreen: fullscreenModeOn }) },
|
|
23
|
+
react_1.default.createElement("div", { className: b('header') },
|
|
24
|
+
react_1.default.createElement(uikit_1.Button, { view: "flat-secondary", onClick: () => onFullscreenModeOnUpdate(!fullscreenModeOn) },
|
|
25
|
+
react_1.default.createElement(uikit_1.Icon, { data: fullscreenModeOn ? icons_1.ChevronsCollapseUpRight : icons_1.ChevronsExpandUpRight, size: 16 }))),
|
|
26
|
+
react_1.default.createElement("div", { className: b('code') },
|
|
27
|
+
react_1.default.createElement(react_monaco_editor_1.default, { key: String(fullscreenModeOn), value: value, language: "yaml", options: constants_1.options, onChange: onChangeWithValidation, theme: "vs" })),
|
|
28
|
+
react_1.default.createElement("div", { className: b('footer') }, message && (react_1.default.createElement("div", { className: b('message-container') },
|
|
29
|
+
react_1.default.createElement("div", { className: b('message', { status: message.status }) }, message.text))))));
|
|
30
|
+
};
|
|
31
|
+
exports.CodeEditor = CodeEditor;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.options = void 0;
|
|
4
|
+
exports.options = {
|
|
5
|
+
wordWrap: 'on',
|
|
6
|
+
renderLineHighlight: 'none',
|
|
7
|
+
selectOnLineNumbers: true,
|
|
8
|
+
renderWhitespace: 'all',
|
|
9
|
+
automaticLayout: true,
|
|
10
|
+
minimap: {
|
|
11
|
+
enabled: false,
|
|
12
|
+
},
|
|
13
|
+
overviewRulerLanes: 0,
|
|
14
|
+
hideCursorInOverviewRuler: true,
|
|
15
|
+
scrollbar: {
|
|
16
|
+
vertical: 'hidden',
|
|
17
|
+
},
|
|
18
|
+
overviewRulerBorder: false,
|
|
19
|
+
readOnly: false,
|
|
20
|
+
};
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
unpredictable css rules order in build */
|
|
3
3
|
body {
|
|
4
4
|
--pc-editor-header-height: 48px;
|
|
5
|
+
--pc-editor-code-header-height: 36px;
|
|
5
6
|
--pc-editor-divider-width: 12px;
|
|
7
|
+
--pc-editor-left-column-width: calc(400px + var(--pc-editor-divider-width));
|
|
6
8
|
--pc-editor-base-color: var(--g-color-base-brand);
|
|
7
9
|
--pc-editor-control-color: var(--g-color-base-brand);
|
|
8
10
|
--pc-editor-control-icon-color: var(--g-color-text-dark-primary);
|
|
9
|
-
--pc-editor-left-column-width: calc(400px + var(--pc-editor-divider-width));
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
.pc-editor-layout__left, .pc-editor-layout__right {
|
|
@@ -4,23 +4,27 @@ exports.Editor = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
6
|
const PageConstructor_1 = require("../../../containers/PageConstructor");
|
|
7
|
+
const schema_1 = require("../../../schema");
|
|
7
8
|
const AddBlock_1 = tslib_1.__importDefault(require("../../components/AddBlock/AddBlock"));
|
|
8
9
|
const EditBlock_1 = tslib_1.__importDefault(require("../../components/EditBlock/EditBlock"));
|
|
9
10
|
const ErrorBoundary_1 = require("../../components/ErrorBoundary/ErrorBoundary");
|
|
10
11
|
const Layout_1 = tslib_1.__importDefault(require("../../components/Layout/Layout"));
|
|
11
12
|
const NotFoundBlock_1 = require("../../components/NotFoundBlock/NotFoundBlock");
|
|
12
13
|
const context_1 = require("../../context");
|
|
13
|
-
const
|
|
14
|
-
const
|
|
14
|
+
const useCodeValidator_1 = require("../../hooks/useCodeValidator");
|
|
15
|
+
const main_1 = require("../../store/main");
|
|
16
|
+
const settings_1 = require("../../store/settings");
|
|
15
17
|
const types_1 = require("../../types");
|
|
16
18
|
const utils_1 = require("../../utils");
|
|
17
19
|
const Form_1 = require("../Form/Form");
|
|
18
20
|
const Editor = (_a) => {
|
|
19
21
|
var { customSchema, onChange, providerProps, transformContent, deviceEmulationSettings } = _a, rest = tslib_1.__rest(_a, ["customSchema", "onChange", "providerProps", "transformContent", "deviceEmulationSettings"]);
|
|
20
|
-
const { content, activeBlockIndex, errorBoundaryState,
|
|
21
|
-
const
|
|
22
|
+
const { content, activeBlockIndex, errorBoundaryState, onContentUpdate, onAdd, onSelect, injectEditBlockProps, } = (0, main_1.useMainState)(rest);
|
|
23
|
+
const { viewMode, theme, onViewModeUpdate, onThemeUpdate, formTab, onFormTabUpdate, codeFullscreeModeOn, onCodeFullscreeModeOnUpdate, } = (0, settings_1.useSettingsState)();
|
|
22
24
|
const isEditingMode = viewMode === types_1.ViewModeItem.Edititng;
|
|
23
25
|
const transformedContent = (0, react_1.useMemo)(() => (transformContent ? transformContent(content, { viewMode }) : content), [content, transformContent, viewMode]);
|
|
26
|
+
const schema = (0, react_1.useMemo)(() => (0, schema_1.generateDefaultSchema)(customSchema), [customSchema]);
|
|
27
|
+
const codeValidator = (0, useCodeValidator_1.useCodeValidator)(schema);
|
|
24
28
|
const outgoingProps = (0, react_1.useMemo)(() => {
|
|
25
29
|
const custom = isEditingMode
|
|
26
30
|
? (0, utils_1.addCustomDecorator)([
|
|
@@ -57,7 +61,7 @@ const Editor = (_a) => {
|
|
|
57
61
|
return (react_1.default.createElement(context_1.EditorContext.Provider, { value: context },
|
|
58
62
|
react_1.default.createElement(Layout_1.default, { mode: viewMode, onModeChange: onViewModeUpdate, theme: theme, onThemeChange: onThemeUpdate },
|
|
59
63
|
isEditingMode && (react_1.default.createElement(Layout_1.default.Left, null,
|
|
60
|
-
react_1.default.createElement(Form_1.Form, { content: content, onChange: onContentUpdate, activeBlockIndex: activeBlockIndex,
|
|
64
|
+
react_1.default.createElement(Form_1.Form, { content: content, onChange: onContentUpdate, activeBlockIndex: activeBlockIndex, activeTab: formTab, codeFullscreeModeOn: codeFullscreeModeOn, schema: schema, codeValidator: codeValidator, onActiveTabUpdate: onFormTabUpdate, onCodeFullscreeModeOnUpdate: onCodeFullscreeModeOnUpdate, onSelect: onSelect }))),
|
|
61
65
|
react_1.default.createElement(Layout_1.default.Right, null,
|
|
62
66
|
react_1.default.createElement(ErrorBoundary_1.ErrorBoundary, { key: errorBoundaryState },
|
|
63
67
|
react_1.default.createElement(PageConstructor_1.PageConstructorProvider, Object.assign({}, providerProps, { theme: theme }),
|
|
@@ -89,6 +89,9 @@ unpredictable css rules order in build */
|
|
|
89
89
|
.pc-editor-form__block-form {
|
|
90
90
|
margin-bottom: 16px;
|
|
91
91
|
}
|
|
92
|
-
.pc-editor-
|
|
93
|
-
height: 100
|
|
92
|
+
.pc-editor-form_code-editor-active {
|
|
93
|
+
height: calc(100% - var(--pc-editor-code-header-height));
|
|
94
|
+
}
|
|
95
|
+
.pc-editor-form_code-editor-active .pc-editor-form__tabs {
|
|
96
|
+
margin-bottom: 0;
|
|
94
97
|
}
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { JSONSchema4 } from 'json-schema';
|
|
2
3
|
import { PageContent } from '../../../models';
|
|
3
|
-
import {
|
|
4
|
+
import { FormTab } from '../../types';
|
|
5
|
+
import { CodeEditorMessageProps } from '../../utils/validation';
|
|
4
6
|
export interface FormProps {
|
|
5
7
|
content: PageContent;
|
|
8
|
+
schema: JSONSchema4;
|
|
6
9
|
activeBlockIndex: number;
|
|
7
|
-
|
|
10
|
+
activeTab: FormTab;
|
|
11
|
+
codeFullscreeModeOn: boolean;
|
|
12
|
+
onActiveTabUpdate: (tab: FormTab) => void;
|
|
13
|
+
onCodeFullscreeModeOnUpdate: (codeFullscreeModeOn: boolean) => void;
|
|
14
|
+
codeValidator: (code: string) => CodeEditorMessageProps;
|
|
8
15
|
onChange: (content: PageContent) => void;
|
|
9
16
|
onSelect: (index: number) => void;
|
|
10
17
|
}
|
|
11
|
-
export declare const Form: React.MemoExoticComponent<({ content, onChange, activeBlockIndex, onSelect,
|
|
18
|
+
export declare const Form: React.MemoExoticComponent<({ content, onChange, activeBlockIndex, onSelect, schema, codeValidator, activeTab, onActiveTabUpdate, codeFullscreeModeOn, onCodeFullscreeModeOnUpdate, }: FormProps) => JSX.Element>;
|
|
@@ -6,32 +6,28 @@ const react_1 = tslib_1.__importStar(require("react"));
|
|
|
6
6
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
7
7
|
const utils_1 = require("../../../utils");
|
|
8
8
|
const BlockForm_1 = require("../../components/BlockForm/BlockForm");
|
|
9
|
+
const CodeEditor_1 = require("../../components/CodeEditor/CodeEditor");
|
|
9
10
|
const PagePropsForm_1 = require("../../components/PagePropsForm/PagePropsForm");
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
(function (FormTab) {
|
|
13
|
-
FormTab["Blocks"] = "blocks";
|
|
14
|
-
FormTab["Page"] = "page";
|
|
15
|
-
FormTab["Yaml"] = "yaml";
|
|
16
|
-
})(FormTab || (FormTab = {}));
|
|
11
|
+
const useFormSpec_1 = tslib_1.__importDefault(require("../../hooks/useFormSpec"));
|
|
12
|
+
const types_1 = require("../../types");
|
|
17
13
|
const b = (0, utils_1.block)('editor-form');
|
|
18
|
-
const tabsItems = Object.values(FormTab).map((tab) => ({
|
|
14
|
+
const tabsItems = Object.values(types_1.FormTab).map((tab) => ({
|
|
19
15
|
id: tab,
|
|
20
16
|
title: tab,
|
|
21
17
|
}));
|
|
22
|
-
exports.Form = (0, react_1.memo)(({ content, onChange, activeBlockIndex, onSelect,
|
|
23
|
-
const [activeTab, setActiveTab] = react_1.default.useState(FormTab.Blocks);
|
|
18
|
+
exports.Form = (0, react_1.memo)(({ content, onChange, activeBlockIndex, onSelect, schema, codeValidator, activeTab, onActiveTabUpdate, codeFullscreeModeOn, onCodeFullscreeModeOnUpdate, }) => {
|
|
24
19
|
const _a = content || {}, { blocks } = _a, page = tslib_1.__rest(_a, ["blocks"]);
|
|
20
|
+
const spec = (0, useFormSpec_1.default)(schema);
|
|
25
21
|
const { blocks: blocksSpec, page: pageSpec } = spec || {};
|
|
26
22
|
let form;
|
|
27
23
|
switch (activeTab) {
|
|
28
|
-
case FormTab.Page: {
|
|
24
|
+
case types_1.FormTab.Page: {
|
|
29
25
|
form = (react_1.default.createElement(PagePropsForm_1.PagePropsForm, { spec: pageSpec, data: page, onChange: (data) => {
|
|
30
26
|
return onChange(Object.assign(Object.assign({}, content), data));
|
|
31
27
|
} }));
|
|
32
28
|
break;
|
|
33
29
|
}
|
|
34
|
-
case FormTab.Blocks: {
|
|
30
|
+
case types_1.FormTab.Blocks: {
|
|
35
31
|
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'), key: (0, utils_1.getBlockKey)(blockData, index) },
|
|
36
32
|
react_1.default.createElement(BlockForm_1.BlockForm, { spec: blocksSpec[blockData.type], data: blockData, active: activeBlockIndex === index, onChange: (data) => {
|
|
37
33
|
onChange(Object.assign(Object.assign({}, content), { blocks: [
|
|
@@ -42,13 +38,13 @@ exports.Form = (0, react_1.memo)(({ content, onChange, activeBlockIndex, onSelec
|
|
|
42
38
|
}, onSelect: () => onSelect(index) }))) : null)));
|
|
43
39
|
break;
|
|
44
40
|
}
|
|
45
|
-
case FormTab.
|
|
46
|
-
form = react_1.default.createElement(
|
|
41
|
+
case types_1.FormTab.Code: {
|
|
42
|
+
form = (react_1.default.createElement(CodeEditor_1.CodeEditor, { content: content, onChange: onChange, validator: codeValidator, fullscreenModeOn: codeFullscreeModeOn, onFullscreenModeOnUpdate: onCodeFullscreeModeOnUpdate }));
|
|
47
43
|
break;
|
|
48
44
|
}
|
|
49
45
|
}
|
|
50
|
-
return (react_1.default.createElement("div", { className: b({ '
|
|
51
|
-
react_1.default.createElement(uikit_1.Tabs, { activeTab: activeTab, className: b('tabs'), items: tabsItems, onSelectTab:
|
|
46
|
+
return (react_1.default.createElement("div", { className: b({ 'code-editor-active': activeTab === types_1.FormTab.Code }) },
|
|
47
|
+
react_1.default.createElement(uikit_1.Tabs, { activeTab: activeTab, className: b('tabs'), items: tabsItems, onSelectTab: onActiveTabUpdate }),
|
|
52
48
|
form));
|
|
53
49
|
});
|
|
54
50
|
exports.Form.displayName = 'Form';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useCodeValidator = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const validation_1 = require("../utils/validation");
|
|
6
|
+
function useCodeValidator(schema) {
|
|
7
|
+
const validator = (0, react_1.useMemo)(() => (0, validation_1.createValidator)(schema), [schema]);
|
|
8
|
+
return (0, react_1.useCallback)((code) => (0, validation_1.validate)(code, validator), [validator]);
|
|
9
|
+
}
|
|
10
|
+
exports.useCodeValidator = useCodeValidator;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export default function useFormSpec(
|
|
1
|
+
import { JSONSchema4 } from 'json-schema';
|
|
2
|
+
export default function useFormSpec(schema: JSONSchema4): import("../dynamic-forms-custom/parser/types").FormSpecs;
|
|
@@ -2,12 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
const schema_1 = require("../../schema");
|
|
6
5
|
const parser_1 = tslib_1.__importDefault(require("../dynamic-forms-custom/parser"));
|
|
7
|
-
function useFormSpec(
|
|
8
|
-
return (0, react_1.useMemo)(() =>
|
|
9
|
-
const schema = (0, schema_1.generateDefaultSchema)(customSchema);
|
|
10
|
-
return parser_1.default.parse(schema);
|
|
11
|
-
}, [customSchema]);
|
|
6
|
+
function useFormSpec(schema) {
|
|
7
|
+
return (0, react_1.useMemo)(() => parser_1.default.parse(schema), [schema]);
|
|
12
8
|
}
|
|
13
9
|
exports.default = useFormSpec;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Block, BlockDecorationProps, PageContent } from '../../../models';
|
|
2
|
+
import { EditBlockProps, EditorProps } from '../../types';
|
|
3
|
+
export type EditorBlockId = number | string;
|
|
4
|
+
export declare function useMainState({ content: intialContent, custom }: Omit<EditorProps, 'children'>): {
|
|
5
|
+
activeBlockIndex: number;
|
|
6
|
+
content: PageContent;
|
|
7
|
+
errorBoundaryState: number;
|
|
8
|
+
injectEditBlockProps: ({ type, index: relativeIndex, children, ...rest }: BlockDecorationProps) => EditBlockProps;
|
|
9
|
+
onAdd: (block: Block) => void;
|
|
10
|
+
onSelect: (index: number) => void;
|
|
11
|
+
onContentUpdate: (newContent: PageContent) => void;
|
|
12
|
+
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.useMainState = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
const constants_1 = require("
|
|
7
|
-
const models_1 = require("
|
|
8
|
-
const utils_1 = require("
|
|
9
|
-
const EditBlock_1 = require("
|
|
10
|
-
const types_1 = require("
|
|
6
|
+
const constants_1 = require("../../../components/constants");
|
|
7
|
+
const models_1 = require("../../../models");
|
|
8
|
+
const utils_1 = require("../../../utils");
|
|
9
|
+
const EditBlock_1 = require("../../components/EditBlock/EditBlock");
|
|
10
|
+
const types_1 = require("../../types");
|
|
11
11
|
const reducer_1 = require("./reducer");
|
|
12
12
|
const utils_2 = require("./utils");
|
|
13
|
-
function
|
|
14
|
-
const [{ activeBlockIndex, content, errorBoundaryState
|
|
13
|
+
function useMainState({ content: intialContent, custom }) {
|
|
14
|
+
const [{ activeBlockIndex, content, errorBoundaryState }, dispatch] = (0, react_1.useReducer)(reducer_1.reducer, {
|
|
15
15
|
activeBlockIndex: 0,
|
|
16
16
|
errorBoundaryState: 0,
|
|
17
17
|
content: (0, utils_2.addEditorProps)(intialContent),
|
|
@@ -38,8 +38,6 @@ function useEditorState({ content: intialContent, custom }) {
|
|
|
38
38
|
};
|
|
39
39
|
const onSelect = (index) => dispatch({ type: reducer_1.SELECT_BLOCK, payload: index });
|
|
40
40
|
const onContentUpdate = (newContent) => dispatch({ type: reducer_1.UPDATE_CONTENT, payload: newContent });
|
|
41
|
-
const onViewModeUpdate = (newViewMode) => dispatch({ type: reducer_1.UPDATE_VIEW_MODE, payload: newViewMode });
|
|
42
|
-
const onThemeUpdate = (newTheme) => dispatch({ type: reducer_1.UPDATE_THEME, payload: newTheme });
|
|
43
41
|
const injectEditBlockProps = (_a) => {
|
|
44
42
|
var { type, index: relativeIndex = 0, children } = _a, rest = tslib_1.__rest(_a, ["type", "index", "children"]);
|
|
45
43
|
const orderedBlocksStartIndex = contentHasHeader ? 1 : 0;
|
|
@@ -73,15 +71,11 @@ function useEditorState({ content: intialContent, custom }) {
|
|
|
73
71
|
activeBlockIndex,
|
|
74
72
|
content,
|
|
75
73
|
errorBoundaryState,
|
|
76
|
-
viewMode,
|
|
77
|
-
theme,
|
|
78
74
|
injectEditBlockProps,
|
|
79
75
|
onAdd,
|
|
80
76
|
onSelect,
|
|
81
77
|
onContentUpdate,
|
|
82
|
-
onViewModeUpdate,
|
|
83
|
-
onThemeUpdate,
|
|
84
78
|
};
|
|
85
|
-
}, [content, activeBlockIndex, errorBoundaryState, custom
|
|
79
|
+
}, [content, activeBlockIndex, errorBoundaryState, custom]);
|
|
86
80
|
}
|
|
87
|
-
exports.
|
|
81
|
+
exports.useMainState = useMainState;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ConstructorBlock, PageContent, Theme } from '
|
|
2
|
-
import { ViewModeItem } from '
|
|
1
|
+
import { ConstructorBlock, PageContent, Theme } from '../../../models';
|
|
2
|
+
import { ViewModeItem } from '../../types';
|
|
3
3
|
export type EditorBlockId = number | string;
|
|
4
|
-
interface
|
|
4
|
+
interface MainState {
|
|
5
5
|
content: PageContent;
|
|
6
6
|
activeBlockIndex: number;
|
|
7
7
|
errorBoundaryState: number;
|
|
@@ -23,8 +23,6 @@ export declare const ADD_BLOCK = "ADD_BLOCK";
|
|
|
23
23
|
export declare const SET_REGION = "SET_REGION";
|
|
24
24
|
export declare const ORDER_BLOCK = "ORDER_BLOCK";
|
|
25
25
|
export declare const UPDATE_CONTENT = "UPDATE_CONTENT";
|
|
26
|
-
export declare const UPDATE_VIEW_MODE = "UPDATE_VIEW_MODE";
|
|
27
|
-
export declare const UPDATE_THEME = "UPDATE_THEME";
|
|
28
26
|
interface SelectBlock {
|
|
29
27
|
type: typeof SELECT_BLOCK;
|
|
30
28
|
payload: number;
|
|
@@ -49,14 +47,6 @@ interface UpdateContent {
|
|
|
49
47
|
type: typeof UPDATE_CONTENT;
|
|
50
48
|
payload: PageContent;
|
|
51
49
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
payload: ViewModeItem;
|
|
55
|
-
}
|
|
56
|
-
interface UpdateTheme {
|
|
57
|
-
type: typeof UPDATE_THEME;
|
|
58
|
-
payload: Theme;
|
|
59
|
-
}
|
|
60
|
-
export type EditorAction = SelectBlock | DeleteBlock | CopyBlock | AddBlock | OrderBlock | UpdateContent | UpdateViewMode | UpdateTheme;
|
|
61
|
-
export declare const reducer: (state: EditorState, action: EditorAction) => EditorState;
|
|
50
|
+
export type EditorAction = SelectBlock | DeleteBlock | CopyBlock | AddBlock | OrderBlock | UpdateContent;
|
|
51
|
+
export declare const reducer: (state: MainState, action: EditorAction) => MainState;
|
|
62
52
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.reducer = exports.
|
|
3
|
+
exports.reducer = exports.UPDATE_CONTENT = exports.ORDER_BLOCK = exports.SET_REGION = exports.ADD_BLOCK = exports.COPY_BLOCK = exports.DELETE_BLOCK = exports.SELECT_BLOCK = void 0;
|
|
4
4
|
const utils_1 = require("./utils");
|
|
5
5
|
// actions
|
|
6
6
|
exports.SELECT_BLOCK = 'SELECT_BLOCK';
|
|
@@ -10,8 +10,6 @@ exports.ADD_BLOCK = 'ADD_BLOCK';
|
|
|
10
10
|
exports.SET_REGION = 'SET_REGION';
|
|
11
11
|
exports.ORDER_BLOCK = 'ORDER_BLOCK';
|
|
12
12
|
exports.UPDATE_CONTENT = 'UPDATE_CONTENT';
|
|
13
|
-
exports.UPDATE_VIEW_MODE = 'UPDATE_VIEW_MODE';
|
|
14
|
-
exports.UPDATE_THEME = 'UPDATE_THEME';
|
|
15
13
|
// reducer
|
|
16
14
|
const reducer = (state, action) => {
|
|
17
15
|
const { content } = state;
|
|
@@ -37,10 +35,6 @@ const reducer = (state, action) => {
|
|
|
37
35
|
const { oldIndex, newIndex } = action.payload;
|
|
38
36
|
return getNewState((0, utils_1.changeBlocksOrder)(content.blocks, oldIndex, newIndex), newIndex);
|
|
39
37
|
}
|
|
40
|
-
case exports.UPDATE_VIEW_MODE:
|
|
41
|
-
return Object.assign(Object.assign({}, state), { viewMode: action.payload });
|
|
42
|
-
case exports.UPDATE_THEME:
|
|
43
|
-
return Object.assign(Object.assign({}, state), { theme: action.payload });
|
|
44
38
|
default:
|
|
45
39
|
return state;
|
|
46
40
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConstructorBlock, PageContent } from '
|
|
1
|
+
import { ConstructorBlock, PageContent } from '../../../models';
|
|
2
2
|
import { EditorBlockId } from './reducer';
|
|
3
3
|
export declare const changeBlocksOrder: (array: ConstructorBlock[], oldIndex: number, newIndex: number) => ConstructorBlock[];
|
|
4
4
|
export declare const duplicateBlock: (array: ConstructorBlock[], index: number) => ConstructorBlock[];
|
|
@@ -7,7 +7,7 @@ export declare const addBlock: (array: ConstructorBlock[], block: ConstructorBlo
|
|
|
7
7
|
export declare const addEditorProps: (content: PageContent) => {
|
|
8
8
|
animated: boolean;
|
|
9
9
|
blocks: ConstructorBlock[];
|
|
10
|
-
menu?: import("
|
|
11
|
-
background?: import("
|
|
10
|
+
menu?: import("../../../models").Menu | undefined;
|
|
11
|
+
background?: import("../../../models").ThemedMediaProps | undefined;
|
|
12
12
|
};
|
|
13
13
|
export declare const getErrorBoundaryState: (prevState: number) => number;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Theme } from '../../../models';
|
|
2
|
+
import { FormTab, ViewModeItem } from '../../types';
|
|
3
|
+
export declare function useSettingsState(): {
|
|
4
|
+
formTab: FormTab;
|
|
5
|
+
viewMode: ViewModeItem;
|
|
6
|
+
theme: Theme;
|
|
7
|
+
codeFullscreeModeOn: boolean;
|
|
8
|
+
onFormTabUpdate: (newFormTab: FormTab) => void;
|
|
9
|
+
onViewModeUpdate: (newViewMode: ViewModeItem) => void;
|
|
10
|
+
onThemeUpdate: (newTheme: Theme) => void;
|
|
11
|
+
onCodeFullscreeModeOnUpdate: (newCodeFullscreeModeOn: boolean) => void;
|
|
12
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSettingsState = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const reducer_1 = require("./reducer");
|
|
6
|
+
function useSettingsState() {
|
|
7
|
+
const [{ formTab, viewMode, theme, codeFullscreeModeOn }, dispatch] = (0, react_1.useReducer)(reducer_1.reducer, reducer_1.initialState);
|
|
8
|
+
return (0, react_1.useMemo)(() => {
|
|
9
|
+
return {
|
|
10
|
+
formTab,
|
|
11
|
+
viewMode,
|
|
12
|
+
theme,
|
|
13
|
+
codeFullscreeModeOn,
|
|
14
|
+
onFormTabUpdate: (newFormTab) => dispatch({ type: reducer_1.UPDATE_FORM_TAB, payload: newFormTab }),
|
|
15
|
+
onViewModeUpdate: (newViewMode) => dispatch({ type: reducer_1.UPDATE_VIEW_MODE, payload: newViewMode }),
|
|
16
|
+
onThemeUpdate: (newTheme) => dispatch({ type: reducer_1.UPDATE_THEME, payload: newTheme }),
|
|
17
|
+
onCodeFullscreeModeOnUpdate: (newCodeFullscreeModeOn) => dispatch({ type: reducer_1.UPDATE_CODE_FULLSCREEN_MODE_ON, payload: newCodeFullscreeModeOn }),
|
|
18
|
+
};
|
|
19
|
+
}, [formTab, viewMode, theme, codeFullscreeModeOn]);
|
|
20
|
+
}
|
|
21
|
+
exports.useSettingsState = useSettingsState;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Theme } from '../../../models';
|
|
2
|
+
import { FormTab, ViewModeItem } from '../../types';
|
|
3
|
+
export declare const UPDATE_FORM_TAB = "UPDATE_FORM_TAB";
|
|
4
|
+
export declare const UPDATE_CODE_FULLSCREEN_MODE_ON = "UPDATE_CODE_FULLSCREEN_MODE_ON";
|
|
5
|
+
export declare const UPDATE_VIEW_MODE = "UPDATE_VIEW_MODE";
|
|
6
|
+
export declare const UPDATE_THEME = "UPDATE_THEME";
|
|
7
|
+
interface EditorSettingsState {
|
|
8
|
+
theme: Theme;
|
|
9
|
+
viewMode: ViewModeItem;
|
|
10
|
+
codeFullscreeModeOn: boolean;
|
|
11
|
+
formTab: FormTab;
|
|
12
|
+
}
|
|
13
|
+
interface UpdateViewMode {
|
|
14
|
+
type: typeof UPDATE_VIEW_MODE;
|
|
15
|
+
payload: ViewModeItem;
|
|
16
|
+
}
|
|
17
|
+
interface UpdateTheme {
|
|
18
|
+
type: typeof UPDATE_THEME;
|
|
19
|
+
payload: Theme;
|
|
20
|
+
}
|
|
21
|
+
interface UpdateCodeFullscreenModeOn {
|
|
22
|
+
type: typeof UPDATE_CODE_FULLSCREEN_MODE_ON;
|
|
23
|
+
payload: boolean;
|
|
24
|
+
}
|
|
25
|
+
interface UpdateFormTab {
|
|
26
|
+
type: typeof UPDATE_FORM_TAB;
|
|
27
|
+
payload: FormTab;
|
|
28
|
+
}
|
|
29
|
+
export type EditorSettingsAction = UpdateViewMode | UpdateTheme | UpdateCodeFullscreenModeOn | UpdateFormTab;
|
|
30
|
+
export declare const reducer: (state: EditorSettingsState, action: EditorSettingsAction) => EditorSettingsState;
|
|
31
|
+
export declare const initialState: {
|
|
32
|
+
viewMode: ViewModeItem;
|
|
33
|
+
theme: Theme;
|
|
34
|
+
codeFullscreeModeOn: boolean;
|
|
35
|
+
formTab: FormTab;
|
|
36
|
+
};
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initialState = exports.reducer = exports.UPDATE_THEME = exports.UPDATE_VIEW_MODE = exports.UPDATE_CODE_FULLSCREEN_MODE_ON = exports.UPDATE_FORM_TAB = void 0;
|
|
4
|
+
const constants_1 = require("../../../components/constants");
|
|
5
|
+
const types_1 = require("../../types");
|
|
6
|
+
// actions
|
|
7
|
+
exports.UPDATE_FORM_TAB = 'UPDATE_FORM_TAB';
|
|
8
|
+
exports.UPDATE_CODE_FULLSCREEN_MODE_ON = 'UPDATE_CODE_FULLSCREEN_MODE_ON';
|
|
9
|
+
exports.UPDATE_VIEW_MODE = 'UPDATE_VIEW_MODE';
|
|
10
|
+
exports.UPDATE_THEME = 'UPDATE_THEME';
|
|
11
|
+
// reducer
|
|
12
|
+
const reducer = (state, action) => {
|
|
13
|
+
switch (action.type) {
|
|
14
|
+
case exports.UPDATE_VIEW_MODE:
|
|
15
|
+
return Object.assign(Object.assign({}, state), { viewMode: action.payload });
|
|
16
|
+
case exports.UPDATE_THEME:
|
|
17
|
+
return Object.assign(Object.assign({}, state), { theme: action.payload });
|
|
18
|
+
case exports.UPDATE_CODE_FULLSCREEN_MODE_ON:
|
|
19
|
+
return Object.assign(Object.assign({}, state), { codeFullscreeModeOn: action.payload });
|
|
20
|
+
case exports.UPDATE_FORM_TAB:
|
|
21
|
+
return Object.assign(Object.assign({}, state), { formTab: action.payload });
|
|
22
|
+
default:
|
|
23
|
+
return state;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
exports.reducer = reducer;
|
|
27
|
+
exports.initialState = {
|
|
28
|
+
viewMode: types_1.ViewModeItem.Edititng,
|
|
29
|
+
theme: constants_1.DEFAULT_THEME,
|
|
30
|
+
codeFullscreeModeOn: false,
|
|
31
|
+
formTab: types_1.FormTab.Blocks,
|
|
32
|
+
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
body {
|
|
2
2
|
--pc-editor-header-height: 48px;
|
|
3
|
+
--pc-editor-code-header-height: 36px;
|
|
3
4
|
--pc-editor-divider-width: 12px;
|
|
5
|
+
--pc-editor-left-column-width: calc(400px + var(--pc-editor-divider-width));
|
|
4
6
|
--pc-editor-base-color: var(--g-color-base-brand);
|
|
5
7
|
--pc-editor-control-color: var(--g-color-base-brand);
|
|
6
8
|
--pc-editor-control-icon-color: var(--g-color-text-dark-primary);
|
|
7
|
-
--pc-editor-left-column-width: calc(400px + var(--pc-editor-divider-width));
|
|
8
9
|
}
|