react-native-enriched-markdown-scaffold 1.0.2-scaffold.12 → 1.0.2-scaffold.13

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.
@@ -863,6 +863,7 @@ static const NSTimeInterval kENRMAtomicSnapPollInterval = 0.1;
863
863
  // Positions are relative to the parsed fragment, so shift them onto the spot
864
864
  // it landed. Pasted markdown carries formulas like any other source.
865
865
  [_mathChipController applyAtoms:parsed.mathAtoms offset:insertLocation];
866
+ [self emitMarkdownAfterAppliedAtoms:parsed.mathAtoms];
866
867
  return;
867
868
  }
868
869
 
@@ -887,6 +888,17 @@ static const NSTimeInterval kENRMAtomicSnapPollInterval = 0.1;
887
888
  formattingRanges:formattingRanges
888
889
  blockRanges:blockRanges];
889
890
  [_mathChipController applyAtoms:parsed.mathAtoms offset:insertLocation + lead];
891
+ [self emitMarkdownAfterAppliedAtoms:parsed.mathAtoms];
892
+ }
893
+
894
+ /// replaceTextInRange: emits markdown before the chips get their LaTeX, so that
895
+ /// markdown has a bare U+FFFC where each formula goes. Emit again once the chips
896
+ /// are applied. Android applies chips before its emit, so it does not need this.
897
+ - (void)emitMarkdownAfterAppliedAtoms:(NSArray<ENRMMathAtom *> *)atoms
898
+ {
899
+ if (atoms.count > 0 && _inputEventEmitter.emitMarkdown) {
900
+ [_inputEventEmitter emitOnChangeMarkdown];
901
+ }
890
902
  }
891
903
 
892
904
  #pragma mark - Formatting
@@ -1517,6 +1529,7 @@ static const NSTimeInterval kENRMAtomicSnapPollInterval = 0.1;
1517
1529
 
1518
1530
  // replaceTextInRange: already emitted text/selection/formatting for the edit, but
1519
1531
  // the caret moved after it and the chip attribute changed the measured height.
1532
+ [self emitMarkdownAfterAppliedAtoms:@[ atom ]];
1520
1533
  [_inputEventEmitter emitOnChangeSelection];
1521
1534
  [self requestHeightUpdate];
1522
1535
  [self scheduleRelayoutIfNeeded];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-enriched-markdown-scaffold",
3
- "version": "1.0.2-scaffold.12",
3
+ "version": "1.0.2-scaffold.13",
4
4
  "description": "Markdown-based Rich Text solution for React Native",
5
5
  "main": "./lib/module/index",
6
6
  "module": "./lib/module/index",