* working editor wrapper * updated other property controls * fix tablefilter_spec unit test * autofocus on editor * update font styles * show lint errors * add syntax highlighting * fix import issue * fix input height * use lazy and suspense * wip * update code clean up * update input style * fix select widget issue * fix build issue * fix import issue and linting css * update lint error method * add polyfill for idle callback * fix undo aggregate helper changes * rename CodeEditor component * fix tests add delay before code mirror * undo name change * rename lazy editor * add comments and update aggregate helper * fix cypress helper * fix testJsonText command * update aggregate helper * add wait to allow time to load * fix filepicker issue * fix currency input test * fix unit tests * update aggregate helper * fix table property tests * fix test * fix command * update json text command * updated command ii * update iii * update iv * add force click * check for wrapper * fix for objects * fix test iv * fix test v * fix tests vi * fix tests vi * fix variable naming issue * fix tests vii * remove wait from wrapper click * fix tests viii * fix recheck wrapper availability * fix updateCodeInput command * fix undo while loop * fix ix * fix each loop * removed EnableAllCodeEditors * updated tests * Upated wait * updated some more tests * updated wait time * updated common method * updated all related common methods * update state name and add callback timeout * updated test * updated the test * fix use while loop and update count * update click func * fix use get instead of find * fix on click action command * remove comments * fix: update import statements * add force click to widget command * update wrapper ui * fix auto load code editor * update editor wrapper ui * fix lineheight adjustment * refactor editor wrapper * update style import * fix ascetic style import * fix font style * fix wrapper height * update color for code block * fix min height of content wrapper * remove error linting and editor wrapper * remove unused variable * remove unused imports * fix font color for objects * update styles for placeholders * remove console log * remove react syntax highlighter * cancel idlecallback on unmount * Delay input foucs Co-authored-by: Aishwarya UR <aishwarya@appsmith.com> Co-authored-by: apple <nandan@thinkify.io> Co-authored-by: Satish Gandham <satish@appsmith.com>
53 lines
1.4 KiB
TypeScript
53 lines
1.4 KiB
TypeScript
import React, { ChangeEvent } from "react";
|
|
import BaseControl, { ControlProps } from "./BaseControl";
|
|
import { EventOrValueHandler } from "redux-form";
|
|
import {
|
|
EditorModes,
|
|
EditorSize,
|
|
TabBehaviour,
|
|
} from "components/editorComponents/CodeEditor/EditorConfig";
|
|
import CodeEditor from "components/editorComponents/LazyCodeEditorWrapper";
|
|
|
|
class CodeEditorControl extends BaseControl<ControlProps> {
|
|
render() {
|
|
const {
|
|
dataTreePath,
|
|
evaluatedValue,
|
|
expected,
|
|
propertyValue,
|
|
useValidationMessage,
|
|
} = this.props;
|
|
|
|
const props: Partial<ControlProps> = {};
|
|
|
|
if (dataTreePath) props.dataTreePath = dataTreePath;
|
|
if (evaluatedValue) props.evaluatedValue = evaluatedValue;
|
|
if (expected) props.expected = expected;
|
|
|
|
return (
|
|
<CodeEditor
|
|
additionalDynamicData={this.props.additionalAutoComplete}
|
|
input={{ value: propertyValue, onChange: this.onChange }}
|
|
mode={EditorModes.TEXT_WITH_BINDING}
|
|
size={EditorSize.EXTENDED}
|
|
tabBehaviour={TabBehaviour.INDENT}
|
|
theme={this.props.theme}
|
|
useValidationMessage={useValidationMessage}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
onChange: EventOrValueHandler<ChangeEvent<any>> = (
|
|
value: string | ChangeEvent,
|
|
) => {
|
|
this.updateProperty(this.props.propertyName, value, true);
|
|
};
|
|
|
|
static getControlType() {
|
|
return "CODE_EDITOR";
|
|
}
|
|
}
|
|
|
|
export default CodeEditorControl;
|