Hi @Renato_Ribeiro ,
Are you trying to use a snippet to modify the contents of the website?
Or are you using {site: html} and process the HTML?
If you are trying to do the later? What exactly are you trying to use it for so I can assist you better.
Hi @VinodGubbala, I’m trying to modify a content of HTML text, that can be modified directly or by his source code.
There is a logo (with a dinamic link) in the beggining of the text that I want to maintain, and the remaining text I want to delete.
Text Blaze can help you insert text into a field in a website and not modify contents of a website.
Please let me know if I understood you incorrectly, so I can relook at your query.
There is no ways to erase or replace part of a text using Text Blaze?
Another way that I thought, it was using the image insertion of HTML editor. But first, I would need to extract the URL of the “img src” tag, that I mencioned in the example.
If you are trying to insert contents in a field,
you can extract it using {site: html} and then using regex to extract the image url. Which can be used to in the {image} command .
Note: The image extract should always be from the same domain. If this is what you are trying to achieve, I can help you with building this snippet.
select all content in the textbox (using the {key} command)
create a new value by clearing all characters after the first closing tag (/>) - using replaceregex() function
insert the new value in place of the selection.
You will need to update the "selector" property in the {site} command to point to the correct textbox - inside which you have the HTML content. Preferably, you should execute this shortcut at the end of the HTML in the text box.
But, how can I get the correct textbox to insert in the {site} command?
When I use the CSS selector of the "Click element" feature in my textbox, I obtain {click: selector=textarea}. Including, if I use {key: ctrl-a} after that, I can view all the HTML code selected.
But when using the {site} command with selector defined as "textarea" I'm receiving an error of not matching the selector.
It looks like your textarea is inside an iframe. Can you change your {site} command to add the "frame=self" property? It would look something like this: {site: text; selector=textarea; frame=self}
Try this site command: {site: text; selector=#editor iframe |> textarea}
The {site} commands are calculated first when you run the snippet, before any other action is taken. In your case, you start the snippet outside the iframe, so we need to update the selector to match the textarea starting from outside the iframe.
I see that the text box is inserted into the page after the snippet is inserted. In that case, sadly the {site} command will not work as it is only computed when the snippet is first run.
We hope to support dynamic {site} command but we have no ETA on that yet. See relevant discussion here:
Oh, that's a shame
But I think I can achieve my objective by using 'replaceregex' directly in the text editor (out of the HTML editor).
What selector I use to edit the text in this area?
If you start the snippet outside the editor frame, then the editor must be already present in the HTML of the page when you run the snippet, so that the snippet can read the editor's text.
If it is already present, then you can use the selector I mentioned earlier: {site: text; selector=#editor iframe |> textarea}.
If it is not already present, then the current use case is not possible (pending the feature request I linked above)