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

Add Live Markdown refactor changes #45150

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
499f5ea
Add react-native-live-markdown refactor for testing
Skalakid Jul 10, 2024
560cae0
Merge branch 'main' into @Skalakid/live-markdown-for-web-refactor
Skalakid Jul 11, 2024
7af6e67
Merge branch '@Skalakid/bump-react-native-live-markdown' into @Skalak…
Skalakid Jul 11, 2024
46671b2
Merge branch 'main' into @Skalakid/live-markdown-for-web-refactor
Skalakid Jul 11, 2024
1b0fa24
pod install
Skalakid Jul 11, 2024
7d1726d
Merge branch 'main' into @Skalakid/live-markdown-for-web-refactor
Skalakid Jul 12, 2024
0280e34
Merge branch 'main' into @Skalakid/live-markdown-for-web-refactor
Skalakid Jul 16, 2024
8ed557e
Merge branch 'main' into @Skalakid/live-markdown-for-web-refactor
Skalakid Jul 18, 2024
22b45aa
Bump react-native-live-markdown
Skalakid Jul 19, 2024
38e45de
Fix pasting performance
Skalakid Jul 19, 2024
a12d0fe
Merge branch 'main' into @Skalakid/live-markdown-for-web-refactor
Skalakid Jul 19, 2024
e7fc5bb
Update Podfile
Skalakid Jul 19, 2024
7b56b7a
Bump react-native-live-markdown
Skalakid Jul 19, 2024
8cf3206
chore: bump live markdown version
BartoszGrajdek Aug 2, 2024
056fa31
chore: resolve merge conflicts
BartoszGrajdek Aug 2, 2024
386bbfc
chore: update package.json & pods
BartoszGrajdek Aug 2, 2024
d430cb5
Merge branch 'main' into @Skalakid/live-markdown-for-web-refactor
Skalakid Aug 12, 2024
0b979e0
Merge branch 'main' into @Skalakid/live-markdown-for-web-refactor
Skalakid Aug 19, 2024
c16b6b4
Fix problem with duplicating newlines when sending a message
Skalakid Aug 19, 2024
60a64bf
Bump react-native-live-markdown
Skalakid Aug 19, 2024
45ddb49
Bump react-native-live-markdown
Skalakid Aug 20, 2024
765899e
Bump react-native-live-markdown version to 0.1.117
Skalakid Aug 21, 2024
0b6f704
Merge branch 'main' into @Skalakid/live-markdown-for-web-refactor
Skalakid Aug 21, 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
42 changes: 7 additions & 35 deletions ios/NewExpensify.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1015,11 +1015,7 @@
"$(inherited)",
"-DRN_FABRIC_ENABLED",
);
OTHER_LDFLAGS = (
"$(inherited)",
"-Wl",
"-ld_classic",
);
OTHER_LDFLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = "";
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
Expand Down Expand Up @@ -1822,11 +1818,7 @@
"$(inherited)",
"-DRN_FABRIC_ENABLED",
);
OTHER_LDFLAGS = (
"$(inherited)",
"-Wl",
"-ld_classic",
);
OTHER_LDFLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = "";
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
Expand Down Expand Up @@ -1894,11 +1886,7 @@
"$(inherited)",
"-DRN_FABRIC_ENABLED",
);
OTHER_LDFLAGS = (
"$(inherited)",
"-Wl",
"-ld_classic",
);
OTHER_LDFLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = "";
PRODUCT_NAME = "";
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
Expand Down Expand Up @@ -1976,11 +1964,7 @@
"$(inherited)",
"-DRN_FABRIC_ENABLED",
);
OTHER_LDFLAGS = (
"$(inherited)",
"-Wl",
"-ld_classic",
);
OTHER_LDFLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = "";
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
Expand Down Expand Up @@ -2125,11 +2109,7 @@
"$(inherited)",
"-DRN_FABRIC_ENABLED",
);
OTHER_LDFLAGS = (
"$(inherited)",
"-Wl",
"-ld_classic",
);
OTHER_LDFLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = "";
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
Expand Down Expand Up @@ -2266,11 +2246,7 @@
"$(inherited)",
"-DRN_FABRIC_ENABLED",
);
OTHER_LDFLAGS = (
"$(inherited)",
"-Wl",
"-ld_classic",
);
OTHER_LDFLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = "";
PRODUCT_NAME = "";
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
Expand Down Expand Up @@ -2405,11 +2381,7 @@
"$(inherited)",
"-DRN_FABRIC_ENABLED",
);
OTHER_LDFLAGS = (
"$(inherited)",
"-Wl",
"-ld_classic",
);
OTHER_LDFLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = "";
PRODUCT_NAME = "";
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
Expand Down
8 changes: 4 additions & 4 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1871,7 +1871,7 @@ PODS:
- RNGoogleSignin (10.0.1):
- GoogleSignIn (~> 7.0)
- React-Core
- RNLiveMarkdown (0.1.113):
- RNLiveMarkdown (0.1.117):
- glog
- hermes-engine
- RCT-Folly (= 2022.05.16.00)
Expand All @@ -1889,9 +1889,9 @@ PODS:
- React-utils
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- RNLiveMarkdown/common (= 0.1.113)
- RNLiveMarkdown/common (= 0.1.117)
- Yoga
- RNLiveMarkdown/common (0.1.113):
- RNLiveMarkdown/common (0.1.117):
- glog
- hermes-engine
- RCT-Folly (= 2022.05.16.00)
Expand Down Expand Up @@ -2614,7 +2614,7 @@ SPEC CHECKSUMS:
RNFS: 4ac0f0ea233904cb798630b3c077808c06931688
RNGestureHandler: 74b7b3d06d667ba0bbf41da7718f2607ae0dfe8f
RNGoogleSignin: ccaa4a81582cf713eea562c5dd9dc1961a715fd0
RNLiveMarkdown: 235376cd828014e8bad6949ea5bb202688fa5bb0
RNLiveMarkdown: 54e6a7dfd3e92fdb1d2dab1b64ee8a56d56acd91
RNLocalize: d4b8af4e442d4bcca54e68fc687a2129b4d71a81
rnmapbox-maps: df8fe93dbd251f25022f4023d31bc04160d4d65c
RNPermissions: d2392b754e67bc14491f5b12588bef2864e783f3
Expand Down
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 @@ -69,7 +69,7 @@
"@babel/plugin-proposal-private-methods": "^7.18.6",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@dotlottie/react-player": "^1.6.3",
"@expensify/react-native-live-markdown": "^0.1.113",
"@expensify/react-native-live-markdown": "0.1.117",
"@expo/metro-runtime": "~3.1.1",
"@formatjs/intl-datetimeformat": "^6.10.0",
"@formatjs/intl-listformat": "^7.2.2",
Expand Down
2 changes: 1 addition & 1 deletion src/components/Composer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ function Composer(
return;
}

