Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions ios/EnrichedTextInputView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ - (void)setDefaults {
_recentlyActiveMentionRange = NSMakeRange(0, 0);
recentlyChangedRange = NSMakeRange(0, 0);
_recentlyEmittedString = @"";
_recentlyEmittedHtml = @"";
_recentlyEmittedHtml = @"<html>\n<p></p>\n</html>";
_emitHtml = NO;
blockEmitting = NO;
_emitFocusBlur = YES;
Expand Down Expand Up @@ -1052,6 +1052,12 @@ - (void)anyTextMayHaveBeenModified {
[h3Style handleImproperHeadings];
}

// mentions removal management
MentionStyle *mentionStyleClass = (MentionStyle *)stylesDict[@([MentionStyle getStyleType])];
if(mentionStyleClass != nullptr) {
[mentionStyleClass handleExistingMentions];
}

// placholder management
if(!_placeholderLabel.hidden && textView.textStorage.string.length > 0) {
[self setPlaceholderLabelShown:NO];
Expand All @@ -1060,12 +1066,6 @@ - (void)anyTextMayHaveBeenModified {
}

if(![textView.textStorage.string isEqualToString:_recentlyEmittedString]) {
// mentions removal management
MentionStyle *mentionStyleClass = (MentionStyle *)stylesDict[@([MentionStyle getStyleType])];
if(mentionStyleClass != nullptr) {
[mentionStyleClass handleExistingMentions];
}

// modified words handling
NSArray *modifiedWords = [WordsUtils getAffectedWordsFromText:textView.textStorage.string modificationRange:recentlyChangedRange];
if(modifiedWords != nullptr) {
Expand All @@ -1087,13 +1087,13 @@ - (void)anyTextMayHaveBeenModified {
// emit onChangeText event
auto emitter = [self getEventEmitter];
if(emitter != nullptr) {
// set the recently emitted string only if the emitter is defined
_recentlyEmittedString = stringToBeEmitted;

emitter->onChangeText({
.value = [stringToBeEmitted toCppString]
});
}

// set the recently emitted string
_recentlyEmittedString = stringToBeEmitted;
}

// update height on each character change
Expand Down
Loading