-
Notifications
You must be signed in to change notification settings - Fork 83
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
Feat: emit height difference of NcReferenceList after loading. #5730
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: DorraJaouad <dorra.jaoued7@gmail.com>
this.loading = false | ||
this.$emit('loaded') | ||
this.$emit('loaded', height) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say reporting the height is not really a expected payload of the event, no?
Because you do not really need it (see below).
handleReferenceListLoaded(oldHeight) { | ||
this.$nextTick(() => { | ||
// emit height difference to parent component | ||
const heightDiff = this.$refs.referenceList.$el.offsetHeight - oldHeight | ||
this.$emit('reference-list-loaded', heightDiff) | ||
}) | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
handleReferenceListLoaded(oldHeight) { | |
this.$nextTick(() => { | |
// emit height difference to parent component | |
const heightDiff = this.$refs.referenceList.$el.offsetHeight - oldHeight | |
this.$emit('reference-list-loaded', heightDiff) | |
}) | |
}, | |
handleReferenceListLoaded() { | |
const oldHeight = this.$refs.referenceList.$el.offsetHeight | |
this.$nextTick(() => { | |
// emit height difference to parent component | |
const heightDiff = this.$refs.referenceList.$el.offsetHeight - oldHeight | |
this.$emit('reference-list-loaded', heightDiff) | |
}) | |
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But in general would it not just work if you emit any event here and in Talk react on that element by scrolling the element into view?
Then you do not need any height calculation here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
calculating the old height here may be already updated with the reference data added height ?
in Talk react on that element by scrolling the element into view?
The goal not to scroll to the element but to calculate the extra height added (it will scroll the view above its previous position) and then we scroll back to the right position.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
calculating the old height here may be already updated with the reference data added height ?
I am not sure about the timing of Vue's event handling, sadly I could not find good documentation about this. Maybe @ShGKme knows more?
The goal not to scroll to the element but to calculate the extra height added (it will scroll the view above its previous position) and then we scroll back to the right position.
I do not know the richtext part good enough (and the talk code) so your solution might be the best.
But then I still would not pass the height as magic number to the event but use a context object with proper property naming like
this.$emit('reference-list-loaded', { heightDiff })
☑️ Resolves
Needed for nextcloud/spreed#10627. Link previews are adding extra height which causes jumping in the chat scroll.
🖼️ Screenshots
No visual changes
🚧 Tasks
loaded
now has height difference as a payload [CHANGED BEHAVIOR]🏁 Checklist
next
requested with a Vue 3 upgrade