diff --git a/backend/src/main/java/com/openisle/schdule/UserVisitScheduler.java b/backend/src/main/java/com/openisle/scheduler/UserVisitScheduler.java similarity index 98% rename from backend/src/main/java/com/openisle/schdule/UserVisitScheduler.java rename to backend/src/main/java/com/openisle/scheduler/UserVisitScheduler.java index c3fb58c50..ff16fe3c4 100644 --- a/backend/src/main/java/com/openisle/schdule/UserVisitScheduler.java +++ b/backend/src/main/java/com/openisle/scheduler/UserVisitScheduler.java @@ -1,4 +1,4 @@ -package com.openisle.schdule; +package com.openisle.scheduler; import com.openisle.config.CachingConfig; import com.openisle.model.User; diff --git a/frontend_nuxt/components/CommentEditor.vue b/frontend_nuxt/components/CommentEditor.vue index 68203de89..3a8408f85 100644 --- a/frontend_nuxt/components/CommentEditor.vue +++ b/frontend_nuxt/components/CommentEditor.vue @@ -6,8 +6,15 @@
- - + +
@@ -24,6 +31,7 @@ import { } from '~/utils/vditor' import '~/assets/global.css' import LoginOverlay from '~/components/LoginOverlay.vue' +import { useIsMobile } from '~/utils/screen' export default { name: 'CommentEditor', @@ -52,12 +60,22 @@ export default { }, components: { LoginOverlay }, setup(props, { emit }) { + const isMobile = useIsMobile() const vditorInstance = ref(null) const text = ref('') const editorId = ref(props.editorId) if (!editorId.value) { editorId.value = 'editor-' + useId() } + + const isMac = ref(false) + + if (navigator.userAgentData) { + isMac.value = navigator.userAgentData.platform === 'macOS' + } else { + isMac.value = /Mac|iPhone|iPad|iPod/.test(navigator.userAgent) + } + const getEditorTheme = getEditorThemeUtil const getPreviewTheme = getPreviewThemeUtil const applyTheme = () => { @@ -96,7 +114,27 @@ export default { applyTheme() }, }) - // applyTheme() + // 不是手机的情况下不添加快捷键 + if(!isMobile.value){ + // 添加快捷键监听 (Ctrl+Enter 或 Cmd+Enter) + const handleKeydown = (e) => { + if ((e.ctrlKey || e.metaKey) && e.key === 'Enter') { + e.preventDefault() + submit() + } + } + + const el = document.getElementById(editorId.value) + if (el) { + el.addEventListener('keydown', handleKeydown) + } + + onUnmounted(() => { + if (el) { + el.removeEventListener('keydown', handleKeydown) + } + }) + } }) onUnmounted(() => { @@ -134,7 +172,7 @@ export default { }, ) - return { submit, isDisabled, editorId } + return { submit, isDisabled, editorId, isMac, isMobile} }, } @@ -174,10 +212,16 @@ export default { .comment-submit:hover { background-color: var(--primary-color-hover); } - -@media (max-width: 768px) { - .comment-editor-container { - margin-bottom: 10px; - } +/** 评论按钮快捷键样式 */ +.shortcut-icon { + padding: 2px 6px; + border-radius: 6px; + font-size: 12px; + font-weight: 500; + line-height: 1.2; + background-color: rgba(0, 0, 0, 0.25); +} +.comment-submit.disabled .shortcut-icon { + background-color: rgba(0, 0, 0, 0); }