diff --git a/webapp/components/Comment/Comment.vue b/webapp/components/Comment/Comment.vue
index 534c45e6b..abb1ff4eb 100644
--- a/webapp/components/Comment/Comment.vue
+++ b/webapp/components/Comment/Comment.vue
@@ -10,7 +10,7 @@
-
+
@@ -43,35 +43,15 @@
/>
-
-
-
-
+
+
@@ -89,9 +69,14 @@ import scrollToAnchor from '~/mixins/scrollToAnchor.js'
export default {
mixins: [scrollToAnchor],
- data: function() {
+ data() {
+ const anchor = `commentId-${this.comment.id}`
+ const isTarget = this.routeHash === `#${anchor}`
+
return {
- isCollapsed: true,
+ anchor,
+ isTarget,
+ isCollapsed: !isTarget,
openEditCommentMenu: false,
}
},
@@ -102,13 +87,9 @@ export default {
HcCommentForm,
},
props: {
- post: { type: Object, default: () => {} },
- comment: {
- type: Object,
- default() {
- return {}
- },
- },
+ routeHash: { type: String, default: () => '' },
+ post: { type: Object, default: () => ({}) },
+ comment: { type: Object, default: () => ({}) },
dateTime: { type: [Date, String], default: null },
},
computed: {
@@ -116,8 +97,15 @@ export default {
user: 'auth/user',
isModerator: 'auth/isModerator',
}),
- anchor() {
- return `commentId-${this.comment.id}`
+ isLongComment() {
+ return this.$filters.removeHtml(this.comment.content).length > 180
+ },
+ commentContent() {
+ if (this.isLongComment && this.isCollapsed) {
+ return this.$filters.truncate(this.comment.content, 180)
+ }
+
+ return this.comment.content
},
displaysComment() {
return !this.unavailable || this.isModerator
@@ -182,26 +170,37 @@ export default {
}
diff --git a/webapp/components/CommentList/CommentList.vue b/webapp/components/CommentList/CommentList.vue
index f1cdf910b..b1a79fd21 100644
--- a/webapp/components/CommentList/CommentList.vue
+++ b/webapp/components/CommentList/CommentList.vue
@@ -22,6 +22,7 @@
:key="comment.id"
:comment="comment"
:post="post"
+ :routeHash="routeHash"
@deleteComment="updateCommentList"
@updateComment="updateCommentList"
/>
@@ -38,6 +39,7 @@ export default {
Comment,
},
props: {
+ routeHash: { type: String, default: () => '' },
post: { type: Object, default: () => {} },
},
methods: {
diff --git a/webapp/components/Editor/ContentViewer.vue b/webapp/components/Editor/ContentViewer.vue
index ab07d11d6..b9a167df7 100644
--- a/webapp/components/Editor/ContentViewer.vue
+++ b/webapp/components/Editor/ContentViewer.vue
@@ -1,5 +1,5 @@
-
+