Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable27] fix(comments): move new comment instructions placeholder to description #44171

Merged
merged 2 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 38 additions & 23 deletions apps/comments/src/components/Comment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,26 +68,35 @@
</div>

<!-- Message editor -->
<div v-if="editor || editing" class="comment__editor ">
<NcRichContenteditable ref="editor"
:auto-complete="autoComplete"
:contenteditable="!loading"
:value="localMessage"
:user-data="userData"
@update:value="updateLocalMessage"
@submit="onSubmit" />
<NcButton class="comment__submit"
type="tertiary-no-background"
native-type="submit"
:aria-label="t('comments', 'Post comment')"
:disabled="isEmptyMessage"
@click="onSubmit">
<template #icon>
<span v-if="loading" class="icon-loading-small" />
<ArrowRight v-else :size="20" />
</template>
</NcButton>
</div>

<form v-if="editor || editing" class="comment__editor" @submit.prevent>
<div class="comment__editor-group">
<NcRichContenteditable ref="editor"
:placeholder="t('comments', 'Write a message …')"
:auto-complete="autoComplete"
:contenteditable="!loading"
:value="localMessage"
:user-data="userData"
aria-describedby="tab-comments__editor-description"
@update:value="updateLocalMessage"
@submit="onSubmit" />
<div class="comment__submit">
<NcButton type="tertiary-no-background"
native-type="submit"
:aria-label="t('comments', 'Post comment')"
:disabled="isEmptyMessage"
@click="onSubmit">
<template #icon>
<span v-if="loading" class="icon-loading-small" />
<ArrowRight v-else :size="20" />
</template>
</NcButton>
</div>
</div>
<div id="tab-comments__editor-description" class="comment__editor-description">
{{ t('comments', '"@" for mentions, ":" for emoji, "/" for smart picker') }}
</div>
</form>

<!-- Message content -->
<!-- The html is escaped and sanitized before rendering -->
Expand All @@ -96,7 +105,7 @@
:class="{'comment__message--expanded': expanded}"
class="comment__message"
@click="onExpand"
v-html="renderedContent" />

Check warning on line 108 in apps/comments/src/components/Comment.vue

View workflow job for this annotation

GitHub Actions / eslint

'v-html' directive can lead to XSS attack
</div>
</component>
</template>
Expand Down Expand Up @@ -279,6 +288,14 @@
padding-top: 16px;
}

&__editor-group {
position: relative;
}
&__editor-description {
color: var(--color-text-maxcontrast);
padding-block: var(--default-grid-baseline);
}

&__body {
display: flex;
flex-grow: 1;
Expand Down Expand Up @@ -312,10 +329,8 @@

&__submit {
position: absolute !important;
right: 0;
bottom: 0;
// Align with input border
margin: 1px;
right: 0;
}

&__message {
Expand Down
7 changes: 5 additions & 2 deletions apps/comments/src/views/Comments.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
import { getCurrentUser } from '@nextcloud/auth'
import { loadState } from '@nextcloud/initial-state'
import axios from '@nextcloud/axios'
import VTooltip from 'v-tooltip'

Check warning on line 87 in apps/comments/src/views/Comments.vue

View workflow job for this annotation

GitHub Actions / eslint

Using exported name 'VTooltip' as identifier for default export
import Vue from 'vue'

import NcEmptyContent from '@nextcloud/vue/dist/Components/NcEmptyContent.js'
Expand Down Expand Up @@ -299,10 +299,13 @@

<style lang="scss" scoped>
.comments {
// Do not add emptycontent top margin
min-height: 100%;
display: flex;
flex-direction: column;

&__empty,
&__error {
margin-top: 0 !important;
flex: 1 0;
}

&__retry {
Expand Down
Loading
Loading