Skip to content

Commit

Permalink
fix 🐛 : fix styles (#1199)
Browse files Browse the repository at this point in the history
* fix 🐛 : fix styles

* fix 🐛 : fix styles
  • Loading branch information
HerbertHe committed Mar 28, 2022
1 parent de6d4b7 commit 172f4c8
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/assets/scss/_hint.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
}

button {
display: flex;
color: var(--toolbar-icon-color);
display: block;
padding: 3px 10px;
border: 0;
border-radius: 0;
Expand Down
39 changes: 35 additions & 4 deletions src/assets/scss/_panel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,21 @@
* @version 1.0.0.0, Jan 22, 2020
*/

@-webkit-keyframes scale-in {
0% {
opacity: 0;
transform: scale(0.5);
}
100% {
opacity: 1;
transform: scale(1);
}
}

@keyframes scale-in {
0% {
opacity: 0;
transform: scale(.5);
transform: scale(0.5);
}
100% {
opacity: 1;
Expand All @@ -26,21 +37,33 @@
z-index: 3;
font-size: 14px;
display: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
max-width: 320px;
min-width: 80px;
animation-duration: .15s;
-webkit-animation-duration: 0.15s;
animation-duration: 0.15s;
-webkit-animation-name: scale-in;
animation-name: scale-in;
animation-timing-function: cubic-bezier(.2, 0, .13, 1.5);
-webkit-animation-timing-function: cubic-bezier(0.2, 0, 0.13, 1.5);
animation-timing-function: cubic-bezier(0.2, 0, 0.13, 1.5);
color: var(--toolbar-icon-color);

&--none {
padding: 0;
-webkit-animation: none;
animation: none;
min-width: auto;
max-width: none;
white-space: nowrap;
opacity: .86;
opacity: 0.86;
}

&--arrow {
display: none;
flex-direction: column;
}

&--arrow:before {
Expand Down Expand Up @@ -108,3 +131,11 @@
}
}
}

.vditor[dir="rtl"] {
&-panel {
&--arrow:before {
right: 5px !important;
}
}
}
1 change: 1 addition & 0 deletions src/assets/scss/_toolbar.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.vditor {
&-toolbar {
display: flex;
background-color: var(--toolbar-background-color);
border-bottom: 1px solid var(--border-color);
padding: 0 5px;
Expand Down
6 changes: 3 additions & 3 deletions src/ts/toolbar/setToolbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const showToolbar = (toolbar: { [key: string]: HTMLElement }, names: stri
return;
}
if (toolbar[name]) {
toolbar[name].style.display = "block";
toolbar[name].style.display = "flex";
}
});
};
Expand Down Expand Up @@ -102,14 +102,14 @@ export const toggleSubMenu = (vditor: IVditor, panelElement: HTMLElement, action
vditor.toolbar.element.querySelectorAll(".vditor-hint--current").forEach((item) => {
item.classList.remove("vditor-hint--current");
});
if (panelElement.style.display === "block") {
if (panelElement.style.display === "flex") {
panelElement.style.display = "none";
} else {
hidePanel(vditor, ["subToolbar", "hint", "popover"], actionBtn.parentElement.parentElement);
if (!actionBtn.classList.contains("vditor-tooltipped")) {
actionBtn.classList.add("vditor-hint--current");
}
panelElement.style.display = "block";
panelElement.style.display = "flex";
if (vditor.toolbar.element.getBoundingClientRect().right - actionBtn.getBoundingClientRect().right < 250) {
panelElement.classList.add("vditor-panel--left");
} else {
Expand Down

0 comments on commit 172f4c8

Please sign in to comment.