Skip to content

Commit 64965c9

Browse files
committed
Merge branch 'master' into feat/preview-images
2 parents 6cc764b + 9c72f2b commit 64965c9

File tree

6 files changed

+28
-15
lines changed

6 files changed

+28
-15
lines changed

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,10 @@ fetchMessages({ room, options }) {
244244
| `textarea-action-enabled`(18) | Boolean | - | `false` |
245245
| `responsive-breakpoint`(19) | Number | - | `900` |
246246
| `single-room`(20) | Boolean | - | `false` |
247-
| `theme`(21) | Sring | - | `light` |
248-
| `accepted-files`(22) | String | - | `*` |
249-
| `styles`(23) | Object | - | (23) |
247+
| `scroll-distance`(21) | Number | - | `60` |
248+
| `theme`(22) | Sring | - | `light` |
249+
| `accepted-files`(23) | String | - | `*` |
250+
| `styles`(24) | Object | - | (23) |
250251

251252
**(1)** `current-user-id` is required to display UI and trigger actions according to the user using the chat (ex: messages position on the right, etc.)
252253

@@ -414,13 +415,15 @@ You can then use the [textarea-action-handler](#events-api) event to call your o
414415

415416
**(20)** `single-room` can be used if you never want to show the rooms list on the left. You still need to pass the `rooms` prop as an array with a single element.
416417

417-
**(21)** `theme` can be used to change the chat theme. Currently, only `light` and `dark` are available.
418+
**(21)** `scroll-distance` can be used to change the number of pixels before `fetchMessages` event is triggered when scrolling up to load more messages, or `fetchMoreRooms` event is triggered when scrolling down to load more rooms.
418419

419-
**(22)** `accepted-files` can be used to set specifics file types allowed in chat. By default, all file types are allowed: `"*"`.
420+
**(22)** `theme` can be used to change the chat theme. Currently, only `light` and `dark` are available.
421+
422+
**(23)** `accepted-files` can be used to set specifics file types allowed in chat. By default, all file types are allowed: `"*"`.
420423

421424
Example: set `"accepted-files="image/png, image/jpeg, application/pdf"` to allow `JPG` `PNG` and `PDF` files only
422425

423-
**(23)** `styles` can be used to customize your own theme. You can find the full list [here](src/themes/index.js)
426+
**(24)** `styles` can be used to customize your own theme. You can find the full list [here](src/themes/index.js)
424427

425428
```javascript
426429
styles="{
@@ -678,8 +681,8 @@ Example:
678681
```
679682

680683
| <div style="width:230px">Slot</div> | Action | Data | Overridden slots |
681-
| ----------------------------------- | ----------------------------------------------------------- | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
682-
| `custom-action-icon` | Add a custom icon inside the footer | - | - | | `rooms-header` | Add a template on top of rooms list (above the search bar) | - | - |
684+
| ----------------------------------- | ----------------------------------------------------------- | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------ | --- | -------------- | ---------------------------------------------------------- | --- | --- |
685+
| `custom-action-icon` | Add a custom icon inside the footer | - | - | | `rooms-header` | Add a template on top of rooms list (above the search bar) | - | - |
683686
| `room-list-item` | Replace the template of the room list items | `room` | `room-list-avatar`, `room-list-options` |
684687
| `room-list-avatar` | Replace the avatar of room list items | `room` | |
685688
| `room-list-options` | Replace the template of the list room options | `room` | `room-list-options-icon` |

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"vue": "^2.6.14"
7575
},
7676
"dependencies": {
77-
"emoji-picker-element": "^1.8.1",
77+
"emoji-picker-element": "^1.8.2",
7878
"linkifyjs": "^2.1.9",
7979
"v-click-outside": "^3.1.2"
8080
},

src/components/EmojiPickerContainer/EmojiPickerContainer.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
background: var(--chat-emoji-bg-color);
2121
box-shadow: 0 1px 2px -2px rgba(0, 0, 0, 0.1),
2222
0 1px 2px -1px rgba(0, 0, 0, 0.1), 0 1px 2px 1px rgba(0, 0, 0, 0.1);
23+
scrollbar-width: none;
24+
25+
&::-webkit-scrollbar {
26+
display: none;
27+
}
2328

2429
&.vac-picker-reaction {
2530
position: fixed;

src/lib/ChatWindow.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
:text-formatting="textFormatting"
1717
:link-options="linkOptions"
1818
:is-mobile="isMobile"
19+
:scroll-distance="scrollDistance"
1920
@fetch-room="fetchRoom"
2021
@fetch-more-rooms="fetchMoreRooms"
2122
@loading-more-rooms="loadingMoreRooms = $event"
@@ -55,6 +56,7 @@
5556
:loading-rooms="loadingRooms"
5657
:room-info-enabled="roomInfoEnabled"
5758
:textarea-action-enabled="textareaActionEnabled"
59+
:scroll-distance="scrollDistance"
5860
:accepted-files="acceptedFiles"
5961
:templates-text="templatesText"
6062
:media-modal-preview="mediaModalPreview"
@@ -144,6 +146,7 @@ export default {
144146
roomInfoEnabled: { type: Boolean, default: false },
145147
textareaActionEnabled: { type: Boolean, default: false },
146148
roomMessage: { type: String, default: '' },
149+
scrollDistance: { type: Number, default: 60 },
147150
acceptedFiles: { type: String, default: '*' },
148151
templatesText: { type: Array, default: null },
149152
mediaModalPreview: { type: Boolean, default: true }

src/lib/Room/Room.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@
278278
v-if="showFiles"
279279
ref="file"
280280
type="file"
281-
multiple
281+
multiple
282282
:accept="acceptedFiles"
283283
style="display: none"
284284
@change="onFileChange($event.target.files)"
@@ -325,7 +325,7 @@ const { detectMobile } = require('../../utils/mobile-detection')
325325
326326
const debounce = (func, delay) => {
327327
let inDebounce
328-
return function() {
328+
return function () {
329329
const context = this
330330
const args = arguments
331331
clearTimeout(inDebounce)
@@ -382,6 +382,7 @@ export default {
382382
loadingRooms: { type: Boolean, required: true },
383383
roomInfoEnabled: { type: Boolean, required: true },
384384
textareaActionEnabled: { type: Boolean, required: true },
385+
scrollDistance: { type: Number, required: true },
385386
templatesText: { type: Array, default: null },
386387
mediaModalPreview: { type: Boolean, default: true }
387388
},
@@ -601,7 +602,7 @@ export default {
601602
if (loader) {
602603
const options = {
603604
root: document.getElementById('messages-list'),
604-
rootMargin: '60px',
605+
rootMargin: `${this.scrollDistance}px`,
605606
threshold: 0
606607
}
607608
@@ -1089,7 +1090,7 @@ export default {
10891090
setTimeout(() => element.classList.remove('vac-scroll-smooth'))
10901091
}, 50)
10911092
},
1092-
onChangeInput: debounce(function(e) {
1093+
onChangeInput: debounce(function (e) {
10931094
if (e?.target?.value || e?.target?.value === '') {
10941095
this.message = e.target.value
10951096
}

src/lib/RoomsList/RoomsList.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ export default {
9999
loadingRooms: { type: Boolean, required: true },
100100
roomsLoaded: { type: Boolean, required: true },
101101
room: { type: Object, required: true },
102-
roomActions: { type: Array, required: true }
102+
roomActions: { type: Array, required: true },
103+
scrollDistance: { type: Number, required: true }
103104
},
104105
105106
emits: [
@@ -169,7 +170,7 @@ export default {
169170
if (loader) {
170171
const options = {
171172
root: document.getElementById('rooms-list'),
172-
rootMargin: '60px',
173+
rootMargin: `${this.scrollDistance}px`,
173174
threshold: 0
174175
}
175176

0 commit comments

Comments
 (0)