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

Heading anchors point to #undefined in view mode #1114

Open
mejo- opened this issue Feb 16, 2024 · 4 comments
Open

Heading anchors point to #undefined in view mode #1114

mejo- opened this issue Feb 16, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@mejo-
Copy link
Member

mejo- commented Feb 16, 2024

Describe the bug
Heading anchors point to #undefined in view mode.

To Reproduce
Steps to reproduce the behavior:

  1. Create a document with headings
  2. Switch to view mode
  3. Hover over the # symbol left to a heading and see the URL.

Server details:

  • Collectives app version: latest
  • Nextcloud version: 27.1.5
@mejo- mejo- added the bug Something isn't working label Feb 16, 2024
@Koc
Copy link
Contributor

Koc commented Mar 12, 2024

not reproducible for me in current main branch after running npm ci && npm run watch

@AngryNui
Copy link

I have the same problem. Only in view mode anchor points to #undefined. In edit mode the anchor points to the correct position.
When view-mode is set as default and you open a link with the correct anchor it wont show the correct position.

Collectives app version: 2.10.0
Nextcloud: 28.0.3

@mejo- mejo- mentioned this issue Mar 25, 2024
6 tasks
@mejo- mejo- self-assigned this Mar 25, 2024
@mejo-
Copy link
Member Author

mejo- commented Mar 25, 2024

The problem seems to be related to updating the page content of MarkdownContentEditor.vue with the content from Editor.vue. Here and here we do setContent() on the MarkdownContentEditor.vue. Before that, the anchor links still work, afterwards, they point to undefined.

@grnd-alt grnd-alt self-assigned this Mar 25, 2024
@grnd-alt
Copy link
Member

Findings

I looked into this issue, couldn't quite figure it out but still possibly made some findings.
The Links for headings are created in extractor.js
and called by either onUpdate or onCreate in nodes/Heading/index.js

the links rendering as undefined most likely has something to do with the lifecycle hooks not beeing called in the way they are ment to be. Somehow the setupReader and setupEditor functions in collectives that start those editors make it so the reader and editor influence one another.

Inspecting the stack trace with breakpoints it was visible that addNode in nodes/Heading/index.js was called before the onCreated Hook which could possibly cause issues. Another possibility would be that the influence of different orders of setContent-calls in collectives affects the link-values, which would bring up the question why setContent calls don't all trigger the same update cycle.

I don't know if any of that will be helpful but I did my best.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 📄 To do (~10 entries)
Development

No branches or pull requests

4 participants