Skip to content

Commit

Permalink
build fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
juliaroldi committed Feb 21, 2025
1 parent 3ed0c21 commit 22dbb23
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,16 @@ export function applySegmentFormatting(
const textSegments = splitParagraphSegments(text);
for (const segment of textSegments) {
const formattedSegment = createText(segment.text);
switch (segment.type) {
case 'image':
const image = createImageSegment(segment.text, segment.url);
paragraph.segments.push(image);
break;
case 'link':
if (segment.type === 'image') {
const image = createImageSegment(segment.text, segment.url);
paragraph.segments.push(image);
} else {
if (segment.type === 'link') {
applyLink(formattedSegment, segment.text, segment.url);
case 'text':
adjustHeading(formattedSegment, decorator);
const formattedSegments = applyTextFormatting(formattedSegment);
paragraph.segments.push(...formattedSegments);
break;
}
adjustHeading(formattedSegment, decorator);
const formattedSegments = applyTextFormatting(formattedSegment);
paragraph.segments.push(...formattedSegments);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { markdownProcessor } from './processor/markdownProcessor';
import type { ContentModelDocument } from 'roosterjs-content-model-types';

/**
* Convert the whole content to ContentModel with the given plain text
Expand All @@ -7,7 +8,10 @@ import { markdownProcessor } from './processor/markdownProcessor';
* @param splitLinesPattern The pattern to split lines. Default is /\r\n|\r|\\n|\n/
* @returns The ContentModelDocument
*/
export function convertMarkdownToContentModel(text: string, splitLinesPattern?: string) {
export function convertMarkdownToContentModel(
text: string,
splitLinesPattern?: string
): ContentModelDocument {
const pattern = splitLinesPattern || /\r\n|\r|\\n|\n/;
return markdownProcessor(text, pattern);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
const linkRegex = /(\[([^\[]+)\]\((https?:\/\/[^\)]+)\))|(\!\[([^\[]+)\]\((https?:\/\/[^\)]+)\))/g;

/**
* @internal
*/
interface MarkdownSegment {
text: string;
url: string;
Expand Down

0 comments on commit 22dbb23

Please sign in to comment.