Skip to content

Commit 846d308

Browse files
authored
chore(compass-indexes): replace ace editor with codemirror (#4189)
1 parent 66ce122 commit 846d308

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

packages/compass-e2e-tests/helpers/selectors.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -894,10 +894,7 @@ export const indexOptionInput = (
894894
fieldName: string,
895895
type: 'code' | 'text' | 'number' | 'checkbox' = 'text'
896896
) => {
897-
if (type === 'code') {
898-
return `[data-testid="create-index-modal-${fieldName}-code"] .ace_editor`;
899-
}
900-
return `input[data-testid="create-index-modal-${fieldName}-${type}"]`;
897+
return `[data-testid="create-index-modal-${fieldName}-${type}"]`;
901898
};
902899

903900
// Indexes modal

packages/compass-e2e-tests/tests/collection-indexes-tab.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ describe('Collection indexes tab', function () {
147147
);
148148

149149
// set the text in the editor
150-
await browser.setAceValue(
150+
await browser.setCodemirrorEditorValue(
151151
Selectors.indexOptionInput('wildcardProjection', 'code'),
152152
'{ "fieldA": 1, "fieldB.fieldC": 1 }'
153153
);

packages/compass-editor/src/json-editor.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,6 +1264,7 @@ const MultilineEditor = React.forwardRef<EditorRef, MultilineEditorProps>(
12641264
ref={editorRef}
12651265
className={editorClassName}
12661266
language="javascript"
1267+
minLines={10}
12671268
{...props}
12681269
></BaseEditor>
12691270
</div>

packages/compass-indexes/src/components/create-index-form/collapsible-input.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { CollapsibleFieldSet, TextInput } from '@mongodb-js/compass-components';
2-
import { Editor, EditorVariant } from '@mongodb-js/compass-editor';
2+
import { CodemirrorMultilineEditor } from '@mongodb-js/compass-editor';
33
import React from 'react';
44
import { connect } from 'react-redux';
55
import type { RootState } from '../../modules/create-index';
@@ -54,14 +54,13 @@ export const CollapsibleInput: React.FunctionComponent<
5454
disabled={disabled}
5555
>
5656
{type === 'code' ? (
57-
<Editor
58-
text={value}
57+
<CodemirrorMultilineEditor
5958
data-testid={inputId}
60-
variant={EditorVariant.Shell}
59+
text={value}
6160
onChangeText={(newVal) => {
6261
onChange(name, newVal);
6362
}}
64-
name={inputId}
63+
id={inputId}
6564
aria-labelledby={id}
6665
readOnly={disabled}
6766
/>

0 commit comments

Comments
 (0)