In the demo EditorBrowser, I inserted an image and need to implement the following function: click on the image, and then you can operate on it, such as deleting, dragging and dropping.
Does anyone know how to do it.
thanks.
Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
How to select images by clicking when editing web pages
- salvadordf
- Posts: 4304
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: How to select images by clicking when editing web pages
Hi,
That demo executes this deprecated JavaScript command to edit the text and insert images : document.execCommand.
https://developer.mozilla.org/en-US/docs/Web/API/document/execCommand
You can also use the experimental Input.dispatchKeyEvent DevTools method :
https://chromedevtools.github.io/devtools-protocol/1-3/Input/#method-dispatchKeyEvent
The DevTools method is used by the EditorBrowser demo for WebView4Delphi and it also works fine.
That demo executes this deprecated JavaScript command to edit the text and insert images : document.execCommand.
https://developer.mozilla.org/en-US/docs/Web/API/document/execCommand
You can also use the experimental Input.dispatchKeyEvent DevTools method :
https://chromedevtools.github.io/devtools-protocol/1-3/Input/#method-dispatchKeyEvent
The DevTools method is used by the EditorBrowser demo for WebView4Delphi and it also works fine.
Re: How to select images by clicking when editing web pages
Thank you for your reply.
I have tested the EditorBrowser demo for WebView4Delphi, but it did not meet my requirements.
Is there any other way to select an image with a mouse click and adjust its size.
I have tested the EditorBrowser demo for WebView4Delphi, but it did not meet my requirements.
Is there any other way to select an image with a mouse click and adjust its size.
- salvadordf
- Posts: 4304
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: How to select images by clicking when editing web pages
Try executing JavaScript code to modify the width and height of the new IMG element.