@finos/legend-extension-dsl-text 3.0.6 → 3.1.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.
@@ -17,6 +17,7 @@ import { LegendStudioPlugin, type NewElementFromStateCreator, type ElementEditor
17
17
  export declare class DSLText_LegendStudioPlugin extends LegendStudioPlugin implements DSL_LegendStudioPlugin_Extension {
18
18
  constructor();
19
19
  getExtraRequiredDocumentationKeys(): string[];
20
+ getExtraAccessEventLoggingApplicationContextKeys(): string[];
20
21
  getExtraSupportedElementTypes(): string[];
21
22
  getExtraElementTypeGetters(): ElementTypeGetter[];
22
23
  getExtraElementIconGetters(): ElementIconGetter[];
@@ -1 +1 @@
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;AAqB9B,qBAAa,0BACX,SAAQ,kBACR,YAAW,gCAAgC;;IAMlC,iCAAiC,IAAI,MAAM,EAAE;IAOtD,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"}
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,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"}
@@ -24,6 +24,7 @@ import { DSL_TEXT_LEGEND_STUDIO_DOCUMENTATION_KEY } from './DSLText_LegendStudio
24
24
  import { PURE_GRAMMAR_TEXT_ELEMENT_TYPE_LABEL, PURE_GRAMMAR_TEXT_PARSER_NAME, } from '../../graphManager/DSLText_PureGraphManagerPlugin.js';
25
25
  import { MARKDOWN_TEXT_SNIPPET, PLAIN_TEXT_SNIPPET, } from './DSLText_CodeSnippets.js';
26
26
  import { create_TextElement } from '../../helper/DSLText_Helper.js';
27
+ import { DSL_TEXT_LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY } from '../../stores/studio/DSLText_LegendStudioApplicationNavigationContext.js';
27
28
  const TEXT_ELEMENT_TYPE = 'TEXT';
28
29
  const TEXT_ELEMENT_PROJECT_EXPLORER_DND_TYPE = 'PROJECT_EXPLORER_TEXT';
29
30
  export class DSLText_LegendStudioPlugin extends LegendStudioPlugin {
@@ -36,6 +37,11 @@ export class DSLText_LegendStudioPlugin extends LegendStudioPlugin {
36
37
  DSL_TEXT_LEGEND_STUDIO_DOCUMENTATION_KEY.GRAMMAR_PARSER,
37
38
  ];
38
39
  }
40
+ getExtraAccessEventLoggingApplicationContextKeys() {
41
+ return [
42
+ DSL_TEXT_LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY.TEXT_EDITOR,
43
+ ];
44
+ }
39
45
  getExtraSupportedElementTypes() {
40
46
  return [TEXT_ELEMENT_TYPE];
41
47
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DSLText_LegendStudioPlugin.js","sourceRoot":"","sources":["../../../src/components/studio/DSLText_LegendStudioPlugin.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,EACL,kBAAkB,GAgBnB,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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,IAAI,aAAa,KAAK,6BAA6B,EAAE;oBACnD,OAAO,WAAW,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,WAAW,CAClE,wCAAwC,CAAC,cAAc,CACxD,CAAC;iBACH;gBACD,OAAO,SAAS,CAAC;YACnB,CAAC;SACF,CAAC;IACJ,CAAC;IAED,iDAAiD;QAC/C,OAAO;YACL,CAAC,WAAwB,EAA+B,EAAE,CAAC;gBACzD;oBACE,IAAI,EAAE,6BAA6B;oBACnC,WAAW,EAAE,OAAO;oBACpB,aAAa,EACX,WAAW,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,WAAW,CAC3D,wCAAwC,CAAC,cAAc,CACxD;oBACH,UAAU,EAAE,6BAA6B;iBAC1C;aACF;SACF,CAAC;IACJ,CAAC;IAED,yDAAyD;QACvD,OAAO;YACL,CACE,WAAwB,EACxB,aAAqB,EACoB,EAAE,CAC3C,aAAa,KAAK,6BAA6B;gBAC7C,CAAC,CAAC;oBACE;wBACE,IAAI,EAAE,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
+ {"version":3,"file":"DSLText_LegendStudioPlugin.js","sourceRoot":"","sources":["../../../src/components/studio/DSLText_LegendStudioPlugin.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,EACL,kBAAkB,GAgBnB,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;AA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,CAAC;qBACH;iBACF;gBACD,OAAO,SAAS,CAAC;YACnB,CAAC;SACF,CAAC;IACJ,CAAC;IAED,6CAA6C;QAC3C,OAAO;YACL,CACE,WAAwB,EACxB,aAAqB,EAC4B,EAAE;gBACnD,IAAI,aAAa,KAAK,6BAA6B,EAAE;oBACnD,OAAO,WAAW,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,WAAW,CAClE,wCAAwC,CAAC,cAAc,CACxD,CAAC;iBACH;gBACD,OAAO,SAAS,CAAC;YACnB,CAAC;SACF,CAAC;IACJ,CAAC;IAED,iDAAiD;QAC/C,OAAO;YACL,CAAC,WAAwB,EAA+B,EAAE,CAAC;gBACzD;oBACE,IAAI,EAAE,6BAA6B;oBACnC,WAAW,EAAE,OAAO;oBACpB,aAAa,EACX,WAAW,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,WAAW,CAC3D,wCAAwC,CAAC,cAAc,CACxD;oBACH,UAAU,EAAE,6BAA6B;iBAC1C;aACF;SACF,CAAC;IACJ,CAAC;IAED,yDAAyD;QACvD,OAAO;YACL,CACE,WAAwB,EACxB,aAAqB,EACoB,EAAE,CAC3C,aAAa,KAAK,6BAA6B;gBAC7C,CAAC,CAAC;oBACE;wBACE,IAAI,EAAE,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;;AAiCH,eAAO,MAAM,iBAAiB;;CAsE5B,CAAC"}
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,15 +14,16 @@ 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';
23
- import { EDITOR_LANGUAGE } from '@finos/legend-application';
22
+ import { OpenPreviewIcon, LockIcon, CaretDownIcon, DropdownMenu, MenuContent, MenuContentItem, MarkdownTextViewer, ResizablePanel, ResizablePanelGroup, ResizablePanelSplitter, getControlledResizablePanelProps, } from '@finos/legend-art';
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';
26
+ import { DSL_TEXT_LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY } from '../../stores/studio/DSLText_LegendStudioApplicationNavigationContext.js';
26
27
  const getTextElementEditorLanguage = (type) => {
27
28
  switch (type) {
28
29
  case TEXT_TYPE.MARKDOWN:
@@ -38,18 +39,27 @@ export const TextElementEditor = observer(() => {
38
39
  const textElement = textEditorState.textElement;
39
40
  const isReadOnly = textEditorState.isReadOnly;
40
41
  const typeNameRef = useRef(null);
42
+ const [showPreview, setShowPreview] = useState(false);
43
+ const isMarkdown = textElement.type === EDITOR_LANGUAGE.MARKDOWN;
41
44
  const changeType = (val) => () => {
42
45
  !isReadOnly && text_setType(textElement, val);
43
46
  };
44
47
  const changeContent = (val) => text_setContent(textElement, val);
48
+ const changePreview = (val) => setShowPreview(val);
45
49
  useEffect(() => {
46
50
  if (!isReadOnly) {
47
51
  typeNameRef.current?.focus();
48
52
  }
49
53
  }, [isReadOnly]);
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
+ }) }) }))] }));
50
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: {
51
61
  anchorOrigin: { vertical: 'bottom', horizontal: 'right' },
52
62
  transformOrigin: { vertical: 'top', horizontal: 'right' },
53
- }, 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, {}) })] }) })] }) }), _jsx("div", { className: "panel__content text-element-editor__editor", children: _jsx(StudioTextInputEditor, { language: getTextElementEditorLanguage(textElement.type), inputValue: textElement.content, updateInput: changeContent }) })] }));
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()] }));
54
64
  });
