@expensify/react-native-live-markdown 0.1.11 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -27,10 +27,19 @@
|
|
|
27
27
|
{
|
|
28
28
|
RCTMarkdownUtils *markdownUtils = [self getMarkdownUtils];
|
|
29
29
|
if (markdownUtils != nil) {
|
|
30
|
-
|
|
31
|
-
NSAttributedString *
|
|
32
|
-
[
|
|
33
|
-
|
|
30
|
+
id<RCTBackedTextInputViewProtocol> backedTextInputView = self.backedTextInputView;
|
|
31
|
+
NSAttributedString *oldAttributedText = backedTextInputView.attributedText;
|
|
32
|
+
NSAttributedString *newAttributedText = [markdownUtils parseMarkdown:oldAttributedText];
|
|
33
|
+
UITextRange *range = backedTextInputView.selectedTextRange;
|
|
34
|
+
|
|
35
|
+
// update attributed text without emitting onSelectionChange event
|
|
36
|
+
id<RCTBackedTextInputDelegate> delegate = backedTextInputView.textInputDelegate;
|
|
37
|
+
backedTextInputView.textInputDelegate = nil;
|
|
38
|
+
[backedTextInputView setAttributedText:newAttributedText];
|
|
39
|
+
backedTextInputView.textInputDelegate = delegate;
|
|
40
|
+
|
|
41
|
+
// restore original selection and emit onSelectionChange event
|
|
42
|
+
[backedTextInputView setSelectedTextRange:range notifyDelegate:YES];
|
|
34
43
|
}
|
|
35
44
|
|
|
36
45
|
// Call the original method
|
package/package.json
CHANGED