mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
[DSC-516] Author show more button fixed
This commit is contained in:
@@ -116,13 +116,12 @@ export class TruncatablePartComponent implements AfterContentChecked, OnInit, On
|
||||
* Function to get data to be observed
|
||||
*/
|
||||
toObserve() {
|
||||
this.observedContent = this.document.querySelectorAll('.content');
|
||||
this.observedContent = this.document.querySelectorAll('.content:not(.notruncatable)');
|
||||
this.observer = new (this._window.nativeWindow as any).ResizeObserver((entries) => {
|
||||
for (let entry of entries) {
|
||||
if (!entry.target.classList.contains('notruncatable')) {
|
||||
if (entry.target.scrollHeight > entry.contentRect.height) {
|
||||
if (entry.target.children.length > 0) {
|
||||
if (entry.target.children[0].offsetHeight > entry.contentRect.height) {
|
||||
if (entry.target.children[entry.target.children.length - 1].offsetHeight > entry.contentRect.height) {
|
||||
entry.target.classList.add('truncated');
|
||||
} else {
|
||||
entry.target.classList.remove('truncated');
|
||||
@@ -134,7 +133,6 @@ export class TruncatablePartComponent implements AfterContentChecked, OnInit, On
|
||||
entry.target.classList.remove('truncated');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
this.observedContent.forEach(p => {
|
||||
this.observer.observe(p);
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { AfterViewChecked, Component, ElementRef, Input, OnInit } from '@angular/core';
|
||||
import { AfterContentChecked, Component, ElementRef, Input, OnInit } from '@angular/core';
|
||||
import { TruncatableService } from './truncatable.service';
|
||||
|
||||
@Component({
|
||||
@@ -11,7 +11,7 @@ import { TruncatableService } from './truncatable.service';
|
||||
/**
|
||||
* Component that represents a section with one or more truncatable parts that all listen to this state
|
||||
*/
|
||||
export class TruncatableComponent implements OnInit, AfterViewChecked {
|
||||
export class TruncatableComponent implements OnInit, AfterContentChecked {
|
||||
/**
|
||||
* Is true when all truncatable parts in this truncatable should be expanded on loading
|
||||
*/
|
||||
@@ -59,7 +59,7 @@ export class TruncatableComponent implements OnInit, AfterViewChecked {
|
||||
}
|
||||
}
|
||||
|
||||
ngAfterViewChecked() {
|
||||
ngAfterContentChecked() {
|
||||
const truncatedElements = this.el.nativeElement.querySelectorAll('.truncated');
|
||||
if (truncatedElements?.length > 1) {
|
||||
for (let i = 0; i < (truncatedElements.length - 1); i++) {
|
||||
|
Reference in New Issue
Block a user