aboutsummaryrefslogtreecommitdiff
path: root/resources
diff options
context:
space:
mode:
authorMurtaza Sultani <sultani@data-quest.de>2025-07-30 17:37:05 +0200
committerMurtaza Sultani <sultani@data-quest.de>2025-07-30 17:37:05 +0200
commitf588d1afae486f6800813403a3f5ff5d35075ab4 (patch)
tree7a3031eea5793deccdfdfaf4525cfe6e6ef6b93b /resources
parent8b5da1acae37d9bc983394c3f27508c24024d69b (diff)
Resolve "Forum: Bearbeiten eines Beitrags fügt jedesmal ein `<div>` hinzu"
Closes #5759 Merge request studip/studip!4396
Diffstat (limited to 'resources')
-rw-r--r--resources/vue/apps/forum/discussions/Show.vue2
-rw-r--r--resources/vue/components/forum/posts/Post.vue2
-rw-r--r--resources/vue/components/forum/posts/PostContent.vue3
-rw-r--r--resources/vue/components/forum/posts/PostEditForm.vue13
4 files changed, 13 insertions, 7 deletions
diff --git a/resources/vue/apps/forum/discussions/Show.vue b/resources/vue/apps/forum/discussions/Show.vue
index b0a6f66..7bc1365 100644
--- a/resources/vue/apps/forum/discussions/Show.vue
+++ b/resources/vue/apps/forum/discussions/Show.vue
@@ -134,7 +134,7 @@ onMounted(async () => {
if (props.search_keyword !== "") {
highlightText(props.search_keyword, '.post-content');
- document.querySelector('.post-content mark').scrollIntoView();
+ document.querySelector('.post-content mark')?.scrollIntoView();
// remove highlights
document.getElementById("discussion_start").addEventListener("click", function() {
diff --git a/resources/vue/components/forum/posts/Post.vue b/resources/vue/components/forum/posts/Post.vue
index 523fa51..0cf7af5 100644
--- a/resources/vue/components/forum/posts/Post.vue
+++ b/resources/vue/components/forum/posts/Post.vue
@@ -175,7 +175,7 @@ const removePostHighlight = id => {
</template>
<template v-else>
<div class="post__text">
- <PostContent ref="postContent" v-model="selectedText" :content="post.content" class="forum-quote">
+ <PostContent ref="postContent" v-model="selectedText" :content="post.content_html" class="forum-quote">
<template #actions>
<a
:href="`#create_form_${post.id}`"
diff --git a/resources/vue/components/forum/posts/PostContent.vue b/resources/vue/components/forum/posts/PostContent.vue
index 93111f3..84d388e 100644
--- a/resources/vue/components/forum/posts/PostContent.vue
+++ b/resources/vue/components/forum/posts/PostContent.vue
@@ -13,6 +13,7 @@ const props = defineProps({
}
});
+
const actionsRef = useTemplateRef('actions');
const onTextSelected = event => {
@@ -57,7 +58,7 @@ watch(() => props.modelValue, newValue => {
<template>
<div @mouseup="onTextSelected" class="with-ballon-action" v-bind="$attrs">
- <p class="text-highlight m-0 post-content" v-html="content"></p>
+ <div class="text-highlight m-0 post-content" v-html="content"></div>
<div class="ballon-action" ref="actions">
<slot name="actions"></slot>
diff --git a/resources/vue/components/forum/posts/PostEditForm.vue b/resources/vue/components/forum/posts/PostEditForm.vue
index 5c9c311..f7ebbe0 100644
--- a/resources/vue/components/forum/posts/PostEditForm.vue
+++ b/resources/vue/components/forum/posts/PostEditForm.vue
@@ -43,15 +43,20 @@ const updatePost = async () => {
isLoading.value = true;
const response = await STUDIP.jsonapi.withPromises().PATCH(
- `forum-postings/${props.post.id}?include=author,opengraph-urls,posting,reactions,reactions.user&fields[users]=id`,
+ `forum-postings/${props.post.id}?include=opengraph-urls,posting`,
{ data: getPostJSONAPIObject }
);
- const post = await deserializeJSONAPIResponse(response)
+ const post = await deserializeJSONAPIResponse(response);
- forumDiscussionPost.updatePost(post);
+ const updatedPost = {
+ ...props.post,
+ ...post
+ };
+
+ forumDiscussionPost.updatePost(updatedPost);
content.value = "";
- emit("updated", post);
+ emit("updated", updatedPost);
STUDIP.Report.success($gettext("Die Änderungen wurde gespeichert."));
} catch (error) {