File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -329,16 +329,22 @@ - (void)manageMentionEditing {
329329 return ;
330330 }
331331
332- // get conflicting style classes
333- LinkStyle* linkStyle = [_input->stylesDict objectForKey: @([LinkStyle getStyleType ])];
334- InlineCodeStyle* inlineCodeStyle = [_input->stylesDict objectForKey: @([InlineCodeStyle getStyleType ])];
335- if (linkStyle == nullptr || inlineCodeStyle == nullptr ) {
336- [self removeActiveMentionRange ];
337- return ;
332+ // get style classes that the mention shouldn't be recognized in
333+ NSArray *conflicts = _input->conflictingStyles [@([MentionStyle getStyleType ])];
334+ NSArray *blocks = _input->blockingStyles [@([MentionStyle getStyleType ])];
335+ NSArray *allConflicts = [conflicts arrayByAddingObjectsFromArray: blocks];
336+ BOOL conflictingStyle = NO ;
337+
338+ for (NSNumber *styleType in allConflicts) {
339+ id <BaseStyleProtocol> styleClass = _input->stylesDict [styleType];
340+ if (styleClass != nullptr && [styleClass anyOccurence: wordRange]) {
341+ conflictingStyle = YES ;
342+ break ;
343+ }
338344 }
339345
340- // if there is any sign of conflicting style classes, stop editing a mention
341- if ([linkStyle anyOccurence: wordRange] || [inlineCodeStyle anyOccurence: wordRange] ) {
346+ // if any of the conflicting styles were present, don't edit the mention
347+ if (conflictingStyle ) {
342348 [self removeActiveMentionRange ];
343349 return ;
344350 }
You can’t perform that action at this time.
0 commit comments