Skip to content

Record the width of some Protyle elements in the attributes - #15043

Merged
Vanessa219 merged 1 commit into
siyuan-note:devfrom
TCOTC:fix/15021
Oct 25, 2025
Merged

Record the width of some Protyle elements in the attributes#15043
Vanessa219 merged 1 commit into
siyuan-note:devfrom
TCOTC:fix/15021

Conversation

@TCOTC

@TCOTC TCOTC commented Jun 16, 2025

Copy link
Copy Markdown
Contributor
  1. 重构 setPadding 函数,修复了编辑器边距动态变化导致 data-realwidth 不准确的问题
  2. 移除 #editorAttr 元素,修复了全局标题角标伪元素共用一个 max-width 的问题
  3. 添加了几个元素的宽度 CSS 变量 close Record Protyle full width in attributes of .protyle, .protyle-content and .protyle-wysiywg. #15021

@TCOTC

TCOTC commented Jun 16, 2025

Copy link
Copy Markdown
Contributor Author

@Wetoria 经过在 Asri 主题 v3.4.0 测试,可以用变量来代替 JS 计算

image

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the setPadding function to fix width calculation issues and improve editor layout management. The changes address dynamic padding changes causing inaccurate data-realwidth attributes and remove a global style element that caused max-width conflicts.

  • Refactored width calculations to compute values before setting padding styles
  • Introduced CSS custom properties (--b3-width-protyle, --b3-width-protyle-content, --b3-width-protyle-wysiwyg) for better width management
  • Removed #editorAttr element and replaced with CSS custom property for bookmark icon tooltips

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
kernel/conf/editor.go Updated comment for DisplayBookmarkIcon field to clarify it controls content block badge display
app/src/protyle/ui/initUI.ts Refactored setPadding to compute widths before applying styles, added CSS custom properties, removed dynamic style element generation
app/src/assets/template/desktop/index.tpl Removed #editorAttr style element
app/src/assets/template/app/window.tpl Removed #editorAttr style element
app/src/assets/template/app/index.tpl Removed #editorAttr style element
app/src/assets/scss/protyle/_wysiwyg.scss Added max-width style using new CSS custom property for tooltip width constraint

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/src/protyle/ui/initUI.ts
@Vanessa219
Vanessa219 merged commit 6150e9b into siyuan-note:dev Oct 25, 2025
2 checks passed
@TCOTC
TCOTC deleted the fix/15021 branch October 25, 2025 09:17
@88250 88250 added this to the 3.3.6 milestone Oct 25, 2025
Vanessa219 added a commit that referenced this pull request Oct 25, 2025
@Vanessa219 Vanessa219 self-assigned this Oct 25, 2025
@TCOTC

TCOTC commented Oct 25, 2025

Copy link
Copy Markdown
Contributor Author

@Vanessa219 这样改不对吧,setAttribute 之后再 getAttribute 得到的是同一个数,然后后面 return 的始终是 0。

image

Vanessa219 added a commit that referenced this pull request Oct 25, 2025
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jul 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants