Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/web/EnrichedText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ import { buildMentionRulesCSS } from './styleConversion/buildMentionRulesCSS';
import { sanitizeHtml } from './sanitization/htmlSanitizer';
import { prepareHtmlForWeb } from './normalization/prepareHtmlForWeb';
import { INLINE_IMAGE_CSS_VARIABLES } from './styleConversion/inlineImageCSSVariables';
import { useImageErrorFallback } from './useImageErrorFallback';
import { usePressInteractions } from './usePressInteractions';
import { useImageErrorFallback } from './htmlExtensions/useImageErrorFallback';
import { usePressInteractions } from './htmlExtensions/usePressInteractions';
import { useEllipsizeMode } from './ellipsizeMode/useEllipsizeMode';
import { adaptWebToNativeEvent } from './adaptWebToNativeEvent';
import { useStableRef } from './useStableRef';
import { assertBrowserEnvironment } from './assertBrowserEnvironment';
import { useOrderedListMarkerWidth } from './useOrderedListMarkerWidth';
import { adaptWebToNativeEvent } from './nativeMappers/adaptWebToNativeEvent';
import { useStableRef } from './utils/useStableRef';
import { assertBrowserEnvironment } from './utils/assertBrowserEnvironment';
import { useOrderedListMarkerWidth } from './htmlExtensions/useOrderedListMarkerWidth';

