mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-23 01:50:12 +01:00
This commit is contained in:
parent
afb5327c43
commit
f7ae1d04ec
3 changed files with 15 additions and 8 deletions
|
|
@ -1,7 +1,6 @@
|
||||||
.av {
|
.av {
|
||||||
user-select: none;
|
user-select: none;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
font-size: 14px;
|
|
||||||
|
|
||||||
&:hover .av__row--footer > .av__calc--show {
|
&:hover .av__row--footer > .av__calc--show {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
|
|
@ -13,14 +12,12 @@
|
||||||
|
|
||||||
.layout-tab-bar {
|
.layout-tab-bar {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
|
font-size: 87.5%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&__title {
|
&__title {
|
||||||
height: 30px;
|
|
||||||
outline: none;
|
outline: none;
|
||||||
line-height: 30px;
|
|
||||||
font-size: 16px;
|
|
||||||
|
|
||||||
&:empty::after {
|
&:empty::after {
|
||||||
color: var(--b3-theme-on-surface);
|
color: var(--b3-theme-on-surface);
|
||||||
|
|
@ -62,6 +59,7 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
border-bottom: 1px solid var(--b3-theme-surface-lighter);
|
border-bottom: 1px solid var(--b3-theme-surface-lighter);
|
||||||
position: relative;
|
position: relative;
|
||||||
|
font-size: 87.5%;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
[data-type="block-ref"] {
|
[data-type="block-ref"] {
|
||||||
|
|
@ -118,9 +116,8 @@
|
||||||
flex-direction: row-reverse;
|
flex-direction: row-reverse;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
line-height: 26px;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
font-size: 12px;
|
font-size: 75%;
|
||||||
|
|
||||||
&.av__calc--ashow {
|
&.av__calc--ashow {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
|
|
@ -133,7 +130,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
span {
|
span {
|
||||||
font-size: 14px;
|
font-size: 116%;
|
||||||
color: var(--b3-theme-on-background);
|
color: var(--b3-theme-on-background);
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
|
|
@ -150,6 +147,7 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
transition: background 20ms ease-in 0s;
|
transition: background 20ms ease-in 0s;
|
||||||
|
font-size: 87.5%;
|
||||||
|
|
||||||
svg {
|
svg {
|
||||||
height: 12px;
|
height: 12px;
|
||||||
|
|
@ -179,7 +177,7 @@
|
||||||
display: none;
|
display: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 5px;
|
right: 5px;
|
||||||
font-size: 10px;
|
font-size: 85%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.block__icon {
|
.block__icon {
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import {hasClosestByAttribute, hasClosestByClassName} from "../util/hasClosest";
|
||||||
import {isMac} from "../util/compatibility";
|
import {isMac} from "../util/compatibility";
|
||||||
import {setInlineStyle} from "../../util/assets";
|
import {setInlineStyle} from "../../util/assets";
|
||||||
import {fetchPost} from "../../util/fetch";
|
import {fetchPost} from "../../util/fetch";
|
||||||
|
import {lineNumberRender} from "../render/highlightRender";
|
||||||
|
|
||||||
export const initUI = (protyle: IProtyle) => {
|
export const initUI = (protyle: IProtyle) => {
|
||||||
protyle.contentElement = document.createElement("div");
|
protyle.contentElement = document.createElement("div");
|
||||||
|
|
@ -92,6 +93,11 @@ export const initUI = (protyle: IProtyle) => {
|
||||||
clearTimeout(wheelTimeout);
|
clearTimeout(wheelTimeout);
|
||||||
wheelTimeout = window.setTimeout(() => {
|
wheelTimeout = window.setTimeout(() => {
|
||||||
fetchPost("/api/setting/setEditor", window.siyuan.config.editor);
|
fetchPost("/api/setting/setEditor", window.siyuan.config.editor);
|
||||||
|
if (window.siyuan.config.editor.codeSyntaxHighlightLineNum) {
|
||||||
|
protyle.wysiwyg.element.querySelectorAll(".code-block .protyle-linenumber").forEach((block: HTMLElement) => {
|
||||||
|
lineNumberRender(block);
|
||||||
|
});
|
||||||
|
}
|
||||||
}, Constants.TIMEOUT_LOAD);
|
}, Constants.TIMEOUT_LOAD);
|
||||||
}, {passive: false});
|
}, {passive: false});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -199,6 +199,7 @@ export const addGA = () => {
|
||||||
|
|
||||||
export const setInlineStyle = (set = true) => {
|
export const setInlineStyle = (set = true) => {
|
||||||
const height = Math.floor(window.siyuan.config.editor.fontSize * 1.625);
|
const height = Math.floor(window.siyuan.config.editor.fontSize * 1.625);
|
||||||
|
// .protyle-wysiwyg .hljs.protyle-linenumber 的设置是由于 lineNumberRender 中 clientHeight 总是取的整数
|
||||||
let style = `.b3-typography, .protyle-wysiwyg, .protyle-title {font-size:${window.siyuan.config.editor.fontSize}px !important}
|
let 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"} }
|
.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}
|
.li > .protyle-action {height:${height + 8}px;line-height: ${height + 8}px}
|
||||||
|
|
@ -209,6 +210,8 @@ export const setInlineStyle = (set = true) => {
|
||||||
.protyle-wysiwyg [data-node-id] [spellcheck] {min-height:${height}px;}
|
.protyle-wysiwyg [data-node-id] [spellcheck] {min-height:${height}px;}
|
||||||
.protyle-wysiwyg [data-node-id] {${window.siyuan.config.editor.rtl ? " direction: rtl;" : ""}${window.siyuan.config.editor.justify ? " text-align: justify;" : ""}}
|
.protyle-wysiwyg [data-node-id] {${window.siyuan.config.editor.rtl ? " direction: rtl;" : ""}${window.siyuan.config.editor.justify ? " text-align: justify;" : ""}}
|
||||||
.protyle-wysiwyg .li {min-height:${height + 8}px}
|
.protyle-wysiwyg .li {min-height:${height + 8}px}
|
||||||
|
.protyle-wysiwyg .hljs.protyle-linenumber {line-height: ${(height * 0.85).toFixed(0)}px}
|
||||||
|
.protyle-wysiwyg .av__calc {line-height: ${height}px}
|
||||||
.protyle-gutters button svg {height:${height}px}
|
.protyle-gutters button svg {height:${height}px}
|
||||||
.protyle-wysiwyg img.emoji, .b3-typography img.emoji {width:${height - 8}px}
|
.protyle-wysiwyg img.emoji, .b3-typography img.emoji {width:${height - 8}px}
|
||||||
.protyle-wysiwyg .h1 img.emoji, .b3-typography h1 img.emoji {width:${Math.floor(window.siyuan.config.editor.fontSize * 1.75 * 1.25)}px}
|
.protyle-wysiwyg .h1 img.emoji, .b3-typography h1 img.emoji {width:${Math.floor(window.siyuan.config.editor.fontSize * 1.75 * 1.25)}px}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue