Skip to content

[Bug Report] 当设置为阅读模式且不给根元素设定最大高度时,悬浮目录不随页面滚动更新定位 #1568

@CitizensLi

Description

@CitizensLi

Prerequisites

Version

v0.10.3

Reproduction Link

No response

Describe the Bug

config配置如下:

       //...忽略其他配置...
        editor: {
          id: 'cherryEditor', 
          name: 'cherryEditor', 
          autoSave2Textarea: true, 
          // 编辑器的高度,默认100%,如果挂载点存在内联设置的height则以内联样式为主
          height: '100%',

          defaultModel: 'previewOnly',
         //...忽略其他配置...
       }
      toolbars: {
          showToolbar: false,
         //...忽略其他配置...
          toc: {
            updateLocationHash: true, // 要不要更新URL的hash
            defaultModel: 'pure', // pure: 精简模式/缩略模式,只有一排小点; full: 完整模式,会展示所有标题
            showAutoNumber: true, // 是否显示自增序号
            position: 'fixed', // 悬浮目录的悬浮方式。当滚动条在cherry内部时,用absolute;当滚动条在cherry外部时,用fixed
            cssText: '', // 自定义样式
          },
     },

    previewer: {
          dom: false,
          className: 'cherry-markdown',
          // 是否启用移动端预览
          isMobilePreview: _this.isPhone,//根据设备宽度<899来确定为移动端
          // 是否启用预览区域编辑能力(目前支持编辑图片尺寸、编辑表格内容)
          enablePreviewerBubble: false,
          floatWhenClosePreviewer: false,
    }





详细见图

<img width="389" height="695" alt="Image" src="https://github.com/user-attachments/assets/79d62d36-a0f2-43cc-bcd0-ebf785a4ac18" />

此时的目录应该滚动到“下山”的位置,但是并没有

### System Information

```Shell
System:
    OS: Windows 11 10.0.26100
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 6.03 GB / 31.86 GB
  Binaries:
    Node: 20.19.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - C:\Users\lijun\AppData\Roaming\npm\yarn.CMD
    npm: 10.8.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 139.0.7258.157
    Edge: Chromium (139.0.3405.125)
    Firefox: 145.0.2 - C:\Program Files\Mozilla Firefox\firefox.exe
    Internet Explorer: 11.0.26100.1882

Contributing

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    pending-no-confirmedThe direction of this issue has not yet been determined.🐞bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions