File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -680,6 +680,9 @@ - (void)handleCommand:(const NSString *)commandName args:(const NSArray *)args {
680680 [self focus ];
681681 } else if ([commandName isEqualToString: @" blur" ]) {
682682 [self blur ];
683+ } else if ([commandName isEqualToString: @" setValue" ]) {
684+ NSString *value = (NSString *)args[0 ];
685+ [self setValue: value];
683686 } else if ([commandName isEqualToString: @" toggleBold" ]) {
684687 [self toggleRegularStyle: [BoldStyle getStyleType ]];
685688 } else if ([commandName isEqualToString: @" toggleItalic" ]) {
@@ -736,6 +739,17 @@ - (void)focus {
736739 [textView reactFocus ];
737740}
738741
742+ - (void )setValue : (NSString *)value {
743+ NSString *initiallyProcessedHtml = [parser initiallyProcessHtml: value];
744+ if (initiallyProcessedHtml == nullptr ) {
745+ // just plain text
746+ textView.text = value;
747+ } else {
748+ // we've got some seemingly proper html
749+ [parser replaceWholeFromHtml: initiallyProcessedHtml];
750+ }
751+ }
752+
739753- (void )emitOnLinkDetectedEvent : (NSString *)text url : (NSString *)url {
740754 auto emitter = [self getEventEmitter ];
741755 if (emitter != nullptr ) {
You can’t perform that action at this time.
0 commit comments