From 066dd14bb14720db7971bff088c134b8f9eb3677 Mon Sep 17 00:00:00 2001 From: Tomek Zawadzki Date: Tue, 10 Dec 2024 11:49:27 +0100 Subject: [PATCH 01/24] Minor improvements in iOS codebase (#575) --- apple/MarkdownCommitHook.mm | 4 ++-- apple/MarkdownFormatter.h | 2 +- apple/MarkdownFormatter.mm | 4 ++-- apple/MarkdownParser.h | 3 ++- apple/MarkdownParser.mm | 4 +++- apple/RCTBackedTextFieldDelegateAdapter+Markdown.mm | 2 +- apple/RCTBaseTextInputView+Markdown.mm | 4 ++-- apple/RCTMarkdownUtils.h | 3 ++- apple/RCTMarkdownUtils.mm | 11 ++++++----- apple/RCTTextInputComponentView+Markdown.mm | 4 ++-- apple/RCTUITextView+Markdown.mm | 2 +- example/ios/Podfile.lock | 8 ++++---- 12 files changed, 28 insertions(+), 23 deletions(-) diff --git a/apple/MarkdownCommitHook.mm b/apple/MarkdownCommitHook.mm index f98f12194..9ff5be224 100644 --- a/apple/MarkdownCommitHook.mm +++ b/apple/MarkdownCommitHook.mm @@ -198,7 +198,7 @@ // apply markdown auto newString = [usedUtils parseMarkdown:nsAttributedString - withAttributes:defaultNSTextAttributes]; + withDefaultTextAttributes:defaultNSTextAttributes]; // create a clone of the old TextInputState and update the // attributed string box to point to the string with markdown @@ -247,7 +247,7 @@ // apply markdown auto newString = [usedUtils parseMarkdown:nsAttributedString - withAttributes:defaultNSTextAttributes]; + withDefaultTextAttributes:defaultNSTextAttributes]; // create a clone of the old TextInputState and update the // attributed string box to point to the string with markdown diff --git a/apple/MarkdownFormatter.h b/apple/MarkdownFormatter.h index 1f5b1a2e1..1cf86c851 100644 --- a/apple/MarkdownFormatter.h +++ b/apple/MarkdownFormatter.h @@ -9,7 +9,7 @@ const NSAttributedStringKey RCTLiveMarkdownBlockquoteDepthAttributeName = @"RCTL @interface MarkdownFormatter : NSObject - (nonnull NSAttributedString *)format:(nonnull NSString *)text - withAttributes:(nullable NSDictionary*)attributes + withDefaultTextAttributes:(nonnull NSDictionary *)defaultTextAttributes withMarkdownRanges:(nonnull NSArray *)markdownRanges withMarkdownStyle:(nonnull RCTMarkdownStyle *)markdownStyle; diff --git a/apple/MarkdownFormatter.mm b/apple/MarkdownFormatter.mm index 642b487bb..b84200c97 100644 --- a/apple/MarkdownFormatter.mm +++ b/apple/MarkdownFormatter.mm @@ -4,11 +4,11 @@ @implementation MarkdownFormatter - (nonnull NSAttributedString *)format:(nonnull NSString *)text - withAttributes:(nullable NSDictionary *)attributes + withDefaultTextAttributes:(nonnull NSDictionary *)defaultTextAttributes withMarkdownRanges:(nonnull NSArray *)markdownRanges withMarkdownStyle:(nonnull RCTMarkdownStyle *)markdownStyle { - NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:text attributes:attributes]; + NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:text attributes:defaultTextAttributes]; [attributedString beginEditing]; diff --git a/apple/MarkdownParser.h b/apple/MarkdownParser.h index 7ec8d1951..407e49b07 100644 --- a/apple/MarkdownParser.h +++ b/apple/MarkdownParser.h @@ -5,7 +5,8 @@ NS_ASSUME_NONNULL_BEGIN @interface MarkdownParser : NSObject -- (NSArray *)parse:(NSString *)text withParserId:(NSNumber *)parserId; +- (NSArray *)parse:(nonnull NSString *)text + withParserId:(nonnull NSNumber *)parserId; NS_ASSUME_NONNULL_END diff --git a/apple/MarkdownParser.mm b/apple/MarkdownParser.mm index 739f106d4..4e96050a1 100644 --- a/apple/MarkdownParser.mm +++ b/apple/MarkdownParser.mm @@ -9,7 +9,9 @@ @implementation MarkdownParser { NSArray *_prevMarkdownRanges; } -- (NSArray *)parse:(NSString *)text withParserId:(nonnull NSNumber *)parserId { +- (NSArray *)parse:(nonnull NSString *)text + withParserId:(nonnull NSNumber *)parserId +{ @synchronized (self) { if ([text isEqualToString:_prevText] && [parserId isEqualToNumber:_prevParserId]) { return _prevMarkdownRanges; diff --git a/apple/RCTBackedTextFieldDelegateAdapter+Markdown.mm b/apple/RCTBackedTextFieldDelegateAdapter+Markdown.mm index 11c3baf8b..d4d8f8214 100644 --- a/apple/RCTBackedTextFieldDelegateAdapter+Markdown.mm +++ b/apple/RCTBackedTextFieldDelegateAdapter+Markdown.mm @@ -19,7 +19,7 @@ - (void)markdown_textFieldDidChange if (markdownUtils != nil) { RCTUITextField *backedTextInputView = [self valueForKey:@"_backedTextInputView"]; UITextRange *range = backedTextInputView.selectedTextRange; - backedTextInputView.attributedText = [markdownUtils parseMarkdown:backedTextInputView.attributedText withAttributes:backedTextInputView.defaultTextAttributes]; + backedTextInputView.attributedText = [markdownUtils parseMarkdown:backedTextInputView.attributedText withDefaultTextAttributes:backedTextInputView.defaultTextAttributes]; [backedTextInputView setSelectedTextRange:range notifyDelegate:YES]; } diff --git a/apple/RCTBaseTextInputView+Markdown.mm b/apple/RCTBaseTextInputView+Markdown.mm index 7662d5455..ec4200682 100644 --- a/apple/RCTBaseTextInputView+Markdown.mm +++ b/apple/RCTBaseTextInputView+Markdown.mm @@ -16,7 +16,7 @@ - (void)markdown_setAttributedText:(NSAttributedString *)attributedText { RCTMarkdownUtils *markdownUtils = [self getMarkdownUtils]; if (markdownUtils != nil) { - attributedText = [markdownUtils parseMarkdown:attributedText withAttributes:self.backedTextInputView.defaultTextAttributes]; + attributedText = [markdownUtils parseMarkdown:attributedText withDefaultTextAttributes:self.backedTextInputView.defaultTextAttributes]; } // Call the original method @@ -46,7 +46,7 @@ - (void)markdown_updateLocalData if (markdownUtils != nil) { id backedTextInputView = self.backedTextInputView; NSAttributedString *oldAttributedText = backedTextInputView.attributedText; - NSAttributedString *newAttributedText = [markdownUtils parseMarkdown:oldAttributedText withAttributes:backedTextInputView.defaultTextAttributes]; + NSAttributedString *newAttributedText = [markdownUtils parseMarkdown:oldAttributedText withDefaultTextAttributes:backedTextInputView.defaultTextAttributes]; UITextRange *range = backedTextInputView.selectedTextRange; // update attributed text without emitting onSelectionChange event diff --git a/apple/RCTMarkdownUtils.h b/apple/RCTMarkdownUtils.h index ea1264722..fed14596d 100644 --- a/apple/RCTMarkdownUtils.h +++ b/apple/RCTMarkdownUtils.h @@ -8,7 +8,8 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic) RCTMarkdownStyle *markdownStyle; @property (nonatomic) NSNumber *parserId; -- (NSAttributedString *)parseMarkdown:(nullable NSAttributedString *)input withAttributes:(nullable NSDictionary*)attributes; +- (NSAttributedString *)parseMarkdown:(nullable NSAttributedString *)input + withDefaultTextAttributes:(nonnull NSDictionary *)defaultTextAttributes; @end diff --git a/apple/RCTMarkdownUtils.mm b/apple/RCTMarkdownUtils.mm index 3c90238be..a932e572c 100644 --- a/apple/RCTMarkdownUtils.mm +++ b/apple/RCTMarkdownUtils.mm @@ -7,7 +7,7 @@ @implementation RCTMarkdownUtils { MarkdownFormatter *_markdownFormatter; NSString *_prevInputString; NSAttributedString *_prevAttributedString; - NSDictionary *_prevTextAttributes; + NSDictionary *_prevDefaultTextAttributes; __weak RCTMarkdownStyle *_prevMarkdownStyle; __weak NSNumber *_prevParserId; } @@ -22,7 +22,8 @@ - (instancetype)init return self; } -- (NSAttributedString *)parseMarkdown:(nullable NSAttributedString *)input withAttributes:(nullable NSDictionary *)attributes +- (NSAttributedString *)parseMarkdown:(nullable NSAttributedString *)input + withDefaultTextAttributes:(nonnull NSDictionary *)defaultTextAttributes { @synchronized (self) { if (input == nil) { @@ -30,19 +31,19 @@ - (NSAttributedString *)parseMarkdown:(nullable NSAttributedString *)input withA } NSString *inputString = [input string]; - if ([inputString isEqualToString:_prevInputString] && [attributes isEqualToDictionary:_prevTextAttributes] && [_markdownStyle isEqual:_prevMarkdownStyle] && [_parserId isEqualToNumber:_prevParserId]) { + if ([inputString isEqualToString:_prevInputString] && [defaultTextAttributes isEqualToDictionary:_prevDefaultTextAttributes] && [_markdownStyle isEqual:_prevMarkdownStyle] && [_parserId isEqualToNumber:_prevParserId]) { return _prevAttributedString; } NSArray *markdownRanges = [_markdownParser parse:inputString withParserId:_parserId]; NSAttributedString *attributedString = [_markdownFormatter format:inputString - withAttributes:attributes + withDefaultTextAttributes:defaultTextAttributes withMarkdownRanges:markdownRanges withMarkdownStyle:_markdownStyle]; _prevInputString = inputString; _prevAttributedString = attributedString; - _prevTextAttributes = attributes; + _prevDefaultTextAttributes = defaultTextAttributes; _prevMarkdownStyle = _markdownStyle; _prevParserId = _parserId; diff --git a/apple/RCTTextInputComponentView+Markdown.mm b/apple/RCTTextInputComponentView+Markdown.mm index 5ce1e63e0..6570097c1 100644 --- a/apple/RCTTextInputComponentView+Markdown.mm +++ b/apple/RCTTextInputComponentView+Markdown.mm @@ -18,7 +18,7 @@ - (void)setMarkdownUtils:(RCTMarkdownUtils *)markdownUtils { if (markdownUtils != nil) { // force Markdown formatting on first render because `_setAttributedText` is called before `setMarkdownUtils` RCTUITextField *backedTextInputView = [self getBackedTextInputView]; - backedTextInputView.attributedText = [markdownUtils parseMarkdown:backedTextInputView.attributedText withAttributes:backedTextInputView.defaultTextAttributes]; + backedTextInputView.attributedText = [markdownUtils parseMarkdown:backedTextInputView.attributedText withDefaultTextAttributes:backedTextInputView.defaultTextAttributes]; } } @@ -36,7 +36,7 @@ - (void)markdown__setAttributedString:(NSAttributedString *)attributedString RCTMarkdownUtils *markdownUtils = [self getMarkdownUtils]; RCTUITextField *backedTextInputView = [self getBackedTextInputView]; if (markdownUtils != nil && backedTextInputView != nil) { - attributedString = [markdownUtils parseMarkdown:attributedString withAttributes:backedTextInputView.defaultTextAttributes]; + attributedString = [markdownUtils parseMarkdown:attributedString withDefaultTextAttributes:backedTextInputView.defaultTextAttributes]; } else { // If markdownUtils is undefined, the text input hasn't been mounted yet. It will // update its state with the unformatted attributed string, we want to prevent displaying diff --git a/apple/RCTUITextView+Markdown.mm b/apple/RCTUITextView+Markdown.mm index 70f2d8820..5a49abe95 100644 --- a/apple/RCTUITextView+Markdown.mm +++ b/apple/RCTUITextView+Markdown.mm @@ -17,7 +17,7 @@ - (void)markdown_textDidChange RCTMarkdownUtils *markdownUtils = [self getMarkdownUtils]; if (markdownUtils != nil) { UITextRange *range = self.selectedTextRange; - super.attributedText = [markdownUtils parseMarkdown:self.attributedText withAttributes:self.defaultTextAttributes]; + super.attributedText = [markdownUtils parseMarkdown:self.attributedText withDefaultTextAttributes:self.defaultTextAttributes]; [super setSelectedTextRange:range]; // prevents cursor from jumping at the end when typing in the middle of the text self.typingAttributes = self.defaultTextAttributes; // removes indent in new line when typing after blockquote } diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index f3bb3529c..aba22425e 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -1497,7 +1497,7 @@ PODS: - React-logger (= 0.75.3) - React-perflogger (= 0.75.3) - React-utils (= 0.75.3) - - RNLiveMarkdown (0.1.199): + - RNLiveMarkdown (0.1.203): - DoubleConversion - glog - hermes-engine @@ -1517,10 +1517,10 @@ PODS: - ReactCodegen - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - - RNLiveMarkdown/newarch (= 0.1.199) + - RNLiveMarkdown/newarch (= 0.1.203) - RNReanimated/worklets - Yoga - - RNLiveMarkdown/newarch (0.1.199): + - RNLiveMarkdown/newarch (0.1.203): - DoubleConversion - glog - hermes-engine @@ -1897,7 +1897,7 @@ SPEC CHECKSUMS: React-utils: f2afa6acd905ca2ce7bb8ffb4a22f7f8a12534e8 ReactCodegen: e35c23cdd36922f6d2990c6c1f1b022ade7ad74d ReactCommon: 289214026502e6a93484f4a46bcc0efa4f3f2864 - RNLiveMarkdown: 18dd4ceada29d66a6b7c29b1b0df589e2fc82183 + RNLiveMarkdown: ed779eaf35a346f5254079b825a13f0a032ba64a RNReanimated: ab6c33a61e90c4cbe5dbcbe65bd6c7cb3be167e6 SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d Yoga: 1354c027ab07c7736f99a3bef16172d6f1b12b47 From 23b01eb5f7e824fdb1e7fc814b9e6b7226846f36 Mon Sep 17 00:00:00 2001 From: "os-botify[bot]" <140437396+os-botify[bot]@users.noreply.github.com> Date: Tue, 10 Dec 2024 10:50:16 +0000 Subject: [PATCH 02/24] Update package-lock.json version to 0.1.204 --- package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3b9507a72..8cf7d34f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@expensify/react-native-live-markdown", - "version": "0.1.203", + "version": "0.1.204", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@expensify/react-native-live-markdown", - "version": "0.1.203", + "version": "0.1.204", "hasInstallScript": true, "license": "MIT", "workspaces": [ From 440b75c1416aff7491da6ce4707d277f4514d142 Mon Sep 17 00:00:00 2001 From: "os-botify[bot]" <140437396+os-botify[bot]@users.noreply.github.com> Date: Tue, 10 Dec 2024 10:50:17 +0000 Subject: [PATCH 03/24] Update package.json version to 0.1.204 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0a705c956..49a4f64b8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@expensify/react-native-live-markdown", - "version": "0.1.203", + "version": "0.1.204", "description": "Drop-in replacement for React Native's TextInput component with Markdown formatting.", "main": "lib/commonjs/index", "module": "lib/module/index", From 0a5d4f08ea8f34c6cb4cbd2ca2863d4639a8cc55 Mon Sep 17 00:00:00 2001 From: Tomek Zawadzki Date: Tue, 10 Dec 2024 14:54:48 +0100 Subject: [PATCH 04/24] Throw error when `html-entities` is not workletized (#576) --- src/parseExpensiMark.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/parseExpensiMark.ts b/src/parseExpensiMark.ts index 4162eb6c1..673734af7 100644 --- a/src/parseExpensiMark.ts +++ b/src/parseExpensiMark.ts @@ -1,9 +1,27 @@ 'worklet'; +import {Platform} from 'react-native'; import {ExpensiMark} from 'expensify-common'; import {unescapeText} from 'expensify-common/dist/utils'; +import {decode} from 'html-entities'; +import type {WorkletFunction} from 'react-native-reanimated/lib/typescript/commonTypes'; import type {MarkdownType, MarkdownRange} from './commonTypes'; +function isWeb() { + return Platform.OS === 'web'; +} + +function isJest() { + return !!global.process.env.JEST_WORKER_ID; +} + +// eslint-disable-next-line no-underscore-dangle +if (__DEV__ && !isWeb() && !isJest() && (decode as WorkletFunction).__workletHash === undefined) { + throw new Error( + "[react-native-live-markdown] `parseExpensiMark` requires `html-entities` package to be workletized. Please add `'worklet';` directive at the top of `node_modules/html-entities/lib/index.js` using patch-package.", + ); +} + const MAX_PARSABLE_LENGTH = 4000; type Token = ['TEXT' | 'HTML', string]; From 5eb2f0951a6ed7c2cef253388f18cd6ef5470a08 Mon Sep 17 00:00:00 2001 From: "os-botify[bot]" <140437396+os-botify[bot]@users.noreply.github.com> Date: Tue, 10 Dec 2024 13:55:44 +0000 Subject: [PATCH 05/24] Update package-lock.json version to 0.1.205 --- package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8cf7d34f1..330581453 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@expensify/react-native-live-markdown", - "version": "0.1.204", + "version": "0.1.205", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@expensify/react-native-live-markdown", - "version": "0.1.204", + "version": "0.1.205", "hasInstallScript": true, "license": "MIT", "workspaces": [ From 540db5fd3103d8239a8e0a0b8d8bcb71e28913eb Mon Sep 17 00:00:00 2001 From: "os-botify[bot]" <140437396+os-botify[bot]@users.noreply.github.com> Date: Tue, 10 Dec 2024 13:55:45 +0000 Subject: [PATCH 06/24] Update package.json version to 0.1.205 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 49a4f64b8..9d3243de0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@expensify/react-native-live-markdown", - "version": "0.1.204", + "version": "0.1.205", "description": "Drop-in replacement for React Native's TextInput component with Markdown formatting.", "main": "lib/commonjs/index", "module": "lib/module/index", From 808fca1183166021b9544722d3992f0df7079756 Mon Sep 17 00:00:00 2001 From: Tomek Zawadzki Date: Wed, 11 Dec 2024 09:30:43 +0100 Subject: [PATCH 07/24] Bump react-native-reanimated to 3.16.4 (#577) --- README.md | 2 +- example/ios/Podfile.lock | 24 ++++++++++++------------ example/package.json | 2 +- package-lock.json | 12 ++++++------ package.json | 4 ++-- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index d8c2dec5a..99027bd8c 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ npm install @expensify/react-native-live-markdown react-native-reanimated expens npx expo install @expensify/react-native-live-markdown react-native-reanimated expensify-common ``` -React Native Live Markdown requires [react-native-reanimated](https://github.com/software-mansion/react-native-reanimated) 3.16.3 or newer and [expensify-common](https://github.com/Expensify/expensify-common) 2.0.108 or newer. +React Native Live Markdown requires [react-native-reanimated](https://github.com/software-mansion/react-native-reanimated) 3.16.4 or newer and [expensify-common](https://github.com/Expensify/expensify-common) 2.0.108 or newer. Then, install the iOS dependencies with CocoaPods: diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index aba22425e..7aed26be2 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -1497,7 +1497,7 @@ PODS: - React-logger (= 0.75.3) - React-perflogger (= 0.75.3) - React-utils (= 0.75.3) - - RNLiveMarkdown (0.1.203): + - RNLiveMarkdown (0.1.205): - DoubleConversion - glog - hermes-engine @@ -1517,10 +1517,10 @@ PODS: - ReactCodegen - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - - RNLiveMarkdown/newarch (= 0.1.203) + - RNLiveMarkdown/newarch (= 0.1.205) - RNReanimated/worklets - Yoga - - RNLiveMarkdown/newarch (0.1.203): + - RNLiveMarkdown/newarch (0.1.205): - DoubleConversion - glog - hermes-engine @@ -1542,7 +1542,7 @@ PODS: - ReactCommon/turbomodule/core - RNReanimated/worklets - Yoga - - RNReanimated (3.16.3): + - RNReanimated (3.16.4): - DoubleConversion - glog - hermes-engine @@ -1562,10 +1562,10 @@ PODS: - ReactCodegen - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - - RNReanimated/reanimated (= 3.16.3) - - RNReanimated/worklets (= 3.16.3) + - RNReanimated/reanimated (= 3.16.4) + - RNReanimated/worklets (= 3.16.4) - Yoga - - RNReanimated/reanimated (3.16.3): + - RNReanimated/reanimated (3.16.4): - DoubleConversion - glog - hermes-engine @@ -1585,9 +1585,9 @@ PODS: - ReactCodegen - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - - RNReanimated/reanimated/apple (= 3.16.3) + - RNReanimated/reanimated/apple (= 3.16.4) - Yoga - - RNReanimated/reanimated/apple (3.16.3): + - RNReanimated/reanimated/apple (3.16.4): - DoubleConversion - glog - hermes-engine @@ -1608,7 +1608,7 @@ PODS: - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - Yoga - - RNReanimated/worklets (3.16.3): + - RNReanimated/worklets (3.16.4): - DoubleConversion - glog - hermes-engine @@ -1897,8 +1897,8 @@ SPEC CHECKSUMS: React-utils: f2afa6acd905ca2ce7bb8ffb4a22f7f8a12534e8 ReactCodegen: e35c23cdd36922f6d2990c6c1f1b022ade7ad74d ReactCommon: 289214026502e6a93484f4a46bcc0efa4f3f2864 - RNLiveMarkdown: ed779eaf35a346f5254079b825a13f0a032ba64a - RNReanimated: ab6c33a61e90c4cbe5dbcbe65bd6c7cb3be167e6 + RNLiveMarkdown: bf0f16b1e8c3320d600a5931d270e19afef9fa92 + RNReanimated: 75df06d3a81fc147b83056ae469512f573365b1d SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d Yoga: 1354c027ab07c7736f99a3bef16172d6f1b12b47 diff --git a/example/package.json b/example/package.json index c75e8e09d..0bf17b188 100644 --- a/example/package.json +++ b/example/package.json @@ -12,7 +12,7 @@ "expensify-common": "2.0.108", "react": "18.3.1", "react-native": "0.75.3", - "react-native-reanimated": "3.16.3" + "react-native-reanimated": "3.16.4" }, "devDependencies": { "@babel/core": "^7.20.0", diff --git a/package-lock.json b/package-lock.json index 330581453..5ec48bcda 100644 --- a/package-lock.json +++ b/package-lock.json @@ -48,7 +48,7 @@ "react": "18.3.1", "react-native": "0.75.3", "react-native-builder-bob": "^0.20.0", - "react-native-reanimated": "3.16.3", + "react-native-reanimated": "3.16.4", "react-native-web": "^0.19.10", "release-it": "^15.0.0", "turbo": "^1.10.7", @@ -61,7 +61,7 @@ "expensify-common": ">=2.0.108", "react": "*", "react-native": "*", - "react-native-reanimated": ">=3.16.3" + "react-native-reanimated": ">=3.16.4" } }, "example": { @@ -71,7 +71,7 @@ "expensify-common": "2.0.108", "react": "18.3.1", "react-native": "0.75.3", - "react-native-reanimated": "3.16.3" + "react-native-reanimated": "3.16.4" }, "devDependencies": { "@babel/core": "^7.20.0", @@ -24615,9 +24615,9 @@ } }, "node_modules/react-native-reanimated": { - "version": "3.16.3", - "resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-3.16.3.tgz", - "integrity": "sha512-OWlA6e1oHhytTpc7WiSZ7Tmb8OYwLKYZz29Sz6d6WAg60Hm5GuAiKIWUG7Ako7FLcYhFkA0pEQ2xPMEYUo9vlw==", + "version": "3.16.4", + "resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-3.16.4.tgz", + "integrity": "sha512-dF1Vvu8gG+p0+DmBhKMTx5X9iw/rH1ZF9WaIn2nW0c5rxsVFf00axmDgaAdPxNWblmtLnroaKwrV7SjMUyOx+g==", "dependencies": { "@babel/plugin-transform-arrow-functions": "^7.0.0-0", "@babel/plugin-transform-class-properties": "^7.0.0-0", diff --git a/package.json b/package.json index 9d3243de0..2fbe4438c 100644 --- a/package.json +++ b/package.json @@ -93,7 +93,7 @@ "react": "18.3.1", "react-native": "0.75.3", "react-native-builder-bob": "^0.20.0", - "react-native-reanimated": "3.16.3", + "react-native-reanimated": "3.16.4", "react-native-web": "^0.19.10", "release-it": "^15.0.0", "turbo": "^1.10.7", @@ -103,7 +103,7 @@ "expensify-common": ">=2.0.108", "react": "*", "react-native": "*", - "react-native-reanimated": ">=3.16.3" + "react-native-reanimated": ">=3.16.4" }, "workspaces": [ "./example", From 5e07c26bd525dc87ec81e10c6b80c3fc44ebee8e Mon Sep 17 00:00:00 2001 From: "os-botify[bot]" <140437396+os-botify[bot]@users.noreply.github.com> Date: Wed, 11 Dec 2024 08:31:35 +0000 Subject: [PATCH 08/24] Update package-lock.json version to 0.1.206 --- package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5ec48bcda..4c4d0467f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@expensify/react-native-live-markdown", - "version": "0.1.205", + "version": "0.1.206", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@expensify/react-native-live-markdown", - "version": "0.1.205", + "version": "0.1.206", "hasInstallScript": true, "license": "MIT", "workspaces": [ From 81601a966a0d2254264bda2cef2de18b35eb5a69 Mon Sep 17 00:00:00 2001 From: "os-botify[bot]" <140437396+os-botify[bot]@users.noreply.github.com> Date: Wed, 11 Dec 2024 08:31:36 +0000 Subject: [PATCH 09/24] Update package.json version to 0.1.206 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2fbe4438c..00f6f7cee 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@expensify/react-native-live-markdown", - "version": "0.1.205", + "version": "0.1.206", "description": "Drop-in replacement for React Native's TextInput component with Markdown formatting.", "main": "lib/commonjs/index", "module": "lib/module/index", From 67724f0e79a7ad14dc3f58677f00a064d89859aa Mon Sep 17 00:00:00 2001 From: Abdelhafidh Belalia <16493223+s77rt@users.noreply.github.com> Date: Wed, 11 Dec 2024 09:51:00 +0100 Subject: [PATCH 10/24] add mock (#578) --- mock/index.ts | 14 ++++++++++++++ package.json | 1 + src/MarkdownTextInput.tsx | 5 ++--- tsconfig.json | 2 +- 4 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 mock/index.ts diff --git a/mock/index.ts b/mock/index.ts new file mode 100644 index 000000000..6e082dea9 --- /dev/null +++ b/mock/index.ts @@ -0,0 +1,14 @@ +import {MarkdownTextInput} from '../src'; +import type {parseExpensiMark} from '../src'; + +global.jsi_setMarkdownRuntime = jest.fn(); +global.jsi_registerMarkdownWorklet = jest.fn(); +global.jsi_unregisterMarkdownWorklet = jest.fn(); + +const parseExpensiMarkMock: typeof parseExpensiMark = () => { + 'worklet'; + + return []; +}; + +export {MarkdownTextInput, parseExpensiMarkMock as parseExpensiMark}; diff --git a/package.json b/package.json index 00f6f7cee..9ed7dd4af 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "files": [ "src", "lib", + "mock", "android", "apple", "cpp", diff --git a/src/MarkdownTextInput.tsx b/src/MarkdownTextInput.tsx index c4ec2467a..b744a9bd3 100644 --- a/src/MarkdownTextInput.tsx +++ b/src/MarkdownTextInput.tsx @@ -28,10 +28,9 @@ function initializeLiveMarkdownIfNeeded() { if (initialized) { return; } - if (!NativeLiveMarkdownModule) { - throw new Error('[react-native-live-markdown] NativeLiveMarkdownModule is not available'); + if (NativeLiveMarkdownModule) { + NativeLiveMarkdownModule.install(); } - NativeLiveMarkdownModule.install(); if (!global.jsi_setMarkdownRuntime) { throw new Error('[react-native-live-markdown] global.jsi_setMarkdownRuntime is not available'); } diff --git a/tsconfig.json b/tsconfig.json index 5af82eaef..a92fd85d4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -26,6 +26,6 @@ "verbatimModuleSyntax": true, "typeRoots": ["node_modules/@types"] }, - "include": ["src/**/*"], + "include": ["src/**/*", "mock/**/*"], "exclude": ["**/node_modules/**/*", "**/lib/**/*", "example/src/**/*", "WebExample/**/*"] } From 2538fb6ae82953f8ff22d2deb842b2bff7f45b19 Mon Sep 17 00:00:00 2001 From: "os-botify[bot]" <140437396+os-botify[bot]@users.noreply.github.com> Date: Wed, 11 Dec 2024 08:51:52 +0000 Subject: [PATCH 11/24] Update package-lock.json version to 0.1.207 --- package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4c4d0467f..ae9e17c9c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@expensify/react-native-live-markdown", - "version": "0.1.206", + "version": "0.1.207", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@expensify/react-native-live-markdown", - "version": "0.1.206", + "version": "0.1.207", "hasInstallScript": true, "license": "MIT", "workspaces": [ From 2581f3a82ed4f04b5c8860cfb5056f1388fe5d18 Mon Sep 17 00:00:00 2001 From: "os-botify[bot]" <140437396+os-botify[bot]@users.noreply.github.com> Date: Wed, 11 Dec 2024 08:51:53 +0000 Subject: [PATCH 12/24] Update package.json version to 0.1.207 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9ed7dd4af..4dc6b0885 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@expensify/react-native-live-markdown", - "version": "0.1.206", + "version": "0.1.207", "description": "Drop-in replacement for React Native's TextInput component with Markdown formatting.", "main": "lib/commonjs/index", "module": "lib/module/index", From 8b6414eb4cdb3e04a33cd1d3c6e41411a5669f43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ska=C5=82ka?= <39538890+Skalakid@users.noreply.github.com> Date: Thu, 12 Dec 2024 00:39:00 -0800 Subject: [PATCH 13/24] Fix codeblock text parsing (#581) --- src/parseExpensiMark.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parseExpensiMark.ts b/src/parseExpensiMark.ts index 673734af7..cbf69845b 100644 --- a/src/parseExpensiMark.ts +++ b/src/parseExpensiMark.ts @@ -172,7 +172,7 @@ function parseTreeToTextAndRanges(tree: StackItem): [string, MarkdownRange[]] { text += '\n'; } else if (node.tag.startsWith(' Date: Thu, 12 Dec 2024 08:39:52 +0000 Subject: [PATCH 14/24] Update package-lock.json version to 0.1.208 --- package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index ae9e17c9c..8340261a4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@expensify/react-native-live-markdown", - "version": "0.1.207", + "version": "0.1.208", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@expensify/react-native-live-markdown", - "version": "0.1.207", + "version": "0.1.208", "hasInstallScript": true, "license": "MIT", "workspaces": [ From 4976b59757d2b4eda21985c6cd5f53abe8e740df Mon Sep 17 00:00:00 2001 From: "os-botify[bot]" <140437396+os-botify[bot]@users.noreply.github.com> Date: Thu, 12 Dec 2024 08:39:53 +0000 Subject: [PATCH 15/24] Update package.json version to 0.1.208 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4dc6b0885..daed2b239 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@expensify/react-native-live-markdown", - "version": "0.1.207", + "version": "0.1.208", "description": "Drop-in replacement for React Native's TextInput component with Markdown formatting.", "main": "lib/commonjs/index", "module": "lib/module/index", From e1ccea1d08b99b073439818b29d34a6746257c14 Mon Sep 17 00:00:00 2001 From: Tomek Zawadzki Date: Tue, 17 Dec 2024 21:52:21 +0100 Subject: [PATCH 16/24] Fix build with `USE_FRAMEWORKS=static` (#589) --- RNLiveMarkdown.podspec | 11 ++++++++++- example/ios/Podfile.lock | 8 ++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/RNLiveMarkdown.podspec b/RNLiveMarkdown.podspec index de9baafc1..34e9fd00c 100644 --- a/RNLiveMarkdown.podspec +++ b/RNLiveMarkdown.podspec @@ -4,6 +4,10 @@ react_native_node_modules_dir = ENV['REACT_NATIVE_NODE_MODULES_DIR'] || File.joi react_native_json = JSON.parse(File.read(File.join(react_native_node_modules_dir, 'react-native/package.json'))) react_native_minor_version = react_native_json['version'].split('.')[1].to_i +pods_root = Pod::Config.instance.project_pods_root +react_native_reanimated_node_modules_dir = ENV['REACT_NATIVE_REANIMATED_NODE_MODULES_DIR'] || File.dirname(`cd "#{Pod::Config.instance.installation_root.to_s}" && node --print "require.resolve('react-native-reanimated/package.json')"`) +react_native_reanimated_node_modules_dir_from_pods_root = Pathname.new(react_native_reanimated_node_modules_dir).relative_path_from(pods_root).to_s + package = JSON.parse(File.read(File.join(__dir__, "package.json"))) folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32' @@ -23,7 +27,11 @@ Pod::Spec.new do |s| s.dependency "RNReanimated/worklets" s.xcconfig = { - "OTHER_CFLAGS" => "$(inherited) -DREACT_NATIVE_MINOR_VERSION=#{react_native_minor_version}" + "OTHER_CFLAGS" => "$(inherited) -DREACT_NATIVE_MINOR_VERSION=#{react_native_minor_version}", + "HEADER_SEARCH_PATHS" => [ + "\"$(PODS_ROOT)/#{react_native_reanimated_node_modules_dir_from_pods_root}/apple\"", + "\"$(PODS_ROOT)/#{react_native_reanimated_node_modules_dir_from_pods_root}/Common/cpp\"", + ].join(' '), } install_modules_dependencies(s) @@ -33,6 +41,7 @@ Pod::Spec.new do |s| "react/renderer/textlayoutmanager/platform/ios", "react/renderer/components/textinput/platform/ios", ]) + add_dependency(s, "React-rendererconsistency") end if ENV['RCT_NEW_ARCH_ENABLED'] == '1' diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 7aed26be2..5a43e11a4 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -1497,7 +1497,7 @@ PODS: - React-logger (= 0.75.3) - React-perflogger (= 0.75.3) - React-utils (= 0.75.3) - - RNLiveMarkdown (0.1.205): + - RNLiveMarkdown (0.1.208): - DoubleConversion - glog - hermes-engine @@ -1517,10 +1517,10 @@ PODS: - ReactCodegen - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - - RNLiveMarkdown/newarch (= 0.1.205) + - RNLiveMarkdown/newarch (= 0.1.208) - RNReanimated/worklets - Yoga - - RNLiveMarkdown/newarch (0.1.205): + - RNLiveMarkdown/newarch (0.1.208): - DoubleConversion - glog - hermes-engine @@ -1897,7 +1897,7 @@ SPEC CHECKSUMS: React-utils: f2afa6acd905ca2ce7bb8ffb4a22f7f8a12534e8 ReactCodegen: e35c23cdd36922f6d2990c6c1f1b022ade7ad74d ReactCommon: 289214026502e6a93484f4a46bcc0efa4f3f2864 - RNLiveMarkdown: bf0f16b1e8c3320d600a5931d270e19afef9fa92 + RNLiveMarkdown: 1ee098c3a830c3133c23fc163b0aff29398a293e RNReanimated: 75df06d3a81fc147b83056ae469512f573365b1d SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d Yoga: 1354c027ab07c7736f99a3bef16172d6f1b12b47 From 31f36be8731cb5b71c020b2017a04957981e4b37 Mon Sep 17 00:00:00 2001 From: "os-botify[bot]" <140437396+os-botify[bot]@users.noreply.github.com> Date: Tue, 17 Dec 2024 20:53:14 +0000 Subject: [PATCH 17/24] Update package-lock.json version to 0.1.209 --- package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8340261a4..d3d61e4d8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@expensify/react-native-live-markdown", - "version": "0.1.208", + "version": "0.1.209", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@expensify/react-native-live-markdown", - "version": "0.1.208", + "version": "0.1.209", "hasInstallScript": true, "license": "MIT", "workspaces": [ From bc6ef7608e1ea7ba288e645a71bb3f4f060657d6 Mon Sep 17 00:00:00 2001 From: "os-botify[bot]" <140437396+os-botify[bot]@users.noreply.github.com> Date: Tue, 17 Dec 2024 20:53:15 +0000 Subject: [PATCH 18/24] Update package.json version to 0.1.209 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index daed2b239..46b0402eb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@expensify/react-native-live-markdown", - "version": "0.1.208", + "version": "0.1.209", "description": "Drop-in replacement for React Native's TextInput component with Markdown formatting.", "main": "lib/commonjs/index", "module": "lib/module/index", From 8b1789a13e2cbb48ec7b0abe9efc7bc9f2dc57dc Mon Sep 17 00:00:00 2001 From: Kevin Brian Bader <56457735+ikevin127@users.noreply.github.com> Date: Wed, 18 Dec 2024 04:44:41 -0800 Subject: [PATCH 19/24] FIX: Android - Live markdown style not applied consistently (#590) --- .../expensify/livemarkdown/MarkdownTextInputDecoratorView.java | 1 + 1 file changed, 1 insertion(+) diff --git a/android/src/main/java/com/expensify/livemarkdown/MarkdownTextInputDecoratorView.java b/android/src/main/java/com/expensify/livemarkdown/MarkdownTextInputDecoratorView.java index 6bd1a68fe..b7ab2aa03 100644 --- a/android/src/main/java/com/expensify/livemarkdown/MarkdownTextInputDecoratorView.java +++ b/android/src/main/java/com/expensify/livemarkdown/MarkdownTextInputDecoratorView.java @@ -61,6 +61,7 @@ protected void onAttachedToWindow() { mReactEditText = (ReactEditText) previousSibling; mTextWatcher = new MarkdownTextWatcher(mMarkdownUtils); mReactEditText.addTextChangedListener(mTextWatcher); + applyNewStyles(); } } From b8c6ff393582569c66bd4ec925d21849da3aa103 Mon Sep 17 00:00:00 2001 From: "os-botify[bot]" <140437396+os-botify[bot]@users.noreply.github.com> Date: Wed, 18 Dec 2024 12:45:37 +0000 Subject: [PATCH 20/24] Update package-lock.json version to 0.1.210 --- package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index d3d61e4d8..f313c8276 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@expensify/react-native-live-markdown", - "version": "0.1.209", + "version": "0.1.210", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@expensify/react-native-live-markdown", - "version": "0.1.209", + "version": "0.1.210", "hasInstallScript": true, "license": "MIT", "workspaces": [ From f165434a62852973f1e46b6271a49c8928d73cbe Mon Sep 17 00:00:00 2001 From: "os-botify[bot]" <140437396+os-botify[bot]@users.noreply.github.com> Date: Wed, 18 Dec 2024 12:45:38 +0000 Subject: [PATCH 21/24] Update package.json version to 0.1.210 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 46b0402eb..17a124aef 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@expensify/react-native-live-markdown", - "version": "0.1.209", + "version": "0.1.210", "description": "Drop-in replacement for React Native's TextInput component with Markdown formatting.", "main": "lib/commonjs/index", "module": "lib/module/index", From a068201769058888e9d87cbd453101bf4d3afe03 Mon Sep 17 00:00:00 2001 From: Tomek Zawadzki Date: Sat, 21 Dec 2024 20:19:06 +0100 Subject: [PATCH 22/24] Fix blockquote line height on iOS (#587) --- apple/MarkdownFormatter.mm | 24 ++++++++++++++++-------- example/ios/Podfile.lock | 8 ++++---- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/apple/MarkdownFormatter.mm b/apple/MarkdownFormatter.mm index b84200c97..fdb4116f6 100644 --- a/apple/MarkdownFormatter.mm +++ b/apple/MarkdownFormatter.mm @@ -24,10 +24,15 @@ - (nonnull NSAttributedString *)format:(nonnull NSString *)text type:std::string([markdownRange.type UTF8String]) range:markdownRange.range depth:markdownRange.depth - markdownStyle:markdownStyle]; + markdownStyle:markdownStyle + defaultTextAttributes:defaultTextAttributes]; } - RCTApplyBaselineOffset(attributedString); + [attributedString.string enumerateSubstringsInRange:NSMakeRange(0, attributedString.length) + options:NSStringEnumerationByLines | NSStringEnumerationSubstringNotRequired + usingBlock:^(NSString * _Nullable substring, NSRange substringRange, NSRange enclosingRange, BOOL * _Nonnull stop) { + RCTApplyBaselineOffset(attributedString, enclosingRange); + }]; [attributedString endEditing]; @@ -38,7 +43,9 @@ - (void)applyRangeToAttributedString:(NSMutableAttributedString *)attributedStri type:(const std::string)type range:(const NSRange)range depth:(const int)depth - markdownStyle:(nonnull RCTMarkdownStyle *)markdownStyle { + markdownStyle:(nonnull RCTMarkdownStyle *)markdownStyle + defaultTextAttributes:(nonnull NSDictionary *)defaultTextAttributes +{ if (type == "bold" || type == "italic" || type == "code" || type == "pre" || type == "h1" || type == "emoji") { UIFont *font = [attributedString attribute:NSFontAttributeName atIndex:range.location effectiveRange:NULL]; if (type == "bold") { @@ -99,7 +106,8 @@ - (void)applyRangeToAttributedString:(NSMutableAttributedString *)attributedStri [attributedString addAttribute:NSForegroundColorAttributeName value:markdownStyle.linkColor range:range]; } else if (type == "blockquote") { CGFloat indent = (markdownStyle.blockquoteMarginLeft + markdownStyle.blockquoteBorderWidth + markdownStyle.blockquotePaddingLeft) * depth; - NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new]; + NSParagraphStyle *defaultParagraphStyle = defaultTextAttributes[NSParagraphStyleAttributeName]; + NSMutableParagraphStyle *paragraphStyle = defaultParagraphStyle != nil ? [defaultParagraphStyle mutableCopy] : [NSMutableParagraphStyle new]; paragraphStyle.firstLineHeadIndent = indent; paragraphStyle.headIndent = indent; [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:range]; @@ -112,12 +120,12 @@ - (void)applyRangeToAttributedString:(NSMutableAttributedString *)attributedStri } } -static void RCTApplyBaselineOffset(NSMutableAttributedString *attributedText) +static void RCTApplyBaselineOffset(NSMutableAttributedString *attributedText, NSRange attributedTextRange) { __block CGFloat maximumLineHeight = 0; [attributedText enumerateAttribute:NSParagraphStyleAttributeName - inRange:NSMakeRange(0, attributedText.length) + inRange:attributedTextRange options:NSAttributedStringEnumerationLongestEffectiveRangeNotRequired usingBlock:^(NSParagraphStyle *paragraphStyle, __unused NSRange range, __unused BOOL *stop) { if (!paragraphStyle) { @@ -135,7 +143,7 @@ static void RCTApplyBaselineOffset(NSMutableAttributedString *attributedText) __block CGFloat maximumFontLineHeight = 0; [attributedText enumerateAttribute:NSFontAttributeName - inRange:NSMakeRange(0, attributedText.length) + inRange:attributedTextRange options:NSAttributedStringEnumerationLongestEffectiveRangeNotRequired usingBlock:^(UIFont *font, NSRange range, __unused BOOL *stop) { if (!font) { @@ -152,7 +160,7 @@ static void RCTApplyBaselineOffset(NSMutableAttributedString *attributedText) CGFloat baseLineOffset = (maximumLineHeight - maximumFontLineHeight) / 2.0; [attributedText addAttribute:NSBaselineOffsetAttributeName value:@(baseLineOffset) - range:NSMakeRange(0, attributedText.length)]; + range:attributedTextRange]; } @end diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 5a43e11a4..a8d14f2a2 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -1497,7 +1497,7 @@ PODS: - React-logger (= 0.75.3) - React-perflogger (= 0.75.3) - React-utils (= 0.75.3) - - RNLiveMarkdown (0.1.208): + - RNLiveMarkdown (0.1.210): - DoubleConversion - glog - hermes-engine @@ -1517,10 +1517,10 @@ PODS: - ReactCodegen - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - - RNLiveMarkdown/newarch (= 0.1.208) + - RNLiveMarkdown/newarch (= 0.1.210) - RNReanimated/worklets - Yoga - - RNLiveMarkdown/newarch (0.1.208): + - RNLiveMarkdown/newarch (0.1.210): - DoubleConversion - glog - hermes-engine @@ -1897,7 +1897,7 @@ SPEC CHECKSUMS: React-utils: f2afa6acd905ca2ce7bb8ffb4a22f7f8a12534e8 ReactCodegen: e35c23cdd36922f6d2990c6c1f1b022ade7ad74d ReactCommon: 289214026502e6a93484f4a46bcc0efa4f3f2864 - RNLiveMarkdown: 1ee098c3a830c3133c23fc163b0aff29398a293e + RNLiveMarkdown: 687bc45ffb3b4af261f414fea169f10eae5ac261 RNReanimated: 75df06d3a81fc147b83056ae469512f573365b1d SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d Yoga: 1354c027ab07c7736f99a3bef16172d6f1b12b47 From 8fbfa803deb69f5adbe518b1b975982712832f60 Mon Sep 17 00:00:00 2001 From: "os-botify[bot]" <140437396+os-botify[bot]@users.noreply.github.com> Date: Sat, 21 Dec 2024 19:19:55 +0000 Subject: [PATCH 23/24] Update package-lock.json version to 0.1.211 --- package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index f313c8276..dee2f10c4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@expensify/react-native-live-markdown", - "version": "0.1.210", + "version": "0.1.211", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@expensify/react-native-live-markdown", - "version": "0.1.210", + "version": "0.1.211", "hasInstallScript": true, "license": "MIT", "workspaces": [ From 6447ea9ec54830f1d55c1eac0e9274ce93a4c769 Mon Sep 17 00:00:00 2001 From: "os-botify[bot]" <140437396+os-botify[bot]@users.noreply.github.com> Date: Sat, 21 Dec 2024 19:19:56 +0000 Subject: [PATCH 24/24] Update package.json version to 0.1.211 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 17a124aef..9e554fc2f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@expensify/react-native-live-markdown", - "version": "0.1.210", + "version": "0.1.211", "description": "Drop-in replacement for React Native's TextInput component with Markdown formatting.", "main": "lib/commonjs/index", "module": "lib/module/index",