From 75a100c8c20684b0710ebc1d0d51feb60044a39e Mon Sep 17 00:00:00 2001 From: Tim <135014430+nagisa77@users.noreply.github.com> Date: Fri, 18 Jul 2025 17:45:02 +0800 Subject: [PATCH] feat: add mobile comment editor --- open-isle-cli/src/components/CommentItem.vue | 9 +- .../src/components/SimpleCommentEditor.vue | 87 +++++++++++++++++++ open-isle-cli/src/views/PostPageView.vue | 7 +- 3 files changed, 98 insertions(+), 5 deletions(-) create mode 100644 open-isle-cli/src/components/SimpleCommentEditor.vue diff --git a/open-isle-cli/src/components/CommentItem.vue b/open-isle-cli/src/components/CommentItem.vue index 7613d83ab..d7ffc1d3a 100644 --- a/open-isle-cli/src/components/CommentItem.vue +++ b/open-isle-cli/src/components/CommentItem.vue @@ -33,7 +33,8 @@
- + +
@@ -69,6 +70,7 @@ import { ref, watch, computed } from 'vue' import VueEasyLightbox from 'vue-easy-lightbox' import { useRouter } from 'vue-router' import CommentEditor from './CommentEditor.vue' +import SimpleCommentEditor from './SimpleCommentEditor.vue' import { renderMarkdown } from '../utils/markdown' import TimeManager from '../utils/time' import BaseTimeline from './BaseTimeline.vue' @@ -77,6 +79,7 @@ import { getToken, authState } from '../utils/auth' import ReactionsGroup from './ReactionsGroup.vue' import DropdownMenu from './DropdownMenu.vue' import LoginOverlay from './LoginOverlay.vue' +import { isMobile } from '../utils/screen' const CommentItem = { name: 'CommentItem', @@ -205,11 +208,11 @@ const CommentItem = { lightboxVisible.value = true } } - return { showReplies, toggleReplies, showEditor, toggleEditor, submitReply, copyCommentLink, renderMarkdown, isWaitingForReply, commentMenuItems, deleteComment, lightboxVisible, lightboxIndex, lightboxImgs, handleImageClick, loggedIn } + return { showReplies, toggleReplies, showEditor, toggleEditor, submitReply, copyCommentLink, renderMarkdown, isWaitingForReply, commentMenuItems, deleteComment, lightboxVisible, lightboxIndex, lightboxImgs, handleImageClick, loggedIn, isMobile } } } -CommentItem.components = { CommentItem, CommentEditor, BaseTimeline, ReactionsGroup, DropdownMenu, VueEasyLightbox, LoginOverlay } +CommentItem.components = { CommentItem, CommentEditor, SimpleCommentEditor, BaseTimeline, ReactionsGroup, DropdownMenu, VueEasyLightbox, LoginOverlay } export default CommentItem diff --git a/open-isle-cli/src/components/SimpleCommentEditor.vue b/open-isle-cli/src/components/SimpleCommentEditor.vue new file mode 100644 index 000000000..ee3c75659 --- /dev/null +++ b/open-isle-cli/src/components/SimpleCommentEditor.vue @@ -0,0 +1,87 @@ + + + + + + diff --git a/open-isle-cli/src/views/PostPageView.vue b/open-isle-cli/src/views/PostPageView.vue index c05aad622..8fbc774f7 100644 --- a/open-isle-cli/src/views/PostPageView.vue +++ b/open-isle-cli/src/views/PostPageView.vue @@ -63,7 +63,9 @@
- +
@@ -108,6 +110,7 @@ import VueEasyLightbox from 'vue-easy-lightbox' import { useRoute } from 'vue-router' import CommentItem from '../components/CommentItem.vue' import CommentEditor from '../components/CommentEditor.vue' +import SimpleCommentEditor from '../components/SimpleCommentEditor.vue' import BaseTimeline from '../components/BaseTimeline.vue' import ArticleTags from '../components/ArticleTags.vue' import ArticleCategory from '../components/ArticleCategory.vue' @@ -124,7 +127,7 @@ hatch.register() export default { name: 'PostPageView', - components: { CommentItem, CommentEditor, BaseTimeline, ArticleTags, ArticleCategory, ReactionsGroup, DropdownMenu, VueEasyLightbox }, + components: { CommentItem, CommentEditor, SimpleCommentEditor, BaseTimeline, ArticleTags, ArticleCategory, ReactionsGroup, DropdownMenu, VueEasyLightbox }, setup() { const route = useRoute() const postId = route.params.id