From 7f1db1fefd46a73a1b67163dbcda09caa17349cc Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 29 Jan 2025 20:48:56 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/pull/13564 --- .../assets/scss/component/_typography.scss | 32 ++++++---------- app/src/assets/scss/protyle/_wysiwyg.scss | 38 ++++++------------- app/src/util/assets.ts | 3 +- 3 files changed, 25 insertions(+), 48 deletions(-) diff --git a/app/src/assets/scss/component/_typography.scss b/app/src/assets/scss/component/_typography.scss index b8fffa1c0..484c26be2 100644 --- a/app/src/assets/scss/component/_typography.scss +++ b/app/src/assets/scss/component/_typography.scss @@ -153,9 +153,7 @@ h5, h6 { padding: 4px; - margin: 4px 0; - font-weight: 600; - line-height: 1.25; + margin: 2px 0; } .h1, @@ -163,28 +161,23 @@ .h3, .h4, .h5, - .h6 { + .h6, + h1, + h2, + h3, + h4, + h5, + h6 { font-weight: 600; - - &[data-node-id] [spellcheck] { - min-height: 1.625em; - } - } - - h1 { - padding: .3em 4px; - font-size: 1.75em; + line-height: 1.25; } + h1, .h1 { font-size: 1.75em; } - h2 { - padding: .3em 4px; - font-size: 1.55em; - } - + h2, .h2 { font-size: 1.55em; } @@ -318,8 +311,7 @@ } .protyle-action__language { - position: absolute; - left: 1em; + margin-left: 1em; opacity: 0; transition: var(--b3-transition); } diff --git a/app/src/assets/scss/protyle/_wysiwyg.scss b/app/src/assets/scss/protyle/_wysiwyg.scss index c2942c9bb..6cbd26226 100644 --- a/app/src/assets/scss/protyle/_wysiwyg.scss +++ b/app/src/assets/scss/protyle/_wysiwyg.scss @@ -166,6 +166,17 @@ align-items: center; word-break: keep-all; + // https://github.com/siyuan-note/siyuan/issues/2803 + & ~ .h1, + & ~ .h2, + & ~ .h3, + & ~ .h4, + & ~ .h5, + & ~ .h6 { + padding-top: 0; + padding-bottom: 0; + } + &::after { content: ""; position: absolute; @@ -185,17 +196,6 @@ &--order::after { border-radius: var(--b3-border-radius); } - - ~ .h1, - ~ .h2, - ~ .h3, - ~ .h4, - ~ .h5, - ~ .h6 { - [spellcheck] { - min-height: unset; - } - } } } @@ -231,20 +231,6 @@ position: initial; margin-left: 4px; } - - /* 选中块的高亮覆盖 margin */ - &> .protyle-wysiwyg--select:not(.sb)::after, - &> .protyle-wysiwyg--hl:not(.sb)::after{ - height: calc(100% + 4px); - top: -2px; - } - - /* 选中块的高亮覆盖 border 和 margin */ - &> .protyle-wysiwyg--select.render-node[data-type="NodeBlockQueryEmbed"]::after, - &> .protyle-wysiwyg--hl.render-node[data-type="NodeBlockQueryEmbed"]::after{ - height: calc(100% + 6px); - top: -3px; - } } } @@ -326,7 +312,7 @@ /* 选中块的高亮覆盖 border */ &.protyle-wysiwyg--select::after, - &.protyle-wysiwyg--hl::after{ + &.protyle-wysiwyg--hl::after { width: calc(100% + 2px); height: calc(100% + 2px); left: -1px; diff --git a/app/src/util/assets.ts b/app/src/util/assets.ts index 1756e4fbf..68cceb221 100644 --- a/app/src/util/assets.ts +++ b/app/src/util/assets.ts @@ -288,8 +288,7 @@ export const setInlineStyle = async (set = true) => { }`; } } - style += `\n:root{--b3-font-size-editor:${window.siyuan.config.editor.fontSize}px} -.b3-typography, .protyle-wysiwyg, .protyle-title {font-size:${window.siyuan.config.editor.fontSize}px !important} + style += `.b3-typography, .protyle-wysiwyg, .protyle-title {font-size:${window.siyuan.config.editor.fontSize}px !important} .b3-typography code:not(.hljs), .protyle-wysiwyg span[data-type~=code] { font-variant-ligatures: ${window.siyuan.config.editor.codeLigatures ? "normal" : "none"} } .li > .protyle-action {height:${height + 8}px;line-height: ${height + 8}px} .protyle-wysiwyg [data-node-id].li > .protyle-action ~ .h1, .protyle-wysiwyg [data-node-id].li > .protyle-action ~ .h2, .protyle-wysiwyg [data-node-id].li > .protyle-action ~ .h3, .protyle-wysiwyg [data-node-id].li > .protyle-action ~ .h4, .protyle-wysiwyg [data-node-id].li > .protyle-action ~ .h5, .protyle-wysiwyg [data-node-id].li > .protyle-action ~ .h6 {line-height:${height + 8}px;}