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

[Bug Report]: Weird behaviour while editing a page if template sidebar is closed #3186

Closed
quaintdev opened this issue Jan 21, 2022 · 1 comment

Comments

@quaintdev
Copy link

Describe the Bug

While using markdown editor the cursor if suppose is on line 9 and we are trying to do backspace it ends up editing line 8. This happens when I close the template sidebar.

Steps to Reproduce

  1. Create new page
  2. Choose template
  3. Start editing text
  4. Close the sidebar
  5. And now cursor is at one line but ends up editing other line (this especially happens if you are trying to navigate using arrow keys, backspace, delete.)

Expected Behaviour

The cursor should not change position when the template sidebar is closed and should only edit the line or text that it is on.

Screenshots or Additional Context

No response

Exact BookStack Version

v21.12.1

PHP Version

No response

Hosting Environment

Hosting on raspberry pi 2 using docker.

@quaintdev quaintdev changed the title [Bug Report]: Weird behaviour while editing a page if template sidebar is used [Bug Report]: Weird behaviour while editing a page if template sidebar is closed Jan 21, 2022
ssddanbrown added a commit that referenced this issue Jan 24, 2022
Intended to fix positioning quirks caused by changing codemirror
instance size when you have lines that wrap and cause line height
changes. Often caused by editor toolbox expand/collapse.

This adds a debounced resize observer to refresh editor layout on size
change.
Also tweaks toolbox expand/collapse to more consistently set aria
attribute.

For #3186
@ssddanbrown ssddanbrown added this to the v21.12.3 milestone Jan 24, 2022
@ssddanbrown ssddanbrown self-assigned this Jan 24, 2022
@ssddanbrown
Copy link
Member

Thanks for reporting @quaintdev, I could confirm this.
From my testing, I don't think this was specifically due to the template system, but could occur whenever the markdown editor box resized (Likely due to sidebar expand/collapse) while having content that may span over a single line. The editor would use old line positioning for the cursor then correct itself after typing.

I have patched this in aaa2205, so that the editor layout is refreshed after resize.
This will be part of the next patch release.

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

No branches or pull requests

2 participants