Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Commit

Permalink
Move TraceAction to lib types
Browse files Browse the repository at this point in the history
  • Loading branch information
langleyd committed Jul 15, 2024
1 parent d83c964 commit 66d6640
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
7 changes: 7 additions & 0 deletions platforms/web/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import { ComposerUpdate } from '../generated/wysiwyg';
import { ACTION_TYPES, SUGGESTIONS } from './constants';
import { AllowedMentionAttributes, LinkEvent } from './useListeners/types';

Expand Down Expand Up @@ -71,3 +72,9 @@ export type MappedSuggestion = {
text: string;
type: SuggestionType;
};
export type TraceAction = (
update: ComposerUpdate | null,
name: string,
value1?: string | number,
value2?: string | number,
) => ComposerUpdate | null;
8 changes: 0 additions & 8 deletions platforms/web/lib/useTestCases/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,9 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import { ComposerUpdate } from '../../generated/wysiwyg';
import { useTestCases } from './useTestCases';

export type TestUtilities = ReturnType<typeof useTestCases>['utilities'];
export type TraceAction = (
update: ComposerUpdate | null,
name: string,
value1?: string | number,
value2?: string | number,
) => ComposerUpdate | null;

export type SelectTuple = ['select', number, number];
export type Tuple =
| SelectTuple
Expand Down
4 changes: 2 additions & 2 deletions platforms/web/lib/useTestCases/useTestCases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ limitations under the License.
import { RefObject, useCallback, useMemo, useRef, useState } from 'react';

import { ComposerModel } from '../../generated/wysiwyg';
import { Actions, TraceAction } from './types';
import { Actions } from './types';
import {
getSelectionAccordingToActions,
resetTestCase,
traceAction,
} from './utils';
import { TraceAction } from '../types';

export type UseTestCases = {
testRef: RefObject<HTMLDivElement>;
Expand Down Expand Up @@ -98,4 +99,3 @@ export function useTestCases(
utilities,
};
}
export type { TraceAction };
2 changes: 1 addition & 1 deletion platforms/web/lib/useTestCases/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import {
new_composer_model_from_html,
} from '../../generated/wysiwyg';
import { getCurrentSelection } from '../dom';
import { TraceAction } from '../types';
import { isSelectTuple } from './assert';
import { Actions } from './types';
import { TraceAction } from './useTestCases';

export function traceAction(
testNode: HTMLElement | null,
Expand Down
2 changes: 1 addition & 1 deletion platforms/web/lib/useWysiwyg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ import {
FormattingFunctions,
InputEventProcessor,
MappedSuggestion,
TraceAction,
} from './types.js';
import { useFormattingFunctions } from './useFormattingFunctions';
import { useComposerModel } from './useComposerModel';
import { useListeners } from './useListeners';
import { useTestCases } from './useTestCases';
import { mapSuggestion } from './suggestion.js';
import { TraceAction } from './useTestCases/types.js';

export { richToPlain, plainToRich } from './conversion';

Expand Down

0 comments on commit 66d6640

Please sign in to comment.