添加 react-router, 使 CallackError 获得更多成员, 导出, (WIP) 图片查看器修改, 修复遗忘的 data.apply()
This commit is contained in:
@@ -1,39 +1,4 @@
|
||||
import { $ } from 'mdui/jq'
|
||||
import 'pinch-zoom-element'
|
||||
|
||||
document.body.appendChild(new DOMParser().parseFromString(`
|
||||
<mdui-dialog id="image-viewer-dialog" fullscreen="fullscreen">
|
||||
<style>
|
||||
#image-viewer-dialog::part(panel) {
|
||||
background: rgba(0, 0, 0, 0) !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
#image-viewer-dialog>mdui-button-icon[icon=close] {
|
||||
z-index: 114514;
|
||||
position: fixed;
|
||||
top: 15px;
|
||||
right: 15px;
|
||||
color: #ffffff
|
||||
}
|
||||
|
||||
#image-viewer-dialog>mdui-button-icon[icon=open_in_new] {
|
||||
z-index: 114514;
|
||||
position: fixed;
|
||||
top: 15px;
|
||||
right: 65px;
|
||||
color: #ffffff
|
||||
}
|
||||
</style>
|
||||
<mdui-button-icon icon="open_in_new"
|
||||
onclick="window.open(document.querySelector('#image-viewer-dialog-inner > *').src, '_blank')">
|
||||
</mdui-button-icon>
|
||||
<mdui-button-icon icon="close" onclick="this.parentNode.open = false">
|
||||
</mdui-button-icon>
|
||||
<pinch-zoom id="image-viewer-dialog-inner" style="width: var(--whitesilk-window-width); height: var(--whitesilk-window-height);">
|
||||
</pinch-zoom>
|
||||
</mdui-dialog>
|
||||
`, 'text/html').body.firstChild as Node)
|
||||
|
||||
export default function openImageViewer(src: string) {
|
||||
$('#image-viewer-dialog-inner').empty()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as React from 'react'
|
||||
|
||||
export default function useEventListener<T extends HTMLElement | null>(ref: React.MutableRefObject<T>, eventName: string, callback: (event: Event) => void) {
|
||||
export default function useEventListener<T extends HTMLElement | undefined | null>(ref: React.MutableRefObject<T>, eventName: string, callback: (event: Event) => void) {
|
||||
React.useEffect(() => {
|
||||
ref.current!.addEventListener(eventName, callback)
|
||||
return () => ref.current?.removeEventListener(eventName, callback)
|
||||
|
||||
Reference in New Issue
Block a user