simpo-component-library 3.6.858 → 3.6.862
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/lib/elements/text-editor/text-editor.component.mjs +93 -49
- package/fesm2022/simpo-component-library.mjs +169 -124
- package/fesm2022/simpo-component-library.mjs.map +1 -1
- package/lib/components/input-fields/input-fields.component.d.ts +1 -1
- package/lib/ecommerce/sections/product-desc/product-desc.component.d.ts +1 -1
- package/lib/ecommerce/sections/schemes/schemes.component.d.ts +1 -1
- package/lib/elements/pricing-s1/pricing-s1.component.d.ts +1 -1
- package/lib/elements/text-editor/text-editor.component.d.ts +9 -7
- package/lib/sections/banner-carousel/banner-carousel.component.d.ts +2 -2
- package/lib/sections/carousel-banner/carousel-banner.component.d.ts +1 -1
- package/lib/sections/image-section/image-section.component.d.ts +2 -2
- package/lib/sections/logo-showcase/logo-showcase.component.d.ts +2 -2
- package/lib/sections/new-testimonials/new-testimonials.component.d.ts +1 -1
- package/lib/sections/pricing-section/pricing-section.component.d.ts +1 -1
- package/package.json +10 -4
- package/simpo-component-library-3.6.862.tgz +0 -0
- package/simpo-component-library-3.6.858.tgz +0 -0
|
@@ -32,15 +32,10 @@ import * as i10$2 from '@angular/material/slider';
|
|
|
32
32
|
import { MatSliderModule, MatSlider } from '@angular/material/slider';
|
|
33
33
|
import * as i10$1 from '@angular/material/progress-spinner';
|
|
34
34
|
import { MatProgressSpinner, MatProgressSpinnerModule, MatSpinner } from '@angular/material/progress-spinner';
|
|
35
|
-
import { Extension, Editor } from '@tiptap/core';
|
|
36
|
-
import StarterKit from '@tiptap/starter-kit';
|
|
37
35
|
import { CdkDrag, CdkDragPlaceholder, moveItemInArray } from '@angular/cdk/drag-drop';
|
|
38
|
-
import { TextStyle } from '@tiptap/extension-text-style';
|
|
39
|
-
import Color from '@tiptap/extension-color';
|
|
40
|
-
import Underline from '@tiptap/extension-underline';
|
|
41
|
-
import TextAlign from '@tiptap/extension-text-align';
|
|
42
36
|
import * as i12 from '@angular/material/form-field';
|
|
43
37
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
38
|
+
import { Extension } from '@tiptap/core';
|
|
44
39
|
import * as i2$2 from '@angular/router';
|
|
45
40
|
import { RouterLink, NavigationEnd } from '@angular/router';
|
|
46
41
|
import * as i1$2 from '@angular/platform-browser';
|
|
@@ -1656,6 +1651,86 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
1656
1651
|
args: ['simpoObjectPosition']
|
|
1657
1652
|
}] } });
|
|
1658
1653
|
|
|
1654
|
+
class ContenteditableValueAccessor {
|
|
1655
|
+
constructor(elementRef, renderer) {
|
|
1656
|
+
this.elementRef = elementRef;
|
|
1657
|
+
this.renderer = renderer;
|
|
1658
|
+
this.onTouched = () => { };
|
|
1659
|
+
this.contenteditable = true; // Allow dynamic input
|
|
1660
|
+
this.onChange = (_value) => { };
|
|
1661
|
+
this.renderer.setAttribute(this.elementRef.nativeElement, 'contenteditable', 'true');
|
|
1662
|
+
}
|
|
1663
|
+
ngAfterViewInit() {
|
|
1664
|
+
this.renderer.setAttribute(this.elementRef.nativeElement, 'contenteditable', this.contenteditable ? 'true' : 'false');
|
|
1665
|
+
this.observer = new MutationObserver(() => {
|
|
1666
|
+
this.onChange(this.elementRef.nativeElement.innerHTML);
|
|
1667
|
+
});
|
|
1668
|
+
this.observer.observe(this.elementRef.nativeElement, {
|
|
1669
|
+
characterData: true,
|
|
1670
|
+
childList: true,
|
|
1671
|
+
subtree: true,
|
|
1672
|
+
});
|
|
1673
|
+
}
|
|
1674
|
+
ngOnDestroy() {
|
|
1675
|
+
this.observer?.disconnect();
|
|
1676
|
+
}
|
|
1677
|
+
onInput() {
|
|
1678
|
+
this.observer?.disconnect();
|
|
1679
|
+
this.onChange(this.elementRef.nativeElement.innerHTML);
|
|
1680
|
+
}
|
|
1681
|
+
onBlur() {
|
|
1682
|
+
this.onTouched();
|
|
1683
|
+
}
|
|
1684
|
+
writeValue(value) {
|
|
1685
|
+
this.renderer.setProperty(this.elementRef.nativeElement, 'innerHTML', value || '');
|
|
1686
|
+
}
|
|
1687
|
+
registerOnChange(onChange) {
|
|
1688
|
+
this.onChange = onChange;
|
|
1689
|
+
}
|
|
1690
|
+
registerOnTouched(onTouched) {
|
|
1691
|
+
this.onTouched = onTouched;
|
|
1692
|
+
}
|
|
1693
|
+
setDisabledState(disabled) {
|
|
1694
|
+
this.renderer.setAttribute(this.elementRef.nativeElement, 'contenteditable', String(!disabled));
|
|
1695
|
+
}
|
|
1696
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ContenteditableValueAccessor, deps: [{ token: ElementRef }, { token: Renderer2 }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1697
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: ContenteditableValueAccessor, isStandalone: true, selector: "[contenteditable][ngModel]", inputs: { contenteditable: "contenteditable" }, host: { listeners: { "input": "onInput()", "blur": "onBlur()" } }, providers: [
|
|
1698
|
+
{
|
|
1699
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1700
|
+
useExisting: forwardRef(() => ContenteditableValueAccessor),
|
|
1701
|
+
multi: true,
|
|
1702
|
+
},
|
|
1703
|
+
], ngImport: i0 }); }
|
|
1704
|
+
}
|
|
1705
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ContenteditableValueAccessor, decorators: [{
|
|
1706
|
+
type: Directive,
|
|
1707
|
+
args: [{
|
|
1708
|
+
selector: '[contenteditable][ngModel]',
|
|
1709
|
+
providers: [
|
|
1710
|
+
{
|
|
1711
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1712
|
+
useExisting: forwardRef(() => ContenteditableValueAccessor),
|
|
1713
|
+
multi: true,
|
|
1714
|
+
},
|
|
1715
|
+
],
|
|
1716
|
+
standalone: true
|
|
1717
|
+
}]
|
|
1718
|
+
}], ctorParameters: () => [{ type: i0.ElementRef, decorators: [{
|
|
1719
|
+
type: Inject,
|
|
1720
|
+
args: [ElementRef]
|
|
1721
|
+
}] }, { type: i0.Renderer2, decorators: [{
|
|
1722
|
+
type: Inject,
|
|
1723
|
+
args: [Renderer2]
|
|
1724
|
+
}] }], propDecorators: { contenteditable: [{
|
|
1725
|
+
type: Input
|
|
1726
|
+
}], onInput: [{
|
|
1727
|
+
type: HostListener,
|
|
1728
|
+
args: ['input']
|
|
1729
|
+
}], onBlur: [{
|
|
1730
|
+
type: HostListener,
|
|
1731
|
+
args: ['blur']
|
|
1732
|
+
}] } });
|
|
1733
|
+
|
|
1659
1734
|
const GradientExtension = Extension.create({
|
|
1660
1735
|
name: 'gradient',
|
|
1661
1736
|
addGlobalAttributes() {
|
|
@@ -1759,92 +1834,19 @@ const FontSize = Extension.create({
|
|
|
1759
1834
|
}
|
|
1760
1835
|
});
|
|
1761
1836
|
|
|
1762
|
-
class ContenteditableValueAccessor {
|
|
1763
|
-
constructor(elementRef, renderer) {
|
|
1764
|
-
this.elementRef = elementRef;
|
|
1765
|
-
this.renderer = renderer;
|
|
1766
|
-
this.onTouched = () => { };
|
|
1767
|
-
this.contenteditable = true; // Allow dynamic input
|
|
1768
|
-
this.onChange = (_value) => { };
|
|
1769
|
-
this.renderer.setAttribute(this.elementRef.nativeElement, 'contenteditable', 'true');
|
|
1770
|
-
}
|
|
1771
|
-
ngAfterViewInit() {
|
|
1772
|
-
this.renderer.setAttribute(this.elementRef.nativeElement, 'contenteditable', this.contenteditable ? 'true' : 'false');
|
|
1773
|
-
this.observer = new MutationObserver(() => {
|
|
1774
|
-
this.onChange(this.elementRef.nativeElement.innerHTML);
|
|
1775
|
-
});
|
|
1776
|
-
this.observer.observe(this.elementRef.nativeElement, {
|
|
1777
|
-
characterData: true,
|
|
1778
|
-
childList: true,
|
|
1779
|
-
subtree: true,
|
|
1780
|
-
});
|
|
1781
|
-
}
|
|
1782
|
-
ngOnDestroy() {
|
|
1783
|
-
this.observer?.disconnect();
|
|
1784
|
-
}
|
|
1785
|
-
onInput() {
|
|
1786
|
-
this.observer?.disconnect();
|
|
1787
|
-
this.onChange(this.elementRef.nativeElement.innerHTML);
|
|
1788
|
-
}
|
|
1789
|
-
onBlur() {
|
|
1790
|
-
this.onTouched();
|
|
1791
|
-
}
|
|
1792
|
-
writeValue(value) {
|
|
1793
|
-
this.renderer.setProperty(this.elementRef.nativeElement, 'innerHTML', value || '');
|
|
1794
|
-
}
|
|
1795
|
-
registerOnChange(onChange) {
|
|
1796
|
-
this.onChange = onChange;
|
|
1797
|
-
}
|
|
1798
|
-
registerOnTouched(onTouched) {
|
|
1799
|
-
this.onTouched = onTouched;
|
|
1800
|
-
}
|
|
1801
|
-
setDisabledState(disabled) {
|
|
1802
|
-
this.renderer.setAttribute(this.elementRef.nativeElement, 'contenteditable', String(!disabled));
|
|
1803
|
-
}
|
|
1804
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ContenteditableValueAccessor, deps: [{ token: ElementRef }, { token: Renderer2 }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1805
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: ContenteditableValueAccessor, isStandalone: true, selector: "[contenteditable][ngModel]", inputs: { contenteditable: "contenteditable" }, host: { listeners: { "input": "onInput()", "blur": "onBlur()" } }, providers: [
|
|
1806
|
-
{
|
|
1807
|
-
provide: NG_VALUE_ACCESSOR,
|
|
1808
|
-
useExisting: forwardRef(() => ContenteditableValueAccessor),
|
|
1809
|
-
multi: true,
|
|
1810
|
-
},
|
|
1811
|
-
], ngImport: i0 }); }
|
|
1812
|
-
}
|
|
1813
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ContenteditableValueAccessor, decorators: [{
|
|
1814
|
-
type: Directive,
|
|
1815
|
-
args: [{
|
|
1816
|
-
selector: '[contenteditable][ngModel]',
|
|
1817
|
-
providers: [
|
|
1818
|
-
{
|
|
1819
|
-
provide: NG_VALUE_ACCESSOR,
|
|
1820
|
-
useExisting: forwardRef(() => ContenteditableValueAccessor),
|
|
1821
|
-
multi: true,
|
|
1822
|
-
},
|
|
1823
|
-
],
|
|
1824
|
-
standalone: true
|
|
1825
|
-
}]
|
|
1826
|
-
}], ctorParameters: () => [{ type: i0.ElementRef, decorators: [{
|
|
1827
|
-
type: Inject,
|
|
1828
|
-
args: [ElementRef]
|
|
1829
|
-
}] }, { type: i0.Renderer2, decorators: [{
|
|
1830
|
-
type: Inject,
|
|
1831
|
-
args: [Renderer2]
|
|
1832
|
-
}] }], propDecorators: { contenteditable: [{
|
|
1833
|
-
type: Input
|
|
1834
|
-
}], onInput: [{
|
|
1835
|
-
type: HostListener,
|
|
1836
|
-
args: ['input']
|
|
1837
|
-
}], onBlur: [{
|
|
1838
|
-
type: HostListener,
|
|
1839
|
-
args: ['blur']
|
|
1840
|
-
}] } });
|
|
1841
|
-
|
|
1842
1837
|
// text-editor.component.ts
|
|
1843
1838
|
class TextEditorComponent {
|
|
1839
|
+
async ngAfterViewInit() {
|
|
1840
|
+
if (this.editable &&
|
|
1841
|
+
isPlatformBrowser(this.platformId)) {
|
|
1842
|
+
await this.initializeEditor();
|
|
1843
|
+
}
|
|
1844
|
+
}
|
|
1844
1845
|
constructor() {
|
|
1845
1846
|
this.value = '<p>Hello this is palash makhija</p>';
|
|
1846
1847
|
this.valueChange = new EventEmitter();
|
|
1847
1848
|
this.editable = false;
|
|
1849
|
+
this.platformId = inject(PLATFORM_ID);
|
|
1848
1850
|
this.selectedFontSize = '';
|
|
1849
1851
|
this.showToolbar = false;
|
|
1850
1852
|
this.toolbarX = 0;
|
|
@@ -1855,31 +1857,44 @@ class TextEditorComponent {
|
|
|
1855
1857
|
this.isColorPickerOpen = false;
|
|
1856
1858
|
this.selectedColorType = 'SOLID';
|
|
1857
1859
|
this.savedSelection = null;
|
|
1860
|
+
this.isFontSizeMenuOpen = false;
|
|
1861
|
+
this.toolbarData = {
|
|
1862
|
+
selectedSize: ''
|
|
1863
|
+
};
|
|
1858
1864
|
this.handleWindowFocus = () => {
|
|
1859
1865
|
setTimeout(() => {
|
|
1860
1866
|
this.isColorPickerOpen = false;
|
|
1861
1867
|
}, 300);
|
|
1862
1868
|
};
|
|
1863
|
-
this.
|
|
1864
|
-
this.toolbarData = {
|
|
1865
|
-
selectedSize: ''
|
|
1866
|
-
};
|
|
1869
|
+
console.log(this.value);
|
|
1867
1870
|
}
|
|
1868
1871
|
ngOnDestroy() {
|
|
1869
|
-
if (this.editor
|
|
1872
|
+
if (this.editor &&
|
|
1873
|
+
isPlatformBrowser(this.platformId)) {
|
|
1870
1874
|
this.editor.destroy();
|
|
1871
1875
|
}
|
|
1872
1876
|
}
|
|
1873
|
-
|
|
1874
|
-
if (this.editable) {
|
|
1875
|
-
this.initializeEditor();
|
|
1876
|
-
}
|
|
1877
|
-
}
|
|
1878
|
-
initializeEditor() {
|
|
1877
|
+
async initializeEditor() {
|
|
1879
1878
|
if (!this.editorElement)
|
|
1880
1879
|
return;
|
|
1880
|
+
// dynamic imports for SSR safety
|
|
1881
|
+
const { Editor } = await import('@tiptap/core');
|
|
1882
|
+
const StarterKit = (await import('@tiptap/starter-kit')).default;
|
|
1883
|
+
const TextStyle = (await import('@tiptap/extension-text-style'))
|
|
1884
|
+
.TextStyle;
|
|
1885
|
+
const Color = (await import('@tiptap/extension-color'))
|
|
1886
|
+
.default;
|
|
1887
|
+
const Underline = (await import('@tiptap/extension-underline'))
|
|
1888
|
+
.default;
|
|
1889
|
+
const TextAlign = (await import('@tiptap/extension-text-align'))
|
|
1890
|
+
.default;
|
|
1881
1891
|
this.editor = new Editor({
|
|
1882
1892
|
element: this.editorElement.nativeElement,
|
|
1893
|
+
editorProps: {
|
|
1894
|
+
attributes: {
|
|
1895
|
+
class: 'ProseMirror'
|
|
1896
|
+
}
|
|
1897
|
+
},
|
|
1883
1898
|
extensions: [
|
|
1884
1899
|
StarterKit,
|
|
1885
1900
|
TextStyle,
|
|
@@ -1888,7 +1903,11 @@ class TextEditorComponent {
|
|
|
1888
1903
|
GradientExtension,
|
|
1889
1904
|
Underline,
|
|
1890
1905
|
TextAlign.configure({
|
|
1891
|
-
types: [
|
|
1906
|
+
types: [
|
|
1907
|
+
'heading',
|
|
1908
|
+
'paragraph',
|
|
1909
|
+
'listItem'
|
|
1910
|
+
],
|
|
1892
1911
|
}),
|
|
1893
1912
|
],
|
|
1894
1913
|
content: this.value,
|
|
@@ -1899,17 +1918,32 @@ class TextEditorComponent {
|
|
|
1899
1918
|
const html = editor.getHTML();
|
|
1900
1919
|
this.value = html;
|
|
1901
1920
|
this.valueChange.emit(html);
|
|
1921
|
+
this.updateEmptyEditorClass();
|
|
1902
1922
|
}
|
|
1903
1923
|
});
|
|
1924
|
+
this.updateEmptyEditorClass();
|
|
1925
|
+
}
|
|
1926
|
+
updateEmptyEditorClass() {
|
|
1927
|
+
if (!this.editorElement)
|
|
1928
|
+
return;
|
|
1929
|
+
const editorWrapper = this.editorElement.nativeElement
|
|
1930
|
+
.closest('.editable-text');
|
|
1931
|
+
if (!editorWrapper)
|
|
1932
|
+
return;
|
|
1933
|
+
if (this.editor?.isEmpty) {
|
|
1934
|
+
editorWrapper.classList.add('editor-empty');
|
|
1935
|
+
}
|
|
1936
|
+
else {
|
|
1937
|
+
editorWrapper.classList.remove('editor-empty');
|
|
1938
|
+
}
|
|
1904
1939
|
}
|
|
1905
1940
|
saveSelection() {
|
|
1906
1941
|
this.savedSelection =
|
|
1907
1942
|
this.editor.state.selection;
|
|
1908
1943
|
}
|
|
1909
1944
|
restoreSelection() {
|
|
1910
|
-
if (!this.savedSelection)
|
|
1945
|
+
if (!this.savedSelection)
|
|
1911
1946
|
return;
|
|
1912
|
-
}
|
|
1913
1947
|
this.editor
|
|
1914
1948
|
.chain()
|
|
1915
1949
|
.focus()
|
|
@@ -1952,30 +1986,30 @@ class TextEditorComponent {
|
|
|
1952
1986
|
return;
|
|
1953
1987
|
}
|
|
1954
1988
|
const selection = window.getSelection();
|
|
1955
|
-
if (!selection ||
|
|
1989
|
+
if (!selection ||
|
|
1990
|
+
selection.rangeCount === 0) {
|
|
1956
1991
|
this.showToolbar = false;
|
|
1957
1992
|
return;
|
|
1958
1993
|
}
|
|
1959
1994
|
const range = selection.getRangeAt(0);
|
|
1960
1995
|
const rect = range.getBoundingClientRect();
|
|
1961
|
-
const editorRect = this.editorElement.nativeElement
|
|
1996
|
+
const editorRect = this.editorElement.nativeElement
|
|
1997
|
+
.getBoundingClientRect();
|
|
1962
1998
|
this.showToolbar = true;
|
|
1963
1999
|
setTimeout(() => {
|
|
1964
2000
|
const toolbar = document.querySelector('.toolbar');
|
|
1965
2001
|
if (!toolbar)
|
|
1966
2002
|
return;
|
|
1967
2003
|
const toolbarWidth = toolbar.offsetWidth;
|
|
1968
|
-
// centered position
|
|
1969
2004
|
let left = rect.left -
|
|
1970
2005
|
editorRect.left +
|
|
1971
2006
|
(rect.width / 2) -
|
|
1972
2007
|
(toolbarWidth / 2);
|
|
1973
|
-
// left limit
|
|
1974
2008
|
left = Math.max(10, left);
|
|
1975
|
-
|
|
1976
|
-
|
|
2009
|
+
const maxLeft = editorRect.width -
|
|
2010
|
+
toolbarWidth -
|
|
2011
|
+
10;
|
|
1977
2012
|
left = Math.min(left, maxLeft);
|
|
1978
|
-
// prevent negative value
|
|
1979
2013
|
left = Math.max(10, left);
|
|
1980
2014
|
this.toolbarX = left;
|
|
1981
2015
|
this.toolbarY =
|
|
@@ -2035,7 +2069,10 @@ class TextEditorComponent {
|
|
|
2035
2069
|
this.editor
|
|
2036
2070
|
.chain()
|
|
2037
2071
|
.focus()
|
|
2038
|
-
.setTextSelection({
|
|
2072
|
+
.setTextSelection({
|
|
2073
|
+
from,
|
|
2074
|
+
to
|
|
2075
|
+
})
|
|
2039
2076
|
.setMark('textStyle', {
|
|
2040
2077
|
...existingStyles,
|
|
2041
2078
|
color: this.selectedColor,
|
|
@@ -2052,16 +2089,19 @@ class TextEditorComponent {
|
|
|
2052
2089
|
return;
|
|
2053
2090
|
const existingStyles = this.editor.getAttributes('textStyle');
|
|
2054
2091
|
const gradient = `
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2092
|
+
linear-gradient(
|
|
2093
|
+
to right,
|
|
2094
|
+
${this.primaryColor},
|
|
2095
|
+
${this.secondaryColor}
|
|
2096
|
+
)
|
|
2097
|
+
`;
|
|
2061
2098
|
this.editor
|
|
2062
2099
|
.chain()
|
|
2063
2100
|
.focus()
|
|
2064
|
-
.setTextSelection({
|
|
2101
|
+
.setTextSelection({
|
|
2102
|
+
from,
|
|
2103
|
+
to
|
|
2104
|
+
})
|
|
2065
2105
|
.setMark('textStyle', {
|
|
2066
2106
|
...existingStyles,
|
|
2067
2107
|
backgroundImage: gradient,
|
|
@@ -2077,11 +2117,13 @@ class TextEditorComponent {
|
|
|
2077
2117
|
if (!this.editor)
|
|
2078
2118
|
return;
|
|
2079
2119
|
const { from, to } = this.editor.state.selection;
|
|
2080
|
-
this.showToolbar =
|
|
2120
|
+
this.showToolbar =
|
|
2121
|
+
from !== to;
|
|
2081
2122
|
});
|
|
2082
2123
|
}
|
|
2083
2124
|
toggleFontSizeMenu(event) {
|
|
2084
|
-
this.isFontSizeMenuOpen =
|
|
2125
|
+
this.isFontSizeMenuOpen =
|
|
2126
|
+
!this.isFontSizeMenuOpen;
|
|
2085
2127
|
event.stopPropagation();
|
|
2086
2128
|
}
|
|
2087
2129
|
getDisplayFontSize() {
|
|
@@ -2104,19 +2146,22 @@ class TextEditorComponent {
|
|
|
2104
2146
|
selectCustomFontSize(cssSize, event) {
|
|
2105
2147
|
event.stopPropagation();
|
|
2106
2148
|
this.changeFontSize(cssSize);
|
|
2107
|
-
this.isFontSizeMenuOpen =
|
|
2149
|
+
this.isFontSizeMenuOpen =
|
|
2150
|
+
false;
|
|
2108
2151
|
}
|
|
2109
2152
|
changeFontSize(fontSize) {
|
|
2110
|
-
this.selectedFontSize =
|
|
2153
|
+
this.selectedFontSize =
|
|
2154
|
+
fontSize;
|
|
2111
2155
|
const { from, to } = this.editor.state.selection;
|
|
2112
|
-
if (from === to)
|
|
2156
|
+
if (from === to)
|
|
2113
2157
|
return;
|
|
2114
|
-
}
|
|
2115
2158
|
this.editor
|
|
2116
2159
|
.chain()
|
|
2117
2160
|
.focus()
|
|
2118
|
-
.setTextSelection({
|
|
2119
|
-
|
|
2161
|
+
.setTextSelection({
|
|
2162
|
+
from,
|
|
2163
|
+
to
|
|
2164
|
+
})
|
|
2120
2165
|
.setMark('textStyle', {
|
|
2121
2166
|
fontSize
|
|
2122
2167
|
})
|
|
@@ -2136,7 +2181,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
2136
2181
|
MatFormFieldModule,
|
|
2137
2182
|
ContenteditableValueAccessor
|
|
2138
2183
|
], template: "<!-- text-editor.component.html -->\r\n\r\n<div class=\"editor-container\" *ngIf=\"editable; else viewMode\">\r\n\r\n <!-- FLOATING TOOLBAR -->\r\n <div class=\"toolbar\" *ngIf=\"showToolbar\" [style.top.px]=\"toolbarY\" [style.left.px]=\"toolbarX\" cdkDrag>\r\n <button class=\"tool drag-handle w-auto\" cdkDragHandle>\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\"\r\n stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\r\n class=\"lucide lucide-grip-vertical\">\r\n <circle cx=\"9\" cy=\"12\" r=\"1\" />\r\n <circle cx=\"9\" cy=\"5\" r=\"1\" />\r\n <circle cx=\"9\" cy=\"19\" r=\"1\" />\r\n <circle cx=\"15\" cy=\"12\" r=\"1\" />\r\n <circle cx=\"15\" cy=\"5\" r=\"1\" />\r\n <circle cx=\"15\" cy=\"19\" r=\"1\" />\r\n </svg>\r\n </button>\r\n <mat-form-field appearance=\"outline\" class=\"font-size-field\">\r\n\r\n <mat-select [value]=\"selectedFontSize\" (selectionChange)=\"changeFontSize($event.value)\" disableOptionCentering>\r\n\r\n <mat-option value=\"\">\r\n Default\r\n </mat-option>\r\n\r\n <mat-option value=\"clamp(0.75rem, 2vw, 1rem)\">\r\n 14\r\n </mat-option>\r\n\r\n <mat-option value=\"clamp(0.75rem, 2vw, 1.25rem)\">\r\n 16\r\n </mat-option>\r\n\r\n <mat-option value=\"clamp(1rem, 3vw, 1.5rem)\">\r\n 20\r\n </mat-option>\r\n\r\n <mat-option value=\"clamp(1.25rem, 4vw, 2rem)\">\r\n 24\r\n </mat-option>\r\n <mat-option value=\"clamp(2rem, 5vw, 3rem)\">\r\n 32\r\n </mat-option>\r\n <mat-option value=\"clamp(3.1rem, 7vw, 4.5rem)\">\r\n 48\r\n </mat-option>\r\n </mat-select>\r\n\r\n </mat-form-field>\r\n <!-- BOLD -->\r\n <button class=\"tool w-auto\" [class.selectedTool]=\"editor?.isActive('bold')\" (click)=\"toggleBold()\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\"\r\n stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\r\n class=\"lucide lucide-bold\">\r\n <path d=\"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8\" />\r\n </svg>\r\n </button>\r\n\r\n <!-- ITALIC -->\r\n <button class=\"tool w-auto\" [class.selectedTool]=\"editor?.isActive('italic')\" (click)=\"toggleItalic()\">\r\n\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\"\r\n stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\r\n class=\"lucide lucide-italic\">\r\n <line x1=\"19\" x2=\"10\" y1=\"4\" y2=\"4\" />\r\n <line x1=\"14\" x2=\"5\" y1=\"20\" y2=\"20\" />\r\n <line x1=\"15\" x2=\"9\" y1=\"4\" y2=\"20\" />\r\n </svg>\r\n </button>\r\n\r\n <!-- UNDERLINE -->\r\n <button class=\"tool w-auto\" [class.selectedTool]=\"editor?.isActive('underline')\" (click)=\"toggleUnderline()\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\"\r\n stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\r\n class=\"lucide lucide-underline\">\r\n <path d=\"M6 4v6a6 6 0 0 0 12 0V4\" />\r\n <line x1=\"4\" x2=\"20\" y1=\"20\" y2=\"20\" />\r\n </svg>\r\n </button>\r\n\r\n <!-- ALIGN LEFT -->\r\n <button class=\"tool w-auto\" (click)=\"setAlign('left')\">\r\n\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\"\r\n stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\r\n class=\"lucide lucide-align-left\">\r\n <line x1=\"21\" x2=\"3\" y1=\"6\" y2=\"6\" />\r\n <line x1=\"15\" x2=\"3\" y1=\"12\" y2=\"12\" />\r\n <line x1=\"17\" x2=\"3\" y1=\"18\" y2=\"18\" />\r\n </svg>\r\n </button>\r\n\r\n <!-- ALIGN CENTER -->\r\n <button class=\"tool w-auto\" (click)=\"setAlign('center')\">\r\n\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\"\r\n stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\r\n class=\"lucide lucide-align-center\">\r\n <line x1=\"21\" x2=\"3\" y1=\"6\" y2=\"6\" />\r\n <line x1=\"17\" x2=\"7\" y1=\"12\" y2=\"12\" />\r\n <line x1=\"19\" x2=\"5\" y1=\"18\" y2=\"18\" />\r\n </svg>\r\n </button>\r\n\r\n <!-- ALIGN RIGHT -->\r\n <button class=\"tool w-auto\" (click)=\"setAlign('right')\">\r\n\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\"\r\n stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\r\n class=\"lucide lucide-align-right\">\r\n <line x1=\"21\" x2=\"3\" y1=\"6\" y2=\"6\" />\r\n <line x1=\"21\" x2=\"9\" y1=\"12\" y2=\"12\" />\r\n <line x1=\"21\" x2=\"7\" y1=\"18\" y2=\"18\" />\r\n </svg>\r\n </button>\r\n\r\n <!-- ORDERED LIST -->\r\n <button class=\"tool w-auto\" (click)=\"toggleOrderedList()\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\"\r\n stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\r\n class=\"lucide lucide-list-ordered\">\r\n <line x1=\"10\" x2=\"21\" y1=\"6\" y2=\"6\" />\r\n <line x1=\"10\" x2=\"21\" y1=\"12\" y2=\"12\" />\r\n <line x1=\"10\" x2=\"21\" y1=\"18\" y2=\"18\" />\r\n <path d=\"M4 6h1v4\" />\r\n <path d=\"M4 10h2\" />\r\n <path d=\"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1\" />\r\n </svg>\r\n </button>\r\n <!-- BULLET LIST -->\r\n <button class=\"tool w-auto\" (click)=\"toggleBulletList()\">\r\n\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\"\r\n stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\r\n class=\"lucide lucide-list\">\r\n <line x1=\"8\" x2=\"21\" y1=\"6\" y2=\"6\" />\r\n <line x1=\"8\" x2=\"21\" y1=\"12\" y2=\"12\" />\r\n <line x1=\"8\" x2=\"21\" y1=\"18\" y2=\"18\" />\r\n <line x1=\"3\" x2=\"3.01\" y1=\"6\" y2=\"6\" />\r\n <line x1=\"3\" x2=\"3.01\" y1=\"12\" y2=\"12\" />\r\n <line x1=\"3\" x2=\"3.01\" y1=\"18\" y2=\"18\" />\r\n </svg>\r\n </button>\r\n\r\n <!-- SOLID / GRADIENT -->\r\n <!-- SOLID / GRADIENT -->\r\n <div class=\"colorType\">\r\n\r\n <button class=\"solid w-auto\" [class.solidColorSelected]=\"selectedColorType === 'SOLID'\"\r\n (mousedown)=\"$event.preventDefault()\" (click)=\"switchToSolid($event)\">\r\n Solid\r\n </button>\r\n\r\n <button class=\"gradient w-auto\" [class.gradientColorSelected]=\"selectedColorType === 'GRADIENT'\"\r\n (mousedown)=\"$event.preventDefault()\" (click)=\"switchToGradient($event)\">\r\n Gradient\r\n </button>\r\n\r\n </div>\r\n\r\n <!-- SOLID COLOR -->\r\n <button class=\"tool color-picker-btn w-auto\" *ngIf=\"selectedColorType === 'SOLID'\">\r\n\r\n <mat-icon>format_color_text</mat-icon>\r\n\r\n <input type=\"color\" class=\"hidden-color-picker\" [(ngModel)]=\"selectedColor\" (click)=\"openColorPicker()\"\r\n (input)=\"changeColor()\">\r\n\r\n </button>\r\n\r\n <!-- GRADIENT -->\r\n <div class=\"gradient-picker\" *ngIf=\"selectedColorType === 'GRADIENT'\">\r\n <input type=\"color\" [(ngModel)]=\"primaryColor\" (click)=\"openColorPicker()\" (input)=\"applyGradient()\" />\r\n\r\n <input type=\"color\" [(ngModel)]=\"secondaryColor\" (click)=\"openColorPicker()\" (input)=\"applyGradient()\" />\r\n\r\n </div>\r\n\r\n </div>\r\n\r\n <!-- TIPTAP EDITOR -->\r\n <div #editorContainer class=\"editable-text\">\r\n </div>\r\n\r\n</div>\r\n<ng-template #viewMode>\r\n <div class=\"read-only-text\" [innerHTML]=\"value\">\r\n </div>\r\n</ng-template>", styles: ["*{font-family:var(--website-font-family)}mat-icon{font-family:Material Icons!important}.editor-container{position:relative;width:100%}.editable-text{cursor:text;width:100%;border:1px solid lightgrey;border-radius:10px}.editable-text ::ng-deep p{margin-bottom:0!important}::ng-deep .ProseMirror ol,::ng-deep .ProseMirror ul{padding-left:2rem;margin-left:0;list-style-position:inside}::ng-deep .ProseMirror li{text-align:inherit;margin-bottom:5px}::ng-deep .ProseMirror li p{display:inline}.ProseMirror{outline:none;min-height:120px;padding:5px}.ProseMirror p{margin:0}.toolbar{position:absolute;left:0;top:0;display:flex;align-items:center;gap:5px;background:#fff;padding:8px 14px;border-radius:22px;z-index:100000;box-shadow:#00000029 0 1px 4px;max-width:calc(100vw - 20px);overflow-x:auto;box-sizing:border-box}.tool{background:none;border:none;padding:5px 8px;cursor:pointer;display:flex;align-items:center}.tool:hover{background:#eee;border-radius:5px}.selectedTool{background:var(--primary-bg-color)!important;color:#fff;border-radius:5px}.color-picker-btn{position:relative}.color-picker-btn mat-icon{font-size:22px!important}.hidden-color-picker{position:absolute;inset:0;opacity:0;cursor:pointer}.gradient-text{background:linear-gradient(to right,var(--gradient-start),var(--gradient-end));background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;color:transparent;display:inline-block}.colorType{display:flex;border:1px solid #E9E9E9;border-radius:9px;overflow:hidden}.colorType button{font-size:12px!important;padding:7px 9px!important;border:none;background:#fff;cursor:pointer}.solid{border-right:1px solid #E9E9E9!important}.solidColorSelected,.gradientColorSelected{background:var(--primary-bg-color)!important;color:#fff}.gradient-picker{display:flex;gap:5px}.gradient-picker input{width:32px;height:32px;border:none;padding:0;cursor:pointer}.white-space-nowrap{white-space:nowrap}.font-size-field{width:120px;border:1px solid lightgrey;border-radius:10px}::ng-deep .font-size-field .mat-mdc-form-field-subscript-wrapper{display:none}::ng-deep .font-size-field .mdc-notched-outline{display:none}::ng-deep .font-size-field .mat-mdc-text-field-wrapper{background:transparent!important;padding-left:8px!important;padding-right:8px!important;height:36px!important}::ng-deep .font-size-field .mat-mdc-select-value{font-size:14px;font-weight:600}::ng-deep .mat-mdc-select-panel{border-radius:12px!important}@media screen and (max-width: 475px){.toolbar{max-width:95%;flex-wrap:wrap;row-gap:10px}}@media screen and (max-width: 768px){.toolbar{width:max-content;max-width:calc(100vw - 20px);flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden}}\n"] }]
|
|
2139
|
-
}], propDecorators: { value: [{
|
|
2184
|
+
}], ctorParameters: () => [], propDecorators: { value: [{
|
|
2140
2185
|
type: Input
|
|
2141
2186
|
}], valueChange: [{
|
|
2142
2187
|
type: Output
|