nnhubbard / ZSSRichTextEditor

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

insertImage function doesn't work(Solved) #167

Open jihongboo opened 7 years ago

jihongboo commented 7 years ago

Add [self.editorView stringByEvaluatingJavaScriptFromString:@"zss_editor.prepareInsert();"]; to function - (void)insertImage:(NSString *)url alt:(NSString *)alt;

- (void)insertImage:(NSString *)url alt:(NSString *)alt {
    [self.editorView stringByEvaluatingJavaScriptFromString:@"zss_editor.prepareInsert();"];

    NSString *trigger = [NSString stringWithFormat:@"zss_editor.insertImage(\"%@\", \"%@\");", url, alt];
    [self.editorView stringByEvaluatingJavaScriptFromString:trigger];
}