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
POC: Try/autogen heading anchors #31174
Conversation
This reverts commit bf0517c.
Co-authored-by: Nik Tsekouras <ntsekouras@outlook.com>
Co-authored-by: Nik Tsekouras <ntsekouras@outlook.com>
…' into add/autogenerate-heading-anchors
Size Change: +1.12 kB (0%) Total Size: 1.49 MB
ℹ️ View Unchanged
|
I don't think this is the right approach because the flag indicating whether the anchor was edited manually is lost when the editor is reloaded (save and reload). I think using a prefix like @aristath suggested might be the simplest way for now without introducing a dedicated attribute. |
After discussing more with @ntsekouras it seems we could approximate the flag by checking that |
This PR is just an exploration for:#30825
The logic is that we should auto generate anchors when:
When we change manually the
anchor
from the sidebar input it should allow it and not change it again from content change (autogeneration).The problem I have here is that the
autoGen
state variable is updated after a manual change, after the next render due to the async running and therefore it misses the first change. So if we manually change theanchor
the first character is missed but it works as intended from the second change :).Of course this is wrong but I'd like some input, if any for the proper approach here... @youknowriad , @ellatrix .