@finos/legend-extension-dsl-text 5.0.3 → 5.0.5
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/lib/components/studio/TextElementEditor.d.ts.map +1 -1
- package/lib/components/studio/TextElementEditor.js +9 -11
- package/lib/components/studio/TextElementEditor.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +4 -4
- package/package.json +11 -11
- package/src/components/studio/TextElementEditor.tsx +44 -47
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextElementEditor.d.ts","sourceRoot":"","sources":["../../../src/components/studio/TextElementEditor.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;
|
|
1
|
+
{"version":3,"file":"TextElementEditor.d.ts","sourceRoot":"","sources":["../../../src/components/studio/TextElementEditor.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;AA2CH,eAAO,MAAM,iBAAiB;;CAmH5B,CAAC"}
|
|
@@ -17,10 +17,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
17
17
|
import { useRef, useEffect, useState } from 'react';
|
|
18
18
|
import { observer } from 'mobx-react-lite';
|
|
19
19
|
import { prettyCONSTName } from '@finos/legend-shared';
|
|
20
|
-
import {
|
|
20
|
+
import { useEditorStore } from '@finos/legend-application-studio';
|
|
21
21
|
import { TextEditorState } from '../../stores/studio/TextEditorState.js';
|
|
22
|
-
import { OpenPreviewIcon, LockIcon, CaretDownIcon, DropdownMenu, MenuContent, MenuContentItem, MarkdownTextViewer, ResizablePanel, ResizablePanelGroup, ResizablePanelSplitter,
|
|
23
|
-
import { EDITOR_LANGUAGE, useApplicationNavigationContext, } from '@finos/legend-application';
|
|
22
|
+
import { OpenPreviewIcon, LockIcon, CaretDownIcon, DropdownMenu, MenuContent, MenuContentItem, MarkdownTextViewer, ResizablePanel, ResizablePanelGroup, ResizablePanelSplitter, } from '@finos/legend-art';
|
|
23
|
+
import { EDITOR_LANGUAGE, TextInputEditor, useApplicationNavigationContext, } from '@finos/legend-application';
|
|
24
24
|
import { text_setContent, text_setType, } from '../../stores/studio/DSL_Text_GraphModifierHelper.js';
|
|
25
25
|
import { TEXT_TYPE } from '../../graph/helpers/DSL_Text_Helper.js';
|
|
26
26
|
import { DSL_TEXT_LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY } from '../../stores/studio/DSL_Text_LegendStudioApplicationNavigationContext.js';
|
|
@@ -40,7 +40,7 @@ export const TextElementEditor = observer(() => {
|
|
|
40
40
|
const isReadOnly = textEditorState.isReadOnly;
|
|
41
41
|
const typeNameRef = useRef(null);
|
|
42
42
|
const [showPreview, setShowPreview] = useState(false);
|
|
43
|
-
const
|
|
43
|
+
const isPreviewSupported = textElement.type === EDITOR_LANGUAGE.MARKDOWN;
|
|
44
44
|
const changeType = (val) => () => {
|
|
45
45
|
!isReadOnly && text_setType(textElement, val);
|
|
46
46
|
};
|
|
@@ -52,14 +52,12 @@ export const TextElementEditor = observer(() => {
|
|
|
52
52
|
}
|
|
53
53
|
}, [isReadOnly]);
|
|
54
54
|
useApplicationNavigationContext(DSL_TEXT_LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY.TEXT_EDITOR);
|
|
55
|
-
|
|
56
|
-
const renderMarkdownView = () => (_jsxs(ResizablePanelGroup, { ...getControlledResizablePanelProps(true), orientation: "vertical", children: [_jsx(ResizablePanel, { minSize: 250, children: renderPlainTextEditorView() }), showPreview && _jsx(ResizablePanelSplitter, {}), showPreview && (_jsx(ResizablePanel, { children: _jsx("div", { className: "panel_content text-element-editor__preview", children: MarkdownTextViewer({
|
|
57
|
-
value: { value: textElement.content },
|
|
58
|
-
className: `text-element-editor__preview__markdown`,
|
|
59
|
-
}) }) }))] }));
|
|
60
|
-
return (_jsxs("div", { className: "panel text-element-editor", children: [_jsx("div", { className: "panel__header text-element-editor__header", children: _jsxs("div", { className: "text-element-editor__header__configs", children: [isReadOnly && (_jsx("div", { className: "text-element-editor__header__lock", children: _jsx(LockIcon, {}) })), _jsx(DropdownMenu, { disabled: isReadOnly, content: _jsx(MenuContent, { children: Object.values(TEXT_TYPE).map((mode) => (_jsx(MenuContentItem, { className: "text-element-editor__header__configs__option", onClick: changeType(mode), children: prettyCONSTName(mode) }, mode))) }), menuProps: {
|
|
55
|
+
return (_jsxs("div", { className: "panel text-element-editor", children: [_jsx("div", { className: "panel__header text-element-editor__header", children: _jsxs("div", { className: "text-element-editor__header__configs", children: [isReadOnly && (_jsx("div", { className: "text-element-editor__header__lock", children: _jsx(LockIcon, {}) })), _jsxs(DropdownMenu, { className: "text-element-editor__header__configs__type", disabled: isReadOnly, content: _jsx(MenuContent, { children: Object.values(TEXT_TYPE).map((mode) => (_jsx(MenuContentItem, { className: "text-element-editor__header__configs__option", onClick: changeType(mode), children: prettyCONSTName(mode) }, mode))) }), menuProps: {
|
|
61
56
|
anchorOrigin: { vertical: 'bottom', horizontal: 'right' },
|
|
62
57
|
transformOrigin: { vertical: 'top', horizontal: 'right' },
|
|
63
|
-
}, children:
|
|
58
|
+
}, children: [_jsx("div", { className: "text-element-editor__header__configs__type__label", children: prettyCONSTName(textElement.type) }), _jsx("div", { className: "text-element-editor__header__configs__type__icon", children: _jsx(CaretDownIcon, {}) })] }), isPreviewSupported ? (_jsx("button", { title: showPreview ? `Hide Preview` : `Show Preview`, className: `text-element-editor__preview-btn ${showPreview ? `text-element-editor__preview-btn__active` : ''}`, onClick: () => changePreview(!showPreview), children: _jsx(OpenPreviewIcon, {}) })) : null] }) }), _jsx("div", { className: "panel__content", children: isPreviewSupported ? (_jsxs(ResizablePanelGroup, { orientation: "vertical", children: [_jsx(ResizablePanel, { minSize: 300, children: _jsx("div", { className: "text-element-editor__editor", children: _jsx(TextInputEditor, { language: getTextElementEditorLanguage(textElement.type), inputValue: textElement.content, updateInput: changeContent }) }) }), showPreview && _jsx(ResizablePanelSplitter, {}), showPreview && (_jsx(ResizablePanel, { minSize: 300, children: _jsx("div", { className: "text-element-editor__preview", children: MarkdownTextViewer({
|
|
59
|
+
value: { value: textElement.content },
|
|
60
|
+
className: `text-element-editor__preview__markdown`,
|
|
61
|
+
}) }) }))] })) : (_jsx("div", { className: "text-element-editor__editor", children: _jsx(TextInputEditor, { language: getTextElementEditorLanguage(textElement.type), inputValue: textElement.content, updateInput: changeContent }) })) })] }));
|
|
64
62
|
});
|
|
65
63
|
//# sourceMappingURL=TextElementEditor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextElementEditor.js","sourceRoot":"","sources":["../../../src/components/studio/TextElementEditor.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,
|
|
1
|
+
{"version":3,"file":"TextElementEditor.js","sourceRoot":"","sources":["../../../src/components/studio/TextElementEditor.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EACL,eAAe,EACf,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,WAAW,EACX,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,eAAe,EAC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
* Copyright (c) 2020-present, Goldman Sachs
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -14,4 +14,4 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
:root{--color-text-element: var(--color-blue-50)}.icon--text-element{color:var(--color-text-element)}.text-element-editor{height:100%;width:100%;display:flex;flex-direction:column;background:var(--color-dark-grey-50);position:relative}.text-element-editor__header__lock{display:flex;align-items:center;justify-content:center;width:4rem;min-width:4rem;padding-left:.5rem;padding-right:.5rem;background:var(--color-dark-grey-100)}.text-element-editor__header__lock svg{font-size:1.2rem;color:var(--color-yellow-200)}.text-element-editor__header{padding-left:0;background:var(--color-dark-grey-50)}.text-element-editor__header__configs{display:flex;width:100%}.text-element-editor__header__configs__type{display:flex;align-items:center;height:2.6rem;width:25rem;background:var(--color-dark-grey-100);border-right:.1rem solid var(--color-dark-grey-50);border-left:.1rem solid var(--color-dark-grey-50);color:var(--color-light-grey-400);cursor:pointer}.text-element-editor__header__configs__type__label{height:2.6rem;width:23.4rem;display:flex;align-items:center;justify-content:center}.text-element-editor__header__configs__type__icon{display:flex;align-items:center;justify-content:center;border-left:.1rem solid var(--color-dark-grey-50);height:2.6rem;width:2.6rem;min-width:2.6rem}.text-element-editor__header__configs__option{display:flex;align-items:center;justify-content:center;width:24.8rem;height:2.6rem}.text-element-editor__editor{
|
|
17
|
+
:root{--color-text-element: var(--color-blue-50)}.icon--text-element{color:var(--color-text-element)}.text-element-editor{height:100%;width:100%;display:flex;flex-direction:column;background:var(--color-dark-grey-50);position:relative}.text-element-editor__header__lock{display:flex;align-items:center;justify-content:center;width:4rem;min-width:4rem;padding-left:.5rem;padding-right:.5rem;background:var(--color-dark-grey-100)}.text-element-editor__header__lock svg{font-size:1.2rem;color:var(--color-yellow-200)}.text-element-editor__header{padding-left:0;background:var(--color-dark-grey-50)}.text-element-editor__header__configs{display:flex;width:100%}.text-element-editor__header__configs__type{display:flex;align-items:center;height:2.6rem;width:25rem;background:var(--color-dark-grey-100);border-right:.1rem solid var(--color-dark-grey-50);border-left:.1rem solid var(--color-dark-grey-50);color:var(--color-light-grey-400);cursor:pointer}.text-element-editor__header__configs__type__label{height:2.6rem;width:23.4rem;display:flex;align-items:center;justify-content:center}.text-element-editor__header__configs__type__icon{display:flex;align-items:center;justify-content:center;border-left:.1rem solid var(--color-dark-grey-50);height:2.6rem;width:2.6rem;min-width:2.6rem}.text-element-editor__header__configs__option{display:flex;align-items:center;justify-content:center;width:24.8rem;height:2.6rem}.text-element-editor__editor{height:100%}.text-element-editor__preview{height:100%}.text-element-editor__preview__markdown{height:100%;overflow-y:scroll}.text-element-editor__preview-btn{color:var(--color-light-grey-400);cursor:pointer;font-size:1.8rem;margin:auto .5rem auto auto}.text-element-editor__preview-btn__active{color:var(--color-light-grey-100)}.text-element-editor__preview-btn:hover{color:var(--color-light-grey-100)}/*# sourceMappingURL=index.css.map */
|
package/lib/index.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sourceRoot":"","sources":["../style/index.scss","../../../node_modules/@finos/legend-art/scss/_mixins.scss"],"names":[],"mappings":"AAkBA,MACE,2CAGF,oBACE,gCAGF,qBACE,YACA,WACA,aACA,sBACA,qCACA,kBAEA,mCCVA,aACA,mBACA,uBDWE,WACA,eACA,mBACA,oBACA,sCAGF,uCACE,iBACA,8BAGF,6BACE,eACA,qCAEA,sCACE,aACA,WAEA,4CC3BJ,aACA,mBD6BM,cACA,YACA,sCACA,mDACA,kDACA,kCACA,eAGF,mDACE,cACA,cC/CN,aACA,mBACA,uBDkDI,kDCpDJ,aACA,mBACA,uBDqDM,kDACA,cACA,aACA,iBAGF,8CC7DJ,aACA,mBACA,uBD8DM,cACA,cAKN,6BACE,
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["../style/index.scss","../../../node_modules/@finos/legend-art/scss/_mixins.scss"],"names":[],"mappings":"AAkBA,MACE,2CAGF,oBACE,gCAGF,qBACE,YACA,WACA,aACA,sBACA,qCACA,kBAEA,mCCVA,aACA,mBACA,uBDWE,WACA,eACA,mBACA,oBACA,sCAGF,uCACE,iBACA,8BAGF,6BACE,eACA,qCAEA,sCACE,aACA,WAEA,4CC3BJ,aACA,mBD6BM,cACA,YACA,sCACA,mDACA,kDACA,kCACA,eAGF,mDACE,cACA,cC/CN,aACA,mBACA,uBDkDI,kDCpDJ,aACA,mBACA,uBDqDM,kDACA,cACA,aACA,iBAGF,8CC7DJ,aACA,mBACA,uBD8DM,cACA,cAKN,6BACE,YAGF,8BACE,YAEA,wCACE,YACA,kBAIJ,kCACE,kCACA,eACA,iBACA,4BAEA,0CACE,kCAGF,wCACE","file":"index.css"}
|
package/lib/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finos/legend-extension-dsl-text",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.5",
|
|
4
4
|
"description": "Legend extension for Text DSL",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"legend",
|
|
@@ -53,14 +53,14 @@
|
|
|
53
53
|
"mobx": "6.6.2",
|
|
54
54
|
"mobx-react-lite": "3.4.0",
|
|
55
55
|
"react": "18.2.0",
|
|
56
|
-
"serializr": "
|
|
56
|
+
"serializr": "3.0.1"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@finos/legend-dev-utils": "workspace:*",
|
|
60
|
-
"@jest/globals": "29.1
|
|
60
|
+
"@jest/globals": "29.2.1",
|
|
61
61
|
"cross-env": "7.0.3",
|
|
62
62
|
"eslint": "8.25.0",
|
|
63
|
-
"jest": "29.1
|
|
63
|
+
"jest": "29.2.1",
|
|
64
64
|
"npm-run-all": "4.1.5",
|
|
65
65
|
"rimraf": "3.0.2",
|
|
66
66
|
"sass": "1.55.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finos/legend-extension-dsl-text",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.5",
|
|
4
4
|
"description": "Legend extension for Text DSL",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"legend",
|
|
@@ -43,24 +43,24 @@
|
|
|
43
43
|
"test:watch": "jest --watch"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@finos/legend-application": "
|
|
47
|
-
"@finos/legend-application-studio": "
|
|
48
|
-
"@finos/legend-art": "4.0
|
|
49
|
-
"@finos/legend-graph": "
|
|
50
|
-
"@finos/legend-shared": "6.1.
|
|
51
|
-
"@finos/legend-storage": "3.0.
|
|
46
|
+
"@finos/legend-application": "10.0.1",
|
|
47
|
+
"@finos/legend-application-studio": "19.1.0",
|
|
48
|
+
"@finos/legend-art": "4.1.0",
|
|
49
|
+
"@finos/legend-graph": "19.1.0",
|
|
50
|
+
"@finos/legend-shared": "6.1.5",
|
|
51
|
+
"@finos/legend-storage": "3.0.14",
|
|
52
52
|
"@types/react": "18.0.21",
|
|
53
53
|
"mobx": "6.6.2",
|
|
54
54
|
"mobx-react-lite": "3.4.0",
|
|
55
55
|
"react": "18.2.0",
|
|
56
|
-
"serializr": "
|
|
56
|
+
"serializr": "3.0.1"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@finos/legend-dev-utils": "2.0.
|
|
60
|
-
"@jest/globals": "29.1
|
|
59
|
+
"@finos/legend-dev-utils": "2.0.21",
|
|
60
|
+
"@jest/globals": "29.2.1",
|
|
61
61
|
"cross-env": "7.0.3",
|
|
62
62
|
"eslint": "8.25.0",
|
|
63
|
-
"jest": "29.1
|
|
63
|
+
"jest": "29.2.1",
|
|
64
64
|
"npm-run-all": "4.1.5",
|
|
65
65
|
"rimraf": "3.0.2",
|
|
66
66
|
"sass": "1.55.0",
|
|
@@ -17,10 +17,7 @@
|
|
|
17
17
|
import { useRef, useEffect, useState } from 'react';
|
|
18
18
|
import { observer } from 'mobx-react-lite';
|
|
19
19
|
import { prettyCONSTName } from '@finos/legend-shared';
|
|
20
|
-
import {
|
|
21
|
-
StudioTextInputEditor,
|
|
22
|
-
useEditorStore,
|
|
23
|
-
} from '@finos/legend-application-studio';
|
|
20
|
+
import { useEditorStore } from '@finos/legend-application-studio';
|
|
24
21
|
import { TextEditorState } from '../../stores/studio/TextEditorState.js';
|
|
25
22
|
import {
|
|
26
23
|
OpenPreviewIcon,
|
|
@@ -33,10 +30,10 @@ import {
|
|
|
33
30
|
ResizablePanel,
|
|
34
31
|
ResizablePanelGroup,
|
|
35
32
|
ResizablePanelSplitter,
|
|
36
|
-
getControlledResizablePanelProps,
|
|
37
33
|
} from '@finos/legend-art';
|
|
38
34
|
import {
|
|
39
35
|
EDITOR_LANGUAGE,
|
|
36
|
+
TextInputEditor,
|
|
40
37
|
useApplicationNavigationContext,
|
|
41
38
|
} from '@finos/legend-application';
|
|
42
39
|
import {
|
|
@@ -65,7 +62,7 @@ export const TextElementEditor = observer(() => {
|
|
|
65
62
|
const isReadOnly = textEditorState.isReadOnly;
|
|
66
63
|
const typeNameRef = useRef<HTMLInputElement>(null);
|
|
67
64
|
const [showPreview, setShowPreview] = useState(false);
|
|
68
|
-
const
|
|
65
|
+
const isPreviewSupported = textElement.type === EDITOR_LANGUAGE.MARKDOWN;
|
|
69
66
|
|
|
70
67
|
const changeType =
|
|
71
68
|
(val: TEXT_TYPE): (() => void) =>
|
|
@@ -86,38 +83,6 @@ export const TextElementEditor = observer(() => {
|
|
|
86
83
|
DSL_TEXT_LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY.TEXT_EDITOR,
|
|
87
84
|
);
|
|
88
85
|
|
|
89
|
-
const renderPlainTextEditorView = (): JSX.Element => (
|
|
90
|
-
<div className="panel__content text-element-editor__editor">
|
|
91
|
-
<StudioTextInputEditor
|
|
92
|
-
language={getTextElementEditorLanguage(textElement.type)}
|
|
93
|
-
inputValue={textElement.content}
|
|
94
|
-
updateInput={changeContent}
|
|
95
|
-
/>
|
|
96
|
-
</div>
|
|
97
|
-
);
|
|
98
|
-
|
|
99
|
-
const renderMarkdownView = (): JSX.Element => (
|
|
100
|
-
<ResizablePanelGroup
|
|
101
|
-
{...getControlledResizablePanelProps(true)}
|
|
102
|
-
orientation="vertical"
|
|
103
|
-
>
|
|
104
|
-
<ResizablePanel minSize={250}>
|
|
105
|
-
{renderPlainTextEditorView()}
|
|
106
|
-
</ResizablePanel>
|
|
107
|
-
{showPreview && <ResizablePanelSplitter />}
|
|
108
|
-
{showPreview && (
|
|
109
|
-
<ResizablePanel>
|
|
110
|
-
<div className="panel_content text-element-editor__preview">
|
|
111
|
-
{MarkdownTextViewer({
|
|
112
|
-
value: { value: textElement.content },
|
|
113
|
-
className: `text-element-editor__preview__markdown`,
|
|
114
|
-
})}
|
|
115
|
-
</div>
|
|
116
|
-
</ResizablePanel>
|
|
117
|
-
)}
|
|
118
|
-
</ResizablePanelGroup>
|
|
119
|
-
);
|
|
120
|
-
|
|
121
86
|
return (
|
|
122
87
|
<div className="panel text-element-editor">
|
|
123
88
|
<div className="panel__header text-element-editor__header">
|
|
@@ -128,6 +93,7 @@ export const TextElementEditor = observer(() => {
|
|
|
128
93
|
</div>
|
|
129
94
|
)}
|
|
130
95
|
<DropdownMenu
|
|
96
|
+
className="text-element-editor__header__configs__type"
|
|
131
97
|
disabled={isReadOnly}
|
|
132
98
|
content={
|
|
133
99
|
<MenuContent>
|
|
@@ -148,16 +114,14 @@ export const TextElementEditor = observer(() => {
|
|
|
148
114
|
transformOrigin: { vertical: 'top', horizontal: 'right' },
|
|
149
115
|
}}
|
|
150
116
|
>
|
|
151
|
-
<div className="text-element-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
<
|
|
156
|
-
<CaretDownIcon />
|
|
157
|
-
</div>
|
|
117
|
+
<div className="text-element-editor__header__configs__type__label">
|
|
118
|
+
{prettyCONSTName(textElement.type)}
|
|
119
|
+
</div>
|
|
120
|
+
<div className="text-element-editor__header__configs__type__icon">
|
|
121
|
+
<CaretDownIcon />
|
|
158
122
|
</div>
|
|
159
123
|
</DropdownMenu>
|
|
160
|
-
{
|
|
124
|
+
{isPreviewSupported ? (
|
|
161
125
|
<button
|
|
162
126
|
title={showPreview ? `Hide Preview` : `Show Preview`}
|
|
163
127
|
className={`text-element-editor__preview-btn ${
|
|
@@ -170,7 +134,40 @@ export const TextElementEditor = observer(() => {
|
|
|
170
134
|
) : null}
|
|
171
135
|
</div>
|
|
172
136
|
</div>
|
|
173
|
-
|
|
137
|
+
<div className="panel__content">
|
|
138
|
+
{isPreviewSupported ? (
|
|
139
|
+
<ResizablePanelGroup orientation="vertical">
|
|
140
|
+
<ResizablePanel minSize={300}>
|
|
141
|
+
<div className="text-element-editor__editor">
|
|
142
|
+
<TextInputEditor
|
|
143
|
+
language={getTextElementEditorLanguage(textElement.type)}
|
|
144
|
+
inputValue={textElement.content}
|
|
145
|
+
updateInput={changeContent}
|
|
146
|
+
/>
|
|
147
|
+
</div>
|
|
148
|
+
</ResizablePanel>
|
|
149
|
+
{showPreview && <ResizablePanelSplitter />}
|
|
150
|
+
{showPreview && (
|
|
151
|
+
<ResizablePanel minSize={300}>
|
|
152
|
+
<div className="text-element-editor__preview">
|
|
153
|
+
{MarkdownTextViewer({
|
|
154
|
+
value: { value: textElement.content },
|
|
155
|
+
className: `text-element-editor__preview__markdown`,
|
|
156
|
+
})}
|
|
157
|
+
</div>
|
|
158
|
+
</ResizablePanel>
|
|
159
|
+
)}
|
|
160
|
+
</ResizablePanelGroup>
|
|
161
|
+
) : (
|
|
162
|
+
<div className="text-element-editor__editor">
|
|
163
|
+
<TextInputEditor
|
|
164
|
+
language={getTextElementEditorLanguage(textElement.type)}
|
|
165
|
+
inputValue={textElement.content}
|
|
166
|
+
updateInput={changeContent}
|
|
167
|
+
/>
|
|
168
|
+
</div>
|
|
169
|
+
)}
|
|
170
|
+
</div>
|
|
174
171
|
</div>
|
|
175
172
|
);
|
|
176
173
|
});
|