Skip to content

Commit e493c15

Browse files
authored
fix: notification component size adaptation (#70)
1 parent 343f669 commit e493c15

File tree

3 files changed

+42
-32
lines changed

3 files changed

+42
-32
lines changed

README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,21 @@ This extension is "**ready to use after download**" and usually requires no worr
4545
- Note: `.tar.gz` would be matched by both `.gz` and `.tar.gz`
4646

4747
```text
48-
jpg
49-
jpeg
50-
png
51-
tif
52-
tiff
53-
webp
54-
avif
55-
gif
56-
pdf
57-
docx
58-
doc
59-
pptx
60-
ppt
61-
xlsx
62-
xls
48+
.jpg
49+
.jpeg
50+
.png
51+
.tif
52+
.tiff
53+
.webp
54+
.avif
55+
.gif
56+
.pdf
57+
.docx
58+
.doc
59+
.pptx
60+
.ppt
61+
.xlsx
62+
.xls
6363
```
6464

6565
### How to set domains that do not need to be captured

README_zh-CN.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,21 @@
4545
- 注:`.tar.gz` 会被 `.gz``.tar.gz` 匹配
4646

4747
```text
48-
jpg
49-
jpeg
50-
png
51-
tif
52-
tiff
53-
webp
54-
avif
55-
gif
56-
pdf
57-
docx
58-
doc
59-
pptx
60-
ppt
61-
xlsx
62-
xls
48+
.jpg
49+
.jpeg
50+
.png
51+
.tif
52+
.tiff
53+
.webp
54+
.avif
55+
.gif
56+
.pdf
57+
.docx
58+
.doc
59+
.pptx
60+
.ppt
61+
.xlsx
62+
.xls
6363
```
6464

6565
### 如何屏蔽来自指定域名的文件

contents/notify.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,24 @@ export const getStyle = () => styleElement
2020
function PlasmoOverlay() {
2121
const notify = usePort("notify")
2222
const [open, setOpen] = useState(false)
23+
const [rootFontSize, setRootFontSize] = useState("")
2324

2425
const handleClose = () => {
2526
setOpen(false)
27+
if (rootFontSize) {
28+
setTimeout(() => {
29+
document.documentElement.style.fontSize = rootFontSize
30+
}, 500)
31+
}
2632
}
2733

2834
useEffect(() => {
2935
if (notify.data) {
36+
const tempRootFontSize = document.documentElement.style.fontSize
37+
if (tempRootFontSize && parseInt(tempRootFontSize) > 32) {
38+
document.documentElement.style.fontSize = null
39+
setRootFontSize(tempRootFontSize)
40+
}
3041
setOpen(true)
3142
}
3243
}, [notify.data])
@@ -39,8 +50,7 @@ function PlasmoOverlay() {
3950
open={open}
4051
anchorOrigin={{ vertical: "bottom", horizontal: "right" }}
4152
autoHideDuration={6000}
42-
onClose={handleClose}
43-
message={notify.data.message}>
53+
onClose={handleClose}>
4454
<Alert
4555
onClose={handleClose}
4656
severity={notify.data.type || "success"}

0 commit comments

Comments
 (0)