Skip to content

Commit

Permalink
feat: 样式调整
Browse files Browse the repository at this point in the history
  • Loading branch information
JuckZ committed Oct 20, 2023
1 parent eaa6c0f commit 6bcc77a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 143 deletions.
143 changes: 0 additions & 143 deletions src/styles/hover-editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ settings:
--he-popover-opacity-while-dragging: 0.8;
--he-popover-border-radius: 6px;
--he-popover-header-transition-speed: 0.3s;
--he-popover-snap-to-edge-transition-speed: 0.3s;
/* resize handle sizing */
--he-resize-handle-side-size: 12px;
--he-resize-handle-corner-size: 18px;
Expand Down Expand Up @@ -246,10 +245,6 @@ body {
width: var(--he-resize-handle-corner-size);
}

/* body.is-dragging-popover .tooltip {
opacity: 0;
} */

.popover-header-icon {
width: fit-content;
}
Expand Down Expand Up @@ -300,54 +295,6 @@ body {
display: none;
}

.popover.hover-editor.is-dragging {
opacity: var(--he-popover-opacity-while-dragging);
}

.popover.hover-editor:is(.snap-to-viewport, .snap-to-left, .snap-to-right) .resize-handle {
display: none;
}

.popover.hover-editor.snap-to-right .resize-handle.left,
.popover.hover-editor.snap-to-left .resize-handle.right {
display: block;
}

.popover.hover-editor.is-dragging.snap-to-left,
.popover.hover-editor.is-dragging.snap-to-right,
.popover.hover-editor.is-dragging.snap-to-viewport {
transition: width var(--he-popover-snap-to-edge-transition-speed),
height var(--he-popover-snap-to-edge-transition-speed), top var(--he-popover-snap-to-edge-transition-speed),
left var(--he-popover-snap-to-edge-transition-speed);
}

.hover-popover.is-dragging.snap-to-left::after,
.hover-popover.is-dragging.snap-to-right::after,
.hover-popover.is-dragging.snap-to-viewport::after {
position: absolute;
content: "";
width: 100%;
height: 100%;
top: 0;
border-radius: var(--he-popover-border-radius);
box-shadow: inset 0px 0px 0px 4px var(--interactive-accent);
pointer-events: none;
}

.popover.hover-editor.snap-to-left {
max-height: unset !important;
}

.popover.hover-editor.snap-to-right {
right: 0 !important;
max-height: unset !important;
}

.popover.hover-editor.snap-to-viewport {
max-height: unset !important;
max-width: unset !important;
}

.popover.hover-editor .popover-titlebar {
display: flex;
height: var(--he-title-bar-height);
Expand Down Expand Up @@ -457,98 +404,8 @@ body {
height: 100%;
}

.popover.hover-editor .workspace-leaf-content[data-type="image"] .view-content {
padding: 0;
position: relative;
overflow: hidden;
}

.popover.hover-editor .workspace-leaf-content[data-type="image"] img {
display: block;
position: relative;
height: 100%;
width: 100%;
max-width: unset;
border-radius: 0;
}

body .popover.hover-editor .view-content {
/* theme devs: if you want to change the header height, you must do so by setting the --he-view-header-height variable */
/* if you don't use the variable, you will break internal measurement logic */
height: calc(100% - var(--he-view-header-height));
}

/* start: zoomable images feature */

.popover.hover-editor.image-zoom .view-content .image-embed:active {
aspect-ratio: unset;
cursor: zoom-out;
display: block;
z-index: 200;
position: fixed;
max-height: calc(100% + 1px);
max-width: 100%;
height: calc(100% + 1px);
width: 100%;
object-fit: contain;
margin: -0.5px auto 0;
text-align: center;
padding: 0;
left: 0;
right: 0;
bottom: 0;
max-width: unset;
}

/* extra specificity to override some community theme styles that cause issues */
.popover.hover-editor.image-zoom .view-content .image-embed img:active {
top: 50%;
z-index: 99;
transform: translateY(-50%);
padding: 0;
margin: 0 auto;
width: calc(100% - 20px);
height: unset;
max-height: 95vh;
object-fit: contain;
left: 0;
right: 0;
bottom: 0;
position: absolute;
opacity: 1;
max-width: unset;
max-height: 100%;
}

.popover.hover-editor.image-zoom .view-content .image-embed:active:after {
background-color: var(--background-primary);
opacity: 0.9;
content: " ";
height: calc(100% + 1px);
width: 100%;
position: fixed;
left: 0;
right: 1px;
z-index: 0;
}

.popover.hover-editor.image-zoom .view-content img {
cursor: zoom-in;
}

/* extra specificity to override some community theme styles that cause issues */
.popover.hover-editor.image-zoom .workspace-leaf-content[data-type="image"] img {
cursor: zoom-in;
top: 50%;
transform: translateY(-50%);
object-fit: contain;
height: unset;
left: 0;
right: 0;
bottom: 0;
position: absolute;
opacity: 1;
max-height: 100%;
}

/* end: zoomable images feature */
1 change: 1 addition & 0 deletions src/ui/popover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ export class HoverEditor extends nosuper(HoverPopover) {
}

setInitialDimensions() {
this.hoverEl.style.zIndex = '99999';
this.hoverEl.style.height = SETTINGS.initialHeight.value;
this.hoverEl.style.width = SETTINGS.initialWidth.value;
}
Expand Down

0 comments on commit 6bcc77a

Please sign in to comment.