How to get the link value?
Question
Hi Guys,
How can I get all links value before or upon saving the email template. I want to substitute the links with proxy url. In order to trap the click links. Any help much appreciated. Thanks
Answers (3)
editor.DomComponents.getWrapper().find('a').forEach(aModel => {
const current = aModel.getAttributes()['href'] || '';
aModel.addAttributes({ href: `https://proxy?u=${current}`});
})
Thanks @artf. It really helps a lot. Thanks again.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #822
[QUESTION] How to get the html and css code in view code tool?
or how to get all the html code and css so that I could save it in my database. Or there is already a functionality in the documentation? y...
Issue #1780
How to change extra dropdown for link change trait
Hello @artf , I want to give one more functionality to user like user can change any link with default links drop down. In above image i wa...
Issue #1706
[Question]: How to get href from rte?
I have this rte toolbar where you can type and click 'save' and it's going to create a link for the selected text. but the problem is that...
Issue #1639
[Question]: Would it be possible to have change settings under style manager in a way that it has href when a link is created?
I'm using preset newsletter with built-in RTE (do not want to use ck editor like the demo) In order to make any text to link, i need to cli...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins →Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.
Browse premium plugins →Related tutorials
In-depth guides on the same topic.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.