grapesjs icon indicating copy to clipboard operation
grapesjs copied to clipboard

Set href for link block

Open AnkitKachhadiya opened this issue 8 years ago • 4 comments

I want to set href for link block as there is empty href by default.

AnkitKachhadiya avatar Jul 11 '18 11:07 AnkitKachhadiya

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

maryia-kabash avatar Jul 13 '18 14:07 maryia-kabash

@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: '...' }
	}
})

artf avatar Jul 15 '18 12:07 artf

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 Do i need to add something or i am missing something 2018-07-16-10-55-localhost 1

AnkitKachhadiya avatar Jul 16 '18 05:07 AnkitKachhadiya

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.

lock[bot] avatar Sep 17 '19 10:09 lock[bot]