Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link text disappearing from attribute dictionary on value change #23

Open
madritz opened this issue Sep 19, 2023 · 2 comments
Open

Link text disappearing from attribute dictionary on value change #23

madritz opened this issue Sep 19, 2023 · 2 comments

Comments

@madritz
Copy link

madritz commented Sep 19, 2023

Hi

I'm noticing that the link text value gets stored into the attribute dictionary the first time its added. But when we modify its value subsequently, it disappears from the attribute dictionary. We have some validation applied to the Link text and title fields, that we are applying by looking at the attribute collection. But because of this behavior, its only getting applied to the title and never the text.

Please review and provide feedback.

@madritz
Copy link
Author

madritz commented Sep 19, 2023

Actually, i just tested with new link and it didnt save link text for new link either in the attribute dictionary. But i see it there for existing links. So is this a recent change in one of the latest versions? any reason behind this?

@svenrog
Copy link
Collaborator

svenrog commented Nov 21, 2023

I've tried reproducing this and this is what I've come up with.

The LinkModel from the dojo widget be passing a .text property among the attributes, but the serialized model in the CMS doesn't contain this.

The current property implementation is based on the logic in Optimizelys LinkItemCollection which serializes to a html a element. Here is what is stored <links><a title="{title}">{text}</a></links>.

As you can see this places "text" in a different place than the other properties and is the reason for this odd behaviour. This might be subject to change in the future as there has been talk about changing this underlying model to allow for nested data structures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants