0

I'm looking for some kind of HTML WYSWYG editor solution for an ASP.Net Webforms application. We currently use AjaxToolkit, but it doesn't support pasting images, is not really accessible, etc. I came accross FreeTextBox, but it seems to not support image pasting either, and it's been a big headache to configure properly given that the documentation is not all that descriptive. I've gotten the image gallery to work finally, but it looks pretty terrible, and I'm not sure the images will actually show up in the email (they were broken in my testing environment using the Papercut SMTP emulator). Just wondering if there are any other options I have with a Web Forms app, or am I limited to solutions that are as old as Web Forms?

Levi Wallach
  • 369
  • 5
  • 17
  • [Tiny MCE](https://www.tiny.cloud/) is worth a look. Keep in mind images are tricky with HTML, they have to be hosted somewhere or converted to inline Base64 images. It gets worse with HTML Email. – Jon P Apr 27 '22 at 04:24

2 Answers2

1

you can try CKEditor(it have editable tool panel and spell checker)

https://ckeditor.com/cke4/builder

this free js library, easy integrate and if you want send result to .aspx.cs side should use call back by DevExpress control

  • I just got this to work, thanks. It's accessible and works except for one issue - that it doesn't allow for pasting of images. I'm not sure if that's something that is just not going to be supported for any email based on how things are encoded or not... – Levi Wallach Apr 27 '22 at 14:04
  • Actually, when I look at the source in the email that's generated by ckEditor, it just has a blank image tag - . – Levi Wallach Apr 27 '22 at 15:03
  • 1
    if you want insert img you need before sending email input src atrr in tag, before sending on C# you have string. Need write hhalper that replace src='' on src='{img source}' where needed. More you need have img on your server or site. htmll email template can not uplad img only get from out internet. – Maks_Matkov Apr 27 '22 at 15:09
1

I still use the ajaxtoolkit HTML editor. It is a bit dated, but I do find without any special settings, that I can paste in in images.

So, say I drop in a text box, use extender, and add HTML editor.

So, say this:

        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

        <asp:TextBox ID="TextBox1" runat="server" Width="1309px" 
            TextMode="MultiLine" Rows="40" ></asp:TextBox>


        <ajaxToolkit:HtmlEditorExtender ID="TextBox1_HtmlEditorExtender" runat="server" 
            BehaviorID="TextBox1_HtmlEditorExtender" 
            EnableSanitization="False" 
            TargetControlID="TextBox1">
        </ajaxToolkit:HtmlEditorExtender>

I am able to put a picture in my paste buffer, and a simple ctrl-v does paste the picture:

eg this:

enter image description here

As noted, I think the tool bar etc. does look quite outdated, but my experiance with the toolkit is that ctrl-v to paste in a picture does work.

As suggested, the other possible is ckedit, and it should work with asp.net web pages.

Its not clear why using the ajaxtoolkit editor does not allow cut + paste of images - my experience does seem to work. Perhaps you need sanitation=false?

As noted, the other suggestion here was CKEditor, and that seems like a good choice also.

Albert D. Kallal
  • 42,205
  • 3
  • 34
  • 51
  • I'm able to paste images in as well, the problem is that they don't show up by the person receiving the email. If I do a view source, I see the encoded version of the image, but it never actually displays. I also already have EnableSanitization="false" in my AjaxToolkit tag... As noted below, I just tried switching out for CKEditor and it's definitely better - more accessible/modern code, but similarly, the images do not show in the received email. – Levi Wallach Apr 27 '22 at 14:09
  • Actually, when I look at the source in the email that's generated by ckEditor, it just has a blank image tag - . – Levi Wallach Apr 27 '22 at 15:03
  • Hum, in line (base64) images should work - maybe it is the email client? I would perhaps do a test - even code to create a basee64 image in the body - try sending that. but, an email sent from above? I can test - but it should work. – Albert D. Kallal Apr 27 '22 at 15:41
  • Should work in what? CKEditor? Ok, seems like they did go through as Base64, but don't show up in Gmail or OWA. Doing a bit more digging I found this, which suggests that Base64 images embedded in emails are not supported in Gmail or Outlook, so it looks like this functionality is not going to happen: https://stackoverflow.com/questions/46783599/base64-encoded-image-is-not-showing-in-gmail#46789485 – Levi Wallach Apr 27 '22 at 16:24
  • My images come though just fine in outlook, and in gmail. -- I'm going to have to dig up that code I am using - but I did not think my code has extra stuff to "use" and consider the in-line base64 image as a attachment. – Albert D. Kallal Apr 27 '22 at 17:14
  • Odd, maybe your image is smaller than the one I'm using? Try using an image that is more than 102K and see if you have the same issue. – Levi Wallach Apr 27 '22 at 17:51