Skip to content

Commit

Permalink
Update packages/ui/src/components/SourceCode/SourceCode.tsx
Browse files Browse the repository at this point in the history
Co-authored-by: Ricardo M. <lordrip@gmail.com>
  • Loading branch information
lhein and lordrip committed Nov 23, 2023
1 parent dfd29a7 commit b3588aa
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 48 deletions.
2 changes: 1 addition & 1 deletion packages/ui/src/components/SourceCode/RedoButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const RedoButton: FunctionComponent<IRedoIcon> = (props) => {
aria-label="Redo change"
data-testid="sourceCode--redoButton"
onClick={props.onClick}
tooltipProps={{content: 'Redo change', position: 'top'}}
tooltipProps={{ content: 'Redo change', position: 'top' }}
isVisible={true}
/>
);
Expand Down
12 changes: 6 additions & 6 deletions packages/ui/src/components/SourceCode/SourceCode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { setDiagnosticsOptions } from 'monaco-yaml';
import { FunctionComponent, Ref, useCallback, useContext, useEffect, useMemo, useRef } from 'react';
import { EditorDidMount } from 'react-monaco-editor';
import './SourceCode.scss';
import { SyncButton } from './SyncButton';
import './workers/enable-workers';
import { sourceSchemaConfig, SourceSchemaType } from '../../models/camel';
import { EntitiesContext } from '../../providers/entities.provider';
Expand Down Expand Up @@ -59,18 +58,19 @@ export const SourceCode: FunctionComponent<SourceCodeProps> = (props) => {
});

const undoAction = () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(editorRef.current?.getModel() as any)?.undo();
}
};

const redoAction = () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(editorRef.current?.getModel() as any)?.redo();
}
};

const customControls = useMemo(() => {
return [
<UndoButton key="undo-button" isVisible onClick={() => undoAction} />,
<RedoButton key="redo-button" isVisible onClick={() => redoAction} />,
<SyncButton key="sync-button" isDirty={false} isVisible onClick={() => undefined} />,
<UndoButton key="undo-button" isVisible onClick={undoAction} />,
<RedoButton key="redo-button" isVisible onClick={redoAction} />,
];
}, []);

Expand Down
7 changes: 0 additions & 7 deletions packages/ui/src/components/SourceCode/SyncButton.scss

This file was deleted.

33 changes: 0 additions & 33 deletions packages/ui/src/components/SourceCode/SyncButton.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion packages/ui/src/components/SourceCode/UndoButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const UndoButton: FunctionComponent<IUndoIcon> = (props) => {
aria-label="Undo change"
data-testid="sourceCode--undoButton"
onClick={props.onClick}
tooltipProps={{content: 'Undo change', position: 'top'}}
tooltipProps={{ content: 'Undo change', position: 'top' }}
isVisible={true}
/>
);
Expand Down

0 comments on commit b3588aa

Please sign in to comment.