diff --git a/platforms/web/.eslintignore b/platforms/web/.eslintignore index c1997a6cf..e49372cd4 100644 --- a/platforms/web/.eslintignore +++ b/platforms/web/.eslintignore @@ -9,3 +9,4 @@ vite.demo.config.ts scripts cypress example-wysiwyg +coverage \ No newline at end of file diff --git a/platforms/web/lib/types.ts b/platforms/web/lib/types.ts index 9fa062567..982b0f200 100644 --- a/platforms/web/lib/types.ts +++ b/platforms/web/lib/types.ts @@ -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'; @@ -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; diff --git a/platforms/web/lib/useTestCases/types.ts b/platforms/web/lib/useTestCases/types.ts index 4a2068a9c..0739f8f0d 100644 --- a/platforms/web/lib/useTestCases/types.ts +++ b/platforms/web/lib/useTestCases/types.ts @@ -17,7 +17,6 @@ limitations under the License. import { useTestCases } from './useTestCases'; export type TestUtilities = ReturnType['utilities']; - export type SelectTuple = ['select', number, number]; export type Tuple = | SelectTuple diff --git a/platforms/web/lib/useTestCases/useTestCases.ts b/platforms/web/lib/useTestCases/useTestCases.ts index f967a43e2..94d3b5596 100644 --- a/platforms/web/lib/useTestCases/useTestCases.ts +++ b/platforms/web/lib/useTestCases/useTestCases.ts @@ -16,20 +16,14 @@ limitations under the License. import { RefObject, useCallback, useMemo, useRef, useState } from 'react'; -import { ComposerModel, ComposerUpdate } from '../../generated/wysiwyg'; +import { ComposerModel } from '../../generated/wysiwyg'; import { Actions } from './types'; import { getSelectionAccordingToActions, resetTestCase, traceAction, } from './utils'; - -export type TraceAction = ( - update: ComposerUpdate | null, - name: string, - value1?: string | number, - value2?: string | number, -) => ComposerUpdate | null; +import { TraceAction } from '../types'; export type UseTestCases = { testRef: RefObject; diff --git a/platforms/web/lib/useTestCases/utils.ts b/platforms/web/lib/useTestCases/utils.ts index 3a497895d..b25493730 100644 --- a/platforms/web/lib/useTestCases/utils.ts +++ b/platforms/web/lib/useTestCases/utils.ts @@ -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, diff --git a/platforms/web/lib/useWysiwyg.ts b/platforms/web/lib/useWysiwyg.ts index f24cb03d4..be22fa336 100644 --- a/platforms/web/lib/useWysiwyg.ts +++ b/platforms/web/lib/useWysiwyg.ts @@ -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/useTestCases.js'; export { richToPlain, plainToRich } from './conversion'; diff --git a/platforms/web/vite.config.ts b/platforms/web/vite.config.ts index d4dc0e330..7e67dc266 100644 --- a/platforms/web/vite.config.ts +++ b/platforms/web/vite.config.ts @@ -34,6 +34,7 @@ export default defineConfig({ 'lib/types.ts', 'lib/constants.ts', 'lib/useListeners/types.ts', + 'lib/useTestCases/types.ts', ], rollupTypes: true, }),