Skip to content

Font size supports relative settings #14231

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

Closed
StarDustSheep opened this issue Feb 28, 2025 · 4 comments
Closed

Font size supports relative settings #14231

StarDustSheep opened this issue Feb 28, 2025 · 4 comments
Assignees
Milestone

Comments

@StarDustSheep
Copy link

StarDustSheep commented Feb 28, 2025

字体大小支持相对设置

In what scenarios do you need this feature?

Image
部分用户会使用快速调整字号这个功能,时不时放大缩小页面字号,以快速浏览文档中的大量内容或聚焦少部分内容
但当他设置了外观-字号后,再使用这个功能时就会影响其排版效果

比如我这里调大了“视觉干扰”,来表示强调(有时候也会设置部分文本字号更小来表明其是另外内容的补充说明,阅读优先级次一级)
Image

但当我放大编辑器字号后,这种字号区别就消失了
Image
这对于习惯了WORD类富文本编辑的用户而言非常不适,而思源相对某些笔记软件的优势就是开箱即有好上手的排版功能。对于老用户来讲有时候也会影响其笔记的阅读效果。

比如我笔记这里,我手动设置字号小的部分是对上面的补充说明,解释细节。
Image

而我调小编辑器字号后,想快速浏览全局时,这里的排版设计效果就会变得混乱
Image

我认为需要不管怎么缩放,这种字号大小的对比,都应该是不变的

Describe the optimal solution

用户设置字号是想和同文档的其他部分的文本形成区别和对比,所以设置字号最好使用百分比这种相对单位

Image
这里提供几个预设的百分比数值选项,再加上个滑块让用户拖动调节百分比数值,拖动的过程中可实时看到效果

如果想功能全面一点,这里也可以手动设置px这种绝对单位的数值

Describe the candidate solution

No response

Other information

No response

@TCOTC
Copy link
Contributor

TCOTC commented Feb 28, 2025

有道理,我觉得可以分成两种:设置字号 (px) 和设置倍数 (em)

用两个下拉菜单,并排放在这里:

Image

@Vanessa219 Vanessa219 added this to the 3.1.25 milestone Mar 4, 2025
@Vanessa219 Vanessa219 changed the title 编辑器里设置外观-字号,使用百分比这种相对单位比目前的绝对单位px更合适 字体大小支持相对设置 Mar 4, 2025
Vanessa219 added a commit that referenced this issue Mar 4, 2025

Verified

This commit was signed with the committer’s verified signature.
@88250 88250 changed the title 字体大小支持相对设置 Font size supports relative settings Mar 4, 2025
@TCOTC
Copy link
Contributor

TCOTC commented Mar 4, 2025

有些奇怪的问题:

  1. 弹出菜单上的字号没有跟随编辑器字号,比如编辑器字号是 49px,但菜单里还是 16px(0:10)
  2. 单击滚动条(0:11)/拖动滚动条回到原位(0:51)之后没有应用字号
  3. 弹出菜单上的字号没有跟随选中文本的字号,比如文本是 210%,但菜单是 200%(0:29)
  4. 切换开关后,滚动条跳到了错误的位置(1:14)
  5. 调整字号后文本突然不选中了(1:20)
  6. 调整字号后出现了一个只有零宽空格的 span 元素(1:23),见后面的截图
video.webm

Image

@Vanessa219
Copy link
Member

  1. 已修改
  2. 值没有进行过改变就不会改动
  3. 无法重现,麻烦看一下源代码中是 2em 还是 2.1em
  4. 已修改
  5. 5 和 6 无法重现,需要一下具体的步骤描述

Vanessa219 added a commit that referenced this issue Mar 4, 2025
@TCOTC
Copy link
Contributor

TCOTC commented Mar 4, 2025

2.值没有进行过改变就不会改动

只要相对于当前的样式是改变的就应该算(而不是相对于当前滚动条位置改变才算)。

不过我看最新的代码已经改了,切换开关后能立即应用字号,这样就不需要修改逻辑了

3.无法重现,麻烦看一下源代码中是 2em 还是 2.1em

我这里可以稳定重现:

video.webm

Image

5.5 和 6 无法重现,需要一下具体的步骤描述

最新代码测试不出来了,先不管了

Vanessa219 added a commit that referenced this issue Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants