Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
micahmo committed May 21, 2024
1 parent b551bcd commit 1e39dd7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions lib/src/format_markdown.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ class FormatMarkdown {
/// String to convert
String data,

/// An alternate data source on which to perform formatting
String? alternateData,

/// Start index when converting part of [data]
int fromIndex,

Expand All @@ -27,6 +24,9 @@ class FormatMarkdown {

/// The curently selected text
String selectedText = '',

/// An alternate data source on which to perform formatting
String? alternateData,
}) {
late String changedData;
late int replaceCursorIndex;
Expand Down Expand Up @@ -74,7 +74,7 @@ class FormatMarkdown {
break;
case MarkdownType.blockquote:
var index = 0;
final splitedData = (alternateData ?? data.substring(fromIndex, toIndex)).split('\n');
final splitedData = (data.isEmpty ? (alternateData ?? '') : data.substring(fromIndex, toIndex)).split('\n');
changedData = splitedData.map((value) {
index++;
return index == splitedData.length ? '> $value' : '> $value\n';
Expand Down
2 changes: 1 addition & 1 deletion lib/src/markdown_toolbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,12 @@ class MarkdownToolbar extends StatelessWidget {
ResultMarkdown result = FormatMarkdown.convertToMarkdown(
type,
controller.text,
getAlternativeSelection?.call(),
fromIndex,
toIndex,
titleSize: titleSize,
link: link,
selectedText: selectedText ?? controller.text.substring(fromIndex, toIndex),
alternateData: getAlternativeSelection?.call(),
);

controller.value = controller.value.copyWith(text: result.data, selection: TextSelection.collapsed(offset: fromIndex + result.cursorIndex));
Expand Down

0 comments on commit 1e39dd7

Please sign in to comment.