imzbf / md-editor-v3

Markdown editor for vue3, developed in jsx and typescript, dark theme、beautify content by prettier、render articles directly、paste or clip the picture and upload it...
https://imzbf.github.io/md-editor-v3
MIT License
1.51k stars 145 forks source link

全屏模式下,同步滚动问题 #619

Closed bintheext closed 1 month ago

bintheext commented 1 month ago

描述这个Bug

当进入全屏模式后,编辑器左边更新内容了,右侧预览始终在top,我的markdown内容如下 当我更新☘️ em...的内容时,右侧实时渲染一直是mermaid的top,这应该是算法判断编辑区和渲染区的对应关系有问题

请复制下面的内容

## 🧬 详细工作

```mermaid
graph TD
  point1[2024-06前\n组件调研] ==>  point2[2024-06-29\n部署前后端]
  point2 ==>  point3[2024-07-01\n新增发布mes]
  point3 ==>  point4[2024-07-02\n规范后端接口]
  point4 ==>  point5[2024-07-03\n增加文章删除功能]
  point5 ==>  point6[2024-07-04\n修改头像设置]
  point6 ==>  point7[2024-07-06\n增加后台用户设置界面]
  point7 ==>  point8[2024-07-09\n更新数据储存-MySQL]
  point8 ==>  point9[2024-07-10\n调整账号中心]
  point9 ==>  point10[2024-07-11\n账号中心完善头像功能]
  point10 ==>  point11[2024-07-16\n修复CSS重置导致的样式覆盖错误]
  point11 ==>  point12[2024-07-17\n增加文本对比、代码格式化功能]
  point12 ==>  point13[2024-07-18\n增加在线数据分析功能]
  point13 ==>  point14[2024-07-19\n完善在线数据分析csv模块]
  point13 ==>  point15[2024-07-22\n在线数据分析兼容json文件]
  point12 ==>  point16[2024-07-26\n日期本地化适配]
  point16 ==>  point17[2024-08-01\n优化移动端体验]

☘️ em...

😇 优化

⚡️安全

版本号

示例文档可以复现该问题

问题重现链接

https://imzbf.github.io/md-editor-v3/en-US/index No response

imzbf commented 1 month ago

如果左侧或者右侧没有滚动条,是不会同步滚动的。

如果不是这种情况的话,麻烦录制一下并提供一下你全屏时的屏幕宽度和高度,方便这边排查问题

bintheext commented 1 month ago

如果左侧或者右侧没有滚动条,是不会同步滚动的。

如果不是这种情况的话,麻烦录制一下并提供一下你全屏时的屏幕宽度和高度,方便这边排查问题

是的,当时左侧没有滚动条,每次更新文本,右侧渲染都重新置顶 视频如下,屏幕1920x1080,正常笔记本屏幕大小 https://github.com/user-attachments/assets/eb42d47c-0ebd-424f-8b80-304c316c043b

imzbf commented 1 month ago

多谢你的视频,这个问题是由于mermaid的内容会有一个生成和替换的过程,我正在考虑优化这个问题。

目前只有建议添加多个回车,将左侧的滚动条显示出来后,靠同步滚动的能力把它拉到相应的位置,不过会有闪烁,只能先将就一下。

imzbf commented 1 month ago

Fixed in 4.18.1

bintheext commented 1 month ago

如果左侧或者右侧没有滚动条,是不会同步滚动的。

能否实现左侧没有滚动条,右侧也能够滚动呢?因为大多数情况下,都是左侧文字比较少,右侧渲染的结果比较多,这就导致在编辑时,写新一行内容时,右侧的不会滚动到最新一行

image image
imzbf commented 1 month ago

这个实现不了,没有滚动条就没有对比的标准,这种情况只能你在文末回车后新增内容强行带出滚动条