Feature request: Add a way to inject an anchor identifier in page content
See original GitHub issueThis is a followup to #1049 which took care of injecting an anchor link for the current page.
This issue is for the other part of the problem: injecting the anchor identifier, which is the target of the anchor link.
In short, we need a way to inject an id
on any selected content in the Draftail richtext component.
Quoting myself from https://github.com/wagtail/wagtail/issues/1049#issuecomment-504651173:
On the other hand there is the question of “Adding anchors to content in rich text”, and maybe it would help and make things clearer to open a new issue to discuss just that. I played with https://github.com/thibaudcolas/wagtail_draftail_experiments/tree/master/wagtail_draftail_anchors last week, it basically does what’s needed but is still missing a proper UI. That new issue could be about improving the work started by @thibaudcolas . Also I’d need guidance on what part of the existing client code could be re-used and extended (eg: there is a Tooltip component into the core, could that be re-used?) and I believe this would be better discussed in a separate issue.
These comments are also relevant: https://github.com/wagtail/wagtail/issues/1049#issuecomment-39595181 https://github.com/wagtail/wagtail/issues/1049#issuecomment-490854586
Issue Analytics
- State:
- Created 4 years ago
- Reactions:7
- Comments:12 (9 by maintainers)
Top GitHub Comments
@thibaudcolas recently I was playing with wagtail_draftail_anchors and made some changes:
span
tag with id<span id="id"...
id
of the existing anchor identifierid
of the header, it means that header can have autoid
or customid
entered by useranchor
- could be helpful to handle anchors on front-endHere is the link to my fork https://github.com/dest81/wagtail_draftail_anchors Any feedback welcome! This is draft version so do not judge too strictly, this is my first real experience with Draft.js and I am not ReactJS developer 😃
https://user-images.githubusercontent.com/2307929/144108329-37aa9c46-70d7-4c14-84f7-014f0ddeafe0.mp4
Has there been anything more on adding an anchor target?