export const EnrichedText = memo(
({
Expand Down
22 changes: 11 additions & 11 deletions src/web/EnrichedTextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import type {
EnrichedTextInputInstance,
EnrichedTextInputProps,
} from '../types';
import { adaptWebToNativeEvent } from './adaptWebToNativeEvent';
import { adaptWebToNativeEvent } from './nativeMappers/adaptWebToNativeEvent';
import {
tiptapPosToNativePos,
nativePosToTiptapPos,
nativeLeafText,
} from './positionMapping';
} from './nativeMappers/positionMapping';
import {
useEditor,
EditorContent,
Expand All @@ -29,11 +29,11 @@ import Paragraph from '@tiptap/extension-paragraph';
import Text from '@tiptap/extension-text';
import History from '@tiptap/extension-history';
import { Placeholder } from '@tiptap/extensions/placeholder';
import { useOnChangeHtml } from './useOnChangeHtml';
import { useOnChangeText } from './useOnChangeText';
import { useOnChangeState } from './useOnChangeState';
import { useOnLinkDetected } from './useOnLinkDetected';
import type { LinkEmitterState } from './emitLinkDetected';
import { useOnChangeHtml } from './tiptapWatchers/useOnChangeHtml';
import { useOnChangeText } from './tiptapWatchers/useOnChangeText';
import { useOnChangeState } from './tiptapWatchers/useOnChangeState';
import { useOnLinkDetected } from './tiptapWatchers/useOnLinkDetected';
import type { LinkEmitterState } from './tiptapWatchers/emitLinkDetected';
import {
prepareHtmlForTiptap,
normalizeHtmlFromTiptap,
Expand Down Expand Up @@ -68,7 +68,7 @@ import { StrictMarksPlugin } from './pmPlugins/StrictMarksPlugin';
import { MergeAdjacentSameKindBlocksPlugin } from './pmPlugins/MergeAdjacentSameKindBlocksPlugin';
import { OrderedListMarkerWidthPlugin } from './pmPlugins/OrderedListMarkerWidthPlugin';
import { StripMarksInCodeBlockPlugin } from './pmPlugins/StripMarksInCodeBlockPlugin';
import { handleClipboardPasteImages } from './pasteImages';
import { handleClipboardPasteImages } from './utils/pasteImages';
import {
MentionPlugin,
setMention,
Expand All @@ -78,15 +78,15 @@ import {
import { StripMarksOnImagePlugin } from './pmPlugins/StripMarksOnImagePlugin';
import { ShortcutPlugin } from './pmPlugins/ShortcutPlugin';
import { TextShortcutsPlugin } from './pmPlugins/TextShortcutsPlugin';
import { returnKeyTypeToEnterKeyHint } from './returnKeyTypeToEnterKeyHint';
import { returnKeyTypeToEnterKeyHint } from './nativeMappers/returnKeyTypeToEnterKeyHint';
import { ENRICHED_TEXT_INPUT_CLASSNAME } from './constants/classNames';
import { AutolinkPlugin } from './pmPlugins/AutolinkPlugin';
import { useStableRef } from './useStableRef';
import { useStableRef } from './utils/useStableRef';
import {
checkMentionAttributes,
sanitizeMentionAttributes,
} from './sanitization/htmlSanitizer';
import { assertBrowserEnvironment } from './assertBrowserEnvironment';
import { assertBrowserEnvironment } from './utils/assertBrowserEnvironment';

function runFocused(
editor: Editor,
Expand Down
2 changes: 1 addition & 1 deletion src/web/__tests__/assertBrowserEnvironment.dom.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertBrowserEnvironment } from '../assertBrowserEnvironment';
import { assertBrowserEnvironment } from '../utils/assertBrowserEnvironment';

describe('assertBrowserEnvironment', () => {
// jsdom provides a full DOM, so the browser APIs are present by default.
Expand Down
2 changes: 1 addition & 1 deletion src/web/__tests__/assertBrowserEnvironment.ssr.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @jest-environment node
*/
// Because of the docblock above, jsdom test environment does not exist here
import { assertBrowserEnvironment } from '../assertBrowserEnvironment';
import { assertBrowserEnvironment } from '../utils/assertBrowserEnvironment';

describe('assertBrowserEnvironment', () => {
test('throws when DOM is missing', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/web/__tests__/returnKeyTypeToEnterKeyHint.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { returnKeyTypeToEnterKeyHint } from '../returnKeyTypeToEnterKeyHint';
import { returnKeyTypeToEnterKeyHint } from '../nativeMappers/returnKeyTypeToEnterKeyHint';

describe('returnKeyTypeToEnterKeyHint', () => {
test.each([
Expand Down
2 changes: 1 addition & 1 deletion src/web/formats/EnrichedLink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Link, { type LinkOptions } from '@tiptap/extension-link';
import { mergeAttributes, type CommandProps } from '@tiptap/core';
import type { Editor } from '@tiptap/react';

import { nativePosToTiptapPos } from '../positionMapping';
import { nativePosToTiptapPos } from '../nativeMappers/positionMapping';
import { isLinkBlocked } from './formatRules';
import { findAutolinkRangesInWord } from '../pmPlugins/AutolinkPlugin/autolinkRegex';

Expand Down
5 changes: 4 additions & 1 deletion src/web/formats/applyWrappingListToSelection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import type { Node } from '@tiptap/pm/model';
import { Fragment } from '@tiptap/pm/model';
import { TextSelection } from '@tiptap/pm/state';

import { nativePosToTiptapPos, tiptapPosToNativePos } from '../positionMapping';
import {
nativePosToTiptapPos,
tiptapPosToNativePos,
} from '../nativeMappers/positionMapping';
import { withPreservedAlignment } from './formatRules';

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, type RefObject } from 'react';
import type { OnLinkPressEvent, OnMentionPressEvent } from '../types';
import type { OnLinkPressEvent, OnMentionPressEvent } from '../../types';

type OnLinkPressEventRef = RefObject<
((event: OnLinkPressEvent) => void) | undefined
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/web/pmPlugins/AutolinkPlugin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import type { OnLinkDetected } from '../../../types';
import {
emitLinkDetected,
type LinkEmitterState,
} from '../../emitLinkDetected';
import { tiptapPosToNativePos } from '../../positionMapping';
} from '../../tiptapWatchers/emitLinkDetected';
import { tiptapPosToNativePos } from '../../nativeMappers/positionMapping';
import { findAutolinkRangesInWord } from './autolinkRegex';

interface Run {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { RefObject } from 'react';
import type { OnLinkDetected } from '../types';
import type { OnLinkDetected } from '../../types';

export interface LinkEmitterState {
linkRegex?: RegExp | null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { type Editor } from '@tiptap/react';
import type { OnChangeHtmlEvent, SanitizationConfig } from '../types';
import type { OnChangeHtmlEvent, SanitizationConfig } from '../../types';
import type { NativeSyntheticEvent } from 'react-native';
import { useOnEditorChange } from './useOnEditorChange';
import { normalizeHtmlFromTiptap } from './normalization/tiptapHtmlNormalizer';
import { normalizeHtmlFromTiptap } from '../normalization/tiptapHtmlNormalizer';

export const useOnChangeHtml = (
editor: Editor,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { useEffect, useRef } from 'react';
import { type Editor } from '@tiptap/react';
import type { OnChangeStateEvent } from '../types';
import type { OnChangeStateEvent } from '../../types';
import type { NativeSyntheticEvent } from 'react-native';
import { adaptWebToNativeEvent } from './adaptWebToNativeEvent';
import { adaptWebToNativeEvent } from '../nativeMappers/adaptWebToNativeEvent';
import {
getCurrentAlignment,
isAnyParagraphFormatActive,
isFormatBlocked,
} from './formats/formatRules';
import type { HtmlStyle } from '../types';
} from '../formats/formatRules';
import type { HtmlStyle } from '../../types';

export const useOnChangeState = (
editor: Editor | null,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type Editor } from '@tiptap/react';
import type { OnChangeTextEvent } from '../types';
import type { OnChangeTextEvent } from '../../types';
import type { NativeSyntheticEvent } from 'react-native';
import { nativeLeafText } from './positionMapping';
import { nativeLeafText } from '../nativeMappers/positionMapping';
import { useOnEditorChange } from './useOnEditorChange';

export const useOnChangeText = (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useEffect, useRef } from 'react';
import { type Editor } from '@tiptap/react';
import type { NativeSyntheticEvent } from 'react-native';
import { adaptWebToNativeEvent } from './adaptWebToNativeEvent';
import { adaptWebToNativeEvent } from '../nativeMappers/adaptWebToNativeEvent';

export const useOnEditorChange = <T extends { value: string }>(
editor: Editor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getMarkRange, getMarksBetween } from '@tiptap/core';
import type { EditorState } from '@tiptap/pm/state';
import type { MarkType } from '@tiptap/pm/model';
import { emitLinkDetected, type LinkEmitterRef } from './emitLinkDetected';
import { tiptapPosToNativePos } from './positionMapping';
import { tiptapPosToNativePos } from '../nativeMappers/positionMapping';

function findLinkRangeAt(
state: EditorState,
Expand Down
6 changes: 3 additions & 3 deletions src/web/pasteImages.ts → src/web/utils/pasteImages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import type { Editor } from '@tiptap/react';
import type { NativeSyntheticEvent } from 'react-native';

import type { OnPasteImagesEvent } from '../types';
import { adaptWebToNativeEvent } from './adaptWebToNativeEvent';
import { isImageBlocked } from './formats/formatRules';
import type { OnPasteImagesEvent } from '../../types';
import { adaptWebToNativeEvent } from '../nativeMappers/adaptWebToNativeEvent';
import { isImageBlocked } from '../formats/formatRules';
import { readImageDimensionsFromBlob } from './pastedImageDimensions';

const isImageLikeClipboardFile = (file: File, reportedMime: string) =>
Expand Down
File renamed without changes.
Loading