快捷移位

This commit is contained in:
2023-10-21 07:37:26 +08:00
parent e844cbd910
commit cb14d5b799
2 changed files with 20 additions and 0 deletions

View File

@ -13,6 +13,7 @@ export default class Chat {
maxWidth: '64rem', width: '100%',
transform: 'translate(-50%, 0)',
display: 'none',
transition: 'all .15s',
},
children: [
this.ul,
@ -35,11 +36,27 @@ export default class Chat {
outline: 'none',
},
onkeydown: event => {
event.stopPropagation()
const text = event.target.value.trim()
if (text && event.key === 'Enter') {
this.发送消息(text)
event.target.value = ''
}
if (!text && event.key === 'Enter') {
event.target.parentNode.parentNode.style.display = 'none'
}
if (event.ctrlKey && event.key === 'ArrowLeft') {
event.target.parentNode.parentNode.style.left = '0'
event.target.parentNode.parentNode.style.right = '50%'
}
if (event.ctrlKey && event.key === 'ArrowRight') {
event.target.parentNode.parentNode.style.left = '50%'
event.target.parentNode.parentNode.style.right = '0'
}
if (event.ctrlKey && event.key === 'ArrowDown') {
event.target.parentNode.parentNode.style.left = '50%'
event.target.parentNode.parentNode.style.right = '50%'
}
}
}),
Button({

View File

@ -205,6 +205,9 @@ export function UploadMusic(options) {
})
}
// 聊天窗口
export function Chat(options) {}
// 弹出窗口, 高斯模糊背景, 进入离开动画过渡
export function Dialog(options) {
const element = createElement({