Skip to content

Commit

Permalink
Merge pull request Expensify#36197 from Expensify/revert-35837-@Skala…
Browse files Browse the repository at this point in the history
…kid/live-markdown-preview-web

Revert "Live Markdown Preview for web"
  • Loading branch information
thienlnam authored Feb 9, 2024
2 parents c2f58ac + 5fb4ea2 commit 5218af4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
6 changes: 3 additions & 3 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 @@ -59,7 +59,7 @@
},
"dependencies": {
"@dotlottie/react-player": "^1.6.3",
"@expensify/react-native-live-markdown": "git+ssh://[email protected]/Expensify/react-native-live-markdown.git#77f85a5265043c6100f1fa65edd58901724faf08",
"@expensify/react-native-live-markdown": "git+ssh://[email protected]/Expensify/react-native-live-markdown.git#2ed4240336e50abb4a7fa9ff6a3c180f8bc9ce5b",
"@expo/metro-runtime": "~3.1.1",
"@formatjs/intl-datetimeformat": "^6.10.0",
"@formatjs/intl-getcanonicallocales": "^2.2.0",
Expand Down
11 changes: 4 additions & 7 deletions src/components/Composer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import {MarkdownTextInput} from '@expensify/react-native-live-markdown';
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 @@ -81,7 +80,6 @@ function Composer(
const theme = useTheme();
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
const markdownStyle = useMarkdownStyle();
const {windowWidth} = useWindowDimensions();
const textRef = useRef<HTMLElement & RNText>(null);
const textInput = useRef<AnimatedTextInputRef | null>(null);
Expand Down Expand Up @@ -170,7 +168,7 @@ function Composer(

// To make sure the composer does not capture paste events from other inputs, we check where the event originated
// If it did originate in another input, we return early to prevent the composer from handling the paste
const isTargetInput = ['INPUT', 'TEXTAREA', 'SPAN'].includes(eventTarget?.nodeName ?? '') || eventTarget?.contentEditable === 'true';
const isTargetInput = eventTarget?.nodeName === 'INPUT' || eventTarget?.nodeName === 'TEXTAREA' || eventTarget?.contentEditable === 'true';
if (isTargetInput) {
return true;
}
Expand Down Expand Up @@ -329,14 +327,13 @@ function Composer(

return (
<>
<MarkdownTextInput
<RNTextInput
autoComplete="off"
autoCorrect={!Browser.isMobileSafari()}
placeholderTextColor={theme.placeholderText}
ref={(el) => (textInput.current = el as AnimatedTextInputRef)}
ref={(el) => (textInput.current = el)}
selection={selection}
style={inputStyleMemo}
markdownStyle={markdownStyle}
value={value}
defaultValue={defaultValue}
autoFocus={autoFocus}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ function ComposerWithSuggestions({
}

// if we're typing on another input/text area, do not focus
if (['INPUT', 'TEXTAREA', 'DIV'].includes(e.target.nodeName)) {
if (['INPUT', 'TEXTAREA'].includes(e.target.nodeName)) {
return;
}

Expand Down

0 comments on commit 5218af4

Please sign in to comment.