@finos/legend-extension-dsl-text 3.0.8 → 3.1.2
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/{DSLText_LegendStudioPlugin.d.ts → DSLText_LegendStudioApplicationPlugin.d.ts} +3 -3
- package/lib/components/studio/DSLText_LegendStudioApplicationPlugin.d.ts.map +1 -0
- package/lib/components/studio/{DSLText_LegendStudioPlugin.js → DSLText_LegendStudioApplicationPlugin.js} +3 -3
- package/lib/components/studio/DSLText_LegendStudioApplicationPlugin.js.map +1 -0
- package/lib/components/studio/TextElementEditor.d.ts.map +1 -1
- package/lib/components/studio/TextElementEditor.js +11 -3
- package/lib/components/studio/TextElementEditor.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/package.json +5 -5
- package/package.json +12 -12
- package/src/components/studio/{DSLText_LegendStudioPlugin.tsx → DSLText_LegendStudioApplicationPlugin.tsx} +8 -8
- package/src/components/studio/TextElementEditor.tsx +55 -8
- package/src/index.ts +1 -1
- package/tsconfig.json +1 -1
- package/lib/components/studio/DSLText_LegendStudioPlugin.d.ts.map +0 -1
- package/lib/components/studio/DSLText_LegendStudioPlugin.js.map +0 -1
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import {
|
|
17
|
-
export declare class
|
|
16
|
+
import { LegendStudioApplicationPlugin, type NewElementFromStateCreator, type ElementEditorStateCreator, type ElementTypeGetter, type ElementProjectExplorerDnDTypeGetter, type ElementIconGetter, type ElementEditorRenderer, type DSL_LegendStudioApplicationPlugin_Extension, type PureGrammarParserDocumentationGetter, type PureGrammarParserKeywordSuggestionGetter, type PureGrammarParserElementSnippetSuggestionsGetter, type PureGrammarParserElementDocumentationGetter } from '@finos/legend-studio';
|
|
17
|
+
export declare class DSLText_LegendStudioApplicationPlugin extends LegendStudioApplicationPlugin implements DSL_LegendStudioApplicationPlugin_Extension {
|
|
18
18
|
constructor();
|
|
19
19
|
getExtraRequiredDocumentationKeys(): string[];
|
|
20
20
|
getExtraAccessEventLoggingApplicationContextKeys(): string[];
|
|
@@ -31,4 +31,4 @@ export declare class DSLText_LegendStudioPlugin extends LegendStudioPlugin imple
|
|
|
31
31
|
getExtraPureGrammarParserKeywordSuggestionGetters(): PureGrammarParserKeywordSuggestionGetter[];
|
|
32
32
|
getExtraPureGrammarParserElementSnippetSuggestionsGetters(): PureGrammarParserElementSnippetSuggestionsGetter[];
|
|
33
33
|
}
|
|
34
|
-
//# sourceMappingURL=
|
|
34
|
+
//# sourceMappingURL=DSLText_LegendStudioApplicationPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DSLText_LegendStudioApplicationPlugin.d.ts","sourceRoot":"","sources":["../../../src/components/studio/DSLText_LegendStudioApplicationPlugin.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EACL,6BAA6B,EAC7B,KAAK,0BAA0B,EAG/B,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,KAAK,mCAAmC,EACxC,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,2CAA2C,EAEhD,KAAK,oCAAoC,EACzC,KAAK,wCAAwC,EAE7C,KAAK,gDAAgD,EACrD,KAAK,2CAA2C,EACjD,MAAM,sBAAsB,CAAC;AAsB9B,qBAAa,qCACX,SAAQ,6BACR,YAAW,2CAA2C;;IAM7C,iCAAiC,IAAI,MAAM,EAAE;IAO7C,gDAAgD,IAAI,MAAM,EAAE;IAMrE,6BAA6B,IAAI,MAAM,EAAE;IAIzC,0BAA0B,IAAI,iBAAiB,EAAE;IAWjD,0BAA0B,IAAI,iBAAiB,EAAE;IAejD,8BAA8B,IAAI,qBAAqB,EAAE;IAWzD,mCAAmC,IAAI,0BAA0B,EAAE;IAenE,kCAAkC,IAAI,yBAAyB,EAAE;IAcjE,4CAA4C,IAAI,mCAAmC,EAAE;IAWrF,qCAAqC,IAAI,MAAM,EAAE;IAIjD,oDAAoD,IAAI,2CAA2C,EAAE;IAmBrG,6CAA6C,IAAI,oCAAoC,EAAE;IAgBvF,iDAAiD,IAAI,wCAAwC,EAAE;IAgB/F,yDAAyD,IAAI,gDAAgD,EAAE;CAsBhH"}
|
|
@@ -15,7 +15,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
import packageJson from '../../../package.json';
|
|
18
|
-
import {
|
|
18
|
+
import { LegendStudioApplicationPlugin, } from '@finos/legend-studio';
|
|
19
19
|
import { FileIcon } from '@finos/legend-art';
|
|
20
20
|
import { TextEditorState } from '../../stores/studio/TextEditorState.js';
|
|
21
21
|
import { TextElementEditor } from './TextElementEditor.js';
|
|
@@ -27,7 +27,7 @@ import { create_TextElement } from '../../helper/DSLText_Helper.js';
|
|
|
27
27
|
import { DSL_TEXT_LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY } from '../../stores/studio/DSLText_LegendStudioApplicationNavigationContext.js';
|
|
28
28
|
const TEXT_ELEMENT_TYPE = 'TEXT';
|
|
29
29
|
const TEXT_ELEMENT_PROJECT_EXPLORER_DND_TYPE = 'PROJECT_EXPLORER_TEXT';
|
|
30
|
-
export class
|
|
30
|
+
export class DSLText_LegendStudioApplicationPlugin extends LegendStudioApplicationPlugin {
|
|
31
31
|
constructor() {
|
|
32
32
|
super(packageJson.extensions.studioPlugin, packageJson.version);
|
|
33
33
|
}
|
|
@@ -161,4 +161,4 @@ export class DSLText_LegendStudioPlugin extends LegendStudioPlugin {
|
|
|
161
161
|
];
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
-
//# sourceMappingURL=
|
|
164
|
+
//# sourceMappingURL=DSLText_LegendStudioApplicationPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DSLText_LegendStudioApplicationPlugin.js","sourceRoot":"","sources":["../../../src/components/studio/DSLText_LegendStudioApplicationPlugin.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,EACL,6BAA6B,GAgB9B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAE,IAAI,EAAE,MAAM,6EAA6E,CAAC;AACnG,OAAO,EAAE,wCAAwC,EAAE,MAAM,wCAAwC,CAAC;AAClG,OAAO,EACL,oCAAoC,EACpC,6BAA6B,GAC9B,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EACL,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAE,yDAAyD,EAAE,MAAM,yEAAyE,CAAC;AAEpJ,MAAM,iBAAiB,GAAG,MAAM,CAAC;AACjC,MAAM,sCAAsC,GAAG,uBAAuB,CAAC;AAEvE,MAAM,OAAO,qCACX,SAAQ,6BAA6B;IAGrC;QACE,KAAK,CAAC,WAAW,CAAC,UAAU,CAAC,YAAY,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAClE,CAAC;IAEQ,iCAAiC;QACxC,OAAO;YACL,wCAAwC,CAAC,oBAAoB;YAC7D,wCAAwC,CAAC,cAAc;SACxD,CAAC;IACJ,CAAC;IAEQ,gDAAgD;QACvD,OAAO;YACL,yDAAyD,CAAC,WAAW;SACtE,CAAC;IACJ,CAAC;IAED,6BAA6B;QAC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oCAAoC;wBAC1C,WAAW,EAAE,YAAY;wBACzB,UAAU,EAAE,kBAAkB;qBAC/B;oBACD;wBACE,IAAI,EAAE,oCAAoC;wBAC1C,WAAW,EAAE,UAAU;wBACvB,UAAU,EAAE,qBAAqB;qBAClC;iBACF;gBACH,CAAC,CAAC,SAAS;SAChB,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -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"}
|
|
@@ -14,12 +14,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
import { useRef, useEffect } from 'react';
|
|
17
|
+
import { useRef, useEffect, useState } from 'react';
|
|
18
18
|
import { observer } from 'mobx-react-lite';
|
|
19
19
|
import { prettyCONSTName } from '@finos/legend-shared';
|
|
20
20
|
import { StudioTextInputEditor, useEditorStore } from '@finos/legend-studio';
|
|
21
21
|
import { TextEditorState } from '../../stores/studio/TextEditorState.js';
|
|
22
|
-
import { LockIcon, CaretDownIcon, DropdownMenu, MenuContent, MenuContentItem, } from '@finos/legend-art';
|
|
22
|
+
import { OpenPreviewIcon, LockIcon, CaretDownIcon, DropdownMenu, MenuContent, MenuContentItem, MarkdownTextViewer, ResizablePanel, ResizablePanelGroup, ResizablePanelSplitter, getControlledResizablePanelProps, } from '@finos/legend-art';
|
|
23
23
|
import { EDITOR_LANGUAGE, useApplicationNavigationContext, } from '@finos/legend-application';
|
|
24
24
|
import { text_setContent, text_setType, } from '../../stores/studio/DSLText_GraphModifierHelper.js';
|
|
25
25
|
import { TEXT_TYPE } from '../../helper/DSLText_Helper.js';
|
|
@@ -39,19 +39,27 @@ export const TextElementEditor = observer(() => {
|
|
|
39
39
|
const textElement = textEditorState.textElement;
|
|
40
40
|
const isReadOnly = textEditorState.isReadOnly;
|
|
41
41
|
const typeNameRef = useRef(null);
|
|
42
|
+
const [showPreview, setShowPreview] = useState(false);
|
|
43
|
+
const isMarkdown = textElement.type === EDITOR_LANGUAGE.MARKDOWN;
|
|
42
44
|
const changeType = (val) => () => {
|
|
43
45
|
!isReadOnly && text_setType(textElement, val);
|
|
44
46
|
};
|
|
45
47
|
const changeContent = (val) => text_setContent(textElement, val);
|
|
48
|
+
const changePreview = (val) => setShowPreview(val);
|
|
46
49
|
useEffect(() => {
|
|
47
50
|
if (!isReadOnly) {
|
|
48
51
|
typeNameRef.current?.focus();
|
|
49
52
|
}
|
|
50
53
|
}, [isReadOnly]);
|
|
51
54
|
useApplicationNavigationContext(DSL_TEXT_LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY.TEXT_EDITOR);
|
|
55
|
+
const renderPlainTextEditorView = () => (_jsx("div", { className: "panel__content text-element-editor__editor", children: _jsx(StudioTextInputEditor, { language: getTextElementEditorLanguage(textElement.type), inputValue: textElement.content, updateInput: changeContent }) }));
|
|
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
|
+
}) }) }))] }));
|
|
52
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: {
|
|
53
61
|
anchorOrigin: { vertical: 'bottom', horizontal: 'right' },
|
|
54
62
|
transformOrigin: { vertical: 'top', horizontal: 'right' },
|
|
55
|
-
}, children: _jsxs("div", { className: "text-element-editor__header__configs__type", 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, {}) })] }) })
|
|
63
|
+
}, children: _jsxs("div", { className: "text-element-editor__header__configs__type", 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, {}) })] }) }), isMarkdown ? (_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] }) }), isMarkdown ? renderMarkdownView() : renderPlainTextEditorView()] }));
|
|
56
64
|
});
|
|
57
65
|
//# 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,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"TextElementEditor.js","sourceRoot":"","sources":["../../../src/components/studio/TextElementEditor.tsx"],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,EAAE,oCACT,WAAW,CAAC,CAAC,CAAC,0CAA0C,CAAC,CAAC,CAAC,EAC7D,EAAE,EACF,OAAO,EAAE,GAAS,EAAE,CAAC,aAAa,CAAC,CAAC,WAAW,CAAC,YAEhD,KAAC,eAAe,KAAG,GACZ,CACV,CAAC,CAAC,CAAC,IAAI,IACJ,GACF,EACL,UAAU,CAAC,CAAC,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,yBAAyB,EAAE,IAC5D,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
package/lib/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license @finos/legend-extension-dsl-text v3.
|
|
1
|
+
/** @license @finos/legend-extension-dsl-text v3.1.2
|
|
2
2
|
* 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}.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{overflow-y:hidden;position:relative}/*# sourceMappingURL=index.css.map */
|
|
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{overflow-y:hidden;position:relative}.text-element-editor__preview{overflow-y:hidden;position:relative}.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,
|
|
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,kBACA,kBAGF,8BACE,kBACA,kBAEA,wCACE,YACA,kBAIJ,kCACE,kCACA,eACA,iBACA,4BAEA,0CACE,kCAGF,wCACE","file":"index.css"}
|
package/lib/index.d.ts
CHANGED
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
export * from './DSLText_Extension.js';
|
|
17
|
-
export {
|
|
17
|
+
export { DSLText_LegendStudioApplicationPlugin } from './components/studio/DSLText_LegendStudioApplicationPlugin.js';
|
|
18
18
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,qCAAqC,EAAE,MAAM,8DAA8D,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
export * from './DSLText_Extension.js';
|
|
17
|
-
export {
|
|
17
|
+
export { DSLText_LegendStudioApplicationPlugin } from './components/studio/DSLText_LegendStudioApplicationPlugin.js';
|
|
18
18
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,qCAAqC,EAAE,MAAM,8DAA8D,CAAC"}
|
package/lib/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finos/legend-extension-dsl-text",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"description": "Legend extension for Text DSL",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"legend",
|
|
@@ -57,13 +57,13 @@
|
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@finos/legend-dev-utils": "workspace:*",
|
|
60
|
-
"@jest/globals": "28.1.
|
|
60
|
+
"@jest/globals": "28.1.3",
|
|
61
61
|
"cross-env": "7.0.3",
|
|
62
|
-
"eslint": "8.
|
|
63
|
-
"jest": "28.1.
|
|
62
|
+
"eslint": "8.20.0",
|
|
63
|
+
"jest": "28.1.3",
|
|
64
64
|
"npm-run-all": "4.1.5",
|
|
65
65
|
"rimraf": "3.0.2",
|
|
66
|
-
"sass": "1.
|
|
66
|
+
"sass": "1.54.0",
|
|
67
67
|
"typescript": "4.7.4"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finos/legend-extension-dsl-text",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"description": "Legend extension for Text DSL",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"legend",
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
"test:watch": "jest --watch"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@finos/legend-application": "
|
|
47
|
-
"@finos/legend-art": "2.0.
|
|
48
|
-
"@finos/legend-graph": "
|
|
49
|
-
"@finos/legend-model-storage": "2.0.
|
|
50
|
-
"@finos/legend-shared": "
|
|
51
|
-
"@finos/legend-studio": "
|
|
46
|
+
"@finos/legend-application": "7.0.0",
|
|
47
|
+
"@finos/legend-art": "2.0.9",
|
|
48
|
+
"@finos/legend-graph": "11.0.0",
|
|
49
|
+
"@finos/legend-model-storage": "2.0.7",
|
|
50
|
+
"@finos/legend-shared": "5.0.0",
|
|
51
|
+
"@finos/legend-studio": "12.0.0",
|
|
52
52
|
"@types/react": "18.0.15",
|
|
53
53
|
"mobx": "6.6.1",
|
|
54
54
|
"mobx-react-lite": "3.4.0",
|
|
@@ -56,14 +56,14 @@
|
|
|
56
56
|
"serializr": "2.0.5"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@finos/legend-dev-utils": "2.0.
|
|
60
|
-
"@jest/globals": "28.1.
|
|
59
|
+
"@finos/legend-dev-utils": "2.0.6",
|
|
60
|
+
"@jest/globals": "28.1.3",
|
|
61
61
|
"cross-env": "7.0.3",
|
|
62
|
-
"eslint": "8.
|
|
63
|
-
"jest": "28.1.
|
|
62
|
+
"eslint": "8.20.0",
|
|
63
|
+
"jest": "28.1.3",
|
|
64
64
|
"npm-run-all": "4.1.5",
|
|
65
65
|
"rimraf": "3.0.2",
|
|
66
|
-
"sass": "1.
|
|
66
|
+
"sass": "1.54.0",
|
|
67
67
|
"typescript": "4.7.4"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import packageJson from '../../../package.json';
|
|
18
18
|
import {
|
|
19
|
-
|
|
19
|
+
LegendStudioApplicationPlugin,
|
|
20
20
|
type NewElementFromStateCreator,
|
|
21
21
|
type EditorStore,
|
|
22
22
|
type ElementEditorState,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
type ElementProjectExplorerDnDTypeGetter,
|
|
26
26
|
type ElementIconGetter,
|
|
27
27
|
type ElementEditorRenderer,
|
|
28
|
-
type
|
|
28
|
+
type DSL_LegendStudioApplicationPlugin_Extension,
|
|
29
29
|
type NewElementState,
|
|
30
30
|
type PureGrammarParserDocumentationGetter,
|
|
31
31
|
type PureGrammarParserKeywordSuggestionGetter,
|
|
@@ -48,15 +48,15 @@ import {
|
|
|
48
48
|
PLAIN_TEXT_SNIPPET,
|
|
49
49
|
} from './DSLText_CodeSnippets.js';
|
|
50
50
|
import { create_TextElement } from '../../helper/DSLText_Helper.js';
|
|
51
|
-
import type {
|
|
51
|
+
import type { DocumentationEntry } from '@finos/legend-application';
|
|
52
52
|
import { DSL_TEXT_LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY } from '../../stores/studio/DSLText_LegendStudioApplicationNavigationContext.js';
|
|
53
53
|
|
|
54
54
|
const TEXT_ELEMENT_TYPE = 'TEXT';
|
|
55
55
|
const TEXT_ELEMENT_PROJECT_EXPLORER_DND_TYPE = 'PROJECT_EXPLORER_TEXT';
|
|
56
56
|
|
|
57
|
-
export class
|
|
58
|
-
extends
|
|
59
|
-
implements
|
|
57
|
+
export class DSLText_LegendStudioApplicationPlugin
|
|
58
|
+
extends LegendStudioApplicationPlugin
|
|
59
|
+
implements DSL_LegendStudioApplicationPlugin_Extension
|
|
60
60
|
{
|
|
61
61
|
constructor() {
|
|
62
62
|
super(packageJson.extensions.studioPlugin, packageJson.version);
|
|
@@ -166,7 +166,7 @@ export class DSLText_LegendStudioPlugin
|
|
|
166
166
|
editorStore: EditorStore,
|
|
167
167
|
parserKeyword: string,
|
|
168
168
|
elementKeyword: string,
|
|
169
|
-
):
|
|
169
|
+
): DocumentationEntry | undefined => {
|
|
170
170
|
if (parserKeyword === PURE_GRAMMAR_TEXT_PARSER_NAME) {
|
|
171
171
|
if (elementKeyword === PURE_GRAMMAR_TEXT_ELEMENT_TYPE_LABEL) {
|
|
172
172
|
return editorStore.applicationStore.documentationService.getDocEntry(
|
|
@@ -184,7 +184,7 @@ export class DSLText_LegendStudioPlugin
|
|
|
184
184
|
(
|
|
185
185
|
editorStore: EditorStore,
|
|
186
186
|
parserKeyword: string,
|
|
187
|
-
):
|
|
187
|
+
): DocumentationEntry | undefined => {
|
|
188
188
|
if (parserKeyword === PURE_GRAMMAR_TEXT_PARSER_NAME) {
|
|
189
189
|
return editorStore.applicationStore.documentationService.getDocEntry(
|
|
190
190
|
DSL_TEXT_LEGEND_STUDIO_DOCUMENTATION_KEY.GRAMMAR_PARSER,
|
|
@@ -14,17 +14,23 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { useRef, useEffect } from 'react';
|
|
17
|
+
import { useRef, useEffect, useState } from 'react';
|
|
18
18
|
import { observer } from 'mobx-react-lite';
|
|
19
19
|
import { prettyCONSTName } from '@finos/legend-shared';
|
|
20
20
|
import { StudioTextInputEditor, useEditorStore } from '@finos/legend-studio';
|
|
21
21
|
import { TextEditorState } from '../../stores/studio/TextEditorState.js';
|
|
22
22
|
import {
|
|
23
|
+
OpenPreviewIcon,
|
|
23
24
|
LockIcon,
|
|
24
25
|
CaretDownIcon,
|
|
25
26
|
DropdownMenu,
|
|
26
27
|
MenuContent,
|
|
27
28
|
MenuContentItem,
|
|
29
|
+
MarkdownTextViewer,
|
|
30
|
+
ResizablePanel,
|
|
31
|
+
ResizablePanelGroup,
|
|
32
|
+
ResizablePanelSplitter,
|
|
33
|
+
getControlledResizablePanelProps,
|
|
28
34
|
} from '@finos/legend-art';
|
|
29
35
|
import {
|
|
30
36
|
EDITOR_LANGUAGE,
|
|
@@ -55,6 +61,9 @@ export const TextElementEditor = observer(() => {
|
|
|
55
61
|
const textElement = textEditorState.textElement;
|
|
56
62
|
const isReadOnly = textEditorState.isReadOnly;
|
|
57
63
|
const typeNameRef = useRef<HTMLInputElement>(null);
|
|
64
|
+
const [showPreview, setShowPreview] = useState(false);
|
|
65
|
+
const isMarkdown = textElement.type === EDITOR_LANGUAGE.MARKDOWN;
|
|
66
|
+
|
|
58
67
|
const changeType =
|
|
59
68
|
(val: TEXT_TYPE): (() => void) =>
|
|
60
69
|
(): void => {
|
|
@@ -62,6 +71,7 @@ export const TextElementEditor = observer(() => {
|
|
|
62
71
|
};
|
|
63
72
|
const changeContent = (val: string): void =>
|
|
64
73
|
text_setContent(textElement, val);
|
|
74
|
+
const changePreview = (val: boolean): void => setShowPreview(val);
|
|
65
75
|
|
|
66
76
|
useEffect(() => {
|
|
67
77
|
if (!isReadOnly) {
|
|
@@ -73,6 +83,38 @@ export const TextElementEditor = observer(() => {
|
|
|
73
83
|
DSL_TEXT_LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY.TEXT_EDITOR,
|
|
74
84
|
);
|
|
75
85
|
|
|
86
|
+
const renderPlainTextEditorView = (): JSX.Element => (
|
|
87
|
+
<div className="panel__content text-element-editor__editor">
|
|
88
|
+
<StudioTextInputEditor
|
|
89
|
+
language={getTextElementEditorLanguage(textElement.type)}
|
|
90
|
+
inputValue={textElement.content}
|
|
91
|
+
updateInput={changeContent}
|
|
92
|
+
/>
|
|
93
|
+
</div>
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
const renderMarkdownView = (): JSX.Element => (
|
|
97
|
+
<ResizablePanelGroup
|
|
98
|
+
{...getControlledResizablePanelProps(true)}
|
|
99
|
+
orientation="vertical"
|
|
100
|
+
>
|
|
101
|
+
<ResizablePanel minSize={250}>
|
|
102
|
+
{renderPlainTextEditorView()}
|
|
103
|
+
</ResizablePanel>
|
|
104
|
+
{showPreview && <ResizablePanelSplitter />}
|
|
105
|
+
{showPreview && (
|
|
106
|
+
<ResizablePanel>
|
|
107
|
+
<div className="panel_content text-element-editor__preview">
|
|
108
|
+
{MarkdownTextViewer({
|
|
109
|
+
value: { value: textElement.content },
|
|
110
|
+
className: `text-element-editor__preview__markdown`,
|
|
111
|
+
})}
|
|
112
|
+
</div>
|
|
113
|
+
</ResizablePanel>
|
|
114
|
+
)}
|
|
115
|
+
</ResizablePanelGroup>
|
|
116
|
+
);
|
|
117
|
+
|
|
76
118
|
return (
|
|
77
119
|
<div className="panel text-element-editor">
|
|
78
120
|
<div className="panel__header text-element-editor__header">
|
|
@@ -112,15 +154,20 @@ export const TextElementEditor = observer(() => {
|
|
|
112
154
|
</div>
|
|
113
155
|
</div>
|
|
114
156
|
</DropdownMenu>
|
|
157
|
+
{isMarkdown ? (
|
|
158
|
+
<button
|
|
159
|
+
title={showPreview ? `Hide Preview` : `Show Preview`}
|
|
160
|
+
className={`text-element-editor__preview-btn ${
|
|
161
|
+
showPreview ? `text-element-editor__preview-btn__active` : ''
|
|
162
|
+
}`}
|
|
163
|
+
onClick={(): void => changePreview(!showPreview)}
|
|
164
|
+
>
|
|
165
|
+
<OpenPreviewIcon />
|
|
166
|
+
</button>
|
|
167
|
+
) : null}
|
|
115
168
|
</div>
|
|
116
169
|
</div>
|
|
117
|
-
|
|
118
|
-
<StudioTextInputEditor
|
|
119
|
-
language={getTextElementEditorLanguage(textElement.type)}
|
|
120
|
-
inputValue={textElement.content}
|
|
121
|
-
updateInput={changeContent}
|
|
122
|
-
/>
|
|
123
|
-
</div>
|
|
170
|
+
{isMarkdown ? renderMarkdownView() : renderPlainTextEditorView()}
|
|
124
171
|
</div>
|
|
125
172
|
);
|
|
126
173
|
});
|
package/src/index.ts
CHANGED
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
export * from './DSLText_Extension.js';
|
|
18
|
-
export {
|
|
18
|
+
export { DSLText_LegendStudioApplicationPlugin } from './components/studio/DSLText_LegendStudioApplicationPlugin.js';
|
package/tsconfig.json
CHANGED
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"./src/stores/studio/DSLText_GraphModifierHelper.ts",
|
|
52
52
|
"./src/stores/studio/DSLText_LegendStudioApplicationNavigationContext.ts",
|
|
53
53
|
"./src/stores/studio/TextEditorState.ts",
|
|
54
|
-
"./src/components/studio/
|
|
54
|
+
"./src/components/studio/DSLText_LegendStudioApplicationPlugin.tsx",
|
|
55
55
|
"./src/components/studio/TextElementEditor.tsx"
|
|
56
56
|
],
|
|
57
57
|
"include": [
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DSLText_LegendStudioPlugin.d.ts","sourceRoot":"","sources":["../../../src/components/studio/DSLText_LegendStudioPlugin.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EACL,kBAAkB,EAClB,KAAK,0BAA0B,EAG/B,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,KAAK,mCAAmC,EACxC,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,gCAAgC,EAErC,KAAK,oCAAoC,EACzC,KAAK,wCAAwC,EAE7C,KAAK,gDAAgD,EACrD,KAAK,2CAA2C,EACjD,MAAM,sBAAsB,CAAC;AAsB9B,qBAAa,0BACX,SAAQ,kBACR,YAAW,gCAAgC;;IAMlC,iCAAiC,IAAI,MAAM,E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