nnhubbard / ZSSRichTextEditor

A beautiful rich text WYSIWYG editor for iOS with a syntax highlighted source view
MIT License
3.78k stars 584 forks source link

setBackgroundColor, setTextColor doesn't work #274

Closed SummerHF closed 3 years ago

SummerHF commented 3 years ago

NOT WORK

- (void)setSelectedColor:(UIColor*)color tag:(int)tag {

    NSString *hex = [NSString stringWithFormat:@"#%06x",HexColorFromUIColor(color)];
    NSString *trigger;
    if (tag == 1) {
        trigger = [NSString stringWithFormat:@"zss_editor.setTextColor(\"%@\");", hex];
    } else if (tag == 2) {
        trigger = [NSString stringWithFormat:@"zss_editor.setBackgroundColor(\"%@\");", hex];
    }
    [self.editorView evaluateJavaScript:trigger completionHandler:^(NSString *result, NSError *error) {

    }];
}