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