-
{
- this.ref = ref;
- }}
- tabIndex="-1"
- >
-
- {t('TF_CODE_ESCAPE', {
- defaultValue: 'To focus out of the editor, press ESC key twice.',
- })}
-
-
+
+ {t('TF_CODE_ESCAPE', {
+ defaultValue: 'To focus out of the editor, press ESC key twice.',
+ })}
-
- );
- }
+
}
+ name="react-ace"
+ version="6.2.0"
+ varName="ReactAce"
+ path="/dist/react-ace.min.js"
+ >
+ {AceEditor => (
+
+ )}
+
+
+
+ );
}
+
if (process.env.NODE_ENV !== 'production') {
- WrappedTextArea.propTypes = TextArea.propTypes;
Code.propTypes = {
id: PropTypes.string,
isValid: PropTypes.bool,
@@ -185,14 +167,4 @@ Code.defaultProps = {
t: getDefaultT(),
};
-try {
- /* eslint-disable global-require, import/no-extraneous-dependencies */
- AceEditor = require('react-ace').default;
- require('brace/ext/language_tools'); // https://github.com/securingsincity/react-ace/issues/95
- /* eslint-enable global-require, import/no-extraneous-dependencies */
- CodeWidget = Code;
-} catch (error) {
- CodeWidget = WrappedTextArea;
-}
-
-export default withTranslation(I18N_DOMAIN_FORMS)(CodeWidget);
+export default withTranslation(I18N_DOMAIN_FORMS)(Code);
diff --git a/packages/forms/src/UIForm/fields/Code/__snapshots__/Code.component.test.js.snap b/packages/forms/src/UIForm/fields/Code/__snapshots__/Code.component.test.js.snap
index ea71fb4847..21ccc91a82 100644
--- a/packages/forms/src/UIForm/fields/Code/__snapshots__/Code.component.test.js.snap
+++ b/packages/forms/src/UIForm/fields/Code/__snapshots__/Code.component.test.js.snap
@@ -21,54 +21,39 @@ exports[`Code field should render ace-editor in FieldTemplate 1`] = `
>
To focus out of the editor, press ESC key twice.
-