File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -711,9 +711,6 @@ - (void)tryUpdatingActiveStyles {
711711 if (detectedLinkData != nullptr ) {
712712 // emit onLinkeDetected event
713713 [self emitOnLinkDetectedEvent: detectedLinkData.text url: detectedLinkData.url range: detectedLinkRange];
714-
715- _recentlyActiveLinkData = detectedLinkData;
716- _recentlyActiveLinkRange = detectedLinkRange;
717714 }
718715
719716 if (detectedMentionParams != nullptr ) {
@@ -812,6 +809,13 @@ - (void)setValue:(NSString *)value {
812809- (void )emitOnLinkDetectedEvent : (NSString *)text url : (NSString *)url range : (NSRange )range {
813810 auto emitter = [self getEventEmitter ];
814811 if (emitter != nullptr ) {
812+ // update recently active link info
813+ LinkData *newLinkData = [[LinkData alloc ] init ];
814+ newLinkData.text = text;
815+ newLinkData.url = url;
816+ _recentlyActiveLinkData = newLinkData;
817+ _recentlyActiveLinkRange = range;
818+
815819 emitter->onLinkDetected ({
816820 .text = [text toCppString ],
817821 .url = [url toCppString ],
Original file line number Diff line number Diff line change @@ -167,7 +167,6 @@ - (void)addLink:(NSString*)text url:(NSString*)url range:(NSRange)range manual:(
167167 }
168168
169169 [self manageLinkTypingAttributes ];
170- [_input anyTextMayHaveBeenModified ];
171170}
172171
173172// get exact link data at the given location if it exists
@@ -351,10 +350,9 @@ - (void)handleAutomaticLinks:(NSString *)word inRange:(NSRange)wordRange {
351350 }
352351 if (addStyle) {
353352 [self addLink: word url: regexPassedUrl range: wordRange manual: NO ];
353+ // emit onLinkDetected if style was added
354+ [_input emitOnLinkDetectedEvent: word url: regexPassedUrl range: wordRange];
354355 }
355-
356- // emit onLinkDetected
357- [_input emitOnLinkDetectedEvent: word url: regexPassedUrl range: wordRange];
358356 }
359357}
360358
You can’t perform that action at this time.
0 commit comments