Compare commits
1 Commits
content-su
...
content-su
| Author | SHA1 | Date | |
|---|---|---|---|
| 81c5550311 |
@@ -374,6 +374,9 @@ var AngularContentTextRenderer = class {
|
||||
}
|
||||
return cutoff;
|
||||
}
|
||||
hasVerticalOverflow(element) {
|
||||
return element.scrollHeight - element.clientHeight > 1;
|
||||
}
|
||||
render() {
|
||||
if (!this.host) {
|
||||
return;
|
||||
@@ -409,15 +412,15 @@ var AngularContentTextRenderer = class {
|
||||
paragraph.style.setProperty("-webkit-box-orient", "vertical");
|
||||
paragraph.style.setProperty("-webkit-line-clamp", String(ellipsisConfig.rows));
|
||||
paragraph.style.overflow = "hidden";
|
||||
if (ellipsisConfig.expandable) {
|
||||
wrapper.append(paragraph);
|
||||
wrapper.append(this.buildReadMoreButton(ellipsisConfig.symbol));
|
||||
this.host.replaceChildren(wrapper);
|
||||
if (ellipsisConfig.expandable && this.hasVerticalOverflow(paragraph)) {
|
||||
wrapper.append(this.buildReadMoreButton(ellipsisConfig.symbol));
|
||||
}
|
||||
this.emitOnViewIfNeeded(mergedExpanded);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
wrapper.append(paragraph);
|
||||
this.host.replaceChildren(wrapper);
|
||||
this.emitOnViewIfNeeded(mergedExpanded);
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -99,6 +99,7 @@ declare class AngularContentTextRenderer {
|
||||
private buildReadMoreButton;
|
||||
private handleExpand;
|
||||
private computeEntitySafeCutoff;
|
||||
private hasVerticalOverflow;
|
||||
private render;
|
||||
private initObserver;
|
||||
private emitOnViewIfNeeded;
|
||||
|
||||
@@ -99,6 +99,7 @@ declare class AngularContentTextRenderer {
|
||||
private buildReadMoreButton;
|
||||
private handleExpand;
|
||||
private computeEntitySafeCutoff;
|
||||
private hasVerticalOverflow;
|
||||
private render;
|
||||
private initObserver;
|
||||
private emitOnViewIfNeeded;
|
||||
|
||||
@@ -372,6 +372,9 @@ var AngularContentTextRenderer = class {
|
||||
}
|
||||
return cutoff;
|
||||
}
|
||||
hasVerticalOverflow(element) {
|
||||
return element.scrollHeight - element.clientHeight > 1;
|
||||
}
|
||||
render() {
|
||||
if (!this.host) {
|
||||
return;
|
||||
@@ -407,15 +410,15 @@ var AngularContentTextRenderer = class {
|
||||
paragraph.style.setProperty("-webkit-box-orient", "vertical");
|
||||
paragraph.style.setProperty("-webkit-line-clamp", String(ellipsisConfig.rows));
|
||||
paragraph.style.overflow = "hidden";
|
||||
if (ellipsisConfig.expandable) {
|
||||
wrapper.append(paragraph);
|
||||
wrapper.append(this.buildReadMoreButton(ellipsisConfig.symbol));
|
||||
this.host.replaceChildren(wrapper);
|
||||
if (ellipsisConfig.expandable && this.hasVerticalOverflow(paragraph)) {
|
||||
wrapper.append(this.buildReadMoreButton(ellipsisConfig.symbol));
|
||||
}
|
||||
this.emitOnViewIfNeeded(mergedExpanded);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
wrapper.append(paragraph);
|
||||
this.host.replaceChildren(wrapper);
|
||||
this.emitOnViewIfNeeded(mergedExpanded);
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hublib-web/content-suggestions",
|
||||
"version": "0.1.1",
|
||||
"version": "0.1.2",
|
||||
"description": "Content text/title with mentions, tags and links for React and Angular",
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
|
||||
@@ -504,6 +504,10 @@ export class AngularContentTextRenderer {
|
||||
return cutoff;
|
||||
}
|
||||
|
||||
private hasVerticalOverflow(element: HTMLElement): boolean {
|
||||
return element.scrollHeight - element.clientHeight > 1;
|
||||
}
|
||||
|
||||
private render(): void {
|
||||
if (!this.host) {
|
||||
return;
|
||||
@@ -549,15 +553,18 @@ export class AngularContentTextRenderer {
|
||||
paragraph.style.setProperty("-webkit-line-clamp", String(ellipsisConfig.rows));
|
||||
paragraph.style.overflow = "hidden";
|
||||
|
||||
if (ellipsisConfig.expandable) {
|
||||
// Важно: сначала рендерим paragraph в DOM, потом меряем реальный overflow.
|
||||
wrapper.append(paragraph);
|
||||
wrapper.append(this.buildReadMoreButton(ellipsisConfig.symbol));
|
||||
this.host.replaceChildren(wrapper);
|
||||
|
||||
if (ellipsisConfig.expandable && this.hasVerticalOverflow(paragraph)) {
|
||||
wrapper.append(this.buildReadMoreButton(ellipsisConfig.symbol));
|
||||
}
|
||||
|
||||
this.emitOnViewIfNeeded(mergedExpanded);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wrapper.append(paragraph);
|
||||
this.host.replaceChildren(wrapper);
|
||||
|
||||
Reference in New Issue
Block a user