@finos/legend-extension-dsl-text 5.0.63 → 5.0.65
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.
|
@@ -20,17 +20,18 @@ import { prettyCONSTName } from '@finos/legend-shared';
|
|
|
20
20
|
import { useEditorStore } from '@finos/legend-application-studio';
|
|
21
21
|
import { TextEditorState } from '../../stores/studio/TextEditorState.js';
|
|
22
22
|
import { OpenPreviewIcon, LockIcon, CaretDownIcon, DropdownMenu, MenuContent, MenuContentItem, MarkdownTextViewer, ResizablePanel, ResizablePanelGroup, ResizablePanelSplitter, } from '@finos/legend-art';
|
|
23
|
-
import {
|
|
23
|
+
import { CODE_EDITOR_LANGUAGE, 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 '../../application/studio/DSL_Text_LegendStudioApplicationNavigationContext.js';
|
|
27
|
+
import { CodeEditor } from '@finos/legend-lego/code-editor';
|
|
27
28
|
const getTextElementEditorLanguage = (type) => {
|
|
28
29
|
switch (type) {
|
|
29
30
|
case TEXT_TYPE.MARKDOWN:
|
|
30
|
-
return
|
|
31
|
+
return CODE_EDITOR_LANGUAGE.MARKDOWN;
|
|
31
32
|
case TEXT_TYPE.PLAIN_TEXT:
|
|
32
33
|
default:
|
|
33
|
-
return
|
|
34
|
+
return CODE_EDITOR_LANGUAGE.TEXT;
|
|
34
35
|
}
|
|
35
36
|
};
|
|
36
37
|
export const TextElementEditor = observer(() => {
|
|
@@ -40,7 +41,7 @@ export const TextElementEditor = observer(() => {
|
|
|
40
41
|
const isReadOnly = textEditorState.isReadOnly;
|
|
41
42
|
const typeNameRef = useRef(null);
|
|
42
43
|
const [showPreview, setShowPreview] = useState(false);
|
|
43
|
-
const isPreviewSupported = textElement.type ===
|
|
44
|
+
const isPreviewSupported = textElement.type === CODE_EDITOR_LANGUAGE.MARKDOWN;
|
|
44
45
|
const changeType = (val) => () => {
|
|
45
46
|
!isReadOnly && text_setType(textElement, val);
|
|
46
47
|
};
|
|
@@ -55,9 +56,9 @@ export const TextElementEditor = observer(() => {
|
|
|
55
56
|
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: {
|
|
56
57
|
anchorOrigin: { vertical: 'bottom', horizontal: 'right' },
|
|
57
58
|
transformOrigin: { vertical: 'top', horizontal: 'right' },
|
|
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(
|
|
59
|
+
}, 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(CodeEditor, { 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
60
|
value: { value: textElement.content },
|
|
60
61
|
className: `text-element-editor__preview__markdown`,
|
|
61
|
-
}) }) }))] })) : (_jsx("div", { className: "text-element-editor__editor", children: _jsx(
|
|
62
|
+
}) }) }))] })) : (_jsx("div", { className: "text-element-editor__editor", children: _jsx(CodeEditor, { language: getTextElementEditorLanguage(textElement.type), inputValue: textElement.content, updateInput: changeContent }) })) })] }));
|
|
62
63
|
});
|
|
63
64
|
//# 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,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,
|
|
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,oBAAoB,EACpB,+BAA+B,GAChC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,eAAe,EACf,YAAY,GACb,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACnE,OAAO,EAAE,yDAAyD,EAAE,MAAM,+EAA+E,CAAC;AAC1J,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAE5D,MAAM,4BAA4B,GAAG,CACnC,IAAwB,EACF,EAAE;IACxB,QAAQ,IAAI,EAAE;QACZ,KAAK,SAAS,CAAC,QAAQ;YACrB,OAAO,oBAAoB,CAAC,QAAQ,CAAC;QACvC,KAAK,SAAS,CAAC,UAAU,CAAC;QAC1B;YACE,OAAO,oBAAoB,CAAC,IAAI,CAAC;KACpC;AACH,CAAC,C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4BAA4B,CAAC,WAAW,CAAC,IAAI,CAAC,EACxD,UAAU,EAAE,WAAW,CAAC,OAAO,EAC/B,WAAW,EAAE,aAAa,GAC1B,GACE,GACS,EAChB,WAAW,IAAI,KAAC,sBAAsB,KAAG,EACzC,WAAW,IAAI,CACd,KAAC,cAAc,IAAC,OAAO,EAAE,GAAG,YAC1B,cAAK,SAAS,EAAC,8BAA8B,YAC1C,kBAAkB,CAAC;oCAClB,KAAK,EAAE,EAAE,KAAK,EAAE,WAAW,CAAC,OAAO,EAAE;oCACrC,SAAS,EAAE,wCAAwC;iCACpD,CAAC,GACE,GACS,CAClB,IACmB,CACvB,CAAC,CAAC,CAAC,CACF,cAAK,SAAS,EAAC,6BAA6B,YAC1C,KAAC,UAAU,IACT,QAAQ,EAAE,4BAA4B,CAAC,WAAW,CAAC,IAAI,CAAC,EACxD,UAAU,EAAE,WAAW,CAAC,OAAO,EAC/B,WAAW,EAAE,aAAa,GAC1B,GACE,CACP,GACG,IACF,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
package/lib/index.css
CHANGED
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.65",
|
|
4
4
|
"description": "Legend extension for Text DSL",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"legend",
|
|
@@ -47,9 +47,10 @@
|
|
|
47
47
|
"@finos/legend-application-studio": "workspace:*",
|
|
48
48
|
"@finos/legend-art": "workspace:*",
|
|
49
49
|
"@finos/legend-graph": "workspace:*",
|
|
50
|
+
"@finos/legend-lego": "workspace:*",
|
|
50
51
|
"@finos/legend-shared": "workspace:*",
|
|
51
52
|
"@finos/legend-storage": "workspace:*",
|
|
52
|
-
"@types/react": "18.0.
|
|
53
|
+
"@types/react": "18.0.34",
|
|
53
54
|
"mobx": "6.9.0",
|
|
54
55
|
"mobx-react-lite": "3.4.3",
|
|
55
56
|
"react": "18.2.0",
|
|
@@ -59,12 +60,12 @@
|
|
|
59
60
|
"@finos/legend-dev-utils": "workspace:*",
|
|
60
61
|
"@jest/globals": "29.5.0",
|
|
61
62
|
"cross-env": "7.0.3",
|
|
62
|
-
"eslint": "8.
|
|
63
|
+
"eslint": "8.38.0",
|
|
63
64
|
"jest": "29.5.0",
|
|
64
65
|
"npm-run-all": "4.1.5",
|
|
65
|
-
"rimraf": "
|
|
66
|
-
"sass": "1.
|
|
67
|
-
"typescript": "5.0.
|
|
66
|
+
"rimraf": "5.0.0",
|
|
67
|
+
"sass": "1.62.0",
|
|
68
|
+
"typescript": "5.0.4"
|
|
68
69
|
},
|
|
69
70
|
"peerDependencies": {
|
|
70
71
|
"react": "^18.0.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.65",
|
|
4
4
|
"description": "Legend extension for Text DSL",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"legend",
|
|
@@ -43,28 +43,29 @@
|
|
|
43
43
|
"test:watch": "jest --watch"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@finos/legend-application": "
|
|
47
|
-
"@finos/legend-application-studio": "23.1.
|
|
48
|
-
"@finos/legend-art": "
|
|
49
|
-
"@finos/legend-graph": "26.0.
|
|
50
|
-
"@finos/legend-
|
|
51
|
-
"@finos/legend-
|
|
52
|
-
"@
|
|
46
|
+
"@finos/legend-application": "14.0.0",
|
|
47
|
+
"@finos/legend-application-studio": "23.1.8",
|
|
48
|
+
"@finos/legend-art": "6.0.0",
|
|
49
|
+
"@finos/legend-graph": "26.0.5",
|
|
50
|
+
"@finos/legend-lego": "0.1.0",
|
|
51
|
+
"@finos/legend-shared": "8.1.0",
|
|
52
|
+
"@finos/legend-storage": "3.0.47",
|
|
53
|
+
"@types/react": "18.0.34",
|
|
53
54
|
"mobx": "6.9.0",
|
|
54
55
|
"mobx-react-lite": "3.4.3",
|
|
55
56
|
"react": "18.2.0",
|
|
56
57
|
"serializr": "3.0.2"
|
|
57
58
|
},
|
|
58
59
|
"devDependencies": {
|
|
59
|
-
"@finos/legend-dev-utils": "2.0.
|
|
60
|
+
"@finos/legend-dev-utils": "2.0.52",
|
|
60
61
|
"@jest/globals": "29.5.0",
|
|
61
62
|
"cross-env": "7.0.3",
|
|
62
|
-
"eslint": "8.
|
|
63
|
+
"eslint": "8.38.0",
|
|
63
64
|
"jest": "29.5.0",
|
|
64
65
|
"npm-run-all": "4.1.5",
|
|
65
|
-
"rimraf": "
|
|
66
|
-
"sass": "1.
|
|
67
|
-
"typescript": "5.0.
|
|
66
|
+
"rimraf": "5.0.0",
|
|
67
|
+
"sass": "1.62.0",
|
|
68
|
+
"typescript": "5.0.4"
|
|
68
69
|
},
|
|
69
70
|
"peerDependencies": {
|
|
70
71
|
"react": "^18.0.0"
|
|
@@ -32,8 +32,7 @@ import {
|
|
|
32
32
|
ResizablePanelSplitter,
|
|
33
33
|
} from '@finos/legend-art';
|
|
34
34
|
import {
|
|
35
|
-
|
|
36
|
-
TextInputEditor,
|
|
35
|
+
CODE_EDITOR_LANGUAGE,
|
|
37
36
|
useApplicationNavigationContext,
|
|
38
37
|
} from '@finos/legend-application';
|
|
39
38
|
import {
|
|
@@ -42,16 +41,17 @@ import {
|
|
|
42
41
|
} from '../../stores/studio/DSL_Text_GraphModifierHelper.js';
|
|
43
42
|
import { TEXT_TYPE } from '../../graph/helpers/DSL_Text_Helper.js';
|
|
44
43
|
import { DSL_TEXT_LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY } from '../../application/studio/DSL_Text_LegendStudioApplicationNavigationContext.js';
|
|
44
|
+
import { CodeEditor } from '@finos/legend-lego/code-editor';
|
|
45
45
|
|
|
46
46
|
const getTextElementEditorLanguage = (
|
|
47
47
|
type: string | undefined,
|
|
48
|
-
):
|
|
48
|
+
): CODE_EDITOR_LANGUAGE => {
|
|
49
49
|
switch (type) {
|
|
50
50
|
case TEXT_TYPE.MARKDOWN:
|
|
51
|
-
return
|
|
51
|
+
return CODE_EDITOR_LANGUAGE.MARKDOWN;
|
|
52
52
|
case TEXT_TYPE.PLAIN_TEXT:
|
|
53
53
|
default:
|
|
54
|
-
return
|
|
54
|
+
return CODE_EDITOR_LANGUAGE.TEXT;
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
57
|
|
|
@@ -63,7 +63,7 @@ export const TextElementEditor = observer(() => {
|
|
|
63
63
|
const isReadOnly = textEditorState.isReadOnly;
|
|
64
64
|
const typeNameRef = useRef<HTMLInputElement>(null);
|
|
65
65
|
const [showPreview, setShowPreview] = useState(false);
|
|
66
|
-
const isPreviewSupported = textElement.type ===
|
|
66
|
+
const isPreviewSupported = textElement.type === CODE_EDITOR_LANGUAGE.MARKDOWN;
|
|
67
67
|
|
|
68
68
|
const changeType =
|
|
69
69
|
(val: TEXT_TYPE): (() => void) =>
|
|
@@ -140,7 +140,7 @@ export const TextElementEditor = observer(() => {
|
|
|
140
140
|
<ResizablePanelGroup orientation="vertical">
|
|
141
141
|
<ResizablePanel minSize={300}>
|
|
142
142
|
<div className="text-element-editor__editor">
|
|
143
|
-
<
|
|
143
|
+
<CodeEditor
|
|
144
144
|
language={getTextElementEditorLanguage(textElement.type)}
|
|
145
145
|
inputValue={textElement.content}
|
|
146
146
|
updateInput={changeContent}
|
|
@@ -161,7 +161,7 @@ export const TextElementEditor = observer(() => {
|
|
|
161
161
|
</ResizablePanelGroup>
|
|
162
162
|
) : (
|
|
163
163
|
<div className="text-element-editor__editor">
|
|
164
|
-
<
|
|
164
|
+
<CodeEditor
|
|
165
165
|
language={getTextElementEditorLanguage(textElement.type)}
|
|
166
166
|
inputValue={textElement.content}
|
|
167
167
|
updateInput={changeContent}
|