Copy Image from Browser and Emojis and Paste to RichViewEdit

General TRichView support forum. Please post your questions here
Post Reply
Aeperd
Posts: 20
Joined: Thu Dec 26, 2024 1:30 pm

Copy Image from Browser and Emojis and Paste to RichViewEdit

Post by Aeperd »

Good day! What do i need to check or enable in the properties of RichViewEdit so i can able to paste an image copied from a browser? And also emojis? Thanks in advance for the help.
Sergey Tkachenko
Site Admin
Posts: 17805
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Copy Image from Browser and Emojis and Paste to RichViewEdit

Post by Sergey Tkachenko »

1. Emojis are Unicode characters. When they are pasted in a VCL TRichView editor, they are displayed using a text color. Unfortunately, the text engine used by the VCL version of TRichView does not allow displaying color emojis. But the FireMonkey version (that uses either DirectX or Skia drawing) does display color emojis.

2. Images in HTMLs copied from browsers are normally located on remote web servers and need to be downloaded. By default, TRichView can load only local image files.

If you use RichViewActions, you do not need to write any code to download images. Just assign a component to RVAControlPanel.DownloadInterface property.
Place idHTTP1: TIdHTTP and RVAIndyDownloadInterface1: TRVAIndyDownloadInterface on a form, assign
RVAIndyDownloadInterface1.IdHTTP = idHTTP1.
RVAControlPanel1.DownloadInterface = RVAIndyDownloadInterface1.
To support HTTPS protocol, place IdSSLIOHandlerSocketOpenSSL1: TIdSSLIOHandlerSocketOpenSSL component on the form, assign it to idHTTP1.IOHandler property. Also, assign IdSSLIOHandlerSocketOpenSSL.SSLOptions.Method = sslvSSLv23

If you do not use RichViewActions, process TRichView.OnImportPicture event to download an image file. A sample code is in the help topic about this event. Additionally, process OnImportFile event to download CSS files referred from the pasted HTML (although, normally, HTMLs copied from browsers include all necessary CSS internally)
Post Reply