const currentText = textInput.current.innerText;
const currentText = textInput.current.value;
textInput.current.clear();

// We need to reset the selection to 0,0 manually after clearing the text input on web
Expand Down
10 changes: 0 additions & 10 deletions src/hooks/useHtmlPaste/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {useNavigation} from '@react-navigation/native';
import {useCallback, useEffect} from 'react';
import type {ClipboardEvent as PasteEvent} from 'react';
import Parser from '@libs/Parser';
import type UseHtmlPaste from './types';

Expand All @@ -21,10 +20,6 @@ const insertAtCaret = (target: HTMLElement, text: string) => {
range.setEnd(node, node.length);
selection.setBaseAndExtent(range.startContainer, range.startOffset, range.endContainer, range.endOffset);

// Dispatch paste event to make Markdown Input properly set cursor position
const pasteEvent = new ClipboardEvent('paste', {bubbles: true, cancelable: true});
(pasteEvent as unknown as PasteEvent<HTMLElement>).isDefaultPrevented = () => false;
target.dispatchEvent(pasteEvent);
// Dispatch input event to trigger Markdown Input to parse the new text
target.dispatchEvent(new Event('input', {bubbles: true}));
} else {
Expand All @@ -48,11 +43,6 @@ const useHtmlPaste: UseHtmlPaste = (textInputRef, preHtmlPasteCallback, removeLi
insertByCommand(text);
}

if (!textInputRef.current?.isFocused()) {
textInputRef.current?.focus();
return;
}

// Pointer will go out of sight when a large paragraph is pasted on the web. Refocusing the input keeps the cursor in view.
// To avoid the keyboard toggle issue in mWeb if using blur() and focus() functions, we just need to dispatch the event to trigger the onFocus handler
// We need to trigger the bubbled "focusin" event to make sure the onFocus handler is triggered
Expand Down
Loading