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

Silverstripe image-shortcodes are picked up/shown as linkable in-page anchors #2837

Open
micschk opened this issue Feb 15, 2023 · 1 comment

Comments

@micschk
Copy link

micschk commented Feb 15, 2023

Images are inserted as shortcode in the editor:
[image src="/assets/image.jpg" id="164" ... ]

The id="164" part is then picked up and shown as on-page linkable anchor in the selector of the anchor-link modal in the CMS. (When selected, an anchor link gets inserted as <a href="[sitetree_link,id=1]#164">...</a>).

Screenshot 2023-02-15 at 12 53 29

One option could be to fix the regex itself at SiteTree::getAnchorsOnPage() (NOTE: duplicated in Elemental).

But probably a better fix would be to process any shortcodes before filtering through the regex, as the result of shortcodes could theoretically contain linkable anchors as well?

@michalkleiner
Copy link
Contributor

But probably a better fix would be to process any shortcodes before filtering through the regex, as the result of shortcodes could theoretically contain linkable anchors as well?

Yes, that would definitely be the case in our projects where shortcodes can provide markup that may contain links and anchors, too. At the same time it might be tricky since the content may not be directly visible if one went to check it manually since the WYSIWYG would still just have the shortcode.

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

No branches or pull requests

3 participants