mProjectsCode / mProjectsCode/obsidian-shiki-plugin

Losing focus on the current document while editing a block of code results in incorrect scrolling

Open
#24 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug wontfix
Dominant language
TypeScript
Stars
238
Forks
25
PR merge metrics
No merged PRs in 30d

Description

  • The Plugin is up to date
  • Obsidian is up to date

Describe the bug
When the code block is in the editing state, if you switch to another page or browser or something, come back to obsidian and find that the document scrolling is heavily offset.
And without using this plugin this problem does not occur, because you can edit the code block directly.
It may be that the current document loses focus and then changes back to a block that cannot be edited, and then enters the editing state when focus is restored, but does not return to the original position.

To Reproduce
Steps to reproduce the behavior:

  1. Write a long block of code.
  2. Entering the editing state of a code block and scroll down a bit.
  3. Open your browser.
  4. Back to Obsidian page.

Expected behavior
Revert to the original scroll offset.

Screenshots
If applicable, add screenshots to help explain your problem.

Occurs on

  • Windows
  • macOS
  • Linux
  • Android
  • iOS

Plugin version
0.4.3

Additional context
The other thing that confuses me is that, in the code block editing state, it is often the original syntax highlighting colour, while there are only a few cases where the preview state syntax highlighting can be displayed.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in Obsidian on Windows with plugin version 0.4.3 by switching away from and back to a scrolled, long code block in editing mode. Trace the focus and scroll behavior when returning to the document, and consider the issue done when the original scroll offset is restored consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.