|
@@ -1,9 +1,11 @@
|
|
|
import './message-history';
|
|
|
import debounce from 'lodash/debounce';
|
|
|
import { CustomElement } from 'shared/components/element.js';
|
|
|
-import { _converse, api } from '@converse/headless/core';
|
|
|
+import { _converse, api, converse } from '@converse/headless/core';
|
|
|
import { html } from 'lit';
|
|
|
|
|
|
+const { u } = converse;
|
|
|
+
|
|
|
export default class ChatContent extends CustomElement {
|
|
|
|
|
|
static get properties () {
|
|
@@ -56,6 +58,13 @@ export default class ChatContent extends CustomElement {
|
|
|
this.debouncedMaintainScroll();
|
|
|
}
|
|
|
|
|
|
+ saveScrollPosition () {
|
|
|
+ const scrollTop = this.scrollTop;
|
|
|
+ if (scrollTop) {
|
|
|
+ u.safeSave(this.model, { 'scrolled': true, scrollTop });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
maintainScrollPosition () {
|
|
|
if (this.was_scrolled_up) {
|
|
|
const pos = this.model.get('scrollTop');
|