Issue #1277✓ SolvedOpened July 11, 2018by AnkitKachhadiya4 reactions

Set href for link block

快速解答by maryia-kabash3

@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)

👍 Most helpfulmaryia-kabashJuly 13, 2018

@AnkitKachhadiya you can change it by going to "Component settings" tab (gear icon). The same is for link block.

artfJuly 15, 2018

@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: '...' }
	}
})
AnkitKachhadiyaJuly 16, 2018

Thank you for the help

代码片段TEXT
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
![2018-07-16-10-55-localhost 1](https://user-images.githubusercontent.com/28569675/42744512-c0e30af8-88ea-11e8-90dd-9d0dbbc59ccc.png)

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

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.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.