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

プレビューとエディターのスクロール同期 #1

Open
uttk-dev opened this issue Nov 8, 2022 · 3 comments
Open

プレビューとエディターのスクロール同期 #1

uttk-dev opened this issue Nov 8, 2022 · 3 comments

Comments

@uttk-dev
Copy link
Contributor

uttk-dev commented Nov 8, 2022

本家のMarkdownエディタを参考にする。
https://github.com/microsoft/vscode/blob/main/extensions/markdown-language-features/preview-src/scroll-sync.ts

@senkenn
Copy link
Contributor

senkenn commented Jul 21, 2024

今こちら実装しようとしています。
上記にもある vscode のソース を見ると markdownソースコード行を例えば123行目であればプレビュー HTML Element 属性に data-line=”123" のように加えることでエディターとプレビューが完全一対一対応になるようにしていることがわかりました。

vscode では

  • エディターからプレビュー、またはその逆どちらからもスクロール同期させる
  • 同期する/しない の setting

がありますが、今回は簡単にするため、

  • エディターからプレビューのみスクロール同期
  • 常に同期させる

で一旦良いのかなと思っています

@cm-igarashi-ryosuke
Copy link
Member

@senkenn 大変ありがたいお申し出をありがとうございます!実装の方針、良さそうと思います。ぜひお願いいたします。

@senkenn
Copy link
Contributor

senkenn commented Aug 7, 2024

#115 で実装しましたが、これはエディター -> プレビューの片方向なので、もしこの Issue が両方向までスコープに入れたものならPRと紐付けないほうがいいだろうなと思って紐付けていません

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

No branches or pull requests

3 participants