refactor: use global css variable

This commit is contained in:
fantasticit 2022-04-13 20:49:38 +08:00
parent 2d89d2057b
commit ba50a54e9b
14 changed files with 120 additions and 99 deletions

View File

@ -1,15 +1,4 @@
body { body {
--border-radius: 4px; --border-radius: 4px;
--box-shadow: rgb(0 0 0 / 10%) 0 0 10px; --box-shadow: rgb(0 0 0 / 10%) 0 0 10px;
/* 自定义节点 边框 */
--node-border-color: rgb(28 31 35 / 8%);
/* 自定义节点 hover */
--node-hover-border-color: #bacefd;
/* 自定义节点选中 */
--node-selected-border-color: rgb(0 101 255);
}
body[theme-mode='dark'] {
--node-border-color: rgb(255, 255, 255, 0.08);
} }

View File

@ -1,3 +1,4 @@
@import './var.scss';
@import './base.scss'; @import './base.scss';
@import './code.scss'; @import './code.scss';
@import './collaboration.scss'; @import './collaboration.scss';
@ -8,6 +9,7 @@
@import './mention.scss'; @import './mention.scss';
@import './menu.scss'; @import './menu.scss';
@import './mind.scss'; @import './mind.scss';
@import './node.scss';
@import './placeholder.scss'; @import './placeholder.scss';
@import './search.scss'; @import './search.scss';
@import './selection.scss'; @import './selection.scss';

View File

@ -0,0 +1,76 @@
/* 自定义节点样式 */
.ProseMirror {
.node-status {
margin-right: 4px;
.semi-tag-default {
border: 1px solid var(--node-border-color);
}
}
.node-codeBlock,
.node-katex,
.node-documentChildren,
.node-documentReference {
user-select: none;
.render-wrapper {
border: 1px solid var(--node-border-color);
}
}
.node-codeBlock,
.node-katex {
.render-wrapper {
border-radius: var(--border-radius);
}
}
.node-image,
.node-attachment,
.node-iframe,
.node-mind,
.node-banner,
.node-countdown {
margin-top: 0.75em;
}
.node-attachment,
.node-banner,
.node-countdown,
.node-iframe,
.node-katex,
.node-mind,
.node-codeBlock,
.node-documentChildren,
.node-documentReference {
.render-wrapper {
position: relative;
user-select: text;
&:hover,
&:active {
border: 1px solid var(--node-hover-border-color);
}
}
}
.node-image {
.render-wrapper {
position: relative;
&:hover,
&:active {
&::after {
position: absolute;
content: '';
inset: 0;
pointer-events: none;
background-color: transparent;
border: 1px solid var(--node-hover-border-color) !important;
border-radius: var(--border-radius);
}
}
}
}
}

View File

