Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 6 additions & 54 deletions app/src/assets/scss/component/_tooltips.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
border-radius: var(--b3-border-radius);
line-height: 17px;
max-width: 320px;
animation-duration: 150ms;
animation-fill-mode: both;
animation-name: zoomIn;
animation-duration: 100ms;
animation-delay: var(--b3-tooltips-delay, 500ms);
animation-fill-mode: both;
max-height: 90vh;
overflow: auto;
box-sizing: border-box;
Expand Down Expand Up @@ -55,7 +56,7 @@
background-color: var(--b3-tooltips-background);
border-radius: var(--b3-border-radius);
line-height: 17px;
transform: scale(.8);
transform: scale(.9);
max-width: 60vw;
overflow: hidden;
text-overflow: ellipsis;
Expand All @@ -64,29 +65,18 @@
font-family: var(--b3-font-family);
}

&::before {
z-index: 1000001;
width: 0;
height: 0;
content: "";
border: 5px solid transparent;
transform: scale(1.54);
}

&::after,
&::before {
&::after {
pointer-events: none;
position: absolute;
opacity: 0;
transition: opacity 150ms 0ms cubic-bezier(0, 0, .2, 1), transform 150ms 0ms cubic-bezier(0, 0, .2, 1);
transition: opacity 100ms 500ms cubic-bezier(0, 0, .2, 1), transform 100ms 500ms cubic-bezier(0, 0, .2, 1);
}

&:hover,
&:focus-within {
overflow: initial;
}

&:hover::before,
&:hover::after {
display: inline-block;
opacity: 1;
Expand All @@ -101,16 +91,6 @@
margin-top: 5px
}

&__s::before,
&__se::before,
&__sw::before {
top: auto;
right: 50%;
bottom: -5px;
margin-right: -5px;
border-bottom-color: var(--b3-tooltips-background)
}

&__se::after {
right: auto;
left: 50%;
Expand All @@ -129,16 +109,6 @@
margin-bottom: 5px
}

&__n::before,
&__ne::before,
&__nw::before {
top: -5px;
right: 50%;
bottom: auto;
margin-right: -5px;
border-top-color: var(--b3-tooltips-background)
}

&__ne::after {
right: auto;
left: 50%;
Expand Down Expand Up @@ -166,14 +136,6 @@
transform: translateY(50%) scale(.8);
}

&__w::before {
top: 50%;
bottom: 50%;
left: -5px;
margin-top: -5px;
border-left-color: var(--b3-tooltips-background);
}

&__e::after {
bottom: 50%;
left: 100%;
Expand All @@ -185,19 +147,9 @@
&__w:hover::after {
transform: translateY(50%) scale(1);
}


&__e::before {
top: 50%;
right: -5px;
bottom: 50%;
margin-top: -5px;
border-right-color: var(--b3-tooltips-background);
}
}

@media screen and (max-width: 520px) {
.b3-tooltips::before,
.b3-tooltips::after {
content: none;
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/assets/scss/util/_keyframes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
@keyframes zoomIn {
0% {
opacity: 0;
transform: scale(.8);
transform: scale(.9);
}

to {
Expand Down
5 changes: 4 additions & 1 deletion app/src/dialog/tooltip.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {isMobile} from "../util/functions";

export const showTooltip = (message: string, target: Element, tooltipClass?: string) => {
export const showTooltip = (message: string, target: Element, tooltipClass?: string, delay?: number) => {
if (isMobile()) {
return;
}
Expand All @@ -16,6 +16,9 @@ export const showTooltip = (message: string, target: Element, tooltipClass?: str
// 避免原本的 top 和 left 影响计算
messageElement.removeAttribute("style");

delay ??= parseInt(target.closest("[data-tooltips-delay]")?.getAttribute("data-tooltips-delay") || "500");
messageElement.style.setProperty("--b3-tooltips-delay", delay + "ms");


const position = target.getAttribute("data-position");
const parentRect = target.parentElement.getBoundingClientRect();
Expand Down
4 changes: 2 additions & 2 deletions app/src/layout/dock/Files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ export class Files extends Model {
return `<ul class="b3-list b3-list--background" data-url="${item.id}" data-sort="${item.sort}" data-sortmode="${item.sortMode}">
<li class="b3-list-item b3-list-item--hide-action" ${window.siyuan.config.fileTree.sort === 6 ? 'draggable="true"' : ""}
style="--file-toggle-width:22px"
data-type="navigation-root" data-path="/">
data-type="navigation-root" data-path="/" data-tooltips-delay="200">
<span class="b3-list-item__toggle b3-list-item__toggle--hl">
<svg class="b3-list-item__arrow"><use xlink:href="#iconRight"></use></svg>
</span>
Expand Down Expand Up @@ -1250,7 +1250,7 @@ data-type="navigation-root" data-path="/">
return `<li data-node-id="${item.id}" data-name="${Lute.EscapeHTMLStr(item.name)}" draggable="true" data-count="${item.subFileCount}"
data-type="navigation-file"
style="--file-toggle-width:${paddingLeft + 18}px"
class="b3-list-item b3-list-item--hide-action" data-path="${item.path}">
class="b3-list-item b3-list-item--hide-action" data-path="${item.path}" data-tooltips-delay="200">
<span style="padding-left: ${paddingLeft}px" class="b3-list-item__toggle b3-list-item__toggle--hl${item.subFileCount === 0 ? " fn__hidden" : ""}">
<svg class="b3-list-item__arrow"><use xlink:href="#iconRight"></use></svg>
</span>
Expand Down