mirror of
https://github.com/LukeHagar/firecamp.git
synced 2025-12-10 12:27:45 +00:00
feat: Editor component is replaced by MultiLineEditor
This commit is contained in:
@@ -6,7 +6,7 @@ import {
|
|||||||
Modal,
|
Modal,
|
||||||
IModal,
|
IModal,
|
||||||
ProgressBar,
|
ProgressBar,
|
||||||
MultiLineIFE,
|
Editor,
|
||||||
CheckboxGroup,
|
CheckboxGroup,
|
||||||
} from '@firecamp/ui-kit';
|
} from '@firecamp/ui-kit';
|
||||||
import { _misc } from '@firecamp/utils';
|
import { _misc } from '@firecamp/utils';
|
||||||
@@ -227,7 +227,7 @@ const CreateEnvironment: FC<IModal> = ({
|
|||||||
Variables will be valid JSON in key-value pair. ex.{' '}
|
Variables will be valid JSON in key-value pair. ex.{' '}
|
||||||
{`{ "host": "https://myapi.com" }`}
|
{`{ "host": "https://myapi.com" }`}
|
||||||
</span>
|
</span>
|
||||||
<MultiLineIFE
|
<Editor
|
||||||
language="json"
|
language="json"
|
||||||
value={env.variables}
|
value={env.variables}
|
||||||
onChange={onVariableEditorChange}
|
onChange={onVariableEditorChange}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {
|
|||||||
Modal,
|
Modal,
|
||||||
IModal,
|
IModal,
|
||||||
ProgressBar,
|
ProgressBar,
|
||||||
MultiLineIFE,
|
Editor,
|
||||||
} from '@firecamp/ui-kit';
|
} from '@firecamp/ui-kit';
|
||||||
import { _misc } from '@firecamp/utils';
|
import { _misc } from '@firecamp/utils';
|
||||||
import { IEnvironment, EEnvironmentScope } from '@firecamp/types';
|
import { IEnvironment, EEnvironmentScope } from '@firecamp/types';
|
||||||
@@ -215,7 +215,7 @@ const ManageEnvironment: FC<IModal> = ({ onClose = () => {} }) => {
|
|||||||
Variables will be valid JSON in key-value pair. ex.{' '}
|
Variables will be valid JSON in key-value pair. ex.{' '}
|
||||||
{`{ "host": "https://myapi.com" }`}
|
{`{ "host": "https://myapi.com" }`}
|
||||||
</span>
|
</span>
|
||||||
<MultiLineIFE
|
<Editor
|
||||||
language="json"
|
language="json"
|
||||||
value={env.variables}
|
value={env.variables}
|
||||||
onChange={onVariableEditorChange}
|
onChange={onVariableEditorChange}
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ import {
|
|||||||
Container,
|
Container,
|
||||||
TabHeader,
|
TabHeader,
|
||||||
Button,
|
Button,
|
||||||
|
Editor
|
||||||
MultiLineIFE,
|
|
||||||
} from '@firecamp/ui-kit';
|
} from '@firecamp/ui-kit';
|
||||||
import equal from 'deep-equal';
|
import equal from 'deep-equal';
|
||||||
import { _object } from '@firecamp/utils';
|
import { _object } from '@firecamp/utils';
|
||||||
@@ -167,7 +166,7 @@ const EnvPlayground: FC<IEnvPlayground> = ({
|
|||||||
return (
|
return (
|
||||||
<Container>
|
<Container>
|
||||||
<Container.Body>
|
<Container.Body>
|
||||||
<MultiLineIFE
|
<Editor
|
||||||
autoFocus={!isAddEnvPopoverOpen}
|
autoFocus={!isAddEnvPopoverOpen}
|
||||||
language={'json'}
|
language={'json'}
|
||||||
value={
|
value={
|
||||||
|
|||||||
@@ -6,9 +6,7 @@ import {
|
|||||||
Container,
|
Container,
|
||||||
TabHeader,
|
TabHeader,
|
||||||
Button,
|
Button,
|
||||||
|
Editor,
|
||||||
|
|
||||||
MultiLineIFE,
|
|
||||||
} from '@firecamp/ui-kit';
|
} from '@firecamp/ui-kit';
|
||||||
|
|
||||||
const ImportRaw: FC<IImportRaw> = ({
|
const ImportRaw: FC<IImportRaw> = ({
|
||||||
@@ -37,7 +35,7 @@ const ImportRaw: FC<IImportRaw> = ({
|
|||||||
return (
|
return (
|
||||||
<Container className="fc-import-editor" overflow="auto">
|
<Container className="fc-import-editor" overflow="auto">
|
||||||
<Container.Body>
|
<Container.Body>
|
||||||
<MultiLineIFE
|
<Editor
|
||||||
disabled={false}
|
disabled={false}
|
||||||
name={'jsonbody'}
|
name={'jsonbody'}
|
||||||
language={'json'}
|
language={'json'}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { VscClose } from '@react-icons/all-files/vsc/VscClose';
|
|||||||
import {
|
import {
|
||||||
Resizable,
|
Resizable,
|
||||||
Container,
|
Container,
|
||||||
MultiLineIFE,
|
Editor,
|
||||||
TabHeader,
|
TabHeader,
|
||||||
Button,
|
Button,
|
||||||
} from '@firecamp/ui-kit';
|
} from '@firecamp/ui-kit';
|
||||||
@@ -247,7 +247,7 @@ const EnvVarPreview: FC<IEnvVarPreview> = ({
|
|||||||
</TabHeader>
|
</TabHeader>
|
||||||
</div>
|
</div>
|
||||||
<div style={{ height: 'calc(50vh - 100px)' }}>
|
<div style={{ height: 'calc(50vh - 100px)' }}>
|
||||||
<MultiLineIFE
|
<Editor
|
||||||
autoFocus={true}
|
autoFocus={true}
|
||||||
language="json"
|
language="json"
|
||||||
value={variables}
|
value={variables}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { FC, Fragment } from 'react';
|
import { FC, Fragment } from 'react';
|
||||||
import { MultiLineIFE } from '@firecamp/ui-kit';
|
import { Editor } from '@firecamp/ui-kit';
|
||||||
import { EConverterLang } from '../types';
|
import { EConverterLang } from '../types';
|
||||||
|
|
||||||
import { ITabFns } from '../../types/tab';
|
import { ITabFns } from '../../types/tab';
|
||||||
@@ -42,7 +42,7 @@ const Body: FC<IBody> = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<MultiLineIFE
|
<Editor
|
||||||
autoFocus={true}
|
autoFocus={true}
|
||||||
language={mode}
|
language={mode}
|
||||||
value={body}
|
value={body}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { FC, Fragment } from 'react';
|
import { FC, Fragment } from 'react';
|
||||||
import { MultiLineIFE } from '@firecamp/ui-kit';
|
import { Editor } from '@firecamp/ui-kit';
|
||||||
import { EConverterLang } from '../types';
|
import { EConverterLang } from '../types';
|
||||||
|
|
||||||
import { ITargetState } from './Target';
|
import { ITargetState } from './Target';
|
||||||
@@ -29,7 +29,7 @@ const Body: FC<IBody> = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<MultiLineIFE
|
<Editor
|
||||||
language={mode}
|
language={mode}
|
||||||
value={body}
|
value={body}
|
||||||
disabled={true}
|
disabled={true}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import { FC, Fragment } from 'react';
|
import { FC, Fragment } from 'react';
|
||||||
import { MultiLineIFE } from '@firecamp/ui-kit';
|
import { Editor } from '@firecamp/ui-kit';
|
||||||
|
|
||||||
import { ITabFns } from '../../types/tab';
|
import { ITabFns } from '../../types/tab';
|
||||||
import { ISourceState } from './Source';
|
import { ISourceState } from './Source';
|
||||||
@@ -12,7 +12,7 @@ const Body: FC<IBody> = ({
|
|||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<MultiLineIFE
|
<Editor
|
||||||
autoFocus={true}
|
autoFocus={true}
|
||||||
language={'markdown'}
|
language={'markdown'}
|
||||||
value={body}
|
value={body}
|
||||||
|
|||||||
@@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
import { FC, Fragment } from 'react';
|
import { FC, Fragment } from 'react';
|
||||||
|
|
||||||
import { MultiLineIFE } from '@firecamp/ui-kit';
|
import { Editor } from '@firecamp/ui-kit';
|
||||||
import { ITabFns } from '../../types/tab';
|
import { ITabFns } from '../../types/tab';
|
||||||
|
|
||||||
const Body: FC<IBody> = ({ body = {}, tabFns = {} }) => {
|
const Body: FC<IBody> = ({ body = {}, tabFns = {} }) => {
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<MultiLineIFE
|
<Editor
|
||||||
language={'html'}
|
language={'html'}
|
||||||
value={body}
|
value={body}
|
||||||
disabled={true}
|
disabled={true}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import shallow from 'zustand/shallow';
|
import shallow from 'zustand/shallow';
|
||||||
import { MultiLineIFE } from '@firecamp/ui-kit';
|
import { Editor } from '@firecamp/ui-kit';
|
||||||
// import equal from 'deep-equal';
|
// import equal from 'deep-equal';
|
||||||
|
|
||||||
import { useGraphQLStore } from '../../../../../store';
|
import { useGraphQLStore } from '../../../../../store';
|
||||||
@@ -14,7 +14,7 @@ const Variables = () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MultiLineIFE
|
<Editor
|
||||||
language={`json`}
|
language={`json`}
|
||||||
value={playground?.request?.meta?.variables || `{ }`}
|
value={playground?.request?.meta?.variables || `{ }`}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useState, useRef, useEffect } from 'react';
|
import { useState, useRef, useEffect } from 'react';
|
||||||
import { print } from 'graphql/language/printer';
|
import { print } from 'graphql/language/printer';
|
||||||
import { Container, Column, MultiLineIFE } from '@firecamp/ui-kit';
|
import { Container, Column, Editor } from '@firecamp/ui-kit';
|
||||||
|
|
||||||
import getQueryFacts, {
|
import getQueryFacts, {
|
||||||
getCurrentOperation,
|
getCurrentOperation,
|
||||||
@@ -112,7 +112,7 @@ const QueryEditorMonaco = ({ isQueryDirty, toggleQueryDirty }) => {
|
|||||||
<Column flex={1} height="100%" overflow="auto">
|
<Column flex={1} height="100%" overflow="auto">
|
||||||
<Container className="with-divider">
|
<Container className="with-divider">
|
||||||
<Container.Body>
|
<Container.Body>
|
||||||
<MultiLineIFE
|
<Editor
|
||||||
value={editorValue || ''}
|
value={editorValue || ''}
|
||||||
language="graphqlDev"
|
language="graphqlDev"
|
||||||
// formatOnPaste={true}
|
// formatOnPaste={true}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import shallow from 'zustand/shallow';
|
|||||||
import {
|
import {
|
||||||
SecondaryTab,
|
SecondaryTab,
|
||||||
Container,
|
Container,
|
||||||
MultiLineIFE,
|
Editor,
|
||||||
StatusBar,
|
StatusBar,
|
||||||
} from '@firecamp/ui-kit';
|
} from '@firecamp/ui-kit';
|
||||||
import { useGraphQLStore } from '../../../../../store';
|
import { useGraphQLStore } from '../../../../../store';
|
||||||
@@ -124,7 +124,7 @@ const BodyTab = () => {
|
|||||||
let cursorStart = 1;
|
let cursorStart = 1;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MultiLineIFE
|
<Editor
|
||||||
language={tab}
|
language={tab}
|
||||||
value={data}
|
value={data}
|
||||||
onLoad={(editor) => {
|
onLoad={(editor) => {
|
||||||
@@ -147,7 +147,7 @@ const BodyTab = () => {
|
|||||||
* Allow to show HTML response without checking data HTML valid or not
|
* Allow to show HTML response without checking data HTML valid or not
|
||||||
*/
|
*/
|
||||||
return (
|
return (
|
||||||
<MultiLineIFE
|
<Editor
|
||||||
disabled={true}
|
disabled={true}
|
||||||
language={tab}
|
language={tab}
|
||||||
value={data}
|
value={data}
|
||||||
@@ -175,7 +175,7 @@ const BodyTab = () => {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return (
|
return (
|
||||||
<MultiLineIFE
|
<Editor
|
||||||
disabled={true}
|
disabled={true}
|
||||||
language={tab}
|
language={tab}
|
||||||
value={data}
|
value={data}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { MultiLineIFE } from '@firecamp/ui-kit';
|
import { Editor } from '@firecamp/ui-kit';
|
||||||
import shallow from 'zustand/shallow';
|
import shallow from 'zustand/shallow';
|
||||||
|
|
||||||
import { useGraphQLStore } from '../../../../../store';
|
import { useGraphQLStore } from '../../../../../store';
|
||||||
@@ -12,7 +12,7 @@ const TimelineTab = () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MultiLineIFE
|
<Editor
|
||||||
disabled={true}
|
disabled={true}
|
||||||
value={response?.timeline || ``}
|
value={response?.timeline || ``}
|
||||||
language="text"
|
language="text"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useEffect, useState, useMemo } from 'react';
|
import { useEffect, useState, useMemo } from 'react';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
import { MultiLineIFE, Container, Tabs, Modal } from '@firecamp/ui-kit';
|
import { Editor, Container, Tabs, Modal } from '@firecamp/ui-kit';
|
||||||
import shallow from 'zustand/shallow';
|
import shallow from 'zustand/shallow';
|
||||||
|
|
||||||
import codeSnippet, {
|
import codeSnippet, {
|
||||||
@@ -160,7 +160,7 @@ const CodeSnippets = ({ tabId = '', getPlatformEnvironments }) => {
|
|||||||
''
|
''
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<MultiLineIFE
|
<Editor
|
||||||
value={snippetCode || ''}
|
value={snippetCode || ''}
|
||||||
language={
|
language={
|
||||||
activeClientTargetMap[activeTarget] || 'typescript'
|
activeClientTargetMap[activeTarget] || 'typescript'
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { isRestBodyEmpty } from '../../../services/rest-service';
|
|||||||
import {
|
import {
|
||||||
Container,
|
Container,
|
||||||
Dropdown,
|
Dropdown,
|
||||||
MultiLineIFE,
|
Editor,
|
||||||
PrimaryIFT,
|
PrimaryIFT,
|
||||||
MultipartIFT,
|
MultipartIFT,
|
||||||
Button,
|
Button,
|
||||||
@@ -182,7 +182,7 @@ const BodyTab: FC<any> = () => {
|
|||||||
case 'application/text':
|
case 'application/text':
|
||||||
case ERestBodyTypes.Text:
|
case ERestBodyTypes.Text:
|
||||||
return (
|
return (
|
||||||
<MultiLineIFE
|
<Editor
|
||||||
autoFocus={false} //todo: previously autoFocus={!propReq.raw_url}
|
autoFocus={false} //todo: previously autoFocus={!propReq.raw_url}
|
||||||
value={body?.[active_body_type]?.value}
|
value={body?.[active_body_type]?.value}
|
||||||
language={
|
language={
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { ERestBodyTypes } from '@firecamp/types';
|
|||||||
import {
|
import {
|
||||||
Container,
|
Container,
|
||||||
Column,
|
Column,
|
||||||
MultiLineIFE,
|
Editor,
|
||||||
CMGQueryEditor,
|
CMGQueryEditor,
|
||||||
} from '@firecamp/ui-kit';
|
} from '@firecamp/ui-kit';
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ const GraphQLBody = ({ body, onChange }) => {
|
|||||||
</Column>
|
</Column>
|
||||||
<Column flex={1}>
|
<Column flex={1}>
|
||||||
<div className="text-base px-1 py-2 bg-focus1">Query variables</div>
|
<div className="text-base px-1 py-2 bg-focus1">Query variables</div>
|
||||||
<MultiLineIFE
|
<Editor
|
||||||
value={variables}
|
value={variables}
|
||||||
language={'json'}
|
language={'json'}
|
||||||
monacoOptions={{
|
monacoOptions={{
|
||||||
|
|||||||
@@ -0,0 +1,69 @@
|
|||||||
|
export interface IEditor {
|
||||||
|
id?: string | number;
|
||||||
|
|
||||||
|
/** editor value string */
|
||||||
|
value: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* boolean value whether editor is readOnly or not
|
||||||
|
* similar to field readOnly
|
||||||
|
*/
|
||||||
|
disabled?: boolean;
|
||||||
|
|
||||||
|
/** similar to field disabled*/
|
||||||
|
readOnly?: boolean;
|
||||||
|
|
||||||
|
/** set auto focus to editor */
|
||||||
|
autoFocus?: boolean;
|
||||||
|
|
||||||
|
/** editor language */
|
||||||
|
language?: string;
|
||||||
|
|
||||||
|
/** monaco editor options */
|
||||||
|
monacoOptions?: any;
|
||||||
|
|
||||||
|
/** editor placeholder */
|
||||||
|
placeholder?: string;
|
||||||
|
|
||||||
|
/** apply class to editor's container */
|
||||||
|
className?: string;
|
||||||
|
|
||||||
|
/** on load editor */
|
||||||
|
editorDidMount?: (edt: any, monaco: any) => {};
|
||||||
|
|
||||||
|
/** on change editor string*/
|
||||||
|
onChange?: (event: any) => any;
|
||||||
|
|
||||||
|
/** on blur editor*/
|
||||||
|
onBlur?: (event: any) => any;
|
||||||
|
|
||||||
|
/** on focus editor */
|
||||||
|
onFocus?: (event: any) => any;
|
||||||
|
|
||||||
|
/** on load editor */
|
||||||
|
onLoad?: (event: any) => any;
|
||||||
|
|
||||||
|
/** on paste text */
|
||||||
|
onPaste?: (event: any) => any;
|
||||||
|
|
||||||
|
/** on press enter */
|
||||||
|
onEnter?: (event: any) => any;
|
||||||
|
|
||||||
|
/** on press s */
|
||||||
|
onCtrlS?: (event: any) => any;
|
||||||
|
|
||||||
|
/** on press shift + s */
|
||||||
|
onCtrlShiftS?: (event: any) => any;
|
||||||
|
|
||||||
|
/** on press ctrl + 0 */
|
||||||
|
onCtrlO?: (event: any) => any;
|
||||||
|
|
||||||
|
/** on press k */
|
||||||
|
onCtrlK?: (event: any) => any;
|
||||||
|
|
||||||
|
/** on press ctrl + enter */
|
||||||
|
onCtrlEnter?: (event: any) => any;
|
||||||
|
|
||||||
|
/** on press shift + enter */
|
||||||
|
onCtrlShiftEnter?: (event: any) => any;
|
||||||
|
}
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
import { FC, useEffect } from 'react';
|
import { FC, useEffect } from 'react';
|
||||||
import MonacoEditor, { OnMount, EditorProps } from '@monaco-editor/react';
|
import MonacoEditor, { OnMount, EditorProps } from '@monaco-editor/react';
|
||||||
import cx from 'classnames';
|
import cx from 'classnames';
|
||||||
import { IMultiLineIFE } from '../monaco/components/MultiLineIFE.interfaces';
|
import { IEditor } from './Editor.interface';
|
||||||
import MonacoFirecampLangInit, {
|
import MonacoFirecampLangInit, {
|
||||||
SetCompletionProvider,
|
SetCompletionProvider,
|
||||||
} from '../monaco/lang/init';
|
} from '../monaco/lang/init';
|
||||||
|
|
||||||
const Editor: FC<IMultiLineIFE> = ({
|
const Editor: FC<IEditor> = ({
|
||||||
value,
|
value,
|
||||||
onChange = () => {}, // similar DOM event, e = { preventDefault, target }
|
onChange = () => {}, // similar DOM event, e = { preventDefault, target }
|
||||||
onBlur,
|
onBlur,
|
||||||
@@ -137,10 +137,6 @@ const Editor: FC<IMultiLineIFE> = ({
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
window.ife.set(edt._id, edt);
|
|
||||||
onLoad(edt);
|
|
||||||
|
|
||||||
// set focus to Editor if autoFocus is given true to Input
|
// set focus to Editor if autoFocus is given true to Input
|
||||||
if (autoFocus === true) {
|
if (autoFocus === true) {
|
||||||
try {
|
try {
|
||||||
@@ -154,6 +150,7 @@ const Editor: FC<IMultiLineIFE> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const options: EditorProps['options'] = {
|
const options: EditorProps['options'] = {
|
||||||
|
readOnly: false,
|
||||||
fontFamily: "'Open Sans', sans-serif",
|
fontFamily: "'Open Sans', sans-serif",
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
links: false,
|
links: false,
|
||||||
@@ -170,14 +167,15 @@ const Editor: FC<IMultiLineIFE> = ({
|
|||||||
// vertical: "hidden",
|
// vertical: "hidden",
|
||||||
// horizontal: "hidden",
|
// horizontal: "hidden",
|
||||||
handleMouseWheel: true,
|
handleMouseWheel: true,
|
||||||
useShadows: false,
|
useShadows: true,
|
||||||
|
|
||||||
verticalScrollbarSize: 5,
|
verticalScrollbarSize: 10,
|
||||||
horizontalScrollbarSize: 5,
|
horizontalScrollbarSize: 5,
|
||||||
},
|
},
|
||||||
...monacoOptions,
|
// ...monacoOptions,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** if 'readOnly' is not provided then consider 'disabled' */
|
||||||
if (!monacoOptions?.hasOwnProperty('readOnly')) {
|
if (!monacoOptions?.hasOwnProperty('readOnly')) {
|
||||||
options.readOnly = disabled;
|
options.readOnly = disabled;
|
||||||
}
|
}
|
||||||
@@ -200,8 +198,7 @@ const Editor: FC<IMultiLineIFE> = ({
|
|||||||
}
|
}
|
||||||
options={options}
|
options={options}
|
||||||
// height="90vh"
|
// height="90vh"
|
||||||
onMount={(edt,monaco) => {
|
onMount={(edt, monaco) => {
|
||||||
onMount(edt, monaco);
|
|
||||||
/**
|
/**
|
||||||
* Allow comments for JSON language
|
* Allow comments for JSON language
|
||||||
* Reference: https://github.com/microsoft/monaco-editor/issues/2426
|
* Reference: https://github.com/microsoft/monaco-editor/issues/2426
|
||||||
@@ -216,6 +213,7 @@ const Editor: FC<IMultiLineIFE> = ({
|
|||||||
onFocus && edt.onDidFocusEditorText(() => onFocus(edt));
|
onFocus && edt.onDidFocusEditorText(() => onFocus(edt));
|
||||||
onPaste && edt.onDidPaste(() => onPaste(edt));
|
onPaste && edt.onDidPaste(() => onPaste(edt));
|
||||||
|
|
||||||
|
// https://www.anycodings.com/1questions/1773746/how-do-i-insert-text-into-a-monaco-editor
|
||||||
// edt.insertTextAtCurrentCursor = (text: any) => {
|
// edt.insertTextAtCurrentCursor = (text: any) => {
|
||||||
// let p = edt.getPosition();
|
// let p = edt.getPosition();
|
||||||
// edt.executeEdits('', [
|
// edt.executeEdits('', [
|
||||||
@@ -230,10 +228,12 @@ const Editor: FC<IMultiLineIFE> = ({
|
|||||||
// },
|
// },
|
||||||
// ]);
|
// ]);
|
||||||
// };
|
// };
|
||||||
|
onMount(edt, monaco);
|
||||||
|
onLoad(edt);
|
||||||
editorDidMount && editorDidMount(edt, monaco);
|
editorDidMount && editorDidMount(edt, monaco);
|
||||||
|
// @ts-ignore
|
||||||
|
window.ife.set(edt._id, edt);
|
||||||
}}
|
}}
|
||||||
// onBlur={onBlur}
|
|
||||||
// onFocus={(e) => onFocus(e)}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { FC } from "react";
|
import { FC } from "react";
|
||||||
import { MultiLineIFE } from '@firecamp/ui-kit';
|
import { Editor } from '@firecamp/ui-kit';
|
||||||
|
|
||||||
const TimelineTab: FC<{timeline: string}> = ({
|
const TimelineTab: FC<{timeline: string}> = ({
|
||||||
timeline
|
timeline
|
||||||
}) => {
|
}) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MultiLineIFE
|
<Editor
|
||||||
disabled={true}
|
disabled={true}
|
||||||
value={timeline || ``}
|
value={timeline || ``}
|
||||||
language="text"
|
language="text"
|
||||||
|
|||||||
@@ -2,10 +2,8 @@ import { FC, useState, useEffect } from 'react';
|
|||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
import { VscInfo } from '@react-icons/all-files/vsc/VscInfo';
|
import { VscInfo } from '@react-icons/all-files/vsc/VscInfo';
|
||||||
import {
|
import {
|
||||||
MultiLineIFE,
|
Editor,
|
||||||
Button,
|
Button,
|
||||||
|
|
||||||
|
|
||||||
Popover,
|
Popover,
|
||||||
EPopoverPosition,
|
EPopoverPosition,
|
||||||
} from '@firecamp/ui-kit';
|
} from '@firecamp/ui-kit';
|
||||||
@@ -219,7 +217,7 @@ const HelpPopUp: FC<IHelpPopup> = ({
|
|||||||
height: '50px',
|
height: '50px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<MultiLineIFE
|
<Editor
|
||||||
value={
|
value={
|
||||||
help.snippet
|
help.snippet
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {
|
|||||||
Container,
|
Container,
|
||||||
SecondaryTab,
|
SecondaryTab,
|
||||||
Checkbox,
|
Checkbox,
|
||||||
MultiLineIFE,
|
Editor,
|
||||||
} from '@firecamp/ui-kit';
|
} from '@firecamp/ui-kit';
|
||||||
import {
|
import {
|
||||||
preScriptSnippets,
|
preScriptSnippets,
|
||||||
@@ -205,7 +205,7 @@ const ScriptsTabs: FC<IScriptsTab> = ({
|
|||||||
{
|
{
|
||||||
// TODO: remove above parent div and height
|
// TODO: remove above parent div and height
|
||||||
}
|
}
|
||||||
<MultiLineIFE
|
<Editor
|
||||||
autoFocus={true}
|
autoFocus={true}
|
||||||
id={`scripts-tab-${activeTab}-${id}`}
|
id={`scripts-tab-${activeTab}-${id}`}
|
||||||
value={scripts[activeTab] || ''}
|
value={scripts[activeTab] || ''}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useState, useEffect, Fragment } from 'react';
|
import { useState, useEffect, Fragment } from 'react';
|
||||||
import equal from 'deep-equal';
|
import equal from 'deep-equal';
|
||||||
import { MultiLineIFE } from '@firecamp/ui-kit';
|
import { Editor } from '@firecamp/ui-kit';
|
||||||
import { _table } from '@firecamp/utils'
|
import { _table } from '@firecamp/utils'
|
||||||
|
|
||||||
const SmartJSONEditor = ({ JSONState, detach = false, onChange }) => {
|
const SmartJSONEditor = ({ JSONState, detach = false, onChange }) => {
|
||||||
@@ -72,7 +72,7 @@ const SmartJSONEditor = ({ JSONState, detach = false, onChange }) => {
|
|||||||
// console.log(`detach`, detach)
|
// console.log(`detach`, detach)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MultiLineIFE
|
<Editor
|
||||||
value={JSONEditorString}
|
value={JSONEditorString}
|
||||||
language="json"
|
language="json"
|
||||||
options={{
|
options={{
|
||||||
|
|||||||
@@ -3,10 +3,8 @@ import {
|
|||||||
Container,
|
Container,
|
||||||
TabHeader,
|
TabHeader,
|
||||||
Button,
|
Button,
|
||||||
|
|
||||||
|
|
||||||
PrimaryIFT,
|
PrimaryIFT,
|
||||||
MultiLineIFE,
|
Editor,
|
||||||
} from '@firecamp/ui-kit';
|
} from '@firecamp/ui-kit';
|
||||||
import equal from 'deep-equal';
|
import equal from 'deep-equal';
|
||||||
|
|
||||||
@@ -103,10 +101,10 @@ const BulkEditIFT: FC<IBulkEditIFT> = ({
|
|||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<div className="h-28">
|
<div className="h-28">
|
||||||
<MultiLineIFE
|
<Editor
|
||||||
value={raw}
|
value={raw}
|
||||||
language="text"
|
language="text"
|
||||||
options={{
|
monacoOptions={{
|
||||||
style: { display: 'table-caption' },
|
style: { display: 'table-caption' },
|
||||||
height: '100px',
|
height: '100px',
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -109,16 +109,16 @@ exports.plugins = [
|
|||||||
console.log(`${(percentage * 100).toFixed()}%`, message, ...args);
|
console.log(`${(percentage * 100).toFixed()}%`, message, ...args);
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
new MonacoWebpackPlugin({
|
// new MonacoWebpackPlugin({
|
||||||
/**
|
// /**
|
||||||
* available options are documented at
|
// * available options are documented at
|
||||||
* https://github.com/microsoft/monaco-editor/tree/main/webpack-plugin#options
|
// * https://github.com/microsoft/monaco-editor/tree/main/webpack-plugin#options
|
||||||
**/
|
// **/
|
||||||
globalAPI: true,
|
// globalAPI: true,
|
||||||
publicPath: '/js',
|
// publicPath: '/js',
|
||||||
filename: '[name].worker.bundle.js',
|
// filename: '[name].worker.bundle.js',
|
||||||
languages: ['javascript', 'html', 'typescript', 'json'],
|
// languages: ['javascript', 'html', 'typescript', 'json'],
|
||||||
}),
|
// }),
|
||||||
];
|
];
|
||||||
|
|
||||||
exports.rules = [
|
exports.rules = [
|
||||||
|
|||||||
Reference in New Issue
Block a user