diff --git a/src/__tests__/parseExpensiMark.test.ts b/src/__tests__/parseExpensiMark.test.ts index b49f46fa3..260ae422f 100644 --- a/src/__tests__/parseExpensiMark.test.ts +++ b/src/__tests__/parseExpensiMark.test.ts @@ -1,6 +1,6 @@ import {expect} from '@jest/globals'; import type {MarkdownRange} from '../commonTypes'; -import parseExpensiMark from '../parseExpensiMark'; +import {parseExpensiMark} from '../parseExpensiMark'; declare module 'expect' { interface Matchers { diff --git a/src/__tests__/webParser.test.tsx b/src/__tests__/webParser.test.tsx index 8fcd31400..4a9a94994 100644 --- a/src/__tests__/webParser.test.tsx +++ b/src/__tests__/webParser.test.tsx @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import {expect} from '@jest/globals'; import {parseRangesToHTMLNodes} from '../web/utils/parserUtils'; -import parseExpensiMark from '../parseExpensiMark'; +import {parseExpensiMark} from '../parseExpensiMark'; declare module 'expect' { interface Matchers { diff --git a/src/index.tsx b/src/index.tsx index 4f3b1d607..b57e2b975 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,4 +1,4 @@ export {default as MarkdownTextInput} from './MarkdownTextInput'; export type {MarkdownTextInputProps, MarkdownStyle} from './MarkdownTextInput'; export type {MarkdownType, MarkdownRange} from './commonTypes'; -export {default as parseExpensiMark} from './parseExpensiMark'; +export {parseExpensiMark} from './parseExpensiMark'; diff --git a/src/parseExpensiMark.ts b/src/parseExpensiMark.ts index 673734af7..1d8e64f0e 100644 --- a/src/parseExpensiMark.ts +++ b/src/parseExpensiMark.ts @@ -292,4 +292,4 @@ function parseExpensiMark(markdown: string): MarkdownRange[] { return groupedRanges; } -export default parseExpensiMark; +export {parseExpensiMark, sortRanges}; diff --git a/src/web/utils/parserUtils.ts b/src/web/utils/parserUtils.ts index 419ed780e..36a73f146 100644 --- a/src/web/utils/parserUtils.ts +++ b/src/web/utils/parserUtils.ts @@ -6,6 +6,7 @@ import {getCurrentCursorPosition, moveCursorToEnd, setCursorPosition} from './cu import {addStyleToBlock, extendBlockStructure, getFirstBlockMarkdownRange, isBlockMarkdownType} from './blockUtils'; import type {InlineImagesInputProps, MarkdownRange} from '../../commonTypes'; import {getAnimationCurrentTimes, updateAnimationsTime} from './animationUtils'; +import {sortRanges} from '../../parseExpensiMark'; type Paragraph = { text: string; @@ -167,7 +168,8 @@ function parseRangesToHTMLNodes( return {dom: rootElement, tree: rootNode}; } - const markdownRanges = ungroupRanges(ranges); + const sortedRanges = sortRanges(ranges); + const markdownRanges = ungroupRanges(sortedRanges); lines = mergeLinesWithMultilineTags(lines, markdownRanges); let lastRangeEndIndex = 0;