[BUG] - Not able to get content of a link block
Question
Hello all,
I am using grapesjs version 0.14.52.
I am having the following issue:
When I drop a link block inside the canvas, I can use the following linkModel.get("content"), to get the content of the link. But once I set a new content, using linkModel.set("content", "whatever"), linkModel.get("content") starts returning an empty string value.
I am able to set and ready the attributes per example using the same get and set methods, and any other property, apart from content.
After checking the linkModel JSON, the content property has the correct value in the beginning, but for some reason is being set to empty on linkModel.set("content", "whatever"); the correct content value is being assigned to linkModel {components: [ { content: "whatever" }]}.
I am even not being able to see the property "content" in linkModel.changed on set, unlike the other properties.
Is anyone else facing this issue? Any idea what is wrong here and what should I change?
Now I am setting my personal property linkModel.set("ali-link", "whatever"), and I am able to get it normally using linkModel.get("ali-link").
Thank you
Answers (3)
Unfortunately, this is due to the not consistent logic in the ComponentTextView https://github.com/artf/grapesjs/blob/3f053af969ef6a688d526d158b9df7e6aa076838/src/dom_components/view/ComponentTextView.js#L87-L114
So, if you use the built-in RTE the content is always moved, on change, to components. I understand that is not coherent but a refactor here would require probably a bit of time that I don't have
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.
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 #2014
[BUG] - Not able to get content of a link block
Hello all, I am using grapesjs version 0.14.52. I am having the following issue: When I drop a link block inside the canvas, I can use the...
Issue #1567
rte toolbar bug
Hello all, I am using the latest grapesjs stable version (40) and I noticed the following bug in the rich text editor: If the user drags an...
Issue #795
editor.getSelected() in run:open-assets
Hello! I want without having to create a new block button, and stopping the event associated to the image that this run:open-assets get the...
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...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.