Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: IOU - one character descriptions are not saved #343

Closed
wants to merge 4 commits into from
Closed
Changes from 2 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
5 changes: 3 additions & 2 deletions src/MarkdownTextInput.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ interface MarkdownTextInputProps extends TextInputProps {

interface MarkdownNativeEvent extends Event {
inputType: string;
data: string;
}

type Selection = {
Expand Down Expand Up @@ -337,14 +338,14 @@ const MarkdownTextInput = React.forwardRef<TextInput, MarkdownTextInputProps>(
}
const changedText = e.target.innerText;

if (compositionRef.current) {
const nativeEvent = e.nativeEvent as MarkdownNativeEvent;
if (compositionRef.current && (nativeEvent.inputType !== 'insertCompositionText' || nativeEvent.data !== '*')) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I doubt it will function properly if the single character entered is * here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when it's just a single character '*', the previous condition composition.current is false.

Copy link

@sobitneupane sobitneupane May 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we return early if inputType is insertCompositionText?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have reviewed my proposal again, and I apologize for modifying the wrong code while handling conflicting situations.

The condition here is that it only early returns if the composite and type are insertCompositionText, and it is not ** to bold.

updateTextColor(divRef.current, changedText);
compositionRef.current = false;
return;
}

let text = '';
const nativeEvent = e.nativeEvent as MarkdownNativeEvent;
switch (nativeEvent.inputType) {
case 'historyUndo':
text = undo(divRef.current);
Expand Down
Loading