nnhubbard/ZSSRichTextEditor

Image is not displayed

Opened this issue · 7 comments

Image is not displayed when the html string contains the image url with alt when loading into editorView. but when I to manually insert image with URL and Alt from tool bar able to see the image.
Please give a solution on this ASAP

Can anyone please respond why? WkWebview is not loading below image
img alt="Sample" src="https://docint0.blob.core.windows.net/publicfilescontainer02/" width="582" style="padding-bottom: 0px; vertical-align: bottom; border: 0px; outline: none; text-decoration: none; display: inline;" class="gmail-m_4922265757032371696mcnImage

https://docint0.blob.core.windows.net/publicfilescontainer02/
this image not accessible

For security reason I edited the URL. not to access. you can use any image URL in that place. The real image works when used in browser.
Please give some solution on this issue

If you toggle the source view, it seems iOS is inserting smart quotes. Not sure why, don't have a chance to investigate.

Can you please give me a solution to handle it. As displaying the image is the major part in my App.

I am able to display the image by changing the code of method removeQuotesFromHTML in ZSSRichTextEditor.m as below
-(NSString *)removeQuotesFromHTML:(NSString *)html {
html = [html stringByReplacingOccurrencesOfString:@""" withString:@"\""];
html = [html stringByReplacingOccurrencesOfString:@"“" withString:@""];
html = [html stringByReplacingOccurrencesOfString:@"”" withString:@""];
html = [html stringByReplacingOccurrencesOfString:@"\r" withString:@"\r"];
html = [html stringByReplacingOccurrencesOfString:@"\n" withString:@"\n"];
return html;
}
Don't know whether the fix is correct or not.

I used the following and it's working for me:

 -(NSString *)removeQuotesFromHTML:(NSString *)html {
    html = [html stringByReplacingOccurrencesOfString:@"\'" withString:@"\\\'"];
    html = [html stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""];
    html = [html stringByReplacingOccurrencesOfString:@"\n" withString:@"\\n"];
    html = [html stringByReplacingOccurrencesOfString:@"\r" withString:@""];
    return html;
}