commit
f266d3b45d
Binary file not shown.
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 25 KiB |
|
@ -547,15 +547,8 @@ export class CoreCollapsibleHeaderDirective implements OnInit, OnChanges, OnDest
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const scrollableHeight = contentScroll.scrollHeight - contentScroll.clientHeight;
|
const frozen = this.isFrozen(contentScroll);
|
||||||
|
|
||||||
let frozen = false;
|
|
||||||
if (this.isWithinContent) {
|
|
||||||
frozen = scrollableHeight <= scrollingHeight;
|
|
||||||
} else {
|
|
||||||
const collapsedHeight = expandedHeaderHeight - (expandedHeader.clientHeight ?? 0);
|
|
||||||
frozen = scrollableHeight + collapsedHeight <= 2 * expandedHeaderHeight;
|
|
||||||
}
|
|
||||||
const progress = frozen
|
const progress = frozen
|
||||||
? 0
|
? 0
|
||||||
: CoreMath.clamp(contentScroll.scrollTop / scrollingHeight, 0, 1);
|
: CoreMath.clamp(contentScroll.scrollTop / scrollingHeight, 0, 1);
|
||||||
|
@ -577,9 +570,16 @@ export class CoreCollapsibleHeaderDirective implements OnInit, OnChanges, OnDest
|
||||||
}
|
}
|
||||||
|
|
||||||
if (page.classList.contains('collapsible-header-page-is-frozen')) {
|
if (page.classList.contains('collapsible-header-page-is-frozen')) {
|
||||||
|
// Check it has to be frozen.
|
||||||
|
const frozen = this.isFrozen(contentScroll);
|
||||||
|
|
||||||
|
if (frozen) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
page.classList.toggle('collapsible-header-page-is-frozen', frozen);
|
||||||
|
}
|
||||||
|
|
||||||
const progress = parseFloat(page.style.getPropertyValue('--collapsible-header-progress'));
|
const progress = parseFloat(page.style.getPropertyValue('--collapsible-header-progress'));
|
||||||
const scrollTop = contentScroll.scrollTop;
|
const scrollTop = contentScroll.scrollTop;
|
||||||
const collapse = progress > 0.5;
|
const collapse = progress > 0.5;
|
||||||
|
@ -598,4 +598,28 @@ export class CoreCollapsibleHeaderDirective implements OnInit, OnChanges, OnDest
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the header is frozen.
|
||||||
|
*
|
||||||
|
* @param contentScroll Content scroll element.
|
||||||
|
* @returns Whether the header is frozen or not.
|
||||||
|
*/
|
||||||
|
protected isFrozen(contentScroll: HTMLElement): boolean {
|
||||||
|
const scrollingHeight = this.scrollingHeight ?? 0;
|
||||||
|
const expandedHeaderClientHeight = this.expandedHeader?.clientHeight ?? 0;
|
||||||
|
const expandedHeaderHeight = this.expandedHeaderHeight ?? 0;
|
||||||
|
|
||||||
|
const scrollableHeight = contentScroll.scrollHeight - contentScroll.clientHeight;
|
||||||
|
|
||||||
|
let frozen = false;
|
||||||
|
if (this.isWithinContent) {
|
||||||
|
frozen = scrollableHeight <= scrollingHeight;
|
||||||
|
} else {
|
||||||
|
const collapsedHeight = expandedHeaderHeight - (expandedHeaderClientHeight);
|
||||||
|
frozen = scrollableHeight + collapsedHeight <= 2 * expandedHeaderHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
return frozen;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<div class="core-rte-editor-container" (click)="focusRTE()" [class.toolbar-hidden]="toolbarHidden">
|
<div class="core-rte-editor-container" (click)="focusRTE()" [class.toolbar-hidden]="toolbarHidden">
|
||||||
<div [hidden]="!rteEnabled" #editor class="core-rte-editor" role="textbox" contenteditable="true"
|
<div [hidden]="!rteEnabled" #editor class="core-rte-editor" role="textbox" contenteditable="true" [class.empty]="isEmpty"
|
||||||
[attr.aria-labelledby]="ariaLabelledBy" [attr.data-placeholder-text]="placeholder" (focus)="showToolbar($event)"
|
[attr.aria-labelledby]="ariaLabelledBy" [attr.data-placeholder-text]="placeholder" (focus)="showToolbar($event)"
|
||||||
(blur)="hideToolbar($event)" (keydown)="onKeyDown($event)">
|
(blur)="hideToolbar($event)" (keydown)="onKeyDown($event)">
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
@use "theme/globals" as *;
|
@use "theme/globals" as *;
|
||||||
:host {
|
:host {
|
||||||
--placeholder-color: var(--ion-placeholder-color);
|
|
||||||
--toobar-background: var(--white);
|
--toobar-background: var(--white);
|
||||||
--button-color: var(--ion-text-color);
|
--button-color: var(--ion-text-color);
|
||||||
--button-active-color: var(--gray-300);
|
--button-active-color: var(--gray-300);
|
||||||
|
@ -80,11 +79,14 @@
|
||||||
max-width: 95%;
|
max-width: 95%;
|
||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
|
&.empty:before,
|
||||||
&:empty:before {
|
&:empty:before {
|
||||||
content: attr(data-placeholder-text);
|
content: attr(data-placeholder-text);
|
||||||
display: block;
|
display: block;
|
||||||
color: var(--placeholder-color);
|
color: var(--placeholder-color);
|
||||||
font-weight: bold;
|
position: absolute;
|
||||||
|
opacity: var(--placeholder-opacity);
|
||||||
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make empty elements selectable (to move the cursor).
|
// Make empty elements selectable (to move the cursor).
|
||||||
|
|
|
@ -156,6 +156,8 @@ export class CoreEditorRichTextEditorComponent implements OnInit, AfterViewInit,
|
||||||
ol: 'false',
|
ol: 'false',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
isEmpty = true;
|
||||||
|
|
||||||
swiperOpts: SwiperOptions = {
|
swiperOpts: SwiperOptions = {
|
||||||
modules: [IonicSlides],
|
modules: [IonicSlides],
|
||||||
slidesPerView: 6,
|
slidesPerView: 6,
|
||||||
|
@ -590,13 +592,17 @@ export class CoreEditorRichTextEditorComponent implements OnInit, AfterViewInit,
|
||||||
*/
|
*/
|
||||||
protected isNullOrWhiteSpace(value: string | null | undefined): boolean {
|
protected isNullOrWhiteSpace(value: string | null | undefined): boolean {
|
||||||
if (value === null || value === undefined) {
|
if (value === null || value === undefined) {
|
||||||
|
this.isEmpty = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
value = value.replace(/[\n\r]/g, '');
|
value = value.replace(/[\n\r]/g, '');
|
||||||
value = value.split(' ').join('');
|
value = value.split(' ').join('');
|
||||||
|
|
||||||
return value.length === 0;
|
this.isEmpty = value.length === 0;
|
||||||
|
|
||||||
|
return this.isEmpty;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -890,7 +890,8 @@ td {
|
||||||
|
|
||||||
ion-input,
|
ion-input,
|
||||||
ion-input input,
|
ion-input input,
|
||||||
ion-textarea {
|
ion-textarea,
|
||||||
|
core-rich-text-editor {
|
||||||
--placeholder-color: var(--ion-placeholder-color);
|
--placeholder-color: var(--ion-placeholder-color);
|
||||||
--placeholder-opacity: .65;
|
--placeholder-opacity: .65;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue