Skip to content

开启自适应宽度的两种状态下设置不同的选择器 #5468

Closed
@UserZYF

Description

@UserZYF

在什么情况下你需要该特性?In what scenarios do you need this feature?

我做了一个chrome-A4主题,宽度是21CM,和A4纸的宽度一致,主题力图做到所见即所得。思源最近版本的升级,加入了自适应宽度的功能,但是我找不到如何控制宽度的办法,所以想着能够设置不同的选择器,可以控制编辑区域宽度

描述可能的最优解决方案 Describe the optimal solution

和思源笔记折叠前后的状态一样,加入一个[fold="1"]之类的选择器

描述候选的解决方案 Describe the candidate solution

或者直接设置两个不同的选择器

其他信息 Other information

Activity

removed their assignment
on Jul 20, 2022
Vanessa219

Vanessa219 commented on Jul 20, 2022

@Vanessa219
Member

使用 important 强制重置一下 width,padding-left 和 padding-right

UserZYF

UserZYF commented on Jul 20, 2022

@UserZYF
Author

这样开启自适应宽度前后就没有任何区别了,会固定编辑区域宽度。而且通过!important强调页面宽度,之前设置的一个文档的自定义属性,设置横版A4纸页面宽度的属性也失效

Vanessa219

Vanessa219 commented on Jul 20, 2022

@Vanessa219
Member

哦,理解错了。

self-assigned this
on Jul 20, 2022
added this to the 2.1.1 milestone on Jul 20, 2022
Vanessa219

Vanessa219 commented on Jul 21, 2022

@Vanessa219
Member

[data-fullwidth="true"]

added a commit that references this issue on Jul 21, 2022
Zuoqiu-Yingyi

Zuoqiu-Yingyi commented on Jul 22, 2022

@Zuoqiu-Yingyi
Contributor

[data-fullwidth="true"]

除了 .protyle-wysiwyg.protyle-wysiwyg--attr 元素, .protyle-title.protyle-wysiwyg--attr.protyle-background > .protyle-background__iconw 元素也需要设置该属性选择器, 或者在 .protyle-content 元素中设置该属性选择器, 因为宽度自适应时文档标题与文档图标的位置也会随之更改

Vanessa219

Vanessa219 commented on Jul 28, 2022

@Vanessa219
Member

好的,下个版本加到 .protyle-content 上

added a commit that references this issue on Jul 28, 2022
Zuoqiu-Yingyi

Zuoqiu-Yingyi commented on Aug 4, 2022

@Zuoqiu-Yingyi
Contributor

好的,下个版本加到 .protyle-content 上

目前(v2.1.5)还是有点问题:
当打开自适应宽度开关时, 新打开的文档的 DOM 中 .protyle-content 未默认添加 data-fullwidth="true" 属性

added a commit that references this issue on Aug 5, 2022
Vanessa219

Vanessa219 commented on Aug 5, 2022

@Vanessa219
Member

抱歉,再等下一个版本吧,初始化的时候加漏了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @Vanessa219@UserZYF@Zuoqiu-Yingyi

      Issue actions

        开启自适应宽度的两种状态下设置不同的选择器 · Issue #5468 · siyuan-note/siyuan