@mathers101/react-native-render-rich-text 0.1.10 → 0.1.14

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.
Files changed (327) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +140 -140
  3. package/ReactNativeRenderRichText.podspec +23 -23
  4. package/android/build.gradle +86 -86
  5. package/android/consumer-rules.pro +3 -3
  6. package/android/src/main/AndroidManifest.xml +2 -2
  7. package/android/src/main/java/com/renderrichtext/EnrichedTiptapTextLayoutManager.kt +24 -24
  8. package/android/src/main/java/com/renderrichtext/EnrichedTiptapTextPackage.kt +13 -13
  9. package/android/src/main/java/com/renderrichtext/MeasurementStore.kt +644 -644
  10. package/android/src/main/java/com/renderrichtext/accessibility/AccessibilityLabels.kt +17 -17
  11. package/android/src/main/java/com/renderrichtext/accessibility/AccessibleTiptapTextView.kt +112 -112
  12. package/android/src/main/java/com/renderrichtext/accessibility/TiptapAccessibilityHelper.kt +576 -576
  13. package/android/src/main/java/com/renderrichtext/events/CodeBlockPressEvent.kt +24 -24
  14. package/android/src/main/java/com/renderrichtext/events/ContextMenuItemPressEvent.kt +28 -28
  15. package/android/src/main/java/com/renderrichtext/events/CopyPressEvent.kt +24 -24
  16. package/android/src/main/java/com/renderrichtext/events/ImagePressEvent.kt +25 -25
  17. package/android/src/main/java/com/renderrichtext/events/LatexErrorEvent.kt +29 -29
  18. package/android/src/main/java/com/renderrichtext/events/LinkLongPressEvent.kt +23 -23
  19. package/android/src/main/java/com/renderrichtext/events/LinkPressEvent.kt +23 -23
  20. package/android/src/main/java/com/renderrichtext/events/MentionLongPressEvent.kt +25 -25
  21. package/android/src/main/java/com/renderrichtext/events/MentionPressEvent.kt +25 -25
  22. package/android/src/main/java/com/renderrichtext/events/TaskListItemPressEvent.kt +26 -26
  23. package/android/src/main/java/com/renderrichtext/math/LatexErrorReporter.kt +9 -9
  24. package/android/src/main/java/com/renderrichtext/parser/Parser.kt +59 -59
  25. package/android/src/main/java/com/renderrichtext/parser/TextLinkMatching.kt +35 -35
  26. package/android/src/main/java/com/renderrichtext/renderer/BaselineShiftRenderer.kt +45 -45
  27. package/android/src/main/java/com/renderrichtext/renderer/BlankLineRenderer.kt +39 -39
  28. package/android/src/main/java/com/renderrichtext/renderer/BlockquoteRenderer.kt +243 -243
  29. package/android/src/main/java/com/renderrichtext/renderer/BlockquoteTextRenderer.kt +56 -56
  30. package/android/src/main/java/com/renderrichtext/renderer/CodeBlockRenderer.kt +135 -135
  31. package/android/src/main/java/com/renderrichtext/renderer/CodeRenderer.kt +37 -37
  32. package/android/src/main/java/com/renderrichtext/renderer/EmphasisRenderer.kt +28 -28
  33. package/android/src/main/java/com/renderrichtext/renderer/HeadingRenderer.kt +81 -81
  34. package/android/src/main/java/com/renderrichtext/renderer/HighlightRenderer.kt +26 -26
  35. package/android/src/main/java/com/renderrichtext/renderer/LineBreakRenderer.kt +17 -17
  36. package/android/src/main/java/com/renderrichtext/renderer/LinkRenderer.kt +90 -90
  37. package/android/src/main/java/com/renderrichtext/renderer/ListContextManager.kt +109 -109
  38. package/android/src/main/java/com/renderrichtext/renderer/ListItemRenderer.kt +211 -211
  39. package/android/src/main/java/com/renderrichtext/renderer/ListRenderer.kt +133 -133
  40. package/android/src/main/java/com/renderrichtext/renderer/MentionRenderer.kt +85 -85
  41. package/android/src/main/java/com/renderrichtext/renderer/ParagraphRenderer.kt +91 -91
  42. package/android/src/main/java/com/renderrichtext/renderer/Renderer.kt +148 -148
  43. package/android/src/main/java/com/renderrichtext/renderer/SoftBreakRenderer.kt +17 -17
  44. package/android/src/main/java/com/renderrichtext/renderer/SpanStyleCache.kt +143 -143
  45. package/android/src/main/java/com/renderrichtext/renderer/StrikethroughRenderer.kt +28 -28
  46. package/android/src/main/java/com/renderrichtext/renderer/StrongRenderer.kt +28 -28
  47. package/android/src/main/java/com/renderrichtext/renderer/TextRenderer.kt +31 -31
  48. package/android/src/main/java/com/renderrichtext/renderer/ThematicBreakRenderer.kt +46 -46
  49. package/android/src/main/java/com/renderrichtext/renderer/UnderlineRenderer.kt +28 -28
  50. package/android/src/main/java/com/renderrichtext/spans/BaseListSpan.kt +164 -164
  51. package/android/src/main/java/com/renderrichtext/spans/BaselineShiftSpan.kt +27 -27
  52. package/android/src/main/java/com/renderrichtext/spans/BlockquoteSpan.kt +302 -302
  53. package/android/src/main/java/com/renderrichtext/spans/CodeBackgroundSpan.kt +205 -205
  54. package/android/src/main/java/com/renderrichtext/spans/CodeBlockSpan.kt +216 -216
  55. package/android/src/main/java/com/renderrichtext/spans/CodeSpan.kt +32 -32
  56. package/android/src/main/java/com/renderrichtext/spans/EmphasisSpan.kt +42 -42
  57. package/android/src/main/java/com/renderrichtext/spans/FadeInSpan.kt +29 -29
  58. package/android/src/main/java/com/renderrichtext/spans/HeadingSpan.kt +38 -38
  59. package/android/src/main/java/com/renderrichtext/spans/HighlightSpan.kt +80 -80
  60. package/android/src/main/java/com/renderrichtext/spans/ImageSpan.kt +481 -481
  61. package/android/src/main/java/com/renderrichtext/spans/InlineBackgroundGeometry.kt +42 -42
  62. package/android/src/main/java/com/renderrichtext/spans/LineHeightSpan.kt +39 -39
  63. package/android/src/main/java/com/renderrichtext/spans/LinkPillIconCache.kt +154 -154
  64. package/android/src/main/java/com/renderrichtext/spans/LinkPillSpan.kt +381 -381
  65. package/android/src/main/java/com/renderrichtext/spans/LinkSpan.kt +68 -68
  66. package/android/src/main/java/com/renderrichtext/spans/ListItemSpacingSpan.kt +33 -33
  67. package/android/src/main/java/com/renderrichtext/spans/ListMarkerAnchorSpan.kt +38 -38
  68. package/android/src/main/java/com/renderrichtext/spans/MarginBottomSpan.kt +76 -76
  69. package/android/src/main/java/com/renderrichtext/spans/MentionChipSpan.kt +132 -132
  70. package/android/src/main/java/com/renderrichtext/spans/MentionSpan.kt +46 -46
  71. package/android/src/main/java/com/renderrichtext/spans/OrderedListSpan.kt +127 -127
  72. package/android/src/main/java/com/renderrichtext/spans/SpoilerSpan.kt +33 -33
  73. package/android/src/main/java/com/renderrichtext/spans/StrikethroughSpan.kt +12 -12
  74. package/android/src/main/java/com/renderrichtext/spans/StrongSpan.kt +39 -39
  75. package/android/src/main/java/com/renderrichtext/spans/TaskListSpan.kt +143 -143
  76. package/android/src/main/java/com/renderrichtext/spans/TextSpan.kt +26 -26
  77. package/android/src/main/java/com/renderrichtext/spans/ThematicBreakSpan.kt +69 -69
  78. package/android/src/main/java/com/renderrichtext/spans/UnorderedListSpan.kt +96 -96
  79. package/android/src/main/java/com/renderrichtext/spoiler/SpoilerStubs.kt +46 -46
  80. package/android/src/main/java/com/renderrichtext/styles/BaseBlockStyle.kt +11 -11
  81. package/android/src/main/java/com/renderrichtext/styles/BlockquoteStyle.kt +83 -83
  82. package/android/src/main/java/com/renderrichtext/styles/CodeBlockStyle.kt +80 -80
  83. package/android/src/main/java/com/renderrichtext/styles/CodeStyle.kt +26 -26
  84. package/android/src/main/java/com/renderrichtext/styles/EmphasisStyle.kt +21 -21
  85. package/android/src/main/java/com/renderrichtext/styles/FactoidStyle.kt +21 -21
  86. package/android/src/main/java/com/renderrichtext/styles/HeadingStyle.kt +33 -33
  87. package/android/src/main/java/com/renderrichtext/styles/HighlightStyle.kt +19 -19
  88. package/android/src/main/java/com/renderrichtext/styles/ImageStyle.kt +29 -29
  89. package/android/src/main/java/com/renderrichtext/styles/InlineImageStyle.kt +17 -17
  90. package/android/src/main/java/com/renderrichtext/styles/InlineMathStyle.kt +17 -17
  91. package/android/src/main/java/com/renderrichtext/styles/LinkPillContent.kt +36 -36
  92. package/android/src/main/java/com/renderrichtext/styles/LinkPillStyle.kt +44 -44
  93. package/android/src/main/java/com/renderrichtext/styles/LinkStyle.kt +23 -23
  94. package/android/src/main/java/com/renderrichtext/styles/LinkVariantEntry.kt +34 -34
  95. package/android/src/main/java/com/renderrichtext/styles/ListStyle.kt +65 -65
  96. package/android/src/main/java/com/renderrichtext/styles/MathStyle.kt +29 -29
  97. package/android/src/main/java/com/renderrichtext/styles/MentionStyle.kt +19 -19
  98. package/android/src/main/java/com/renderrichtext/styles/ParagraphStyle.kt +33 -33
  99. package/android/src/main/java/com/renderrichtext/styles/SpoilerStyle.kt +27 -27
  100. package/android/src/main/java/com/renderrichtext/styles/StrikethroughStyle.kt +17 -17
  101. package/android/src/main/java/com/renderrichtext/styles/StrongStyle.kt +21 -21
  102. package/android/src/main/java/com/renderrichtext/styles/StyleConfig.kt +411 -411
  103. package/android/src/main/java/com/renderrichtext/styles/StyleParser.kt +92 -92
  104. package/android/src/main/java/com/renderrichtext/styles/SubscriptStyle.kt +16 -16
  105. package/android/src/main/java/com/renderrichtext/styles/SuperscriptStyle.kt +16 -16
  106. package/android/src/main/java/com/renderrichtext/styles/TableStyle.kt +75 -75
  107. package/android/src/main/java/com/renderrichtext/styles/TaskListStyle.kt +29 -29
  108. package/android/src/main/java/com/renderrichtext/styles/TextAlignment.kt +32 -32
  109. package/android/src/main/java/com/renderrichtext/styles/ThematicBreakStyle.kt +23 -23
  110. package/android/src/main/java/com/renderrichtext/styles/UnderlineStyle.kt +17 -17
  111. package/android/src/main/java/com/renderrichtext/styles/VideoStyle.kt +31 -31
  112. package/android/src/main/java/com/renderrichtext/utils/common/BorderStyleUtils.kt +86 -86
  113. package/android/src/main/java/com/renderrichtext/utils/common/BreakStrategyUtils.kt +32 -32
  114. package/android/src/main/java/com/renderrichtext/utils/common/CodeBlockHighlighter.kt +36 -36
  115. package/android/src/main/java/com/renderrichtext/utils/common/CodeBlockNode.kt +42 -42
  116. package/android/src/main/java/com/renderrichtext/utils/common/EllipsizeUtils.kt +27 -27
  117. package/android/src/main/java/com/renderrichtext/utils/common/EnrichedTiptapAncestorUtils.kt +10 -10
  118. package/android/src/main/java/com/renderrichtext/utils/common/FeatureFlags.kt +9 -9
  119. package/android/src/main/java/com/renderrichtext/utils/common/LinkRecognitionProps.kt +31 -31
  120. package/android/src/main/java/com/renderrichtext/utils/common/LinkRegexConfig.kt +56 -56
  121. package/android/src/main/java/com/renderrichtext/utils/common/MotionPreferences.kt +18 -18
  122. package/android/src/main/java/com/renderrichtext/utils/common/ReadableMapExtensions.kt +28 -28
  123. package/android/src/main/java/com/renderrichtext/utils/common/layout/RTLUtils.kt +6 -6
  124. package/android/src/main/java/com/renderrichtext/utils/common/serialization/TiptapASTSerializer.kt +368 -368
  125. package/android/src/main/java/com/renderrichtext/utils/text/ImageCache.kt +88 -88
  126. package/android/src/main/java/com/renderrichtext/utils/text/ImageDownloader.kt +203 -203
  127. package/android/src/main/java/com/renderrichtext/utils/text/LocalImageLoader.kt +167 -167
  128. package/android/src/main/java/com/renderrichtext/utils/text/TailFadeInAnimator.kt +84 -84
  129. package/android/src/main/java/com/renderrichtext/utils/text/conversion/HTMLGenerator.kt +1105 -1105
  130. package/android/src/main/java/com/renderrichtext/utils/text/conversion/TiptapExtractor.kt +423 -423
  131. package/android/src/main/java/com/renderrichtext/utils/text/extensions/ParagraphUtils.kt +9 -9
  132. package/android/src/main/java/com/renderrichtext/utils/text/extensions/SpannableExtensions.kt +9 -9
  133. package/android/src/main/java/com/renderrichtext/utils/text/extensions/TextPaintExtensions.kt +76 -76
  134. package/android/src/main/java/com/renderrichtext/utils/text/interaction/CheckboxTouchHelper.kt +61 -61
  135. package/android/src/main/java/com/renderrichtext/utils/text/interaction/TaskListTapUtils.kt +286 -286
  136. package/android/src/main/java/com/renderrichtext/utils/text/span/ApplyLineHeight.kt +39 -39
  137. package/android/src/main/java/com/renderrichtext/utils/text/span/BlockSpacing.kt +142 -142
  138. package/android/src/main/java/com/renderrichtext/utils/text/span/SpanFlags.kt +43 -43
  139. package/android/src/main/java/com/renderrichtext/utils/text/span/WidthAwareSpans.kt +30 -30
  140. package/android/src/main/java/com/renderrichtext/utils/text/view/CodeBlockPressHost.kt +15 -15
  141. package/android/src/main/java/com/renderrichtext/utils/text/view/ImagePressHost.kt +19 -19
  142. package/android/src/main/java/com/renderrichtext/utils/text/view/SelectionActionMode.kt +235 -235
  143. package/android/src/main/java/com/renderrichtext/utils/text/view/TextSelectionColors.kt +48 -48
  144. package/android/src/main/java/com/renderrichtext/utils/text/view/TextViewSetup.kt +119 -119
  145. package/android/src/main/java/com/renderrichtext/views/ContextMenuPopup.kt +217 -217
  146. package/android/src/main/java/com/renderrichtext/views/CopyGlyph.kt +101 -101
  147. package/android/src/main/java/com/renderrichtext/views/WrapGlyph.kt +40 -40
  148. package/android/src/main/jni/CMakeLists.txt +52 -52
  149. package/android/src/main/jni/react/renderer/components/RichTextSpec/ComponentDescriptors.h +30 -30
  150. package/android/src/main/jni/react/renderer/components/RichTextSpec/TiptapTextComponentDescriptor.h +29 -29
  151. package/android/src/main/jni/react/renderer/components/RichTextSpec/TiptapTextMeasurementManager.cpp +45 -45
  152. package/android/src/main/jni/react/renderer/components/RichTextSpec/TiptapTextMeasurementManager.h +21 -21
  153. package/android/src/main/jni/react/renderer/components/RichTextSpec/TiptapTextShadowNode.cpp +38 -38
  154. package/android/src/main/jni/react/renderer/components/RichTextSpec/TiptapTextShadowNode.h +53 -53
  155. package/android/src/main/jni/react/renderer/components/RichTextSpec/TiptapTextState.cpp +9 -9
  156. package/android/src/main/jni/react/renderer/components/RichTextSpec/TiptapTextState.h +24 -24
  157. package/android/src/main/jni/react/renderer/components/RichTextSpec/conversions.h +40 -40
  158. package/cpp/parser/TiptapParser.hpp +13 -13
  159. package/cpp/vendor/nlohmann/json.hpp +24765 -24765
  160. package/ios/EnrichedTiptapText.h +27 -27
  161. package/ios/attachments/ENRMImageAttachment.h +51 -51
  162. package/ios/attachments/ENRMImageAttachment.m +398 -398
  163. package/ios/attachments/ENRMLinkPillAttachment.h +47 -47
  164. package/ios/attachments/ENRMLinkPillAttachment.m +324 -324
  165. package/ios/attachments/ENRMLinkPillIconCache.h +28 -28
  166. package/ios/attachments/ENRMLinkPillIconCache.m +181 -181
  167. package/ios/attachments/ENRMLinkPillText.h +27 -27
  168. package/ios/attachments/ENRMLinkPillText.m +118 -118
  169. package/ios/attachments/ENRMMathInlineAttachment.h +7 -7
  170. package/ios/attachments/ENRMMathInlineAttachment.m +4 -4
  171. package/ios/attachments/ThematicBreakAttachment.h +15 -15
  172. package/ios/attachments/ThematicBreakAttachment.m +33 -33
  173. package/ios/internals/ENRMViewFreeMeasurement.h +208 -208
  174. package/ios/internals/EnrichedTiptapTextComponentDescriptor.h +19 -19
  175. package/ios/internals/EnrichedTiptapTextShadowNode.h +43 -43
  176. package/ios/internals/EnrichedTiptapTextShadowNode.mm +69 -69
  177. package/ios/internals/EnrichedTiptapTextState.h +24 -24
  178. package/ios/internals/MeasurementCache.h +308 -308
  179. package/ios/internals/ShadowMeasurementUtils.h +145 -145
  180. package/ios/parser/ENRMTextLinkAttributes.h +7 -7
  181. package/ios/parser/ENRMTiptapParser.h +33 -33
  182. package/ios/parser/ENRMTiptapParser.mm +73 -73
  183. package/ios/parser/TiptapASTNode.m +52 -52
  184. package/ios/renderer/AttributedRenderer.h +23 -23
  185. package/ios/renderer/AttributedRenderer.m +229 -229
  186. package/ios/renderer/BaseRenderer.h +33 -33
  187. package/ios/renderer/BaseRenderer.m +46 -46
  188. package/ios/renderer/BaselineShiftTextAttributes.h +10 -10
  189. package/ios/renderer/BaselineShiftTextAttributes.m +26 -26
  190. package/ios/renderer/BlankLineRenderer.h +4 -4
  191. package/ios/renderer/BlankLineRenderer.m +51 -51
  192. package/ios/renderer/BlockquoteRenderer.h +6 -6
  193. package/ios/renderer/BlockquoteRenderer.m +258 -258
  194. package/ios/renderer/CodeBlockRenderer.h +9 -9
  195. package/ios/renderer/CodeBlockRenderer.m +99 -99
  196. package/ios/renderer/CodeRenderer.h +9 -9
  197. package/ios/renderer/CodeRenderer.m +69 -69
  198. package/ios/renderer/ENRMBlockquoteTextRenderer.h +25 -25
  199. package/ios/renderer/ENRMBlockquoteTextRenderer.m +48 -48
  200. package/ios/renderer/EmphasisRenderer.h +5 -5
  201. package/ios/renderer/EmphasisRenderer.m +99 -99
  202. package/ios/renderer/HeadingRenderer.h +6 -6
  203. package/ios/renderer/HeadingRenderer.m +102 -102
  204. package/ios/renderer/HighlightRenderer.h +7 -7
  205. package/ios/renderer/HighlightRenderer.m +33 -33
  206. package/ios/renderer/LinkRenderer.h +6 -6
  207. package/ios/renderer/LinkRenderer.m +157 -157
  208. package/ios/renderer/ListItemRenderer.h +24 -24
  209. package/ios/renderer/ListItemRenderer.m +283 -283
  210. package/ios/renderer/ListRenderer.h +13 -13
  211. package/ios/renderer/ListRenderer.m +126 -126
  212. package/ios/renderer/MentionRenderer.h +9 -9
  213. package/ios/renderer/MentionRenderer.m +96 -96
  214. package/ios/renderer/NodeRenderer.h +8 -8
  215. package/ios/renderer/ParagraphRenderer.h +6 -6
  216. package/ios/renderer/ParagraphRenderer.m +85 -85
  217. package/ios/renderer/RenderContext.h +145 -145
  218. package/ios/renderer/RenderContext.m +402 -402
  219. package/ios/renderer/RendererFactory.h +12 -12
  220. package/ios/renderer/StrikethroughRenderer.h +5 -5
  221. package/ios/renderer/StrikethroughRenderer.m +30 -30
  222. package/ios/renderer/StrongRenderer.h +5 -5
  223. package/ios/renderer/StrongRenderer.m +87 -87
  224. package/ios/renderer/TextRenderer.h +6 -6
  225. package/ios/renderer/TextRenderer.m +18 -18
  226. package/ios/renderer/ThematicBreakRenderer.h +4 -4
  227. package/ios/renderer/ThematicBreakRenderer.m +41 -41
  228. package/ios/renderer/UnderlineRenderer.h +4 -4
  229. package/ios/renderer/UnderlineRenderer.m +41 -41
  230. package/ios/styles/ENRMFontSlot.h +12 -12
  231. package/ios/styles/ENRMFontSlot.m +24 -24
  232. package/ios/styles/StyleConfig.h +488 -488
  233. package/ios/styles/StyleConfig.mm +2820 -2820
  234. package/ios/utils/AccessibilityInfo.h +35 -35
  235. package/ios/utils/AccessibilityInfo.m +24 -24
  236. package/ios/utils/BlockquoteBorder.h +26 -26
  237. package/ios/utils/BlockquoteBorder.m +294 -294
  238. package/ios/utils/CodeBackground.h +19 -19
  239. package/ios/utils/CodeBackground.m +196 -196
  240. package/ios/utils/CodeBlockBackground.h +17 -17
  241. package/ios/utils/CodeBlockBackground.m +102 -102
  242. package/ios/utils/ContextMenuUtils.h +76 -76
  243. package/ios/utils/ContextMenuUtils.mm +75 -75
  244. package/ios/utils/ENRMAccessibilityLabels.h +40 -40
  245. package/ios/utils/ENRMAccessibilityLabels.m +5 -5
  246. package/ios/utils/ENRMAsyncRenderCoordinator.h +24 -24
  247. package/ios/utils/ENRMAsyncRenderCoordinator.m +37 -37
  248. package/ios/utils/ENRMAtomicSize.h +65 -65
  249. package/ios/utils/ENRMCodeBlockContent.h +37 -37
  250. package/ios/utils/ENRMCodeBlockContent.mm +89 -89
  251. package/ios/utils/ENRMFeatureFlags.h +25 -25
  252. package/ios/utils/ENRMImageDownloader.h +30 -30
  253. package/ios/utils/ENRMImageDownloader.m +168 -168
  254. package/ios/utils/ENRMLatexErrorCoordinator.h +27 -27
  255. package/ios/utils/ENRMLatexErrorCoordinator.mm +75 -75
  256. package/ios/utils/ENRMLatexErrorReporting.h +13 -13
  257. package/ios/utils/ENRMLinkContextMenus.h +93 -93
  258. package/ios/utils/ENRMLinkContextMenus.m +178 -178
  259. package/ios/utils/ENRMLinkRegexConfig.h +30 -30
  260. package/ios/utils/ENRMLinkRegexConfig.mm +104 -104
  261. package/ios/utils/ENRMLinkRegexProps.h +23 -23
  262. package/ios/utils/ENRMLocalImageLoader.h +35 -35
  263. package/ios/utils/ENRMLocalImageLoader.m +111 -111
  264. package/ios/utils/ENRMMenuAction.h +27 -27
  265. package/ios/utils/ENRMMenuAction.m +33 -33
  266. package/ios/utils/ENRMSpoilerOverlayManager.h +15 -15
  267. package/ios/utils/ENRMSpoilerOverlayManager.m +19 -19
  268. package/ios/utils/ENRMSpoilerTapUtils.h +6 -6
  269. package/ios/utils/ENRMSpoilerTapUtils.m +11 -11
  270. package/ios/utils/ENRMTailFadeInAnimator.h +16 -16
  271. package/ios/utils/ENRMTailFadeInAnimator.m +161 -161
  272. package/ios/utils/ENRMTextHitTest.h +23 -23
  273. package/ios/utils/ENRMTextHitTest.m +20 -20
  274. package/ios/utils/ENRMTextInteractionUtils.h +20 -20
  275. package/ios/utils/ENRMTextInteractionUtils.m +15 -15
  276. package/ios/utils/ENRMTextRenderer.h +38 -38
  277. package/ios/utils/ENRMTextRenderer.m +54 -54
  278. package/ios/utils/ENRMTextViewSetup.h +132 -132
  279. package/ios/utils/ENRMUIKit.h +429 -429
  280. package/ios/utils/EditMenuUtils.h +105 -105
  281. package/ios/utils/EditMenuUtils.m +143 -143
  282. package/ios/utils/FontScaleObserver.h +10 -10
  283. package/ios/utils/FontScaleObserver.m +55 -55
  284. package/ios/utils/FontUtils.h +31 -31
  285. package/ios/utils/FontUtils.m +63 -63
  286. package/ios/utils/HTMLGenerator.h +25 -25
  287. package/ios/utils/HTMLGenerator.m +1041 -1041
  288. package/ios/utils/HeightUpdateUtils.h +25 -25
  289. package/ios/utils/ImageRequestHeaderUtils.h +35 -35
  290. package/ios/utils/LastElementUtils.h +97 -97
  291. package/ios/utils/LinkContextMenuUtils.h +55 -55
  292. package/ios/utils/LinkPillContentUtils.h +46 -46
  293. package/ios/utils/ListMarkerDrawer.h +15 -15
  294. package/ios/utils/ListMarkerDrawer.m +239 -239
  295. package/ios/utils/MentionBackground.h +26 -26
  296. package/ios/utils/MentionBackground.m +86 -86
  297. package/ios/utils/ParagraphStyleUtils.h +87 -87
  298. package/ios/utils/ParagraphStyleUtils.m +484 -484
  299. package/ios/utils/PasteboardUtils.h +48 -48
  300. package/ios/utils/PasteboardUtils.m +166 -166
  301. package/ios/utils/RTFExportUtils.h +24 -24
  302. package/ios/utils/RTFExportUtils.m +299 -299
  303. package/ios/utils/SelectionColorUtils.h +14 -14
  304. package/ios/utils/StylePropsUtils.h +1340 -1340
  305. package/ios/utils/TaskListTapUtils.h +6 -6
  306. package/ios/utils/TaskListTapUtils.m +14 -14
  307. package/ios/utils/TextViewLayoutManager.h +14 -14
  308. package/ios/utils/TiptapAccessibilityElementBuilder.h +43 -43
  309. package/ios/utils/TiptapAccessibilityElementBuilder.m +432 -432
  310. package/ios/utils/TiptapExtractor.h +17 -17
  311. package/ios/utils/TiptapExtractor.m +367 -367
  312. package/ios/views/ENRMTiptapTextView.h +25 -25
  313. package/ios/views/ENRMTiptapTextView.m +247 -247
  314. package/package.json +65 -70
  315. package/react-native.config.js +10 -10
  316. package/src/admonitionDefaults.ts +58 -58
  317. package/src/darkModeTextStyle.ts +99 -99
  318. package/src/headingDefaults.ts +21 -21
  319. package/src/index.tsx +4 -4
  320. package/src/linkVariantUtils.ts +120 -120
  321. package/src/normalizeTiptapStyle.ts +397 -397
  322. package/src/rn-globals.d.ts +1 -1
  323. package/src/styleUtils.ts +107 -107
  324. package/src/types/TiptapStyle.ts +532 -532
  325. package/src/types/TiptapStyleInternal.ts +299 -299
  326. package/src/types/linkPill.ts +9 -9
  327. package/src/utils/isDev.ts +4 -4
@@ -1,1340 +1,1340 @@
1
- #pragma once
2
- #import "ENRMUIKit.h"
3
-
4
- /**
5
- * StylePropsHelper.h
6
- *
7
- * C++ template that maps codegen-generated tiptapStyle props to StyleConfig setters.
8
- */
9
-
10
- #import "ParagraphStyleUtils.h"
11
- #import "StyleConfig.h"
12
- #import <React/RCTConversions.h>
13
-
14
- template <typename TiptapStyle>
15
- BOOL applyTiptapStyleToConfig(StyleConfig *config, const TiptapStyle &newStyle, const TiptapStyle &oldStyle)
16
- {
17
- BOOL changed = NO;
18
-
19
- // ── Paragraph ──────────────────────────────────────────────────────────────
20
-
21
- if (newStyle.paragraph.fontSize != oldStyle.paragraph.fontSize) {
22
- [config setParagraphFontSize:newStyle.paragraph.fontSize];
23
- changed = YES;
24
- }
25
-
26
- if (newStyle.paragraph.fontFamily != oldStyle.paragraph.fontFamily) {
27
- if (!newStyle.paragraph.fontFamily.empty()) {
28
- NSString *fontFamily = [[NSString alloc] initWithUTF8String:newStyle.paragraph.fontFamily.c_str()];
29
- [config setParagraphFontFamily:fontFamily];
30
- } else {
31
- [config setParagraphFontFamily:nullptr];
32
- }
33
- changed = YES;
34
- }
35
-
36
- if (newStyle.paragraph.fontWeight != oldStyle.paragraph.fontWeight) {
37
- if (!newStyle.paragraph.fontWeight.empty()) {
38
- NSString *fontWeight = [[NSString alloc] initWithUTF8String:newStyle.paragraph.fontWeight.c_str()];
39
- [config setParagraphFontWeight:fontWeight];
40
- } else {
41
- [config setParagraphFontWeight:nullptr];
42
- }
43
- changed = YES;
44
- }
45
-
46
- if (newStyle.paragraph.color != oldStyle.paragraph.color) {
47
- if (newStyle.paragraph.color) {
48
- RCTUIColor *paragraphColor = RCTUIColorFromSharedColor(newStyle.paragraph.color);
49
- [config setParagraphColor:paragraphColor];
50
- } else {
51
- [config setParagraphColor:nullptr];
52
- }
53
- changed = YES;
54
- }
55
-
56
- if (newStyle.paragraph.marginTop != oldStyle.paragraph.marginTop) {
57
- [config setParagraphMarginTop:newStyle.paragraph.marginTop];
58
- changed = YES;
59
- }
60
-
61
- if (newStyle.paragraph.marginBottom != oldStyle.paragraph.marginBottom) {
62
- [config setParagraphMarginBottom:newStyle.paragraph.marginBottom];
63
- changed = YES;
64
- }
65
-
66
- if (newStyle.paragraph.lineHeight != oldStyle.paragraph.lineHeight) {
67
- [config setParagraphLineHeight:newStyle.paragraph.lineHeight];
68
- changed = YES;
69
- }
70
-
71
- if (newStyle.paragraph.textAlign != oldStyle.paragraph.textAlign) {
72
- [config setParagraphTextAlign:textAlignmentFromString(@(newStyle.paragraph.textAlign.c_str()))];
73
- changed = YES;
74
- }
75
-
76
- // ── H1 ─────────────────────────────────────────────────────────────────────
77
-
78
- if (newStyle.h1.fontSize != oldStyle.h1.fontSize) {
79
- [config setH1FontSize:newStyle.h1.fontSize];
80
- changed = YES;
81
- }
82
-
83
- if (newStyle.h1.fontFamily != oldStyle.h1.fontFamily) {
84
- if (!newStyle.h1.fontFamily.empty()) {
85
- NSString *fontFamily = [[NSString alloc] initWithUTF8String:newStyle.h1.fontFamily.c_str()];
86
- [config setH1FontFamily:fontFamily];
87
- } else {
88
- [config setH1FontFamily:nullptr];
89
- }
90
- changed = YES;
91
- }
92
-
93
- if (newStyle.h1.fontWeight != oldStyle.h1.fontWeight) {
94
- if (!newStyle.h1.fontWeight.empty()) {
95
- NSString *fontWeight = [[NSString alloc] initWithUTF8String:newStyle.h1.fontWeight.c_str()];
96
- [config setH1FontWeight:fontWeight];
97
- } else {
98
- [config setH1FontWeight:nullptr];
99
- }
100
- changed = YES;
101
- }
102
-
103
- if (newStyle.h1.color != oldStyle.h1.color) {
104
- if (newStyle.h1.color) {
105
- RCTUIColor *h1Color = RCTUIColorFromSharedColor(newStyle.h1.color);
106
- [config setH1Color:h1Color];
107
- } else {
108
- [config setH1Color:nullptr];
109
- }
110
- changed = YES;
111
- }
112
-
113
- if (newStyle.h1.marginTop != oldStyle.h1.marginTop) {
114
- [config setH1MarginTop:newStyle.h1.marginTop];
115
- changed = YES;
116
- }
117
-
118
- if (newStyle.h1.marginBottom != oldStyle.h1.marginBottom) {
119
- [config setH1MarginBottom:newStyle.h1.marginBottom];
120
- changed = YES;
121
- }
122
-
123
- if (newStyle.h1.lineHeight != oldStyle.h1.lineHeight) {
124
- [config setH1LineHeight:newStyle.h1.lineHeight];
125
- changed = YES;
126
- }
127
-
128
- if (newStyle.h1.textAlign != oldStyle.h1.textAlign) {
129
- [config setH1TextAlign:textAlignmentFromString(@(newStyle.h1.textAlign.c_str()))];
130
- changed = YES;
131
- }
132
-
133
- // ── H2 ─────────────────────────────────────────────────────────────────────
134
-
135
- if (newStyle.h2.fontSize != oldStyle.h2.fontSize) {
136
- [config setH2FontSize:newStyle.h2.fontSize];
137
- changed = YES;
138
- }
139
-
140
- if (newStyle.h2.fontFamily != oldStyle.h2.fontFamily) {
141
- if (!newStyle.h2.fontFamily.empty()) {
142
- NSString *fontFamily = [[NSString alloc] initWithUTF8String:newStyle.h2.fontFamily.c_str()];
143
- [config setH2FontFamily:fontFamily];
144
- } else {
145
- [config setH2FontFamily:nullptr];
146
- }
147
- changed = YES;
148
- }
149
-
150
- if (newStyle.h2.fontWeight != oldStyle.h2.fontWeight) {
151
- if (!newStyle.h2.fontWeight.empty()) {
152
- NSString *fontWeight = [[NSString alloc] initWithUTF8String:newStyle.h2.fontWeight.c_str()];
153
- [config setH2FontWeight:fontWeight];
154
- } else {
155
- [config setH2FontWeight:nullptr];
156
- }
157
- changed = YES;
158
- }
159
-
160
- if (newStyle.h2.color != oldStyle.h2.color) {
161
- if (newStyle.h2.color) {
162
- RCTUIColor *h2Color = RCTUIColorFromSharedColor(newStyle.h2.color);
163
- [config setH2Color:h2Color];
164
- } else {
165
- [config setH2Color:nullptr];
166
- }
167
- changed = YES;
168
- }
169
-
170
- if (newStyle.h2.marginTop != oldStyle.h2.marginTop) {
171
- [config setH2MarginTop:newStyle.h2.marginTop];
172
- changed = YES;
173
- }
174
-
175
- if (newStyle.h2.marginBottom != oldStyle.h2.marginBottom) {
176
- [config setH2MarginBottom:newStyle.h2.marginBottom];
177
- changed = YES;
178
- }
179
-
180
- if (newStyle.h2.lineHeight != oldStyle.h2.lineHeight) {
181
- [config setH2LineHeight:newStyle.h2.lineHeight];
182
- changed = YES;
183
- }
184
-
185
- if (newStyle.h2.textAlign != oldStyle.h2.textAlign) {
186
- [config setH2TextAlign:textAlignmentFromString(@(newStyle.h2.textAlign.c_str()))];
187
- changed = YES;
188
- }
189
-
190
- // ── H3 ─────────────────────────────────────────────────────────────────────
191
-
192
- if (newStyle.h3.fontSize != oldStyle.h3.fontSize) {
193
- [config setH3FontSize:newStyle.h3.fontSize];
194
- changed = YES;
195
- }
196
-
197
- if (newStyle.h3.fontFamily != oldStyle.h3.fontFamily) {
198
- if (!newStyle.h3.fontFamily.empty()) {
199
- NSString *fontFamily = [[NSString alloc] initWithUTF8String:newStyle.h3.fontFamily.c_str()];
200
- [config setH3FontFamily:fontFamily];
201
- } else {
202
- [config setH3FontFamily:nullptr];
203
- }
204
- changed = YES;
205
- }
206
-
207
- if (newStyle.h3.fontWeight != oldStyle.h3.fontWeight) {
208
- if (!newStyle.h3.fontWeight.empty()) {
209
- NSString *fontWeight = [[NSString alloc] initWithUTF8String:newStyle.h3.fontWeight.c_str()];
210
- [config setH3FontWeight:fontWeight];
211
- } else {
212
- [config setH3FontWeight:nullptr];
213
- }
214
- changed = YES;
215
- }
216
-
217
- if (newStyle.h3.color != oldStyle.h3.color) {
218
- if (newStyle.h3.color) {
219
- RCTUIColor *h3Color = RCTUIColorFromSharedColor(newStyle.h3.color);
220
- [config setH3Color:h3Color];
221
- } else {
222
- [config setH3Color:nullptr];
223
- }
224
- changed = YES;
225
- }
226
-
227
- if (newStyle.h3.marginTop != oldStyle.h3.marginTop) {
228
- [config setH3MarginTop:newStyle.h3.marginTop];
229
- changed = YES;
230
- }
231
-
232
- if (newStyle.h3.marginBottom != oldStyle.h3.marginBottom) {
233
- [config setH3MarginBottom:newStyle.h3.marginBottom];
234
- changed = YES;
235
- }
236
-
237
- if (newStyle.h3.lineHeight != oldStyle.h3.lineHeight) {
238
- [config setH3LineHeight:newStyle.h3.lineHeight];
239
- changed = YES;
240
- }
241
-
242
- if (newStyle.h3.textAlign != oldStyle.h3.textAlign) {
243
- [config setH3TextAlign:textAlignmentFromString(@(newStyle.h3.textAlign.c_str()))];
244
- changed = YES;
245
- }
246
-
247
- // ── H4 ─────────────────────────────────────────────────────────────────────
248
-
249
- if (newStyle.h4.fontSize != oldStyle.h4.fontSize) {
250
- [config setH4FontSize:newStyle.h4.fontSize];
251
- changed = YES;
252
- }
253
-
254
- if (newStyle.h4.fontFamily != oldStyle.h4.fontFamily) {
255
- if (!newStyle.h4.fontFamily.empty()) {
256
- NSString *fontFamily = [[NSString alloc] initWithUTF8String:newStyle.h4.fontFamily.c_str()];
257
- [config setH4FontFamily:fontFamily];
258
- } else {
259
- [config setH4FontFamily:nullptr];
260
- }
261
- changed = YES;
262
- }
263
-
264
- if (newStyle.h4.fontWeight != oldStyle.h4.fontWeight) {
265
- if (!newStyle.h4.fontWeight.empty()) {
266
- NSString *fontWeight = [[NSString alloc] initWithUTF8String:newStyle.h4.fontWeight.c_str()];
267
- [config setH4FontWeight:fontWeight];
268
- } else {
269
- [config setH4FontWeight:nullptr];
270
- }
271
- changed = YES;
272
- }
273
-
274
- if (newStyle.h4.color != oldStyle.h4.color) {
275
- if (newStyle.h4.color) {
276
- RCTUIColor *h4Color = RCTUIColorFromSharedColor(newStyle.h4.color);
277
- [config setH4Color:h4Color];
278
- } else {
279
- [config setH4Color:nullptr];
280
- }
281
- changed = YES;
282
- }
283
-
284
- if (newStyle.h4.marginTop != oldStyle.h4.marginTop) {
285
- [config setH4MarginTop:newStyle.h4.marginTop];
286
- changed = YES;
287
- }
288
-
289
- if (newStyle.h4.marginBottom != oldStyle.h4.marginBottom) {
290
- [config setH4MarginBottom:newStyle.h4.marginBottom];
291
- changed = YES;
292
- }
293
-
294
- if (newStyle.h4.lineHeight != oldStyle.h4.lineHeight) {
295
- [config setH4LineHeight:newStyle.h4.lineHeight];
296
- changed = YES;
297
- }
298
-
299
- if (newStyle.h4.textAlign != oldStyle.h4.textAlign) {
300
- [config setH4TextAlign:textAlignmentFromString(@(newStyle.h4.textAlign.c_str()))];
301
- changed = YES;
302
- }
303
-
304
- // ── H5 ─────────────────────────────────────────────────────────────────────
305
-
306
- if (newStyle.h5.fontSize != oldStyle.h5.fontSize) {
307
- [config setH5FontSize:newStyle.h5.fontSize];
308
- changed = YES;
309
- }
310
-
311
- if (newStyle.h5.fontFamily != oldStyle.h5.fontFamily) {
312
- if (!newStyle.h5.fontFamily.empty()) {
313
- NSString *fontFamily = [[NSString alloc] initWithUTF8String:newStyle.h5.fontFamily.c_str()];
314
- [config setH5FontFamily:fontFamily];
315
- } else {
316
- [config setH5FontFamily:nullptr];
317
- }
318
- changed = YES;
319
- }
320
-
321
- if (newStyle.h5.fontWeight != oldStyle.h5.fontWeight) {
322
- if (!newStyle.h5.fontWeight.empty()) {
323
- NSString *fontWeight = [[NSString alloc] initWithUTF8String:newStyle.h5.fontWeight.c_str()];
324
- [config setH5FontWeight:fontWeight];
325
- } else {
326
- [config setH5FontWeight:nullptr];
327
- }
328
- changed = YES;
329
- }
330
-
331
- if (newStyle.h5.color != oldStyle.h5.color) {
332
- if (newStyle.h5.color) {
333
- RCTUIColor *h5Color = RCTUIColorFromSharedColor(newStyle.h5.color);
334
- [config setH5Color:h5Color];
335
- } else {
336
- [config setH5Color:nullptr];
337
- }
338
- changed = YES;
339
- }
340
-
341
- if (newStyle.h5.marginTop != oldStyle.h5.marginTop) {
342
- [config setH5MarginTop:newStyle.h5.marginTop];
343
- changed = YES;
344
- }
345
-
346
- if (newStyle.h5.marginBottom != oldStyle.h5.marginBottom) {
347
- [config setH5MarginBottom:newStyle.h5.marginBottom];
348
- changed = YES;
349
- }
350
-
351
- if (newStyle.h5.lineHeight != oldStyle.h5.lineHeight) {
352
- [config setH5LineHeight:newStyle.h5.lineHeight];
353
- changed = YES;
354
- }
355
-
356
- if (newStyle.h5.textAlign != oldStyle.h5.textAlign) {
357
- [config setH5TextAlign:textAlignmentFromString(@(newStyle.h5.textAlign.c_str()))];
358
- changed = YES;
359
- }
360
-
361
- // ── H6 ─────────────────────────────────────────────────────────────────────
362
-
363
- if (newStyle.h6.fontSize != oldStyle.h6.fontSize) {
364
- [config setH6FontSize:newStyle.h6.fontSize];
365
- changed = YES;
366
- }
367
-
368
- if (newStyle.h6.fontFamily != oldStyle.h6.fontFamily) {
369
- if (!newStyle.h6.fontFamily.empty()) {
370
- NSString *fontFamily = [[NSString alloc] initWithUTF8String:newStyle.h6.fontFamily.c_str()];
371
- [config setH6FontFamily:fontFamily];
372
- } else {
373
- [config setH6FontFamily:nullptr];
374
- }
375
- changed = YES;
376
- }
377
-
378
- if (newStyle.h6.fontWeight != oldStyle.h6.fontWeight) {
379
- if (!newStyle.h6.fontWeight.empty()) {
380
- NSString *fontWeight = [[NSString alloc] initWithUTF8String:newStyle.h6.fontWeight.c_str()];
381
- [config setH6FontWeight:fontWeight];
382
- } else {
383
- [config setH6FontWeight:nullptr];
384
- }
385
- changed = YES;
386
- }
387
-
388
- if (newStyle.h6.color != oldStyle.h6.color) {
389
- if (newStyle.h6.color) {
390
- RCTUIColor *h6Color = RCTUIColorFromSharedColor(newStyle.h6.color);
391
- [config setH6Color:h6Color];
392
- } else {
393
- [config setH6Color:nullptr];
394
- }
395
- changed = YES;
396
- }
397
-
398
- if (newStyle.h6.marginTop != oldStyle.h6.marginTop) {
399
- [config setH6MarginTop:newStyle.h6.marginTop];
400
- changed = YES;
401
- }
402
-
403
- if (newStyle.h6.marginBottom != oldStyle.h6.marginBottom) {
404
- [config setH6MarginBottom:newStyle.h6.marginBottom];
405
- changed = YES;
406
- }
407
-
408
- if (newStyle.h6.lineHeight != oldStyle.h6.lineHeight) {
409
- [config setH6LineHeight:newStyle.h6.lineHeight];
410
- changed = YES;
411
- }
412
-
413
- if (newStyle.h6.textAlign != oldStyle.h6.textAlign) {
414
- [config setH6TextAlign:textAlignmentFromString(@(newStyle.h6.textAlign.c_str()))];
415
- changed = YES;
416
- }
417
-
418
- // ── Blockquote ─────────────────────────────────────────────────────────────
419
-
420
- if (newStyle.blockquote.fontSize != oldStyle.blockquote.fontSize) {
421
- [config setBlockquoteFontSize:newStyle.blockquote.fontSize];
422
- changed = YES;
423
- }
424
-
425
- if (newStyle.blockquote.fontFamily != oldStyle.blockquote.fontFamily) {
426
- NSString *fontFamily = [[NSString alloc] initWithUTF8String:newStyle.blockquote.fontFamily.c_str()];
427
- [config setBlockquoteFontFamily:fontFamily];
428
- changed = YES;
429
- }
430
-
431
- if (newStyle.blockquote.fontWeight != oldStyle.blockquote.fontWeight) {
432
- NSString *fontWeight = [[NSString alloc] initWithUTF8String:newStyle.blockquote.fontWeight.c_str()];
433
- [config setBlockquoteFontWeight:fontWeight];
434
- changed = YES;
435
- }
436
-
437
- if (newStyle.blockquote.color != oldStyle.blockquote.color) {
438
- RCTUIColor *blockquoteColor = RCTUIColorFromSharedColor(newStyle.blockquote.color);
439
- [config setBlockquoteColor:blockquoteColor];
440
- changed = YES;
441
- }
442
-
443
- if (newStyle.blockquote.marginTop != oldStyle.blockquote.marginTop) {
444
- [config setBlockquoteMarginTop:newStyle.blockquote.marginTop];
445
- changed = YES;
446
- }
447
-
448
- if (newStyle.blockquote.marginBottom != oldStyle.blockquote.marginBottom) {
449
- [config setBlockquoteMarginBottom:newStyle.blockquote.marginBottom];
450
- changed = YES;
451
- }
452
-
453
- if (newStyle.blockquote.lineHeight != oldStyle.blockquote.lineHeight) {
454
- [config setBlockquoteLineHeight:newStyle.blockquote.lineHeight];
455
- changed = YES;
456
- }
457
-
458
- if (newStyle.blockquote.borderColor != oldStyle.blockquote.borderColor) {
459
- RCTUIColor *blockquoteBorderColor = RCTUIColorFromSharedColor(newStyle.blockquote.borderColor);
460
- [config setBlockquoteBorderColor:blockquoteBorderColor];
461
- changed = YES;
462
- }
463
-
464
- if (newStyle.blockquote.borderWidth != oldStyle.blockquote.borderWidth) {
465
- [config setBlockquoteBorderWidth:newStyle.blockquote.borderWidth];
466
- changed = YES;
467
- }
468
-
469
- if (newStyle.blockquote.gapWidth != oldStyle.blockquote.gapWidth) {
470
- [config setBlockquoteGapWidth:newStyle.blockquote.gapWidth];
471
- changed = YES;
472
- }
473
-
474
- if (newStyle.blockquote.backgroundColor != oldStyle.blockquote.backgroundColor) {
475
- RCTUIColor *blockquoteBackgroundColor = RCTUIColorFromSharedColor(newStyle.blockquote.backgroundColor);
476
- [config setBlockquoteBackgroundColor:blockquoteBackgroundColor];
477
- changed = YES;
478
- }
479
-
480
- if (newStyle.blockquote.borderRadius != oldStyle.blockquote.borderRadius) {
481
- [config setBlockquoteBorderRadius:newStyle.blockquote.borderRadius];
482
- changed = YES;
483
- }
484
-
485
- if (newStyle.blockquote.padding != oldStyle.blockquote.padding) {
486
- [config setBlockquotePadding:newStyle.blockquote.padding];
487
- changed = YES;
488
- }
489
-
490
- const auto &newAdm = newStyle.blockquote.admonitions;
491
- const auto &oldAdm = oldStyle.blockquote.admonitions;
492
- BOOL admonitionsChanged =
493
- newAdm.note.color != oldAdm.note.color || newAdm.note.backgroundColor != oldAdm.note.backgroundColor ||
494
- newAdm.tip.color != oldAdm.tip.color || newAdm.tip.backgroundColor != oldAdm.tip.backgroundColor ||
495
- newAdm.important.color != oldAdm.important.color ||
496
- newAdm.important.backgroundColor != oldAdm.important.backgroundColor ||
497
- newAdm.warning.color != oldAdm.warning.color ||
498
- newAdm.warning.backgroundColor != oldAdm.warning.backgroundColor ||
499
- newAdm.caution.color != oldAdm.caution.color || newAdm.caution.backgroundColor != oldAdm.caution.backgroundColor;
500
- if (admonitionsChanged) {
501
- RCTUIColor *clear = [RCTUIColor clearColor];
502
- NSDictionary<NSString *, RCTUIColor *> *admonitionColors = @{
503
- @"note" : RCTUIColorFromSharedColor(newAdm.note.color) ?: clear,
504
- @"tip" : RCTUIColorFromSharedColor(newAdm.tip.color) ?: clear,
505
- @"important" : RCTUIColorFromSharedColor(newAdm.important.color) ?: clear,
506
- @"warning" : RCTUIColorFromSharedColor(newAdm.warning.color) ?: clear,
507
- @"caution" : RCTUIColorFromSharedColor(newAdm.caution.color) ?: clear,
508
- };
509
- NSDictionary<NSString *, RCTUIColor *> *admonitionBackgroundColors = @{
510
- @"note" : RCTUIColorFromSharedColor(newAdm.note.backgroundColor) ?: clear,
511
- @"tip" : RCTUIColorFromSharedColor(newAdm.tip.backgroundColor) ?: clear,
512
- @"important" : RCTUIColorFromSharedColor(newAdm.important.backgroundColor) ?: clear,
513
- @"warning" : RCTUIColorFromSharedColor(newAdm.warning.backgroundColor) ?: clear,
514
- @"caution" : RCTUIColorFromSharedColor(newAdm.caution.backgroundColor) ?: clear,
515
- };
516
- [config setAdmonitionColors:admonitionColors backgroundColors:admonitionBackgroundColors];
517
- changed = YES;
518
- }
519
-
520
- // ── Link ───────────────────────────────────────────────────────────────────
521
-
522
- if (newStyle.link.fontFamily != oldStyle.link.fontFamily) {
523
- if (!newStyle.link.fontFamily.empty()) {
524
- NSString *fontFamily = [[NSString alloc] initWithUTF8String:newStyle.link.fontFamily.c_str()];
525
- [config setLinkFontFamily:fontFamily];
526
- } else {
527
- [config setLinkFontFamily:nullptr];
528
- }
529
- changed = YES;
530
- }
531
-
532
- if (newStyle.link.color != oldStyle.link.color) {
533
- RCTUIColor *linkColor = RCTUIColorFromSharedColor(newStyle.link.color);
534
- [config setLinkColor:linkColor];
535
- changed = YES;
536
- }
537
-
538
- {
539
- BOOL newUnderline = newStyle.link.underline ? YES : NO;
540
- if (newStyle.link.underline != oldStyle.link.underline || [config linkUnderline] != newUnderline) {
541
- [config setLinkUnderline:newUnderline];
542
- changed = YES;
543
- }
544
- }
545
-
546
- if (newStyle.link.backgroundColor != oldStyle.link.backgroundColor) {
547
- RCTUIColor *color = RCTUIColorFromSharedColor(newStyle.link.backgroundColor);
548
- [config setLinkBackgroundColor:CGColorGetAlpha(color.CGColor) > 0 ? color : nil];
549
- changed = YES;
550
- }
551
-
552
- {
553
- BOOL linkVariantsChanged = newStyle.linkVariants.size() != oldStyle.linkVariants.size();
554
- if (!linkVariantsChanged) {
555
- for (size_t i = 0; i < newStyle.linkVariants.size(); i++) {
556
- const auto &newVariant = newStyle.linkVariants[i];
557
- const auto &oldVariant = oldStyle.linkVariants[i];
558
- if (newVariant.pattern != oldVariant.pattern || newVariant.color != oldVariant.color ||
559
- newVariant.underline != oldVariant.underline || newVariant.backgroundColor != oldVariant.backgroundColor ||
560
- newVariant.fontFamily != oldVariant.fontFamily || newVariant.pill.enabled != oldVariant.pill.enabled ||
561
- newVariant.pill.label != oldVariant.pill.label || newVariant.pill.iconUri != oldVariant.pill.iconUri ||
562
- newVariant.pill.iconTintColor != oldVariant.pill.iconTintColor ||
563
- newVariant.pill.borderRadius != oldVariant.pill.borderRadius ||
564
- newVariant.pill.paddingHorizontal != oldVariant.pill.paddingHorizontal ||
565
- newVariant.pill.paddingVertical != oldVariant.pill.paddingVertical ||
566
- newVariant.pill.lineHeight != oldVariant.pill.lineHeight ||
567
- newVariant.pill.borderWidth != oldVariant.pill.borderWidth ||
568
- newVariant.pill.borderColor != oldVariant.pill.borderColor ||
569
- newVariant.pill.maxWidth != oldVariant.pill.maxWidth) {
570
- linkVariantsChanged = YES;
571
- break;
572
- }
573
- }
574
- }
575
- if (linkVariantsChanged) {
576
- NSMutableArray<LinkVariantConfig *> *variants = [NSMutableArray array];
577
- for (const auto &entry : newStyle.linkVariants) {
578
- LinkVariantConfig *variant = [[LinkVariantConfig alloc] init];
579
- variant.pattern = [[NSString alloc] initWithUTF8String:entry.pattern.c_str()];
580
- variant.color = RCTUIColorFromSharedColor(entry.color);
581
- variant.underline = entry.underline;
582
- variant.fontFamily = [[NSString alloc] initWithUTF8String:entry.fontFamily.c_str()];
583
- if (entry.pill.enabled) {
584
- LinkPillConfig *pill = [[LinkPillConfig alloc] init];
585
- pill.label = [[NSString alloc] initWithUTF8String:entry.pill.label.c_str()];
586
- pill.iconUri = [[NSString alloc] initWithUTF8String:entry.pill.iconUri.c_str()];
587
- pill.iconTintColor = entry.pill.iconTintColor ? RCTUIColorFromSharedColor(entry.pill.iconTintColor) : nil;
588
- pill.borderRadius = entry.pill.borderRadius;
589
- pill.paddingHorizontal = entry.pill.paddingHorizontal;
590
- pill.paddingVertical = entry.pill.paddingVertical;
591
- pill.lineHeight = entry.pill.lineHeight;
592
- pill.borderWidth = entry.pill.borderWidth;
593
- pill.borderColor = RCTUIColorFromSharedColor(entry.pill.borderColor);
594
- pill.maxWidth = entry.pill.maxWidth;
595
- variant.pill = pill;
596
- }
597
- RCTUIColor *backgroundColor = RCTUIColorFromSharedColor(entry.backgroundColor);
598
- variant.backgroundColor = CGColorGetAlpha(backgroundColor.CGColor) > 0 ? backgroundColor : nil;
599
- [variants addObject:variant];
600
- }
601
- [config setLinkVariants:variants];
602
- changed = YES;
603
- }
604
- }
605
-
606
- // ── Strong ─────────────────────────────────────────────────────────────────
607
-
608
- if (newStyle.strong.fontFamily != oldStyle.strong.fontFamily) {
609
- if (!newStyle.strong.fontFamily.empty()) {
610
- NSString *fontFamily = [[NSString alloc] initWithUTF8String:newStyle.strong.fontFamily.c_str()];
611
- [config setStrongFontFamily:fontFamily];
612
- } else {
613
- [config setStrongFontFamily:nullptr];
614
- }
615
- changed = YES;
616
- }
617
-
618
- if (newStyle.strong.fontWeight != oldStyle.strong.fontWeight) {
619
- if (!newStyle.strong.fontWeight.empty()) {
620
- NSString *fontWeight = [[NSString alloc] initWithUTF8String:newStyle.strong.fontWeight.c_str()];
621
- [config setStrongFontWeight:fontWeight];
622
- } else {
623
- [config setStrongFontWeight:nullptr];
624
- }
625
- changed = YES;
626
- }
627
-
628
- if (newStyle.strong.color != oldStyle.strong.color) {
629
- if (newStyle.strong.color) {
630
- RCTUIColor *strongColor = RCTUIColorFromSharedColor(newStyle.strong.color);
631
- [config setStrongColor:strongColor];
632
- } else {
633
- [config setStrongColor:nullptr];
634
- }
635
- changed = YES;
636
- }
637
-
638
- // ── Emphasis ───────────────────────────────────────────────────────────────
639
-
640
- if (newStyle.em.fontFamily != oldStyle.em.fontFamily) {
641
- if (!newStyle.em.fontFamily.empty()) {
642
- NSString *fontFamily = [[NSString alloc] initWithUTF8String:newStyle.em.fontFamily.c_str()];
643
- [config setEmphasisFontFamily:fontFamily];
644
- } else {
645
- [config setEmphasisFontFamily:nullptr];
646
- }
647
- changed = YES;
648
- }
649
-
650
- if (newStyle.em.fontStyle != oldStyle.em.fontStyle) {
651
- if (!newStyle.em.fontStyle.empty()) {
652
- NSString *fontStyle = [[NSString alloc] initWithUTF8String:newStyle.em.fontStyle.c_str()];
653
- [config setEmphasisFontStyle:fontStyle];
654
- } else {
655
- [config setEmphasisFontStyle:nullptr];
656
- }
657
- changed = YES;
658
- }
659
-
660
- if (newStyle.em.color != oldStyle.em.color) {
661
- if (newStyle.em.color) {
662
- RCTUIColor *emphasisColor = RCTUIColorFromSharedColor(newStyle.em.color);
663
- [config setEmphasisColor:emphasisColor];
664
- } else {
665
- [config setEmphasisColor:nullptr];
666
- }
667
- changed = YES;
668
- }
669
-
670
- // ── Strikethrough ──────────────────────────────────────────────────────────
671
-
672
- if (newStyle.strikethrough.color != oldStyle.strikethrough.color) {
673
- RCTUIColor *strikethroughColor = RCTUIColorFromSharedColor(newStyle.strikethrough.color);
674
- [config setStrikethroughColor:strikethroughColor];
675
- changed = YES;
676
- }
677
-
678
- // ── Highlight ──────────────────────────────────────────────────────────────
679
-
680
- if (newStyle.highlight.color != oldStyle.highlight.color) {
681
- RCTUIColor *highlightColor = RCTUIColorFromSharedColor(newStyle.highlight.color);
682
- [config setHighlightColor:highlightColor];
683
- changed = YES;
684
- }
685
-
686
- if (newStyle.highlight.backgroundColor != oldStyle.highlight.backgroundColor) {
687
- RCTUIColor *highlightBackgroundColor = RCTUIColorFromSharedColor(newStyle.highlight.backgroundColor);
688
- [config setHighlightBackgroundColor:highlightBackgroundColor];
689
- changed = YES;
690
- }
691
-
692
- // ── Underline ──────────────────────────────────────────────────────────────
693
-
694
- if (newStyle.underline.color != oldStyle.underline.color) {
695
- RCTUIColor *underlineColor = RCTUIColorFromSharedColor(newStyle.underline.color);
696
- [config setUnderlineColor:underlineColor];
697
- changed = YES;
698
- }
699
-
700
- // ── Code ───────────────────────────────────────────────────────────────────
701
-
702
- if (newStyle.code.fontFamily != oldStyle.code.fontFamily) {
703
- if (!newStyle.code.fontFamily.empty()) {
704
- NSString *fontFamily = [[NSString alloc] initWithUTF8String:newStyle.code.fontFamily.c_str()];
705
- [config setCodeFontFamily:fontFamily];
706
- } else {
707
- [config setCodeFontFamily:nullptr];
708
- }
709
- changed = YES;
710
- }
711
-
712
- if (newStyle.code.fontSize != oldStyle.code.fontSize) {
713
- [config setCodeFontSize:newStyle.code.fontSize];
714
- changed = YES;
715
- }
716
-
717
- if (newStyle.code.color != oldStyle.code.color) {
718
- if (newStyle.code.color) {
719
- RCTUIColor *codeColor = RCTUIColorFromSharedColor(newStyle.code.color);
720
- [config setCodeColor:codeColor];
721
- } else {
722
- [config setCodeColor:nullptr];
723
- }
724
- changed = YES;
725
- }
726
-
727
- if (newStyle.code.backgroundColor != oldStyle.code.backgroundColor) {
728
- if (newStyle.code.backgroundColor) {
729
- RCTUIColor *codeBackgroundColor = RCTUIColorFromSharedColor(newStyle.code.backgroundColor);
730
- [config setCodeBackgroundColor:codeBackgroundColor];
731
- } else {
732
- [config setCodeBackgroundColor:nullptr];
733
- }
734
- changed = YES;
735
- }
736
-
737
- if (newStyle.code.borderColor != oldStyle.code.borderColor) {
738
- if (newStyle.code.borderColor) {
739
- RCTUIColor *codeBorderColor = RCTUIColorFromSharedColor(newStyle.code.borderColor);
740
- [config setCodeBorderColor:codeBorderColor];
741
- } else {
742
- [config setCodeBorderColor:nullptr];
743
- }
744
- changed = YES;
745
- }
746
-
747
- // ── Factoid ────────────────────────────────────────────────────────────────
748
-
749
- if (newStyle.factoid.color != oldStyle.factoid.color) {
750
- if (newStyle.factoid.color) {
751
- RCTUIColor *factoidColor = RCTUIColorFromSharedColor(newStyle.factoid.color);
752
- [config setFactoidColor:factoidColor];
753
- } else {
754
- [config setFactoidColor:nullptr];
755
- }
756
- changed = YES;
757
- }
758
-
759
- if (newStyle.factoid.backgroundColor != oldStyle.factoid.backgroundColor) {
760
- if (newStyle.factoid.backgroundColor) {
761
- RCTUIColor *factoidBackgroundColor = RCTUIColorFromSharedColor(newStyle.factoid.backgroundColor);
762
- [config setFactoidBackgroundColor:factoidBackgroundColor];
763
- } else {
764
- [config setFactoidBackgroundColor:nullptr];
765
- }
766
- changed = YES;
767
- }
768
-
769
- if (newStyle.factoid.borderColor != oldStyle.factoid.borderColor) {
770
- if (newStyle.factoid.borderColor) {
771
- RCTUIColor *factoidBorderColor = RCTUIColorFromSharedColor(newStyle.factoid.borderColor);
772
- [config setFactoidBorderColor:factoidBorderColor];
773
- } else {
774
- [config setFactoidBorderColor:nullptr];
775
- }
776
- changed = YES;
777
- }
778
-
779
- // ── Mention ────────────────────────────────────────────────────────────────
780
-
781
- if (newStyle.mention.color != oldStyle.mention.color) {
782
- if (newStyle.mention.color) {
783
- RCTUIColor *mentionColor = RCTUIColorFromSharedColor(newStyle.mention.color);
784
- [config setMentionColor:mentionColor];
785
- } else {
786
- [config setMentionColor:nullptr];
787
- }
788
- changed = YES;
789
- }
790
-
791
- if (newStyle.mention.backgroundColor != oldStyle.mention.backgroundColor) {
792
- if (newStyle.mention.backgroundColor) {
793
- RCTUIColor *mentionBackgroundColor = RCTUIColorFromSharedColor(newStyle.mention.backgroundColor);
794
- [config setMentionBackgroundColor:mentionBackgroundColor];
795
- } else {
796
- [config setMentionBackgroundColor:nullptr];
797
- }
798
- changed = YES;
799
- }
800
-
801
- // ── Image ──────────────────────────────────────────────────────────────────
802
-
803
- if (newStyle.image.height != oldStyle.image.height) {
804
- [config setImageHeight:newStyle.image.height];
805
- changed = YES;
806
- }
807
-
808
- if (newStyle.image.maxHeight != oldStyle.image.maxHeight) {
809
- [config setImageMaxHeight:newStyle.image.maxHeight];
810
- changed = YES;
811
- }
812
-
813
- if (newStyle.image.aspectRatio != oldStyle.image.aspectRatio) {
814
- [config setImageAspectRatio:newStyle.image.aspectRatio];
815
- changed = YES;
816
- }
817
-
818
- if (newStyle.image.resizeMode != oldStyle.image.resizeMode) {
819
- [config setImageResizeMode:@(newStyle.image.resizeMode.c_str())];
820
- changed = YES;
821
- }
822
-
823
- if (newStyle.image.borderRadius != oldStyle.image.borderRadius) {
824
- [config setImageBorderRadius:newStyle.image.borderRadius];
825
- changed = YES;
826
- }
827
-
828
- if (newStyle.image.marginTop != oldStyle.image.marginTop) {
829
- [config setImageMarginTop:newStyle.image.marginTop];
830
- changed = YES;
831
- }
832
-
833
- if (newStyle.image.marginBottom != oldStyle.image.marginBottom) {
834
- [config setImageMarginBottom:newStyle.image.marginBottom];
835
- changed = YES;
836
- }
837
-
838
- // ── Video ───────────────────────────────────────────────────────────────────
839
-
840
- if (newStyle.video.marginTop != oldStyle.video.marginTop) {
841
- [config setVideoMarginTop:newStyle.video.marginTop];
842
- changed = YES;
843
- }
844
-
845
- if (newStyle.video.marginBottom != oldStyle.video.marginBottom) {
846
- [config setVideoMarginBottom:newStyle.video.marginBottom];
847
- changed = YES;
848
- }
849
-
850
- if (newStyle.video.borderRadius != oldStyle.video.borderRadius) {
851
- [config setVideoBorderRadius:newStyle.video.borderRadius];
852
- changed = YES;
853
- }
854
-
855
- if (newStyle.video.aspectRatio != oldStyle.video.aspectRatio) {
856
- [config setVideoAspectRatio:newStyle.video.aspectRatio];
857
- changed = YES;
858
- }
859
-
860
- if (newStyle.video.backgroundColor != oldStyle.video.backgroundColor) {
861
- [config setVideoBackgroundColor:RCTUIColorFromSharedColor(newStyle.video.backgroundColor)];
862
- changed = YES;
863
- }
864
-
865
- // ── Inline Image ───────────────────────────────────────────────────────────
866
-
867
- if (newStyle.inlineImage.size != oldStyle.inlineImage.size) {
868
- [config setInlineImageSize:newStyle.inlineImage.size];
869
- changed = YES;
870
- }
871
-
872
- // ── List ───────────────────────────────────────────────────────────────────
873
-
874
- if (newStyle.list.fontSize != oldStyle.list.fontSize) {
875
- [config setListStyleFontSize:newStyle.list.fontSize];
876
- changed = YES;
877
- }
878
-
879
- if (newStyle.list.fontFamily != oldStyle.list.fontFamily) {
880
- NSString *fontFamily = [[NSString alloc] initWithUTF8String:newStyle.list.fontFamily.c_str()];
881
- [config setListStyleFontFamily:fontFamily];
882
- changed = YES;
883
- }
884
-
885
- if (newStyle.list.fontWeight != oldStyle.list.fontWeight) {
886
- NSString *fontWeight = [[NSString alloc] initWithUTF8String:newStyle.list.fontWeight.c_str()];
887
- [config setListStyleFontWeight:fontWeight];
888
- changed = YES;
889
- }
890
-
891
- if (newStyle.list.color != oldStyle.list.color) {
892
- RCTUIColor *listColor = RCTUIColorFromSharedColor(newStyle.list.color);
893
- [config setListStyleColor:listColor];
894
- changed = YES;
895
- }
896
-
897
- if (newStyle.list.marginTop != oldStyle.list.marginTop) {
898
- [config setListStyleMarginTop:newStyle.list.marginTop];
899
- changed = YES;
900
- }
901
-
902
- if (newStyle.list.marginBottom != oldStyle.list.marginBottom) {
903
- [config setListStyleMarginBottom:newStyle.list.marginBottom];
904
- changed = YES;
905
- }
906
-
907
- if (newStyle.list.lineHeight != oldStyle.list.lineHeight) {
908
- [config setListStyleLineHeight:newStyle.list.lineHeight];
909
- changed = YES;
910
- }
911
-
912
- if (newStyle.list.bulletColor != oldStyle.list.bulletColor) {
913
- RCTUIColor *bulletColor = RCTUIColorFromSharedColor(newStyle.list.bulletColor);
914
- [config setListStyleBulletColor:bulletColor];
915
- changed = YES;
916
- }
917
-
918
- if (newStyle.list.bulletSize != oldStyle.list.bulletSize) {
919
- [config setListStyleBulletSize:newStyle.list.bulletSize];
920
- changed = YES;
921
- }
922
-
923
- if (newStyle.list.markerMinWidth != oldStyle.list.markerMinWidth) {
924
- [config setListStyleMarkerMinWidth:newStyle.list.markerMinWidth];
925
- changed = YES;
926
- }
927
-
928
- if (newStyle.list.markerColor != oldStyle.list.markerColor) {
929
- RCTUIColor *markerColor = RCTUIColorFromSharedColor(newStyle.list.markerColor);
930
- [config setListStyleMarkerColor:markerColor];
931
- changed = YES;
932
- }
933
-
934
- if (newStyle.list.markerFontWeight != oldStyle.list.markerFontWeight) {
935
- NSString *markerFontWeight = [[NSString alloc] initWithUTF8String:newStyle.list.markerFontWeight.c_str()];
936
- [config setListStyleMarkerFontWeight:markerFontWeight];
937
- changed = YES;
938
- }
939
-
940
- if (newStyle.list.gapWidth != oldStyle.list.gapWidth) {
941
- [config setListStyleGapWidth:newStyle.list.gapWidth];
942
- changed = YES;
943
- }
944
-
945
- if (newStyle.list.marginLeft != oldStyle.list.marginLeft) {
946
- [config setListStyleMarginLeft:newStyle.list.marginLeft];
947
- changed = YES;
948
- }
949
-
950
- if (newStyle.list.itemSpacing != oldStyle.list.itemSpacing) {
951
- [config setListStyleItemSpacing:newStyle.list.itemSpacing];
952
- changed = YES;
953
- }
954
-
955
- // ── Code Block ─────────────────────────────────────────────────────────────
956
-
957
- if (newStyle.codeBlock.fontSize != oldStyle.codeBlock.fontSize) {
958
- [config setCodeBlockFontSize:newStyle.codeBlock.fontSize];
959
- changed = YES;
960
- }
961
-
962
- if (newStyle.codeBlock.fontFamily != oldStyle.codeBlock.fontFamily) {
963
- NSString *fontFamily = [[NSString alloc] initWithUTF8String:newStyle.codeBlock.fontFamily.c_str()];
964
- [config setCodeBlockFontFamily:fontFamily];
965
- changed = YES;
966
- }
967
-
968
- if (newStyle.codeBlock.fontWeight != oldStyle.codeBlock.fontWeight) {
969
- NSString *fontWeight = [[NSString alloc] initWithUTF8String:newStyle.codeBlock.fontWeight.c_str()];
970
- [config setCodeBlockFontWeight:fontWeight];
971
- changed = YES;
972
- }
973
-
974
- if (newStyle.codeBlock.color != oldStyle.codeBlock.color) {
975
- RCTUIColor *codeBlockColor = RCTUIColorFromSharedColor(newStyle.codeBlock.color);
976
- [config setCodeBlockColor:codeBlockColor];
977
- changed = YES;
978
- }
979
-
980
- if (newStyle.codeBlock.marginTop != oldStyle.codeBlock.marginTop) {
981
- [config setCodeBlockMarginTop:newStyle.codeBlock.marginTop];
982
- changed = YES;
983
- }
984
-
985
- if (newStyle.codeBlock.marginBottom != oldStyle.codeBlock.marginBottom) {
986
- [config setCodeBlockMarginBottom:newStyle.codeBlock.marginBottom];
987
- changed = YES;
988
- }
989
-
990
- if (newStyle.codeBlock.lineHeight != oldStyle.codeBlock.lineHeight) {
991
- [config setCodeBlockLineHeight:newStyle.codeBlock.lineHeight];
992
- changed = YES;
993
- }
994
-
995
- if (newStyle.codeBlock.backgroundColor != oldStyle.codeBlock.backgroundColor) {
996
- RCTUIColor *codeBlockBackgroundColor = RCTUIColorFromSharedColor(newStyle.codeBlock.backgroundColor);
997
- [config setCodeBlockBackgroundColor:codeBlockBackgroundColor];
998
- changed = YES;
999
- }
1000
-
1001
- if (newStyle.codeBlock.borderColor != oldStyle.codeBlock.borderColor) {
1002
- RCTUIColor *codeBlockBorderColor = RCTUIColorFromSharedColor(newStyle.codeBlock.borderColor);
1003
- [config setCodeBlockBorderColor:codeBlockBorderColor];
1004
- changed = YES;
1005
- }
1006
-
1007
- if (newStyle.codeBlock.borderRadius != oldStyle.codeBlock.borderRadius) {
1008
- [config setCodeBlockBorderRadius:newStyle.codeBlock.borderRadius];
1009
- changed = YES;
1010
- }
1011
-
1012
- if (newStyle.codeBlock.borderWidth != oldStyle.codeBlock.borderWidth) {
1013
- [config setCodeBlockBorderWidth:newStyle.codeBlock.borderWidth];
1014
- changed = YES;
1015
- }
1016
-
1017
- if (newStyle.codeBlock.padding != oldStyle.codeBlock.padding) {
1018
- [config setCodeBlockPadding:newStyle.codeBlock.padding];
1019
- changed = YES;
1020
- }
1021
-
1022
- #define ENRM_SET_SYNTAX_COLOR(field, token) \
1023
- if (newStyle.codeBlock.syntaxColors.field != oldStyle.codeBlock.syntaxColors.field) { \
1024
- [config setCodeBlockSyntaxColor:RCTUIColorFromSharedColor(newStyle.codeBlock.syntaxColors.field) forToken:token]; \
1025
- changed = YES; \
1026
- }
1027
- ENRM_SET_SYNTAX_COLOR(keyword, 0)
1028
- ENRM_SET_SYNTAX_COLOR(operatorColor, 1)
1029
- ENRM_SET_SYNTAX_COLOR(punctuation, 2)
1030
- ENRM_SET_SYNTAX_COLOR(string, 3)
1031
- ENRM_SET_SYNTAX_COLOR(number, 4)
1032
- ENRM_SET_SYNTAX_COLOR(constant, 5)
1033
- ENRM_SET_SYNTAX_COLOR(comment, 6)
1034
- ENRM_SET_SYNTAX_COLOR(function, 7)
1035
- ENRM_SET_SYNTAX_COLOR(type, 8)
1036
- ENRM_SET_SYNTAX_COLOR(variable, 9)
1037
- ENRM_SET_SYNTAX_COLOR(property, 10)
1038
- ENRM_SET_SYNTAX_COLOR(tag, 11)
1039
- ENRM_SET_SYNTAX_COLOR(attribute, 12)
1040
- ENRM_SET_SYNTAX_COLOR(embedded, 13)
1041
- #undef ENRM_SET_SYNTAX_COLOR
1042
-
1043
- // ── Thematic Break ─────────────────────────────────────────────────────────
1044
-
1045
- if (newStyle.thematicBreak.color != oldStyle.thematicBreak.color) {
1046
- RCTUIColor *thematicBreakColor = RCTUIColorFromSharedColor(newStyle.thematicBreak.color);
1047
- [config setThematicBreakColor:thematicBreakColor];
1048
- changed = YES;
1049
- }
1050
-
1051
- if (newStyle.thematicBreak.height != oldStyle.thematicBreak.height) {
1052
- [config setThematicBreakHeight:newStyle.thematicBreak.height];
1053
- changed = YES;
1054
- }
1055
-
1056
- if (newStyle.thematicBreak.marginTop != oldStyle.thematicBreak.marginTop) {
1057
- [config setThematicBreakMarginTop:newStyle.thematicBreak.marginTop];
1058
- changed = YES;
1059
- }
1060
-
1061
- if (newStyle.thematicBreak.marginBottom != oldStyle.thematicBreak.marginBottom) {
1062
- [config setThematicBreakMarginBottom:newStyle.thematicBreak.marginBottom];
1063
- changed = YES;
1064
- }
1065
-
1066
- // ── Table ───────────────────────────────────────────────────────────────────
1067
-
1068
- if (newStyle.table.fontSize != oldStyle.table.fontSize) {
1069
- [config setTableFontSize:newStyle.table.fontSize];
1070
- changed = YES;
1071
- }
1072
-
1073
- if (newStyle.table.fontFamily != oldStyle.table.fontFamily) {
1074
- if (!newStyle.table.fontFamily.empty()) {
1075
- NSString *fontFamily = [[NSString alloc] initWithUTF8String:newStyle.table.fontFamily.c_str()];
1076
- [config setTableFontFamily:fontFamily];
1077
- } else {
1078
- [config setTableFontFamily:nullptr];
1079
- }
1080
- changed = YES;
1081
- }
1082
-
1083
- if (newStyle.table.fontWeight != oldStyle.table.fontWeight) {
1084
- if (!newStyle.table.fontWeight.empty()) {
1085
- NSString *fontWeight = [[NSString alloc] initWithUTF8String:newStyle.table.fontWeight.c_str()];
1086
- [config setTableFontWeight:fontWeight];
1087
- } else {
1088
- [config setTableFontWeight:nullptr];
1089
- }
1090
- changed = YES;
1091
- }
1092
-
1093
- if (newStyle.table.color != oldStyle.table.color) {
1094
- if (newStyle.table.color) {
1095
- RCTUIColor *color = RCTUIColorFromSharedColor(newStyle.table.color);
1096
- [config setTableColor:color];
1097
- } else {
1098
- [config setTableColor:nullptr];
1099
- }
1100
- changed = YES;
1101
- }
1102
-
1103
- if (newStyle.table.marginTop != oldStyle.table.marginTop) {
1104
- [config setTableMarginTop:newStyle.table.marginTop];
1105
- changed = YES;
1106
- }
1107
-
1108
- if (newStyle.table.marginBottom != oldStyle.table.marginBottom) {
1109
- [config setTableMarginBottom:newStyle.table.marginBottom];
1110
- changed = YES;
1111
- }
1112
-
1113
- if (newStyle.table.lineHeight != oldStyle.table.lineHeight) {
1114
- [config setTableLineHeight:newStyle.table.lineHeight];
1115
- changed = YES;
1116
- }
1117
-
1118
- if (newStyle.table.headerFontFamily != oldStyle.table.headerFontFamily) {
1119
- if (!newStyle.table.headerFontFamily.empty()) {
1120
- NSString *fontFamily = [[NSString alloc] initWithUTF8String:newStyle.table.headerFontFamily.c_str()];
1121
- [config setTableHeaderFontFamily:fontFamily];
1122
- } else {
1123
- [config setTableHeaderFontFamily:nullptr];
1124
- }
1125
- changed = YES;
1126
- }
1127
-
1128
- if (newStyle.table.headerBackgroundColor != oldStyle.table.headerBackgroundColor) {
1129
- RCTUIColor *color = RCTUIColorFromSharedColor(newStyle.table.headerBackgroundColor);
1130
- [config setTableHeaderBackgroundColor:color];
1131
- changed = YES;
1132
- }
1133
-
1134
- if (newStyle.table.headerTextColor != oldStyle.table.headerTextColor) {
1135
- RCTUIColor *color = RCTUIColorFromSharedColor(newStyle.table.headerTextColor);
1136
- [config setTableHeaderTextColor:color];
1137
- changed = YES;
1138
- }
1139
-
1140
- if (newStyle.table.rowEvenBackgroundColor != oldStyle.table.rowEvenBackgroundColor) {
1141
- RCTUIColor *color = RCTUIColorFromSharedColor(newStyle.table.rowEvenBackgroundColor);
1142
- [config setTableRowEvenBackgroundColor:color];
1143
- changed = YES;
1144
- }
1145
-
1146
- if (newStyle.table.rowOddBackgroundColor != oldStyle.table.rowOddBackgroundColor) {
1147
- RCTUIColor *color = RCTUIColorFromSharedColor(newStyle.table.rowOddBackgroundColor);
1148
- [config setTableRowOddBackgroundColor:color];
1149
- changed = YES;
1150
- }
1151
-
1152
- if (newStyle.table.borderColor != oldStyle.table.borderColor) {
1153
- RCTUIColor *color = RCTUIColorFromSharedColor(newStyle.table.borderColor);
1154
- [config setTableBorderColor:color];
1155
- changed = YES;
1156
- }
1157
-
1158
- if (newStyle.table.borderWidth != oldStyle.table.borderWidth) {
1159
- [config setTableBorderWidth:newStyle.table.borderWidth];
1160
- changed = YES;
1161
- }
1162
-
1163
- if (newStyle.table.borderRadius != oldStyle.table.borderRadius) {
1164
- [config setTableBorderRadius:newStyle.table.borderRadius];
1165
- changed = YES;
1166
- }
1167
-
1168
- if (newStyle.table.cellPaddingHorizontal != oldStyle.table.cellPaddingHorizontal) {
1169
- [config setTableCellPaddingHorizontal:newStyle.table.cellPaddingHorizontal];
1170
- changed = YES;
1171
- }
1172
-
1173
- if (newStyle.table.cellPaddingVertical != oldStyle.table.cellPaddingVertical) {
1174
- [config setTableCellPaddingVertical:newStyle.table.cellPaddingVertical];
1175
- changed = YES;
1176
- }
1177
-
1178
- if (newStyle.table.horizontalOverflow != oldStyle.table.horizontalOverflow) {
1179
- [config setTableHorizontalOverflow:newStyle.table.horizontalOverflow];
1180
- changed = YES;
1181
- }
1182
-
1183
- if (newStyle.table.align != oldStyle.table.align) {
1184
- [config setTableAlign:@(newStyle.table.align.c_str())];
1185
- changed = YES;
1186
- }
1187
-
1188
- // ── Task List ───────────────────────────────────────────────────────────────
1189
-
1190
- if (newStyle.taskList.checkedColor != oldStyle.taskList.checkedColor) {
1191
- RCTUIColor *color = RCTUIColorFromSharedColor(newStyle.taskList.checkedColor);
1192
- [config setTaskListCheckedColor:color];
1193
- changed = YES;
1194
- }
1195
-
1196
- if (newStyle.taskList.borderColor != oldStyle.taskList.borderColor) {
1197
- RCTUIColor *color = RCTUIColorFromSharedColor(newStyle.taskList.borderColor);
1198
- [config setTaskListBorderColor:color];
1199
- changed = YES;
1200
- }
1201
-
1202
- if (newStyle.taskList.checkboxSize != oldStyle.taskList.checkboxSize) {
1203
- [config setTaskListCheckboxSize:newStyle.taskList.checkboxSize];
1204
- changed = YES;
1205
- }
1206
-
1207
- if (newStyle.taskList.checkboxBorderRadius != oldStyle.taskList.checkboxBorderRadius) {
1208
- [config setTaskListCheckboxBorderRadius:newStyle.taskList.checkboxBorderRadius];
1209
- changed = YES;
1210
- }
1211
-
1212
- if (newStyle.taskList.checkmarkColor != oldStyle.taskList.checkmarkColor) {
1213
- RCTUIColor *color = RCTUIColorFromSharedColor(newStyle.taskList.checkmarkColor);
1214
- [config setTaskListCheckmarkColor:color];
1215
- changed = YES;
1216
- }
1217
-
1218
- if (newStyle.taskList.checkedTextColor != oldStyle.taskList.checkedTextColor) {
1219
- if (newStyle.taskList.checkedTextColor) {
1220
- RCTUIColor *color = RCTUIColorFromSharedColor(newStyle.taskList.checkedTextColor);
1221
- [config setTaskListCheckedTextColor:color];
1222
- } else {
1223
- [config setTaskListCheckedTextColor:nullptr];
1224
- }
1225
- changed = YES;
1226
- }
1227
-
1228
- if (newStyle.taskList.checkedStrikethrough != oldStyle.taskList.checkedStrikethrough) {
1229
- [config setTaskListCheckedStrikethrough:newStyle.taskList.checkedStrikethrough];
1230
- changed = YES;
1231
- }
1232
-
1233
- // ── Math ───────────────────────────────────────────────────────────────────
1234
-
1235
- if (newStyle.math.fontSize != oldStyle.math.fontSize) {
1236
- [config setMathFontSize:newStyle.math.fontSize];
1237
- changed = YES;
1238
- }
1239
-
1240
- if (newStyle.math.color != oldStyle.math.color) {
1241
- if (newStyle.math.color) {
1242
- RCTUIColor *color = RCTUIColorFromSharedColor(newStyle.math.color);
1243
- [config setMathColor:color];
1244
- } else {
1245
- [config setMathColor:nullptr];
1246
- }
1247
- changed = YES;
1248
- }
1249
-
1250
- if (newStyle.math.backgroundColor != oldStyle.math.backgroundColor) {
1251
- if (newStyle.math.backgroundColor) {
1252
- RCTUIColor *color = RCTUIColorFromSharedColor(newStyle.math.backgroundColor);
1253
- [config setMathBackgroundColor:color];
1254
- } else {
1255
- [config setMathBackgroundColor:nullptr];
1256
- }
1257
- changed = YES;
1258
- }
1259
-
1260
- if (newStyle.math.padding != oldStyle.math.padding) {
1261
- [config setMathPadding:newStyle.math.padding];
1262
- changed = YES;
1263
- }
1264
-
1265
- if (newStyle.math.marginTop != oldStyle.math.marginTop) {
1266
- [config setMathMarginTop:newStyle.math.marginTop];
1267
- changed = YES;
1268
- }
1269
-
1270
- if (newStyle.math.marginBottom != oldStyle.math.marginBottom) {
1271
- [config setMathMarginBottom:newStyle.math.marginBottom];
1272
- changed = YES;
1273
- }
1274
-
1275
- if (newStyle.math.textAlign != oldStyle.math.textAlign) {
1276
- [config setMathTextAlign:@(newStyle.math.textAlign.c_str())];
1277
- changed = YES;
1278
- }
1279
-
1280
- // ── Inline Math ───────────────────────────────────────────────────────────
1281
-
1282
- if (newStyle.inlineMath.color != oldStyle.inlineMath.color) {
1283
- if (newStyle.inlineMath.color) {
1284
- RCTUIColor *color = RCTUIColorFromSharedColor(newStyle.inlineMath.color);
1285
- [config setInlineMathColor:color];
1286
- } else {
1287
- [config setInlineMathColor:nullptr];
1288
- }
1289
- changed = YES;
1290
- }
1291
-
1292
- // ── Spoiler ─────────────────────────────────────────────────────────────
1293
-
1294
- if (newStyle.spoiler.color != oldStyle.spoiler.color) {
1295
- RCTUIColor *color = RCTUIColorFromSharedColor(newStyle.spoiler.color);
1296
- [config setSpoilerColor:color];
1297
- changed = YES;
1298
- }
1299
-
1300
- if (newStyle.spoiler.particles.density != oldStyle.spoiler.particles.density) {
1301
- [config setSpoilerParticleDensity:newStyle.spoiler.particles.density];
1302
- changed = YES;
1303
- }
1304
-
1305
- if (newStyle.spoiler.particles.speed != oldStyle.spoiler.particles.speed) {
1306
- [config setSpoilerParticleSpeed:newStyle.spoiler.particles.speed];
1307
- changed = YES;
1308
- }
1309
-
1310
- if (newStyle.spoiler.solid.borderRadius != oldStyle.spoiler.solid.borderRadius) {
1311
- [config setSpoilerSolidBorderRadius:newStyle.spoiler.solid.borderRadius];
1312
- changed = YES;
1313
- }
1314
-
1315
- // ── Superscript ──────────────────────────────────────────────────────────
1316
-
1317
- if (newStyle.superscript.fontScale != oldStyle.superscript.fontScale) {
1318
- [config setSuperscriptFontScale:newStyle.superscript.fontScale];
1319
- changed = YES;
1320
- }
1321
-
1322
- if (newStyle.superscript.baselineOffsetScale != oldStyle.superscript.baselineOffsetScale) {
1323
- [config setSuperscriptBaselineOffsetScale:newStyle.superscript.baselineOffsetScale];
1324
- changed = YES;
1325
- }
1326
-
1327
- // ── Subscript ────────────────────────────────────────────────────────────
1328
-
1329
- if (newStyle.subscript.fontScale != oldStyle.subscript.fontScale) {
1330
- [config setSubscriptFontScale:newStyle.subscript.fontScale];
1331
- changed = YES;
1332
- }
1333
-
1334
- if (newStyle.subscript.baselineOffsetScale != oldStyle.subscript.baselineOffsetScale) {
1335
- [config setSubscriptBaselineOffsetScale:newStyle.subscript.baselineOffsetScale];
1336
- changed = YES;
1337
- }
1338
-
1339
- return changed;
1340
- }
1
+ #pragma once
2
+ #import "ENRMUIKit.h"
3
+
4
+ /**
5
+ * StylePropsHelper.h
6
+ *
7
+ * C++ template that maps codegen-generated tiptapStyle props to StyleConfig setters.
8
+ */
9
+
10
+ #import "ParagraphStyleUtils.h"
11
+ #import "StyleConfig.h"
12
+ #import <React/RCTConversions.h>
13
+
14
+ template <typename TiptapStyle>
15
+ BOOL applyTiptapStyleToConfig(StyleConfig *config, const TiptapStyle &newStyle, const TiptapStyle &oldStyle)
16
+ {
17
+ BOOL changed = NO;
18
+
19
+ // ── Paragraph ──────────────────────────────────────────────────────────────
20
+
21
+ if (newStyle.paragraph.fontSize != oldStyle.paragraph.fontSize) {
22
+ [config setParagraphFontSize:newStyle.paragraph.fontSize];
23
+ changed = YES;
24
+ }
25
+
26
+ if (newStyle.paragraph.fontFamily != oldStyle.paragraph.fontFamily) {
27
+ if (!newStyle.paragraph.fontFamily.empty()) {
28
+ NSString *fontFamily = [[NSString alloc] initWithUTF8String:newStyle.paragraph.fontFamily.c_str()];
29
+ [config setParagraphFontFamily:fontFamily];
30
+ } else {
31
+ [config setParagraphFontFamily:nullptr];
32
+ }
33
+ changed = YES;
34
+ }
35
+
36
+ if (newStyle.paragraph.fontWeight != oldStyle.paragraph.fontWeight) {
37
+ if (!newStyle.paragraph.fontWeight.empty()) {
38
+ NSString *fontWeight = [[NSString alloc] initWithUTF8String:newStyle.paragraph.fontWeight.c_str()];
39
+ [config setParagraphFontWeight:fontWeight];
40
+ } else {
41
+ [config setParagraphFontWeight:nullptr];
42
+ }
43
+ changed = YES;
44
+ }
45
+
46
+ if (newStyle.paragraph.color != oldStyle.paragraph.color) {
47
+ if (newStyle.paragraph.color) {
48
+ RCTUIColor *paragraphColor = RCTUIColorFromSharedColor(newStyle.paragraph.color);
49
+ [config setParagraphColor:paragraphColor];
50
+ } else {
51
+ [config setParagraphColor:nullptr];
52
+ }
53
+ changed = YES;
54
+ }
55
+
56
+ if (newStyle.paragraph.marginTop != oldStyle.paragraph.marginTop) {
57
+ [config setParagraphMarginTop:newStyle.paragraph.marginTop];
58
+ changed = YES;
59
+ }
60
+
61
+ if (newStyle.paragraph.marginBottom != oldStyle.paragraph.marginBottom) {
62
+ [config setParagraphMarginBottom:newStyle.paragraph.marginBottom];
63
+ changed = YES;
64
+ }
65
+
66
+ if (newStyle.paragraph.lineHeight != oldStyle.paragraph.lineHeight) {
67
+ [config setParagraphLineHeight:newStyle.paragraph.lineHeight];
68
+ changed = YES;
69
+ }
70
+
71
+ if (newStyle.paragraph.textAlign != oldStyle.paragraph.textAlign) {
72
+ [config setParagraphTextAlign:textAlignmentFromString(@(newStyle.paragraph.textAlign.c_str()))];
73
+ changed = YES;
74
+ }
75
+
76
+ // ── H1 ─────────────────────────────────────────────────────────────────────
77
+
78
+ if (newStyle.h1.fontSize != oldStyle.h1.fontSize) {
79
+ [config setH1FontSize:newStyle.h1.fontSize];
80
+ changed = YES;
81
+ }
82
+
83
+ if (newStyle.h1.fontFamily != oldStyle.h1.fontFamily) {
84
+ if (!newStyle.h1.fontFamily.empty()) {
85
+ NSString *fontFamily = [[NSString alloc] initWithUTF8String:newStyle.h1.fontFamily.c_str()];
86
+ [config setH1FontFamily:fontFamily];
87
+ } else {
88
+ [config setH1FontFamily:nullptr];
89
+ }
90
+ changed = YES;
91
+ }
92
+
93
+ if (newStyle.h1.fontWeight != oldStyle.h1.fontWeight) {
94
+ if (!newStyle.h1.fontWeight.empty()) {
95
+ NSString *fontWeight = [[NSString alloc] initWithUTF8String:newStyle.h1.fontWeight.c_str()];
96
+ [config setH1FontWeight:fontWeight];
97
+ } else {
98
+ [config setH1FontWeight:nullptr];
99
+ }
100
+ changed = YES;
101
+ }
102
+
103
+ if (newStyle.h1.color != oldStyle.h1.color) {
104
+ if (newStyle.h1.color) {
105
+ RCTUIColor *h1Color = RCTUIColorFromSharedColor(newStyle.h1.color);
106
+ [config setH1Color:h1Color];
107
+ } else {
108
+ [config setH1Color:nullptr];
109
+ }
110
+ changed = YES;
111
+ }
112
+
113
+ if (newStyle.h1.marginTop != oldStyle.h1.marginTop) {
114
+ [config setH1MarginTop:newStyle.h1.marginTop];
115
+ changed = YES;
116
+ }
117
+
118
+ if (newStyle.h1.marginBottom != oldStyle.h1.marginBottom) {
119
+ [config setH1MarginBottom:newStyle.h1.marginBottom];
120
+ changed = YES;
121
+ }
122
+
123
+ if (newStyle.h1.lineHeight != oldStyle.h1.lineHeight) {
124
+ [config setH1LineHeight:newStyle.h1.lineHeight];
125
+ changed = YES;
126
+ }
127
+
128
+ if (newStyle.h1.textAlign != oldStyle.h1.textAlign) {
129
+ [config setH1TextAlign:textAlignmentFromString(@(newStyle.h1.textAlign.c_str()))];
130
+ changed = YES;
131
+ }
132
+
133
+ // ── H2 ─────────────────────────────────────────────────────────────────────
134
+
135
+ if (newStyle.h2.fontSize != oldStyle.h2.fontSize) {
136
+ [config setH2FontSize:newStyle.h2.fontSize];
137
+ changed = YES;
138
+ }
139
+
140
+ if (newStyle.h2.fontFamily != oldStyle.h2.fontFamily) {
141
+ if (!newStyle.h2.fontFamily.empty()) {
142
+ NSString *fontFamily = [[NSString alloc] initWithUTF8String:newStyle.h2.fontFamily.c_str()];
143
+ [config setH2FontFamily:fontFamily];
144
+ } else {
145
+ [config setH2FontFamily:nullptr];
146
+ }
147
+ changed = YES;
148
+ }
149
+
150
+ if (newStyle.h2.fontWeight != oldStyle.h2.fontWeight) {
151
+ if (!newStyle.h2.fontWeight.empty()) {
152
+ NSString *fontWeight = [[NSString alloc] initWithUTF8String:newStyle.h2.fontWeight.c_str()];
153
+ [config setH2FontWeight:fontWeight];
154
+ } else {
155
+ [config setH2FontWeight:nullptr];
156
+ }
157
+ changed = YES;
158
+ }
159
+
160
+ if (newStyle.h2.color != oldStyle.h2.color) {
161
+ if (newStyle.h2.color) {
162
+ RCTUIColor *h2Color = RCTUIColorFromSharedColor(newStyle.h2.color);
163
+ [config setH2Color:h2Color];
164
+ } else {
165
+ [config setH2Color:nullptr];
166
+ }
167
+ changed = YES;
168
+ }
169
+
170
+ if (newStyle.h2.marginTop != oldStyle.h2.marginTop) {
171
+ [config setH2MarginTop:newStyle.h2.marginTop];
172
+ changed = YES;
173
+ }
174
+
175
+ if (newStyle.h2.marginBottom != oldStyle.h2.marginBottom) {
176
+ [config setH2MarginBottom:newStyle.h2.marginBottom];
177
+ changed = YES;
178
+ }
179
+
180
+ if (newStyle.h2.lineHeight != oldStyle.h2.lineHeight) {
181
+ [config setH2LineHeight:newStyle.h2.lineHeight];
182
+ changed = YES;
183
+ }
184
+
185
+ if (newStyle.h2.textAlign != oldStyle.h2.textAlign) {
186
+ [config setH2TextAlign:textAlignmentFromString(@(newStyle.h2.textAlign.c_str()))];
187
+ changed = YES;
188
+ }
189
+
190
+ // ── H3 ─────────────────────────────────────────────────────────────────────
191
+
192
+ if (newStyle.h3.fontSize != oldStyle.h3.fontSize) {
193
+ [config setH3FontSize:newStyle.h3.fontSize];
194
+ changed = YES;
195
+ }
196
+
197
+ if (newStyle.h3.fontFamily != oldStyle.h3.fontFamily) {
198
+ if (!newStyle.h3.fontFamily.empty()) {
199
+ NSString *fontFamily = [[NSString alloc] initWithUTF8String:newStyle.h3.fontFamily.c_str()];
200
+ [config setH3FontFamily:fontFamily];
201
+ } else {
202
+ [config setH3FontFamily:nullptr];
203
+ }
204
+ changed = YES;
205
+ }
206
+
207
+ if (newStyle.h3.fontWeight != oldStyle.h3.fontWeight) {
208
+ if (!newStyle.h3.fontWeight.empty()) {
209
+ NSString *fontWeight = [[NSString alloc] initWithUTF8String:newStyle.h3.fontWeight.c_str()];
210
+ [config setH3FontWeight:fontWeight];
211
+ } else {
212
+ [config setH3FontWeight:nullptr];
213
+ }
214
+ changed = YES;
215
+ }
216
+
217
+ if (newStyle.h3.color != oldStyle.h3.color) {
218
+ if (newStyle.h3.color) {
219
+ RCTUIColor *h3Color = RCTUIColorFromSharedColor(newStyle.h3.color);
220
+ [config setH3Color:h3Color];
221
+ } else {
222
+ [config setH3Color:nullptr];
223
+ }
224
+ changed = YES;
225
+ }
226
+
227
+ if (newStyle.h3.marginTop != oldStyle.h3.marginTop) {
228
+ [config setH3MarginTop:newStyle.h3.marginTop];
229
+ changed = YES;
230
+ }
231
+
232
+ if (newStyle.h3.marginBottom != oldStyle.h3.marginBottom) {
233
+ [config setH3MarginBottom:newStyle.h3.marginBottom];
234
+ changed = YES;
235
+ }
236
+
237
+ if (newStyle.h3.lineHeight != oldStyle.h3.lineHeight) {
238
+ [config setH3LineHeight:newStyle.h3.lineHeight];
239
+ changed = YES;
240
+ }
241
+
242
+ if (newStyle.h3.textAlign != oldStyle.h3.textAlign) {
243
+ [config setH3TextAlign:textAlignmentFromString(@(newStyle.h3.textAlign.c_str()))];
244
+ changed = YES;
245
+ }
246
+
247
+ // ── H4 ─────────────────────────────────────────────────────────────────────
248
+
249
+ if (newStyle.h4.fontSize != oldStyle.h4.fontSize) {
250
+ [config setH4FontSize:newStyle.h4.fontSize];
251
+ changed = YES;
252
+ }
253
+
254
+ if (newStyle.h4.fontFamily != oldStyle.h4.fontFamily) {
255
+ if (!newStyle.h4.fontFamily.empty()) {
256
+ NSString *fontFamily = [[NSString alloc] initWithUTF8String:newStyle.h4.fontFamily.c_str()];
257
+ [config setH4FontFamily:fontFamily];
258
+ } else {
259
+ [config setH4FontFamily:nullptr];
260
+ }
261
+ changed = YES;
262
+ }
263
+
264
+ if (newStyle.h4.fontWeight != oldStyle.h4.fontWeight) {
265
+ if (!newStyle.h4.fontWeight.empty()) {
266
+ NSString *fontWeight = [[NSString alloc] initWithUTF8String:newStyle.h4.fontWeight.c_str()];
267
+ [config setH4FontWeight:fontWeight];
268
+ } else {
269
+ [config setH4FontWeight:nullptr];
270
+ }
271
+ changed = YES;
272
+ }
273
+
274
+ if (newStyle.h4.color != oldStyle.h4.color) {
275
+ if (newStyle.h4.color) {
276
+ RCTUIColor *h4Color = RCTUIColorFromSharedColor(newStyle.h4.color);
277
+ [config setH4Color:h4Color];
278
+ } else {
279
+ [config setH4Color:nullptr];
280
+ }
281
+ changed = YES;
282
+ }
283
+
284
+ if (newStyle.h4.marginTop != oldStyle.h4.marginTop) {
285
+ [config setH4MarginTop:newStyle.h4.marginTop];
286
+ changed = YES;
287
+ }
288
+
289
+ if (newStyle.h4.marginBottom != oldStyle.h4.marginBottom) {
290
+ [config setH4MarginBottom:newStyle.h4.marginBottom];
291
+ changed = YES;
292
+ }
293
+
294
+ if (newStyle.h4.lineHeight != oldStyle.h4.lineHeight) {
295
+ [config setH4LineHeight:newStyle.h4.lineHeight];
296
+ changed = YES;
297
+ }
298
+
299
+ if (newStyle.h4.textAlign != oldStyle.h4.textAlign) {
300
+ [config setH4TextAlign:textAlignmentFromString(@(newStyle.h4.textAlign.c_str()))];
301
+ changed = YES;
302
+ }
303
+
304
+ // ── H5 ─────────────────────────────────────────────────────────────────────
305
+
306
+ if (newStyle.h5.fontSize != oldStyle.h5.fontSize) {
307
+ [config setH5FontSize:newStyle.h5.fontSize];
308
+ changed = YES;
309
+ }
310
+
311
+ if (newStyle.h5.fontFamily != oldStyle.h5.fontFamily) {
312
+ if (!newStyle.h5.fontFamily.empty()) {
313
+ NSString *fontFamily = [[NSString alloc] initWithUTF8String:newStyle.h5.fontFamily.c_str()];
314
+ [config setH5FontFamily:fontFamily];
315
+ } else {
316
+ [config setH5FontFamily:nullptr];
317
+ }
318
+ changed = YES;
319
+ }
320
+
321
+ if (newStyle.h5.fontWeight != oldStyle.h5.fontWeight) {
322
+ if (!newStyle.h5.fontWeight.empty()) {
323
+ NSString *fontWeight = [[NSString alloc] initWithUTF8String:newStyle.h5.fontWeight.c_str()];
324
+ [config setH5FontWeight:fontWeight];
325
+ } else {
326
+ [config setH5FontWeight:nullptr];
327
+ }
328
+ changed = YES;
329
+ }
330
+
331
+ if (newStyle.h5.color != oldStyle.h5.color) {
332
+ if (newStyle.h5.color) {
333
+ RCTUIColor *h5Color = RCTUIColorFromSharedColor(newStyle.h5.color);
334
+ [config setH5Color:h5Color];
335
+ } else {
336
+ [config setH5Color:nullptr];
337
+ }
338
+ changed = YES;
339
+ }
340
+
341
+ if (newStyle.h5.marginTop != oldStyle.h5.marginTop) {
342
+ [config setH5MarginTop:newStyle.h5.marginTop];
343
+ changed = YES;
344
+ }
345
+
346
+ if (newStyle.h5.marginBottom != oldStyle.h5.marginBottom) {
347
+ [config setH5MarginBottom:newStyle.h5.marginBottom];
348
+ changed = YES;
349
+ }
350
+
351
+ if (newStyle.h5.lineHeight != oldStyle.h5.lineHeight) {
352
+ [config setH5LineHeight:newStyle.h5.lineHeight];
353
+ changed = YES;
354
+ }
355
+
356
+ if (newStyle.h5.textAlign != oldStyle.h5.textAlign) {
357
+ [config setH5TextAlign:textAlignmentFromString(@(newStyle.h5.textAlign.c_str()))];
358
+ changed = YES;
359
+ }
360
+
361
+ // ── H6 ─────────────────────────────────────────────────────────────────────
362
+
363
+ if (newStyle.h6.fontSize != oldStyle.h6.fontSize) {
364
+ [config setH6FontSize:newStyle.h6.fontSize];
365
+ changed = YES;
366
+ }
367
+
368
+ if (newStyle.h6.fontFamily != oldStyle.h6.fontFamily) {
369
+ if (!newStyle.h6.fontFamily.empty()) {
370
+ NSString *fontFamily = [[NSString alloc] initWithUTF8String:newStyle.h6.fontFamily.c_str()];
371
+ [config setH6FontFamily:fontFamily];
372
+ } else {
373
+ [config setH6FontFamily:nullptr];
374
+ }
375
+ changed = YES;
376
+ }
377
+
378
+ if (newStyle.h6.fontWeight != oldStyle.h6.fontWeight) {
379
+ if (!newStyle.h6.fontWeight.empty()) {
380
+ NSString *fontWeight = [[NSString alloc] initWithUTF8String:newStyle.h6.fontWeight.c_str()];
381
+ [config setH6FontWeight:fontWeight];
382
+ } else {
383
+ [config setH6FontWeight:nullptr];
384
+ }
385
+ changed = YES;
386
+ }
387
+
388
+ if (newStyle.h6.color != oldStyle.h6.color) {
389
+ if (newStyle.h6.color) {
390
+ RCTUIColor *h6Color = RCTUIColorFromSharedColor(newStyle.h6.color);
391
+ [config setH6Color:h6Color];
392
+ } else {
393
+ [config setH6Color:nullptr];
394
+ }
395
+ changed = YES;
396
+ }
397
+
398
+ if (newStyle.h6.marginTop != oldStyle.h6.marginTop) {
399
+ [config setH6MarginTop:newStyle.h6.marginTop];
400
+ changed = YES;
401
+ }
402
+
403
+ if (newStyle.h6.marginBottom != oldStyle.h6.marginBottom) {
404
+ [config setH6MarginBottom:newStyle.h6.marginBottom];
405
+ changed = YES;
406
+ }
407
+
408
+ if (newStyle.h6.lineHeight != oldStyle.h6.lineHeight) {
409
+ [config setH6LineHeight:newStyle.h6.lineHeight];
410
+ changed = YES;
411
+ }
412
+
413
+ if (newStyle.h6.textAlign != oldStyle.h6.textAlign) {
414
+ [config setH6TextAlign:textAlignmentFromString(@(newStyle.h6.textAlign.c_str()))];
415
+ changed = YES;
416
+ }
417
+
418
+ // ── Blockquote ─────────────────────────────────────────────────────────────
419
+
420
+ if (newStyle.blockquote.fontSize != oldStyle.blockquote.fontSize) {
421
+ [config setBlockquoteFontSize:newStyle.blockquote.fontSize];
422
+ changed = YES;
423
+ }
424
+
425
+ if (newStyle.blockquote.fontFamily != oldStyle.blockquote.fontFamily) {
426
+ NSString *fontFamily = [[NSString alloc] initWithUTF8String:newStyle.blockquote.fontFamily.c_str()];
427
+ [config setBlockquoteFontFamily:fontFamily];
428
+ changed = YES;
429
+ }
430
+
431
+ if (newStyle.blockquote.fontWeight != oldStyle.blockquote.fontWeight) {
432
+ NSString *fontWeight = [[NSString alloc] initWithUTF8String:newStyle.blockquote.fontWeight.c_str()];
433
+ [config setBlockquoteFontWeight:fontWeight];
434
+ changed = YES;
435
+ }
436
+
437
+ if (newStyle.blockquote.color != oldStyle.blockquote.color) {
438
+ RCTUIColor *blockquoteColor = RCTUIColorFromSharedColor(newStyle.blockquote.color);
439
+ [config setBlockquoteColor:blockquoteColor];
440
+ changed = YES;
441
+ }
442
+
443
+ if (newStyle.blockquote.marginTop != oldStyle.blockquote.marginTop) {
444
+ [config setBlockquoteMarginTop:newStyle.blockquote.marginTop];
445
+ changed = YES;
446
+ }
447
+
448
+ if (newStyle.blockquote.marginBottom != oldStyle.blockquote.marginBottom) {
449
+ [config setBlockquoteMarginBottom:newStyle.blockquote.marginBottom];
450
+ changed = YES;
451
+ }
452
+
453
+ if (newStyle.blockquote.lineHeight != oldStyle.blockquote.lineHeight) {
454
+ [config setBlockquoteLineHeight:newStyle.blockquote.lineHeight];
455
+ changed = YES;
456
+ }
457
+
458
+ if (newStyle.blockquote.borderColor != oldStyle.blockquote.borderColor) {
459
+ RCTUIColor *blockquoteBorderColor = RCTUIColorFromSharedColor(newStyle.blockquote.borderColor);
460
+ [config setBlockquoteBorderColor:blockquoteBorderColor];
461
+ changed = YES;
462
+ }
463
+
464
+ if (newStyle.blockquote.borderWidth != oldStyle.blockquote.borderWidth) {
465
+ [config setBlockquoteBorderWidth:newStyle.blockquote.borderWidth];
466
+ changed = YES;
467
+ }
468
+
469
+ if (newStyle.blockquote.gapWidth != oldStyle.blockquote.gapWidth) {
470
+ [config setBlockquoteGapWidth:newStyle.blockquote.gapWidth];
471
+ changed = YES;
472
+ }
473
+
474
+ if (newStyle.blockquote.backgroundColor != oldStyle.blockquote.backgroundColor) {
475
+ RCTUIColor *blockquoteBackgroundColor = RCTUIColorFromSharedColor(newStyle.blockquote.backgroundColor);
476
+ [config setBlockquoteBackgroundColor:blockquoteBackgroundColor];
477
+ changed = YES;
478
+ }
479
+
480
+ if (newStyle.blockquote.borderRadius != oldStyle.blockquote.borderRadius) {
481
+ [config setBlockquoteBorderRadius:newStyle.blockquote.borderRadius];
482
+ changed = YES;
483
+ }
484
+
485
+ if (newStyle.blockquote.padding != oldStyle.blockquote.padding) {
486
+ [config setBlockquotePadding:newStyle.blockquote.padding];
487
+ changed = YES;
488
+ }
489
+
490
+ const auto &newAdm = newStyle.blockquote.admonitions;
491
+ const auto &oldAdm = oldStyle.blockquote.admonitions;
492
+ BOOL admonitionsChanged =
493
+ newAdm.note.color != oldAdm.note.color || newAdm.note.backgroundColor != oldAdm.note.backgroundColor ||
494
+ newAdm.tip.color != oldAdm.tip.color || newAdm.tip.backgroundColor != oldAdm.tip.backgroundColor ||
495
+ newAdm.important.color != oldAdm.important.color ||
496
+ newAdm.important.backgroundColor != oldAdm.important.backgroundColor ||
497
+ newAdm.warning.color != oldAdm.warning.color ||
498
+ newAdm.warning.backgroundColor != oldAdm.warning.backgroundColor ||
499
+ newAdm.caution.color != oldAdm.caution.color || newAdm.caution.backgroundColor != oldAdm.caution.backgroundColor;
500
+ if (admonitionsChanged) {
501
+ RCTUIColor *clear = [RCTUIColor clearColor];
502
+ NSDictionary<NSString *, RCTUIColor *> *admonitionColors = @{
503
+ @"note" : RCTUIColorFromSharedColor(newAdm.note.color) ?: clear,
504
+ @"tip" : RCTUIColorFromSharedColor(newAdm.tip.color) ?: clear,
505
+ @"important" : RCTUIColorFromSharedColor(newAdm.important.color) ?: clear,
506
+ @"warning" : RCTUIColorFromSharedColor(newAdm.warning.color) ?: clear,
507
+ @"caution" : RCTUIColorFromSharedColor(newAdm.caution.color) ?: clear,
508
+ };
509
+ NSDictionary<NSString *, RCTUIColor *> *admonitionBackgroundColors = @{
510
+ @"note" : RCTUIColorFromSharedColor(newAdm.note.backgroundColor) ?: clear,
511
+ @"tip" : RCTUIColorFromSharedColor(newAdm.tip.backgroundColor) ?: clear,
512
+ @"important" : RCTUIColorFromSharedColor(newAdm.important.backgroundColor) ?: clear,
513
+ @"warning" : RCTUIColorFromSharedColor(newAdm.warning.backgroundColor) ?: clear,
514
+ @"caution" : RCTUIColorFromSharedColor(newAdm.caution.backgroundColor) ?: clear,
515
+ };
516
+ [config setAdmonitionColors:admonitionColors backgroundColors:admonitionBackgroundColors];
517
+ changed = YES;
518
+ }
519
+
520
+ // ── Link ───────────────────────────────────────────────────────────────────
521
+
522
+ if (newStyle.link.fontFamily != oldStyle.link.fontFamily) {
523
+ if (!newStyle.link.fontFamily.empty()) {
524
+ NSString *fontFamily = [[NSString alloc] initWithUTF8String:newStyle.link.fontFamily.c_str()];
525
+ [config setLinkFontFamily:fontFamily];
526
+ } else {
527
+ [config setLinkFontFamily:nullptr];
528
+ }
529
+ changed = YES;
530
+ }
531
+
532
+ if (newStyle.link.color != oldStyle.link.color) {
533
+ RCTUIColor *linkColor = RCTUIColorFromSharedColor(newStyle.link.color);
534
+ [config setLinkColor:linkColor];
535
+ changed = YES;
536
+ }
537
+
538
+ {
539
+ BOOL newUnderline = newStyle.link.underline ? YES : NO;
540
+ if (newStyle.link.underline != oldStyle.link.underline || [config linkUnderline] != newUnderline) {
541
+ [config setLinkUnderline:newUnderline];
542
+ changed = YES;
543
+ }
544
+ }
545
+
546
+ if (newStyle.link.backgroundColor != oldStyle.link.backgroundColor) {
547
+ RCTUIColor *color = RCTUIColorFromSharedColor(newStyle.link.backgroundColor);
548
+ [config setLinkBackgroundColor:CGColorGetAlpha(color.CGColor) > 0 ? color : nil];
549
+ changed = YES;
550
+ }
551
+
552
+ {
553
+ BOOL linkVariantsChanged = newStyle.linkVariants.size() != oldStyle.linkVariants.size();
554
+ if (!linkVariantsChanged) {
555
+ for (size_t i = 0; i < newStyle.linkVariants.size(); i++) {
556
+ const auto &newVariant = newStyle.linkVariants[i];
557
+ const auto &oldVariant = oldStyle.linkVariants[i];
558
+ if (newVariant.pattern != oldVariant.pattern || newVariant.color != oldVariant.color ||
559
+ newVariant.underline != oldVariant.underline || newVariant.backgroundColor != oldVariant.backgroundColor ||
560
+ newVariant.fontFamily != oldVariant.fontFamily || newVariant.pill.enabled != oldVariant.pill.enabled ||
561
+ newVariant.pill.label != oldVariant.pill.label || newVariant.pill.iconUri != oldVariant.pill.iconUri ||
562
+ newVariant.pill.iconTintColor != oldVariant.pill.iconTintColor ||
563
+ newVariant.pill.borderRadius != oldVariant.pill.borderRadius ||
564
+ newVariant.pill.paddingHorizontal != oldVariant.pill.paddingHorizontal ||
565
+ newVariant.pill.paddingVertical != oldVariant.pill.paddingVertical ||
566
+ newVariant.pill.lineHeight != oldVariant.pill.lineHeight ||
567
+ newVariant.pill.borderWidth != oldVariant.pill.borderWidth ||
568
+ newVariant.pill.borderColor != oldVariant.pill.borderColor ||
569
+ newVariant.pill.maxWidth != oldVariant.pill.maxWidth) {
570
+ linkVariantsChanged = YES;
571
+ break;
572
+ }
573
+ }
574
+ }
575
+ if (linkVariantsChanged) {
576
+ NSMutableArray<LinkVariantConfig *> *variants = [NSMutableArray array];
577
+ for (const auto &entry : newStyle.linkVariants) {
578
+ LinkVariantConfig *variant = [[LinkVariantConfig alloc] init];
579
+ variant.pattern = [[NSString alloc] initWithUTF8String:entry.pattern.c_str()];
580
+ variant.color = RCTUIColorFromSharedColor(entry.color);
581
+ variant.underline = entry.underline;
582
+ variant.fontFamily = [[NSString alloc] initWithUTF8String:entry.fontFamily.c_str()];
583
+ if (entry.pill.enabled) {
584
+ LinkPillConfig *pill = [[LinkPillConfig alloc] init];
585
+ pill.label = [[NSString alloc] initWithUTF8String:entry.pill.label.c_str()];
586
+ pill.iconUri = [[NSString alloc] initWithUTF8String:entry.pill.iconUri.c_str()];
587
+ pill.iconTintColor = entry.pill.iconTintColor ? RCTUIColorFromSharedColor(entry.pill.iconTintColor) : nil;
588
+ pill.borderRadius = entry.pill.borderRadius;
589
+ pill.paddingHorizontal = entry.pill.paddingHorizontal;
590
+ pill.paddingVertical = entry.pill.paddingVertical;
591
+ pill.lineHeight = entry.pill.lineHeight;
592
+ pill.borderWidth = entry.pill.borderWidth;
593
+ pill.borderColor = RCTUIColorFromSharedColor(entry.pill.borderColor);
594
+ pill.maxWidth = entry.pill.maxWidth;
595
+ variant.pill = pill;
596
+ }
597
+ RCTUIColor *backgroundColor = RCTUIColorFromSharedColor(entry.backgroundColor);
598
+ variant.backgroundColor = CGColorGetAlpha(backgroundColor.CGColor) > 0 ? backgroundColor : nil;
599
+ [variants addObject:variant];
600
+ }
601
+ [config setLinkVariants:variants];
602
+ changed = YES;
603
+ }
604
+ }
605
+
606
+ // ── Strong ─────────────────────────────────────────────────────────────────
607
+
608
+ if (newStyle.strong.fontFamily != oldStyle.strong.fontFamily) {
609
+ if (!newStyle.strong.fontFamily.empty()) {
610
+ NSString *fontFamily = [[NSString alloc] initWithUTF8String:newStyle.strong.fontFamily.c_str()];
611
+ [config setStrongFontFamily:fontFamily];
612
+ } else {
613
+ [config setStrongFontFamily:nullptr];
614
+ }
615
+ changed = YES;
616
+ }
617
+
618
+ if (newStyle.strong.fontWeight != oldStyle.strong.fontWeight) {
619
+ if (!newStyle.strong.fontWeight.empty()) {
620
+ NSString *fontWeight = [[NSString alloc] initWithUTF8String:newStyle.strong.fontWeight.c_str()];
621
+ [config setStrongFontWeight:fontWeight];
622
+ } else {
623
+ [config setStrongFontWeight:nullptr];
624
+ }
625
+ changed = YES;
626
+ }
627
+
628
+ if (newStyle.strong.color != oldStyle.strong.color) {
629
+ if (newStyle.strong.color) {
630
+ RCTUIColor *strongColor = RCTUIColorFromSharedColor(newStyle.strong.color);
631
+ [config setStrongColor:strongColor];
632
+ } else {
633
+ [config setStrongColor:nullptr];
634
+ }
635
+ changed = YES;
636
+ }
637
+
638
+ // ── Emphasis ───────────────────────────────────────────────────────────────
639
+
640
+ if (newStyle.em.fontFamily != oldStyle.em.fontFamily) {
641
+ if (!newStyle.em.fontFamily.empty()) {
642
+ NSString *fontFamily = [[NSString alloc] initWithUTF8String:newStyle.em.fontFamily.c_str()];
643
+ [config setEmphasisFontFamily:fontFamily];
644
+ } else {
645
+ [config setEmphasisFontFamily:nullptr];
646
+ }
647
+ changed = YES;
648
+ }
649
+
650
+ if (newStyle.em.fontStyle != oldStyle.em.fontStyle) {
651
+ if (!newStyle.em.fontStyle.empty()) {
652
+ NSString *fontStyle = [[NSString alloc] initWithUTF8String:newStyle.em.fontStyle.c_str()];
653
+ [config setEmphasisFontStyle:fontStyle];
654
+ } else {
655
+ [config setEmphasisFontStyle:nullptr];
656
+ }
657
+ changed = YES;
658
+ }
659
+
660
+ if (newStyle.em.color != oldStyle.em.color) {
661
+ if (newStyle.em.color) {
662
+ RCTUIColor *emphasisColor = RCTUIColorFromSharedColor(newStyle.em.color);
663
+ [config setEmphasisColor:emphasisColor];
664
+ } else {
665
+ [config setEmphasisColor:nullptr];
666
+ }
667
+ changed = YES;
668
+ }
669
+
670
+ // ── Strikethrough ──────────────────────────────────────────────────────────
671
+
672
+ if (newStyle.strikethrough.color != oldStyle.strikethrough.color) {
673
+ RCTUIColor *strikethroughColor = RCTUIColorFromSharedColor(newStyle.strikethrough.color);
674
+ [config setStrikethroughColor:strikethroughColor];
675
+ changed = YES;
676
+ }
677
+
678
+ // ── Highlight ──────────────────────────────────────────────────────────────
679
+
680
+ if (newStyle.highlight.color != oldStyle.highlight.color) {
681
+ RCTUIColor *highlightColor = RCTUIColorFromSharedColor(newStyle.highlight.color);
682
+ [config setHighlightColor:highlightColor];
683
+ changed = YES;
684
+ }
685
+
686
+ if (newStyle.highlight.backgroundColor != oldStyle.highlight.backgroundColor) {
687
+ RCTUIColor *highlightBackgroundColor = RCTUIColorFromSharedColor(newStyle.highlight.backgroundColor);
688
+ [config setHighlightBackgroundColor:highlightBackgroundColor];
689
+ changed = YES;
690
+ }
691
+
692
+ // ── Underline ──────────────────────────────────────────────────────────────
693
+
694
+ if (newStyle.underline.color != oldStyle.underline.color) {
695
+ RCTUIColor *underlineColor = RCTUIColorFromSharedColor(newStyle.underline.color);
696
+ [config setUnderlineColor:underlineColor];
697
+ changed = YES;
698
+ }
699
+
700
+ // ── Code ───────────────────────────────────────────────────────────────────
701
+
702
+ if (newStyle.code.fontFamily != oldStyle.code.fontFamily) {
703
+ if (!newStyle.code.fontFamily.empty()) {
704
+ NSString *fontFamily = [[NSString alloc] initWithUTF8String:newStyle.code.fontFamily.c_str()];
705
+ [config setCodeFontFamily:fontFamily];
706
+ } else {
707
+ [config setCodeFontFamily:nullptr];
708
+ }
709
+ changed = YES;
710
+ }
711
+
712
+ if (newStyle.code.fontSize != oldStyle.code.fontSize) {
713
+ [config setCodeFontSize:newStyle.code.fontSize];
714
+ changed = YES;
715
+ }
716
+
717
+ if (newStyle.code.color != oldStyle.code.color) {
718
+ if (newStyle.code.color) {
719
+ RCTUIColor *codeColor = RCTUIColorFromSharedColor(newStyle.code.color);
720
+ [config setCodeColor:codeColor];
721
+ } else {
722
+ [config setCodeColor:nullptr];
723
+ }
724
+ changed = YES;
725
+ }
726
+
727
+ if (newStyle.code.backgroundColor != oldStyle.code.backgroundColor) {
728
+ if (newStyle.code.backgroundColor) {
729
+ RCTUIColor *codeBackgroundColor = RCTUIColorFromSharedColor(newStyle.code.backgroundColor);
730
+ [config setCodeBackgroundColor:codeBackgroundColor];
731
+ } else {
732
+ [config setCodeBackgroundColor:nullptr];
733
+ }
734
+ changed = YES;
735
+ }
736
+
737
+ if (newStyle.code.borderColor != oldStyle.code.borderColor) {
738
+ if (newStyle.code.borderColor) {
739
+ RCTUIColor *codeBorderColor = RCTUIColorFromSharedColor(newStyle.code.borderColor);
740
+ [config setCodeBorderColor:codeBorderColor];
741
+ } else {
742
+ [config setCodeBorderColor:nullptr];
743
+ }
744
+ changed = YES;
745
+ }
746
+
747
+ // ── Factoid ────────────────────────────────────────────────────────────────
748
+
749
+ if (newStyle.factoid.color != oldStyle.factoid.color) {
750
+ if (newStyle.factoid.color) {
751
+ RCTUIColor *factoidColor = RCTUIColorFromSharedColor(newStyle.factoid.color);
752
+ [config setFactoidColor:factoidColor];
753
+ } else {
754
+ [config setFactoidColor:nullptr];
755
+ }
756
+ changed = YES;
757
+ }
758
+
759
+ if (newStyle.factoid.backgroundColor != oldStyle.factoid.backgroundColor) {
760
+ if (newStyle.factoid.backgroundColor) {
761
+ RCTUIColor *factoidBackgroundColor = RCTUIColorFromSharedColor(newStyle.factoid.backgroundColor);
762
+ [config setFactoidBackgroundColor:factoidBackgroundColor];
763
+ } else {
764
+ [config setFactoidBackgroundColor:nullptr];
765
+ }
766
+ changed = YES;
767
+ }
768
+
769
+ if (newStyle.factoid.borderColor != oldStyle.factoid.borderColor) {
770
+ if (newStyle.factoid.borderColor) {
771
+ RCTUIColor *factoidBorderColor = RCTUIColorFromSharedColor(newStyle.factoid.borderColor);
772
+ [config setFactoidBorderColor:factoidBorderColor];
773
+ } else {
774
+ [config setFactoidBorderColor:nullptr];
775
+ }
776
+ changed = YES;
777
+ }
778
+
779
+ // ── Mention ────────────────────────────────────────────────────────────────
780
+
781
+ if (newStyle.mention.color != oldStyle.mention.color) {
782
+ if (newStyle.mention.color) {
783
+ RCTUIColor *mentionColor = RCTUIColorFromSharedColor(newStyle.mention.color);
784
+ [config setMentionColor:mentionColor];
785
+ } else {
786
+ [config setMentionColor:nullptr];
787
+ }
788
+ changed = YES;
789
+ }
790
+
791
+ if (newStyle.mention.backgroundColor != oldStyle.mention.backgroundColor) {
792
+ if (newStyle.mention.backgroundColor) {
793
+ RCTUIColor *mentionBackgroundColor = RCTUIColorFromSharedColor(newStyle.mention.backgroundColor);
794
+ [config setMentionBackgroundColor:mentionBackgroundColor];
795
+ } else {
796
+ [config setMentionBackgroundColor:nullptr];
797
+ }
798
+ changed = YES;
799
+ }
800
+
801
+ // ── Image ──────────────────────────────────────────────────────────────────
802
+
803
+ if (newStyle.image.height != oldStyle.image.height) {
804
+ [config setImageHeight:newStyle.image.height];
805
+ changed = YES;
806
+ }
807
+
808
+ if (newStyle.image.maxHeight != oldStyle.image.maxHeight) {
809
+ [config setImageMaxHeight:newStyle.image.maxHeight];
810
+ changed = YES;
811
+ }
812
+
813
+ if (newStyle.image.aspectRatio != oldStyle.image.aspectRatio) {
814
+ [config setImageAspectRatio:newStyle.image.aspectRatio];
815
+ changed = YES;
816
+ }
817
+
818
+ if (newStyle.image.resizeMode != oldStyle.image.resizeMode) {
819
+ [config setImageResizeMode:@(newStyle.image.resizeMode.c_str())];
820
+ changed = YES;
821
+ }
822
+
823
+ if (newStyle.image.borderRadius != oldStyle.image.borderRadius) {
824
+ [config setImageBorderRadius:newStyle.image.borderRadius];
825
+ changed = YES;
826
+ }
827
+
828
+ if (newStyle.image.marginTop != oldStyle.image.marginTop) {
829
+ [config setImageMarginTop:newStyle.image.marginTop];
830
+ changed = YES;
831
+ }
832
+
833
+ if (newStyle.image.marginBottom != oldStyle.image.marginBottom) {
834
+ [config setImageMarginBottom:newStyle.image.marginBottom];
835
+ changed = YES;
836
+ }
837
+
838
+ // ── Video ───────────────────────────────────────────────────────────────────
839
+
840
+ if (newStyle.video.marginTop != oldStyle.video.marginTop) {
841
+ [config setVideoMarginTop:newStyle.video.marginTop];
842
+ changed = YES;
843
+ }
844
+
845
+ if (newStyle.video.marginBottom != oldStyle.video.marginBottom) {
846
+ [config setVideoMarginBottom:newStyle.video.marginBottom];
847
+ changed = YES;
848
+ }
849
+
850
+ if (newStyle.video.borderRadius != oldStyle.video.borderRadius) {
851
+ [config setVideoBorderRadius:newStyle.video.borderRadius];
852
+ changed = YES;
853
+ }
854
+
855
+ if (newStyle.video.aspectRatio != oldStyle.video.aspectRatio) {
856
+ [config setVideoAspectRatio:newStyle.video.aspectRatio];
857
+ changed = YES;
858
+ }
859
+
860
+ if (newStyle.video.backgroundColor != oldStyle.video.backgroundColor) {
861
+ [config setVideoBackgroundColor:RCTUIColorFromSharedColor(newStyle.video.backgroundColor)];
862
+ changed = YES;
863
+ }
864
+
865
+ // ── Inline Image ───────────────────────────────────────────────────────────
866
+
867
+ if (newStyle.inlineImage.size != oldStyle.inlineImage.size) {
868
+ [config setInlineImageSize:newStyle.inlineImage.size];
869
+ changed = YES;
870
+ }
871
+
872
+ // ── List ───────────────────────────────────────────────────────────────────
873
+
874
+ if (newStyle.list.fontSize != oldStyle.list.fontSize) {
875
+ [config setListStyleFontSize:newStyle.list.fontSize];
876
+ changed = YES;
877
+ }
878
+
879
+ if (newStyle.list.fontFamily != oldStyle.list.fontFamily) {
880
+ NSString *fontFamily = [[NSString alloc] initWithUTF8String:newStyle.list.fontFamily.c_str()];
881
+ [config setListStyleFontFamily:fontFamily];
882
+ changed = YES;
883
+ }
884
+
885
+ if (newStyle.list.fontWeight != oldStyle.list.fontWeight) {
886
+ NSString *fontWeight = [[NSString alloc] initWithUTF8String:newStyle.list.fontWeight.c_str()];
887
+ [config setListStyleFontWeight:fontWeight];
888
+ changed = YES;
889
+ }
890
+
891
+ if (newStyle.list.color != oldStyle.list.color) {
892
+ RCTUIColor *listColor = RCTUIColorFromSharedColor(newStyle.list.color);
893
+ [config setListStyleColor:listColor];
894
+ changed = YES;
895
+ }
896
+
897
+ if (newStyle.list.marginTop != oldStyle.list.marginTop) {
898
+ [config setListStyleMarginTop:newStyle.list.marginTop];
899
+ changed = YES;
900
+ }
901
+
902
+ if (newStyle.list.marginBottom != oldStyle.list.marginBottom) {
903
+ [config setListStyleMarginBottom:newStyle.list.marginBottom];
904
+ changed = YES;
905
+ }
906
+
907
+ if (newStyle.list.lineHeight != oldStyle.list.lineHeight) {
908
+ [config setListStyleLineHeight:newStyle.list.lineHeight];
909
+ changed = YES;
910
+ }
911
+
912
+ if (newStyle.list.bulletColor != oldStyle.list.bulletColor) {
913
+ RCTUIColor *bulletColor = RCTUIColorFromSharedColor(newStyle.list.bulletColor);
914
+ [config setListStyleBulletColor:bulletColor];
915
+ changed = YES;
916
+ }
917
+
918
+ if (newStyle.list.bulletSize != oldStyle.list.bulletSize) {
919
+ [config setListStyleBulletSize:newStyle.list.bulletSize];
920
+ changed = YES;
921
+ }
922
+
923
+ if (newStyle.list.markerMinWidth != oldStyle.list.markerMinWidth) {
924
+ [config setListStyleMarkerMinWidth:newStyle.list.markerMinWidth];
925
+ changed = YES;
926
+ }
927
+
928
+ if (newStyle.list.markerColor != oldStyle.list.markerColor) {
929
+ RCTUIColor *markerColor = RCTUIColorFromSharedColor(newStyle.list.markerColor);
930
+ [config setListStyleMarkerColor:markerColor];
931
+ changed = YES;
932
+ }
933
+
934
+ if (newStyle.list.markerFontWeight != oldStyle.list.markerFontWeight) {
935
+ NSString *markerFontWeight = [[NSString alloc] initWithUTF8String:newStyle.list.markerFontWeight.c_str()];
936
+ [config setListStyleMarkerFontWeight:markerFontWeight];
937
+ changed = YES;
938
+ }
939
+
940
+ if (newStyle.list.gapWidth != oldStyle.list.gapWidth) {
941
+ [config setListStyleGapWidth:newStyle.list.gapWidth];
942
+ changed = YES;
943
+ }
944
+
945
+ if (newStyle.list.marginLeft != oldStyle.list.marginLeft) {
946
+ [config setListStyleMarginLeft:newStyle.list.marginLeft];
947
+ changed = YES;
948
+ }
949
+
950
+ if (newStyle.list.itemSpacing != oldStyle.list.itemSpacing) {
951
+ [config setListStyleItemSpacing:newStyle.list.itemSpacing];
952
+ changed = YES;
953
+ }
954
+
955
+ // ── Code Block ─────────────────────────────────────────────────────────────
956
+
957
+ if (newStyle.codeBlock.fontSize != oldStyle.codeBlock.fontSize) {
958
+ [config setCodeBlockFontSize:newStyle.codeBlock.fontSize];
959
+ changed = YES;
960
+ }
961
+
962
+ if (newStyle.codeBlock.fontFamily != oldStyle.codeBlock.fontFamily) {
963
+ NSString *fontFamily = [[NSString alloc] initWithUTF8String:newStyle.codeBlock.fontFamily.c_str()];
964
+ [config setCodeBlockFontFamily:fontFamily];
965
+ changed = YES;
966
+ }
967
+
968
+ if (newStyle.codeBlock.fontWeight != oldStyle.codeBlock.fontWeight) {
969
+ NSString *fontWeight = [[NSString alloc] initWithUTF8String:newStyle.codeBlock.fontWeight.c_str()];
970
+ [config setCodeBlockFontWeight:fontWeight];
971
+ changed = YES;
972
+ }
973
+
974
+ if (newStyle.codeBlock.color != oldStyle.codeBlock.color) {
975
+ RCTUIColor *codeBlockColor = RCTUIColorFromSharedColor(newStyle.codeBlock.color);
976
+ [config setCodeBlockColor:codeBlockColor];
977
+ changed = YES;
978
+ }
979
+
980
+ if (newStyle.codeBlock.marginTop != oldStyle.codeBlock.marginTop) {
981
+ [config setCodeBlockMarginTop:newStyle.codeBlock.marginTop];
982
+ changed = YES;
983
+ }
984
+
985
+ if (newStyle.codeBlock.marginBottom != oldStyle.codeBlock.marginBottom) {
986
+ [config setCodeBlockMarginBottom:newStyle.codeBlock.marginBottom];
987
+ changed = YES;
988
+ }
989
+
990
+ if (newStyle.codeBlock.lineHeight != oldStyle.codeBlock.lineHeight) {
991
+ [config setCodeBlockLineHeight:newStyle.codeBlock.lineHeight];
992
+ changed = YES;
993
+ }
994
+
995
+ if (newStyle.codeBlock.backgroundColor != oldStyle.codeBlock.backgroundColor) {
996
+ RCTUIColor *codeBlockBackgroundColor = RCTUIColorFromSharedColor(newStyle.codeBlock.backgroundColor);
997
+ [config setCodeBlockBackgroundColor:codeBlockBackgroundColor];
998
+ changed = YES;
999
+ }
1000
+
1001
+ if (newStyle.codeBlock.borderColor != oldStyle.codeBlock.borderColor) {
1002
+ RCTUIColor *codeBlockBorderColor = RCTUIColorFromSharedColor(newStyle.codeBlock.borderColor);
1003
+ [config setCodeBlockBorderColor:codeBlockBorderColor];
1004
+ changed = YES;
1005
+ }
1006
+
1007
+ if (newStyle.codeBlock.borderRadius != oldStyle.codeBlock.borderRadius) {
1008
+ [config setCodeBlockBorderRadius:newStyle.codeBlock.borderRadius];
1009
+ changed = YES;
1010
+ }
1011
+
1012
+ if (newStyle.codeBlock.borderWidth != oldStyle.codeBlock.borderWidth) {
1013
+ [config setCodeBlockBorderWidth:newStyle.codeBlock.borderWidth];
1014
+ changed = YES;
1015
+ }
1016
+
1017
+ if (newStyle.codeBlock.padding != oldStyle.codeBlock.padding) {
1018
+ [config setCodeBlockPadding:newStyle.codeBlock.padding];
1019
+ changed = YES;
1020
+ }
1021
+
1022
+ #define ENRM_SET_SYNTAX_COLOR(field, token) \
1023
+ if (newStyle.codeBlock.syntaxColors.field != oldStyle.codeBlock.syntaxColors.field) { \
1024
+ [config setCodeBlockSyntaxColor:RCTUIColorFromSharedColor(newStyle.codeBlock.syntaxColors.field) forToken:token]; \
1025
+ changed = YES; \
1026
+ }
1027
+ ENRM_SET_SYNTAX_COLOR(keyword, 0)
1028
+ ENRM_SET_SYNTAX_COLOR(operatorColor, 1)
1029
+ ENRM_SET_SYNTAX_COLOR(punctuation, 2)
1030
+ ENRM_SET_SYNTAX_COLOR(string, 3)
1031
+ ENRM_SET_SYNTAX_COLOR(number, 4)
1032
+ ENRM_SET_SYNTAX_COLOR(constant, 5)
1033
+ ENRM_SET_SYNTAX_COLOR(comment, 6)
1034
+ ENRM_SET_SYNTAX_COLOR(function, 7)
1035
+ ENRM_SET_SYNTAX_COLOR(type, 8)
1036
+ ENRM_SET_SYNTAX_COLOR(variable, 9)
1037
+ ENRM_SET_SYNTAX_COLOR(property, 10)
1038
+ ENRM_SET_SYNTAX_COLOR(tag, 11)
1039
+ ENRM_SET_SYNTAX_COLOR(attribute, 12)
1040
+ ENRM_SET_SYNTAX_COLOR(embedded, 13)
1041
+ #undef ENRM_SET_SYNTAX_COLOR
1042
+
1043
+ // ── Thematic Break ─────────────────────────────────────────────────────────
1044
+
1045
+ if (newStyle.thematicBreak.color != oldStyle.thematicBreak.color) {
1046
+ RCTUIColor *thematicBreakColor = RCTUIColorFromSharedColor(newStyle.thematicBreak.color);
1047
+ [config setThematicBreakColor:thematicBreakColor];
1048
+ changed = YES;
1049
+ }
1050
+
1051
+ if (newStyle.thematicBreak.height != oldStyle.thematicBreak.height) {
1052
+ [config setThematicBreakHeight:newStyle.thematicBreak.height];
1053
+ changed = YES;
1054
+ }
1055
+
1056
+ if (newStyle.thematicBreak.marginTop != oldStyle.thematicBreak.marginTop) {
1057
+ [config setThematicBreakMarginTop:newStyle.thematicBreak.marginTop];
1058
+ changed = YES;
1059
+ }
1060
+
1061
+ if (newStyle.thematicBreak.marginBottom != oldStyle.thematicBreak.marginBottom) {
1062
+ [config setThematicBreakMarginBottom:newStyle.thematicBreak.marginBottom];
1063
+ changed = YES;
1064
+ }
1065
+
1066
+ // ── Table ───────────────────────────────────────────────────────────────────
1067
+
1068
+ if (newStyle.table.fontSize != oldStyle.table.fontSize) {
1069
+ [config setTableFontSize:newStyle.table.fontSize];
1070
+ changed = YES;
1071
+ }
1072
+
1073
+ if (newStyle.table.fontFamily != oldStyle.table.fontFamily) {
1074
+ if (!newStyle.table.fontFamily.empty()) {
1075
+ NSString *fontFamily = [[NSString alloc] initWithUTF8String:newStyle.table.fontFamily.c_str()];
1076
+ [config setTableFontFamily:fontFamily];
1077
+ } else {
1078
+ [config setTableFontFamily:nullptr];
1079
+ }
1080
+ changed = YES;
1081
+ }
1082
+
1083
+ if (newStyle.table.fontWeight != oldStyle.table.fontWeight) {
1084
+ if (!newStyle.table.fontWeight.empty()) {
1085
+ NSString *fontWeight = [[NSString alloc] initWithUTF8String:newStyle.table.fontWeight.c_str()];
1086
+ [config setTableFontWeight:fontWeight];
1087
+ } else {
1088
+ [config setTableFontWeight:nullptr];
1089
+ }
1090
+ changed = YES;
1091
+ }
1092
+
1093
+ if (newStyle.table.color != oldStyle.table.color) {
1094
+ if (newStyle.table.color) {
1095
+ RCTUIColor *color = RCTUIColorFromSharedColor(newStyle.table.color);
1096
+ [config setTableColor:color];
1097
+ } else {
1098
+ [config setTableColor:nullptr];
1099
+ }
1100
+ changed = YES;
1101
+ }
1102
+
1103
+ if (newStyle.table.marginTop != oldStyle.table.marginTop) {
1104
+ [config setTableMarginTop:newStyle.table.marginTop];
1105
+ changed = YES;
1106
+ }
1107
+
1108
+ if (newStyle.table.marginBottom != oldStyle.table.marginBottom) {
1109
+ [config setTableMarginBottom:newStyle.table.marginBottom];
1110
+ changed = YES;
1111
+ }
1112
+
1113
+ if (newStyle.table.lineHeight != oldStyle.table.lineHeight) {
1114
+ [config setTableLineHeight:newStyle.table.lineHeight];
1115
+ changed = YES;
1116
+ }
1117
+
1118
+ if (newStyle.table.headerFontFamily != oldStyle.table.headerFontFamily) {
1119
+ if (!newStyle.table.headerFontFamily.empty()) {
1120
+ NSString *fontFamily = [[NSString alloc] initWithUTF8String:newStyle.table.headerFontFamily.c_str()];
1121
+ [config setTableHeaderFontFamily:fontFamily];
1122
+ } else {
1123
+ [config setTableHeaderFontFamily:nullptr];
1124
+ }
1125
+ changed = YES;
1126
+ }
1127
+
1128
+ if (newStyle.table.headerBackgroundColor != oldStyle.table.headerBackgroundColor) {
1129
+ RCTUIColor *color = RCTUIColorFromSharedColor(newStyle.table.headerBackgroundColor);
1130
+ [config setTableHeaderBackgroundColor:color];
1131
+ changed = YES;
1132
+ }
1133
+
1134
+ if (newStyle.table.headerTextColor != oldStyle.table.headerTextColor) {
1135
+ RCTUIColor *color = RCTUIColorFromSharedColor(newStyle.table.headerTextColor);
1136
+ [config setTableHeaderTextColor:color];
1137
+ changed = YES;
1138
+ }
1139
+
1140
+ if (newStyle.table.rowEvenBackgroundColor != oldStyle.table.rowEvenBackgroundColor) {
1141
+ RCTUIColor *color = RCTUIColorFromSharedColor(newStyle.table.rowEvenBackgroundColor);
1142
+ [config setTableRowEvenBackgroundColor:color];
1143
+ changed = YES;
1144
+ }
1145
+
1146
+ if (newStyle.table.rowOddBackgroundColor != oldStyle.table.rowOddBackgroundColor) {
1147
+ RCTUIColor *color = RCTUIColorFromSharedColor(newStyle.table.rowOddBackgroundColor);
1148
+ [config setTableRowOddBackgroundColor:color];
1149
+ changed = YES;
1150
+ }
1151
+
1152
+ if (newStyle.table.borderColor != oldStyle.table.borderColor) {
1153
+ RCTUIColor *color = RCTUIColorFromSharedColor(newStyle.table.borderColor);
1154
+ [config setTableBorderColor:color];
1155
+ changed = YES;
1156
+ }
1157
+
1158
+ if (newStyle.table.borderWidth != oldStyle.table.borderWidth) {
1159
+ [config setTableBorderWidth:newStyle.table.borderWidth];
1160
+ changed = YES;
1161
+ }
1162
+
1163
+ if (newStyle.table.borderRadius != oldStyle.table.borderRadius) {
1164
+ [config setTableBorderRadius:newStyle.table.borderRadius];
1165
+ changed = YES;
1166
+ }
1167
+
1168
+ if (newStyle.table.cellPaddingHorizontal != oldStyle.table.cellPaddingHorizontal) {
1169
+ [config setTableCellPaddingHorizontal:newStyle.table.cellPaddingHorizontal];
1170
+ changed = YES;
1171
+ }
1172
+
1173
+ if (newStyle.table.cellPaddingVertical != oldStyle.table.cellPaddingVertical) {
1174
+ [config setTableCellPaddingVertical:newStyle.table.cellPaddingVertical];
1175
+ changed = YES;
1176
+ }
1177
+
1178
+ if (newStyle.table.horizontalOverflow != oldStyle.table.horizontalOverflow) {
1179
+ [config setTableHorizontalOverflow:newStyle.table.horizontalOverflow];
1180
+ changed = YES;
1181
+ }
1182
+
1183
+ if (newStyle.table.align != oldStyle.table.align) {
1184
+ [config setTableAlign:@(newStyle.table.align.c_str())];
1185
+ changed = YES;
1186
+ }
1187
+
1188
+ // ── Task List ───────────────────────────────────────────────────────────────
1189
+
1190
+ if (newStyle.taskList.checkedColor != oldStyle.taskList.checkedColor) {
1191
+ RCTUIColor *color = RCTUIColorFromSharedColor(newStyle.taskList.checkedColor);
1192
+ [config setTaskListCheckedColor:color];
1193
+ changed = YES;
1194
+ }
1195
+
1196
+ if (newStyle.taskList.borderColor != oldStyle.taskList.borderColor) {
1197
+ RCTUIColor *color = RCTUIColorFromSharedColor(newStyle.taskList.borderColor);
1198
+ [config setTaskListBorderColor:color];
1199
+ changed = YES;
1200
+ }
1201
+
1202
+ if (newStyle.taskList.checkboxSize != oldStyle.taskList.checkboxSize) {
1203
+ [config setTaskListCheckboxSize:newStyle.taskList.checkboxSize];
1204
+ changed = YES;
1205
+ }
1206
+
1207
+ if (newStyle.taskList.checkboxBorderRadius != oldStyle.taskList.checkboxBorderRadius) {
1208
+ [config setTaskListCheckboxBorderRadius:newStyle.taskList.checkboxBorderRadius];
1209
+ changed = YES;
1210
+ }
1211
+
1212
+ if (newStyle.taskList.checkmarkColor != oldStyle.taskList.checkmarkColor) {
1213
+ RCTUIColor *color = RCTUIColorFromSharedColor(newStyle.taskList.checkmarkColor);
1214
+ [config setTaskListCheckmarkColor:color];
1215
+ changed = YES;
1216
+ }
1217
+
1218
+ if (newStyle.taskList.checkedTextColor != oldStyle.taskList.checkedTextColor) {
1219
+ if (newStyle.taskList.checkedTextColor) {
1220
+ RCTUIColor *color = RCTUIColorFromSharedColor(newStyle.taskList.checkedTextColor);
1221
+ [config setTaskListCheckedTextColor:color];
1222
+ } else {
1223
+ [config setTaskListCheckedTextColor:nullptr];
1224
+ }
1225
+ changed = YES;
1226
+ }
1227
+
1228
+ if (newStyle.taskList.checkedStrikethrough != oldStyle.taskList.checkedStrikethrough) {
1229
+ [config setTaskListCheckedStrikethrough:newStyle.taskList.checkedStrikethrough];
1230
+ changed = YES;
1231
+ }
1232
+
1233
+ // ── Math ───────────────────────────────────────────────────────────────────
1234
+
1235
+ if (newStyle.math.fontSize != oldStyle.math.fontSize) {
1236
+ [config setMathFontSize:newStyle.math.fontSize];
1237
+ changed = YES;
1238
+ }
1239
+
1240
+ if (newStyle.math.color != oldStyle.math.color) {
1241
+ if (newStyle.math.color) {
1242
+ RCTUIColor *color = RCTUIColorFromSharedColor(newStyle.math.color);
1243
+ [config setMathColor:color];
1244
+ } else {
1245
+ [config setMathColor:nullptr];
1246
+ }
1247
+ changed = YES;
1248
+ }
1249
+
1250
+ if (newStyle.math.backgroundColor != oldStyle.math.backgroundColor) {
1251
+ if (newStyle.math.backgroundColor) {
1252
+ RCTUIColor *color = RCTUIColorFromSharedColor(newStyle.math.backgroundColor);
1253
+ [config setMathBackgroundColor:color];
1254
+ } else {
1255
+ [config setMathBackgroundColor:nullptr];
1256
+ }
1257
+ changed = YES;
1258
+ }
1259
+
1260
+ if (newStyle.math.padding != oldStyle.math.padding) {
1261
+ [config setMathPadding:newStyle.math.padding];
1262
+ changed = YES;
1263
+ }
1264
+
1265
+ if (newStyle.math.marginTop != oldStyle.math.marginTop) {
1266
+ [config setMathMarginTop:newStyle.math.marginTop];
1267
+ changed = YES;
1268
+ }
1269
+
1270
+ if (newStyle.math.marginBottom != oldStyle.math.marginBottom) {
1271
+ [config setMathMarginBottom:newStyle.math.marginBottom];
1272
+ changed = YES;
1273
+ }
1274
+
1275
+ if (newStyle.math.textAlign != oldStyle.math.textAlign) {
1276
+ [config setMathTextAlign:@(newStyle.math.textAlign.c_str())];
1277
+ changed = YES;
1278
+ }
1279
+
1280
+ // ── Inline Math ───────────────────────────────────────────────────────────
1281
+
1282
+ if (newStyle.inlineMath.color != oldStyle.inlineMath.color) {
1283
+ if (newStyle.inlineMath.color) {
1284
+ RCTUIColor *color = RCTUIColorFromSharedColor(newStyle.inlineMath.color);
1285
+ [config setInlineMathColor:color];
1286
+ } else {
1287
+ [config setInlineMathColor:nullptr];
1288
+ }
1289
+ changed = YES;
1290
+ }
1291
+
1292
+ // ── Spoiler ─────────────────────────────────────────────────────────────
1293
+
1294
+ if (newStyle.spoiler.color != oldStyle.spoiler.color) {
1295
+ RCTUIColor *color = RCTUIColorFromSharedColor(newStyle.spoiler.color);
1296
+ [config setSpoilerColor:color];
1297
+ changed = YES;
1298
+ }
1299
+
1300
+ if (newStyle.spoiler.particles.density != oldStyle.spoiler.particles.density) {
1301
+ [config setSpoilerParticleDensity:newStyle.spoiler.particles.density];
1302
+ changed = YES;
1303
+ }
1304
+
1305
+ if (newStyle.spoiler.particles.speed != oldStyle.spoiler.particles.speed) {
1306
+ [config setSpoilerParticleSpeed:newStyle.spoiler.particles.speed];
1307
+ changed = YES;
1308
+ }
1309
+
1310
+ if (newStyle.spoiler.solid.borderRadius != oldStyle.spoiler.solid.borderRadius) {
1311
+ [config setSpoilerSolidBorderRadius:newStyle.spoiler.solid.borderRadius];
1312
+ changed = YES;
1313
+ }
1314
+
1315
+ // ── Superscript ──────────────────────────────────────────────────────────
1316
+
1317
+ if (newStyle.superscript.fontScale != oldStyle.superscript.fontScale) {
1318
+ [config setSuperscriptFontScale:newStyle.superscript.fontScale];
1319
+ changed = YES;
1320
+ }
1321
+
1322
+ if (newStyle.superscript.baselineOffsetScale != oldStyle.superscript.baselineOffsetScale) {
1323
+ [config setSuperscriptBaselineOffsetScale:newStyle.superscript.baselineOffsetScale];
1324
+ changed = YES;
1325
+ }
1326
+
1327
+ // ── Subscript ────────────────────────────────────────────────────────────
1328
+
1329
+ if (newStyle.subscript.fontScale != oldStyle.subscript.fontScale) {
1330
+ [config setSubscriptFontScale:newStyle.subscript.fontScale];
1331
+ changed = YES;
1332
+ }
1333
+
1334
+ if (newStyle.subscript.baselineOffsetScale != oldStyle.subscript.baselineOffsetScale) {
1335
+ [config setSubscriptBaselineOffsetScale:newStyle.subscript.baselineOffsetScale];
1336
+ changed = YES;
1337
+ }
1338
+
1339
+ return changed;
1340
+ }