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

Enable Live Markdown Preview on web #38152

Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
3973b76
Enable live markdown input on web
Skalakid Mar 12, 2024
60a8cec
Bump expensify-common version
Skalakid Mar 12, 2024
4379afe
Merge branch 'main' into @Skalakid/live-markdown-input-for-web
Skalakid Mar 12, 2024
c868943
Bump react-native-live-markdown verion to 0.1.26
Skalakid Mar 13, 2024
3cd3e79
Merge branch 'main' into @Skalakid/live-markdown-input-for-web
Skalakid Mar 13, 2024
cf5f86b
Change Composer markdown component to RNMarkdownTextInput
Skalakid Mar 13, 2024
124ac6c
Change ref type
Skalakid Mar 13, 2024
52f68dc
Fix prettier
Skalakid Mar 13, 2024
8333bb6
Fix Podfile
Skalakid Mar 13, 2024
f24cebb
Merge branch 'main' into @Skalakid/live-markdown-input-for-web
Skalakid Mar 14, 2024
ab6d0f6
Update react-native-live-markdown and expensify-common versions
Skalakid Mar 14, 2024
6db2f6b
Update Podfile
Skalakid Mar 14, 2024
9509076
fix: flushSync error
BartoszGrajdek Mar 14, 2024
e90a031
fix: flushSync
BartoszGrajdek Mar 18, 2024
a689007
fix: paste in composer for message editing
BartoszGrajdek Mar 18, 2024
08692ed
fix: repeated pasting
BartoszGrajdek Mar 19, 2024
095cc23
chore: resolve merge conflicts
BartoszGrajdek Mar 19, 2024
155a097
remove no longer needed workaround when mentions recalculate on char …
Kicu Mar 21, 2024
2e73780
fix: duplicated attachments while pasting
BartoszGrajdek Mar 25, 2024
7624b85
chore: resolve merge conflicts
BartoszGrajdek Mar 25, 2024
58bb4ea
fix: full composer scrollbar
BartoszGrajdek Mar 27, 2024
8fe7c78
fix: shift+enter after mentions scrolling issue
BartoszGrajdek Mar 27, 2024
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
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
},
"dependencies": {
"@dotlottie/react-player": "^1.6.3",
"@expensify/react-native-live-markdown": "0.1.5",
"@expensify/react-native-live-markdown": "0.1.26",
"@expo/metro-runtime": "~3.1.1",
"@formatjs/intl-datetimeformat": "^6.10.0",
"@formatjs/intl-getcanonicallocales": "^2.2.0",
Expand Down
9 changes: 6 additions & 3 deletions src/components/Composer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import {MarkdownTextInput} from '@expensify/react-native-live-markdown';
Copy link
Contributor

Choose a reason for hiding this comment

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

import type {BaseSyntheticEvent, ForwardedRef} from 'react';
import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react';
import {flushSync} from 'react-dom';
// eslint-disable-next-line no-restricted-imports
import type {DimensionValue, NativeSyntheticEvent, Text as RNText, TextInput, TextInputKeyPressEventData, TextInputSelectionChangeEventData} from 'react-native';
import {StyleSheet, View} from 'react-native';
import type {AnimatedTextInputRef} from '@components/RNTextInput';
import RNTextInput from '@components/RNTextInput';
import Text from '@components/Text';
import useHtmlPaste from '@hooks/useHtmlPaste';
import useIsScrollBarVisible from '@hooks/useIsScrollBarVisible';
import useMarkdownStyle from '@hooks/useMarkdownStyle';
import useStyleUtils from '@hooks/useStyleUtils';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
Expand Down Expand Up @@ -79,6 +80,7 @@ function Composer(
) {
const theme = useTheme();
const styles = useThemeStyles();
const markdownStyle = useMarkdownStyle();
const StyleUtils = useStyleUtils();
const {windowWidth} = useWindowDimensions();
const textRef = useRef<HTMLElement & RNText>(null);
Expand Down Expand Up @@ -328,13 +330,14 @@ function Composer(

return (
<>
<RNTextInput
<MarkdownTextInput
autoComplete="off"
autoCorrect={!Browser.isMobileSafari()}
placeholderTextColor={theme.placeholderText}
ref={(el) => (textInput.current = el)}
ref={(el) => (textInput.current = el as AnimatedTextInputRef)}
selection={selection}
style={inputStyleMemo}
markdownStyle={markdownStyle}
value={value}
defaultValue={defaultValue}
autoFocus={autoFocus}
Expand Down
Loading