55
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;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EACL,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,WAAW,EACX,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EACL,eAAe,EACf,YAAY,GACb,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAE3D,MA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CAAC,CAAC,CAAC"}
package/lib/index.css CHANGED
@@ -1,4 +1,4 @@
1
- /** @license @finos/legend-extension-dsl-text v3.0.6
1
+ /** @license @finos/legend-extension-dsl-text v3.1.0
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-blue-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{background:var(--color-blue-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,aAEA,4CC1BJ,aACA,mBD4BM,cACA,YACA,sCACA,mDACA,kDACA,kCACA,eAGF,mDACE,cACA,cC9CN,aACA,mBACA,uBDiDI,kDCnDJ,aACA,mBACA,uBDoDM,kDACA,cACA,aACA,iBAGF,8CC5DJ,aACA,mBACA,uBD6DM,cACA,cAKN,6BACE,kBACA","file":"index.css"}
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,4BACA,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": "3.0.6",
3
+ "version": "3.1.0",
4
4
  "description": "Legend extension for Text DSL",
5
5
  "keywords": [
6
6
  "legend",
@@ -49,7 +49,7 @@
49
49
  "@finos/legend-model-storage": "workspace:*",
50
50
  "@finos/legend-shared": "workspace:*",
51
51
  "@finos/legend-studio": "workspace:*",
52
- "@types/react": "18.0.14",
52
+ "@types/react": "18.0.15",
53
53
  "mobx": "6.6.1",
54
54
  "mobx-react-lite": "3.4.0",
55
55
  "react": "18.2.0",
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Copyright (c) 2020-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export declare enum DSL_TEXT_LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY {
17
+ TEXT_EDITOR = "dsl-text.studiop.editor.text-editor"
18
+ }
19
+ //# sourceMappingURL=DSLText_LegendStudioApplicationNavigationContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DSLText_LegendStudioApplicationNavigationContext.d.ts","sourceRoot":"","sources":["../../../src/stores/studio/DSLText_LegendStudioApplicationNavigationContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,oBAAY,yDAAyD;IACnE,WAAW,wCAAwC;CACpD"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright (c) 2020-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export var DSL_TEXT_LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY;
17
+ (function (DSL_TEXT_LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY) {
18
+ DSL_TEXT_LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY["TEXT_EDITOR"] = "dsl-text.studiop.editor.text-editor";
19
+ })(DSL_TEXT_LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY = DSL_TEXT_LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY || (DSL_TEXT_LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY = {}));
20
+ //# sourceMappingURL=DSLText_LegendStudioApplicationNavigationContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DSLText_LegendStudioApplicationNavigationContext.js","sourceRoot":"","sources":["../../../src/stores/studio/DSLText_LegendStudioApplicationNavigationContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,CAAN,IAAY,yDAEX;AAFD,WAAY,yDAAyD;IACnE,gHAAmD,CAAA;AACrD,CAAC,EAFW,yDAAyD,GAAzD,yDAAyD,KAAzD,yDAAyD,QAEpE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finos/legend-extension-dsl-text",
3
- "version": "3.0.6",
3
+ "version": "3.1.0",
4
4
  "description": "Legend extension for Text DSL",
5
5
  "keywords": [
6
6
  "legend",
@@ -43,20 +43,20 @@
43
43
  "test:watch": "jest --watch"
44
44
  },
45
45
  "dependencies": {
46
- "@finos/legend-application": "5.1.0",
47
- "@finos/legend-art": "2.0.5",
48
- "@finos/legend-graph": "10.0.0",
49
- "@finos/legend-model-storage": "2.0.5",
50
- "@finos/legend-shared": "4.0.2",
51
- "@finos/legend-studio": "10.3.0",
52
- "@types/react": "18.0.14",
46
+ "@finos/legend-application": "6.0.1",
47
+ "@finos/legend-art": "2.0.7",
48
+ "@finos/legend-graph": "10.1.1",
49
+ "@finos/legend-model-storage": "2.0.6",
50
+ "@finos/legend-shared": "4.0.3",
51
+ "@finos/legend-studio": "11.0.2",
52
+ "@types/react": "18.0.15",
53
53
  "mobx": "6.6.1",
54
54
  "mobx-react-lite": "3.4.0",
55
55
  "react": "18.2.0",
56
56
  "serializr": "2.0.5"
57
57
  },
58
58
  "devDependencies": {
59
- "@finos/legend-dev-utils": "2.0.4",
59
+ "@finos/legend-dev-utils": "2.0.5",
60
60
  "@jest/globals": "28.1.2",
61
61
  "cross-env": "7.0.3",
62
62
  "eslint": "8.19.0",
@@ -49,6 +49,7 @@ import {
49
49
  } from './DSLText_CodeSnippets.js';
50
50
  import { create_TextElement } from '../../helper/DSLText_Helper.js';
51
51
  import type { LegendApplicationDocumentationEntry } from '@finos/legend-application';
52
+ import { DSL_TEXT_LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY } from '../../stores/studio/DSLText_LegendStudioApplicationNavigationContext.js';
52
53
 
53
54
  const TEXT_ELEMENT_TYPE = 'TEXT';
54
55
  const TEXT_ELEMENT_PROJECT_EXPLORER_DND_TYPE = 'PROJECT_EXPLORER_TEXT';
@@ -68,6 +69,12 @@ export class DSLText_LegendStudioPlugin
68
69
  ];
69
70
  }
70
71
 
72
+ override getExtraAccessEventLoggingApplicationContextKeys(): string[] {
73
+ return [
74
+ DSL_TEXT_LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY.TEXT_EDITOR,
75
+ ];
76
+ }
77
+
71
78
  getExtraSupportedElementTypes(): string[] {
72
79
  return [TEXT_ELEMENT_TYPE];
73
80
  }
@@ -14,24 +14,34 @@
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
- import { EDITOR_LANGUAGE } from '@finos/legend-application';
35
+ import {
36
+ EDITOR_LANGUAGE,
37
+ useApplicationNavigationContext,
38
+ } from '@finos/legend-application';
30
39
  import {
31
40
  text_setContent,
32
41
  text_setType,
33
42
  } from '../../stores/studio/DSLText_GraphModifierHelper.js';
34
43
  import { TEXT_TYPE } from '../../helper/DSLText_Helper.js';
44
+ import { DSL_TEXT_LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY } from '../../stores/studio/DSLText_LegendStudioApplicationNavigationContext.js';
35
45
 
36
46
  const getTextElementEditorLanguage = (
37
47
  type: string | undefined,
@@ -51,6 +61,9 @@ export const TextElementEditor = observer(() => {
51
61
  const textElement = textEditorState.textElement;
52
62
  const isReadOnly = textEditorState.isReadOnly;
53
63
  const typeNameRef = useRef<HTMLInputElement>(null);
64
+ const [showPreview, setShowPreview] = useState(false);
65
+ const isMarkdown = textElement.type === EDITOR_LANGUAGE.MARKDOWN;
66
+
54
67
  const changeType =
55
68
  (val: TEXT_TYPE): (() => void) =>
56
69
  (): void => {
@@ -58,6 +71,7 @@ export const TextElementEditor = observer(() => {
58
71
  };
59
72
  const changeContent = (val: string): void =>
60
73
  text_setContent(textElement, val);
74
+ const changePreview = (val: boolean): void => setShowPreview(val);
61
75
 
62
76
  useEffect(() => {
63
77
  if (!isReadOnly) {
@@ -65,6 +79,42 @@ export const TextElementEditor = observer(() => {
65
79
  }
66
80
  }, [isReadOnly]);
67
81
 
82
+ useApplicationNavigationContext(
83
+ DSL_TEXT_LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY.TEXT_EDITOR,
84
+ );
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
+
68
118
  return (
69
119
  <div className="panel text-element-editor">
70
120
  <div className="panel__header text-element-editor__header">
@@ -104,15 +154,20 @@ export const TextElementEditor = observer(() => {
104
154
  </div>
105
155
  </div>
106
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}
107
168
  </div>
108
169
  </div>
109
- <div className="panel__content text-element-editor__editor">
110
- <StudioTextInputEditor
111
- language={getTextElementEditorLanguage(textElement.type)}
112
- inputValue={textElement.content}
113
- updateInput={changeContent}
114
- />
115
- </div>
170
+ {isMarkdown ? renderMarkdownView() : renderPlainTextEditorView()}
116
171
  </div>
117
172
  );
118
173
  });
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Copyright (c) 2020-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ export enum DSL_TEXT_LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY {
18
+ TEXT_EDITOR = 'dsl-text.studiop.editor.text-editor',
19
+ }
package/tsconfig.json CHANGED
@@ -49,6 +49,7 @@
49
49
  "./src/models/protocols/pure/v1/transformation/pureGraph/V1_DSLText_GraphBuilderHelper.ts",
50
50
  "./src/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLText_ProtocolHelper.ts",
51
51
  "./src/stores/studio/DSLText_GraphModifierHelper.ts",
52
+ "./src/stores/studio/DSLText_LegendStudioApplicationNavigationContext.ts",
52
53
  "./src/stores/studio/TextEditorState.ts",
53
54
  "./src/components/studio/DSLText_LegendStudioPlugin.tsx",
54
55
  "./src/components/studio/TextElementEditor.tsx"