@ -4,10 +4,6 @@
} }
.tableWrapper { .tableWrapper {
::selection {
//background-color: transparent;
}
&.selected-node { &.selected-node {
td, td,
th { th {
@ -17,12 +13,6 @@
} }
.node-status { .node-status {
margin-right: 4px;
.semi-tag-default {
border: 1px solid var(--node-border-color);
}
&.selected-node { &.selected-node {
.semi-tag-default { .semi-tag-default {
border: 1px solid var(--node-selected-border-color); border: 1px solid var(--node-selected-border-color);
@ -30,33 +20,6 @@
} }
} }
.node-codeBlock,
.node-katex,
.node-documentChildren,
.node-documentReference {
user-select: none;
.render-wrapper {
border: 1px solid var(--node-border-color);
}
}
.node-codeBlock,
.node-katex {
.render-wrapper {
border-radius: var(--border-radius);
}
}
.node-image,
.node-attachment,
.node-iframe,
.node-mind,
.node-banner,
.node-countdown {
margin-top: 0.75em;
}
.node-attachment, .node-attachment,
.node-banner, .node-banner,
.node-countdown, .node-countdown,
@ -66,16 +29,6 @@
.node-codeBlock, .node-codeBlock,
.node-documentChildren, .node-documentChildren,
.node-documentReference { .node-documentReference {
.render-wrapper {
position: relative;
user-select: text;
&:hover,
&:active {
border: 1px solid var(--node-hover-border-color);
}
}
&.selected-node { &.selected-node {
&:not(.has-focus) { &:not(.has-focus) {
::selection { ::selection {
@ -105,22 +58,6 @@
} }
.node-image { .node-image {
.render-wrapper {
position: relative;
&:hover,
&:active {
&::after {
position: absolute;
content: '';
inset: 0;
pointer-events: none;
background-color: transparent;
border: 1px solid var(--node-hover-border-color) !important;
border-radius: var(--border-radius);
}
}
}
&.selected-node { &.selected-node {
&:not(.has-focus) { &:not(.has-focus) {
::selection { ::selection {

View File

@ -0,0 +1,17 @@
.ProseMirror {
--node-text-color: rgba(3, 3, 3, 0.8);
--node-hover-text-color: rgb(0 101 255);
/* 自定义节点 边框 */
--node-border-color: rgb(28 31 35 / 8%);
/* 自定义节点 hover */
--node-hover-border-color: rgb(0 101 255);
/* 自定义节点选中 */
--node-selected-border-color: rgb(0 101 255);
}
body[theme-mode='dark'] {
.ProseMirror {
--node-text-color: rgba(249, 249, 249, 0.8);
--node-border-color: rgb(255, 255, 255, 0.08);
}
}

View File

@ -2,7 +2,7 @@
width: 100%; width: 100%;
display: flex; display: flex;
justify-content: center; justify-content: center;
border-top: 1px solid var(--semi-color-border); border-top: 1px solid var(--node-border-color);
padding: 12px; padding: 12px;
> video { > video {

View File

@ -1,10 +1,10 @@
.wrap { .wrap {
line-height: 0; line-height: 0;
border: 1px solid var(--semi-color-border); border: 1px solid var(--node-border-color);
border-radius: var(--border-radius); border-radius: var(--border-radius);
p { p {
margin-top: .25em; margin-top: 0.25em;
} }
p:first-child { p:first-child {

View File

@ -6,7 +6,7 @@
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding: 6px 8px; padding: 6px 8px;
border-bottom: 1px solid var(--semi-color-border); border-bottom: 1px solid var(--node-border-color);
background-color: var(--semi-color-fill-0); background-color: var(--semi-color-fill-0);
.selectorWrap { .selectorWrap {

View File

@ -3,7 +3,7 @@
overflow: hidden; overflow: hidden;
line-height: 0; line-height: 0;
background-color: var(--semi-color-fill-0); background-color: var(--semi-color-fill-0);
border: 1px solid var(--semi-color-border); border: 1px solid var(--node-border-color);
border-radius: var(--border-radius); border-radius: var(--border-radius);
display: flex; display: flex;

View File

@ -1,23 +1,23 @@
.wrap { .wrap {
padding: 12px; padding: 12px;
margin-top: .75em; margin-top: 0.75em;
border: 1px solid var(--semi-color-border); border: 1px solid var(--node-border-color);
border-radius: var(--border-radius); border-radius: var(--border-radius);
.itemWrap { .itemWrap {
display: flex; display: flex;
padding: 6px; padding: 6px;
margin-top: 12px; margin-top: 12px;
color: var(--semi-color-text-1); color: var(--node-text-color);
text-decoration: none; text-decoration: none;
cursor: pointer; cursor: pointer;
border: 1px solid var(--semi-color-border); border: 1px solid var(--node-border-color);
border-radius: var(--border-radius); border-radius: var(--border-radius);
align-items: center; align-items: center;
&:hover { &:hover {
border-color: var(--semi-color-link); border-color: var(--node-hover-border-color);
color: var(--semi-color-link); color: var(--node-hover-text-color);
} }
span { span {

View File

@ -1,19 +1,19 @@
.wrap { .wrap {
margin-top: .75em; margin-top: 0.75em;
border-radius: var(--border-radius); border-radius: var(--border-radius);
.itemWrap { .itemWrap {
display: flex; display: flex;
padding: 8px; padding: 8px;
color: var(--semi-color-text-1); color: var(--node-text-color);
text-decoration: none; text-decoration: none;
border: 1px solid var(--semi-color-border); border: 1px solid var(--node-border-color);
border-radius: var(--border-radius); border-radius: var(--border-radius);
align-items: center; align-items: center;
&:hover { &:hover {
border-color: var(--semi-color-link); border-color: var(--node-hover-border-color);
color: var(--semi-color-link); color: var(--node-hover-text-color);
} }
span { span {
@ -24,10 +24,10 @@
.empty { .empty {
display: flex; display: flex;
padding: 8px; padding: 8px;
color: var(--semi-color-text-1); color: var(--node-text-color);
text-decoration: none; text-decoration: none;
cursor: not-allowed; cursor: not-allowed;
border: 1px solid var(--semi-color-border); border: 1px solid var(--node-border-color);
border-radius: var(--border-radius); border-radius: var(--border-radius);
align-items: center; align-items: center;
} }

View File

@ -5,7 +5,7 @@
overflow: hidden; overflow: hidden;
line-height: 0; line-height: 0;
background-color: var(--semi-color-fill-0); background-color: var(--semi-color-fill-0);
border: 1px solid var(--semi-color-border); border: 1px solid var(--node-border-color);
border-radius: var(--border-radius); border-radius: var(--border-radius);
flex-direction: column; flex-direction: column;

View File

@ -2,7 +2,7 @@
display: flex; display: flex;
padding: 8px 16px; padding: 8px 16px;
cursor: pointer; cursor: pointer;
border: 1px solid var(--semi-color-border); border: 1px solid var(--node-border-color);
border-radius: var(--border-radius); border-radius: var(--border-radius);
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;

View File

@ -40,7 +40,7 @@
align-items: center; align-items: center;
width: 12px; width: 12px;
height: 12px; height: 12px;
border-color: var(--semi-color-border); border-color: var(--node-border-color);
} }
} }
} }
@ -58,7 +58,7 @@
.jsmindInnerWrap { .jsmindInnerWrap {
padding: 6px; padding: 6px;
background-color: var(--semi-color-bg-2); background-color: var(--semi-color-bg-2);
border: 1px solid var(--semi-color-border); border: 1px solid var(--node-border-color);
border-radius: var(--border-radius); border-radius: var(--border-radius);
box-shadow: var(--box-shadow); box-shadow: var(--box-shadow);
} }
@ -68,7 +68,7 @@
position: relative; position: relative;
min-height: 50px; min-height: 50px;
overflow: hidden; overflow: hidden;
border: 1px solid var(--semi-color-border); border: 1px solid var(--node-border-color);
border-radius: var(--border-radius); border-radius: var(--border-radius);
outline: none; outline: none;
@ -89,7 +89,7 @@
z-index: 1000; z-index: 1000;
padding: 4px 8px; padding: 4px 8px;
background-color: var(--semi-color-bg-2); background-color: var(--semi-color-bg-2);
border: 1px solid var(--semi-color-border); border: 1px solid var(--node-border-color);
border-radius: var(--border-radius); border-radius: var(--border-radius);
opacity: 0; opacity: 0;
box-shadow: var(--box-shadow); box-shadow: var(--box-shadow);
@ -112,6 +112,6 @@
display: flex; display: flex;
justify-content: center; justify-content: center;
padding: 10px; padding: 10px;
border-top: 1px solid var(--semi-color-border); border-top: 1px solid var(--node-border-color);
} }
} }