-
Notifications
You must be signed in to change notification settings - Fork 432
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: 图片放大失效、作者头像取消旋转效果、图片加载失败时增加一个原有src属性的展示属性
- Loading branch information
Showing
11 changed files
with
95 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { visit } from "unist-util-visit"; | ||
import { BytemdPlugin } from "bytemd"; | ||
import m from "medium-zoom" | ||
const ImgZoomPlugin = () => (tree) => { | ||
visit(tree, (node) => { | ||
if (node.type === "element" && node.tagName === "img") { | ||
node.properties.className += " img-zoom" | ||
} | ||
}) | ||
} | ||
|
||
export function Img(): BytemdPlugin { | ||
return { | ||
rehype: (processor) => processor.use(ImgZoomPlugin), | ||
viewerEffect: ({ markdownBody }) => { | ||
markdownBody.querySelectorAll(".img-zoom").forEach((img: HTMLImageElement) => { | ||
if (img.getAttribute("data-zoomed")) return | ||
img.setAttribute("data-zoomed", "true") | ||
m(img) | ||
}) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.medium-zoom-overlay { | ||
z-index: 1300; | ||
background: white !important; | ||
} | ||
|
||
.dark .medium-zoom-overlay { | ||
background: #1d2025 !important; | ||
} | ||
|
||
.medium-zoom-image--opened { | ||
z-index: 1400; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.