Set href for link block
@AnkitKachhadiya you can change it by going to "Component settings" tab (gear icon). The same is for link block.
Read full answer below ↓Question
I want to set href for link block as there is empty href by default.
Answers (3)
@AnkitKachhadiya you can change it by going to "Component settings" tab (gear icon). The same is for link block.
@AnkitKachhadiya you can also update dynamically the default one
editor.BlockManager.get('id-of-the-block').set({
content: {
type: 'link',
content:'Text for the link',
attributes: { href: '...' }
}
})
Thank you for the help
Can you please re-open these issue
@maryia-kabash @artf I have made a custom block for my custom link see code:
> editor.BlockManager.add("unsubscribe-block", {
label: "Unsubscribe",
content: {
type: "link",
content: "unsubscribe_link",
attributes: {href: "{unsubscribe_link}"}
},
attributes: {
title: "Insert Unsubscribe block",
class: "fa fa-ban"
}
});
Every thing works perfectly but the issue is whenever i remove href content using style manager it doesn't remove from my code editor .The code doesn't change (i think href is not editable). (refer image).
**Check Fiddle** [FIDDLE](https://jsfiddle.net/Ankit_Kachhadiya/4Lzqvf0k/1/)
Do i need to add something or i am missing something
Related Questions and Answers
Continue research with similar issue discussions.
Issue #865
[QUESTION] How can I set default tagName
Hi ! I want to set tagName tr for all components(or specific component in use). Is there any predefined function to set tagName ?
Issue #1135
[Question] Two html tags as one (link/button)
Is it possible to have two elements (div and lnik) and consider as a single? For example: there is the my following link block: <div class=...
Issue #1290
[BUG]Set href for link block not editable once initialized
#1277 is closed but issue still exist so i have to post as new issue Thank you for the help for earlier @maryia-kabash @artf I have made a...
Issue #1374
Default Component Properties
Is there any way I can change the default properties of components? I want almost everything to be copyable: false, resizable: false, dragg...
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.