[Bug] Link element selection shows no toolbar
Steps to reproduce: add Text, select a word, click on Link icon in RTE panel, select a Link.
Expected behaviour: when I select Link I expect it to display toolbar (with 'select parent' button) alongside its badge.
Actual behaviour: If a link was in startup HTML, Link is properly initialised and selecting it results in both badge and toolbar being displayed. Otherwise, if a Link was created via RTE button selecting it results in just badge being displayed.
May you provide a reproducible demo?
Problem can be seen on any Grapes page, e.g. https://grapesjs.com/demo.html Just create new Link (it will have no toolbar), refresh the page and you can see Link gets its toolbar. BTW, if you then create new Link within same parent, there will be no toolbar for both of them.
So, here's default heading:

Creating a Link:

Refreshing the page:

Adding another Link:

First one lost its toolbar:

Refreshing the page, links got their toolbars back:

Yeah, I'm aware of this, you have to unfocus from the text editor because of the parser triggering on blur. Hope to improve this soon...
@artf It also applies to any editing that is made within the same text block, for example if you go back and edit a portion of the text and blur, any other content inside will not have the toolbars.
Is there a manual way to fix this for the moment until it is improved?
Hi @artf @simplecommerce @devgru Any update on this. Is there any way to fix this manually? Thanks
@Abhisheknanda1344463
Hi @artf @simplecommerce @devgru Any update on this. Is there any way to fix this manually? Thanks
I am not sure if it will work for you but this is what I did to work around it.
editor.on('component:selected', function(model) {
// if no toolbar detected, call init (i am using isEmpty from lodash) but you can just validate this without it
if (isEmpty(model.attributes.toolbar)) {
model.initToolbar();
}
});
@simplecommerce Thank you Man. It's worked. Thanks
Closing the issue as it seems to be fixed.