simpo-component-library 3.6.853 → 3.6.854

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.
@@ -1841,10 +1841,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
1841
1841
 
1842
1842
  // text-editor.component.ts
1843
1843
  class TextEditorComponent {
1844
- constructor() {
1844
+ constructor(platformId) {
1845
+ this.platformId = platformId;
1845
1846
  this.value = '<p>Hello this is palash makhija</p>';
1846
1847
  this.valueChange = new EventEmitter();
1847
1848
  this.editable = false;
1849
+ this.isBrowser = false;
1848
1850
  this.selectedFontSize = '';
1849
1851
  this.showToolbar = false;
1850
1852
  this.toolbarX = 0;
@@ -1855,27 +1857,35 @@ 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 = () => {
1865
+ if (!this.isBrowser)
1866
+ return;
1859
1867
  setTimeout(() => {
1860
1868
  this.isColorPickerOpen = false;
1861
1869
  }, 300);
1862
1870
  };
1863
- this.isFontSizeMenuOpen = false;
1864
- this.toolbarData = {
1865
- selectedSize: ''
1866
- };
1867
- }
1868
- ngOnDestroy() {
1869
- if (this.editor) {
1870
- this.editor.destroy();
1871
- }
1871
+ this.isBrowser =
1872
+ isPlatformBrowser(this.platformId);
1872
1873
  }
1873
1874
  ngAfterViewInit() {
1875
+ if (!this.isBrowser)
1876
+ return;
1874
1877
  if (this.editable) {
1875
1878
  this.initializeEditor();
1876
1879
  }
1877
1880
  }
1881
+ ngOnDestroy() {
1882
+ if (this.editor) {
1883
+ this.editor.destroy();
1884
+ }
1885
+ }
1878
1886
  initializeEditor() {
1887
+ if (!this.isBrowser)
1888
+ return;
1879
1889
  if (!this.editorElement)
1880
1890
  return;
1881
1891
  this.editor = new Editor({
@@ -1888,7 +1898,11 @@ class TextEditorComponent {
1888
1898
  GradientExtension,
1889
1899
  Underline,
1890
1900
  TextAlign.configure({
1891
- types: ['heading', 'paragraph', 'listItem'],
1901
+ types: [
1902
+ 'heading',
1903
+ 'paragraph',
1904
+ 'listItem'
1905
+ ],
1892
1906
  }),
1893
1907
  ],
1894
1908
  content: this.value,
@@ -1903,13 +1917,20 @@ class TextEditorComponent {
1903
1917
  });
1904
1918
  }
1905
1919
  saveSelection() {
1920
+ if (!this.isBrowser)
1921
+ return;
1922
+ if (!this.editor)
1923
+ return;
1906
1924
  this.savedSelection =
1907
1925
  this.editor.state.selection;
1908
1926
  }
1909
1927
  restoreSelection() {
1910
- if (!this.savedSelection) {
1928
+ if (!this.isBrowser)
1929
+ return;
1930
+ if (!this.savedSelection)
1931
+ return;
1932
+ if (!this.editor)
1911
1933
  return;
1912
- }
1913
1934
  this.editor
1914
1935
  .chain()
1915
1936
  .focus()
@@ -1937,6 +1958,8 @@ class TextEditorComponent {
1937
1958
  });
1938
1959
  }
1939
1960
  openColorPicker() {
1961
+ if (!this.isBrowser)
1962
+ return;
1940
1963
  this.isColorPickerOpen = true;
1941
1964
  this.saveSelection();
1942
1965
  setTimeout(() => {
@@ -1944,6 +1967,10 @@ class TextEditorComponent {
1944
1967
  });
1945
1968
  }
1946
1969
  handleSelection() {
1970
+ if (!this.isBrowser)
1971
+ return;
1972
+ if (!this.editor)
1973
+ return;
1947
1974
  const { from, to } = this.editor.state.selection;
1948
1975
  if (from === to) {
1949
1976
  if (!this.isColorPickerOpen) {
@@ -1952,30 +1979,31 @@ class TextEditorComponent {
1952
1979
  return;
1953
1980
  }
1954
1981
  const selection = window.getSelection();
1955
- if (!selection || selection.rangeCount === 0) {
1982
+ if (!selection ||
1983
+ selection.rangeCount === 0) {
1956
1984
  this.showToolbar = false;
1957
1985
  return;
1958
1986
  }
1959
1987
  const range = selection.getRangeAt(0);
1960
1988
  const rect = range.getBoundingClientRect();
1961
- const editorRect = this.editorElement.nativeElement.getBoundingClientRect();
1989
+ const editorRect = this.editorElement
1990
+ .nativeElement
1991
+ .getBoundingClientRect();
1962
1992
  this.showToolbar = true;
1963
1993
  setTimeout(() => {
1964
1994
  const toolbar = document.querySelector('.toolbar');
1965
1995
  if (!toolbar)
1966
1996
  return;
1967
1997
  const toolbarWidth = toolbar.offsetWidth;
1968
- // centered position
1969
1998
  let left = rect.left -
1970
1999
  editorRect.left +
1971
2000
  (rect.width / 2) -
1972
2001
  (toolbarWidth / 2);
1973
- // left limit
1974
2002
  left = Math.max(10, left);
1975
- // right limit
1976
- const maxLeft = editorRect.width - toolbarWidth - 10;
2003
+ const maxLeft = editorRect.width -
2004
+ toolbarWidth -
2005
+ 10;
1977
2006
  left = Math.min(left, maxLeft);
1978
- // prevent negative value
1979
2007
  left = Math.max(10, left);
1980
2008
  this.toolbarX = left;
1981
2009
  this.toolbarY =
@@ -1985,6 +2013,8 @@ class TextEditorComponent {
1985
2013
  });
1986
2014
  }
1987
2015
  toggleBold() {
2016
+ if (!this.editor)
2017
+ return;
1988
2018
  this.editor
1989
2019
  .chain()
1990
2020
  .focus()
@@ -1992,6 +2022,8 @@ class TextEditorComponent {
1992
2022
  .run();
1993
2023
  }
1994
2024
  toggleItalic() {
2025
+ if (!this.editor)
2026
+ return;
1995
2027
  this.editor
1996
2028
  .chain()
1997
2029
  .focus()
@@ -1999,6 +2031,8 @@ class TextEditorComponent {
1999
2031
  .run();
2000
2032
  }
2001
2033
  toggleUnderline() {
2034
+ if (!this.editor)
2035
+ return;
2002
2036
  this.editor
2003
2037
  .chain()
2004
2038
  .focus()
@@ -2006,6 +2040,8 @@ class TextEditorComponent {
2006
2040
  .run();
2007
2041
  }
2008
2042
  toggleOrderedList() {
2043
+ if (!this.editor)
2044
+ return;
2009
2045
  this.editor
2010
2046
  .chain()
2011
2047
  .focus()
@@ -2013,6 +2049,8 @@ class TextEditorComponent {
2013
2049
  .run();
2014
2050
  }
2015
2051
  toggleBulletList() {
2052
+ if (!this.editor)
2053
+ return;
2016
2054
  this.editor
2017
2055
  .chain()
2018
2056
  .focus()
@@ -2020,6 +2058,8 @@ class TextEditorComponent {
2020
2058
  .run();
2021
2059
  }
2022
2060
  setAlign(alignment) {
2061
+ if (!this.editor)
2062
+ return;
2023
2063
  this.editor
2024
2064
  .chain()
2025
2065
  .focus()
@@ -2027,6 +2067,8 @@ class TextEditorComponent {
2027
2067
  .run();
2028
2068
  }
2029
2069
  changeColor() {
2070
+ if (!this.editor)
2071
+ return;
2030
2072
  this.restoreSelection();
2031
2073
  const { from, to } = this.editor.state.selection;
2032
2074
  if (from === to)
@@ -2035,7 +2077,10 @@ class TextEditorComponent {
2035
2077
  this.editor
2036
2078
  .chain()
2037
2079
  .focus()
2038
- .setTextSelection({ from, to })
2080
+ .setTextSelection({
2081
+ from,
2082
+ to
2083
+ })
2039
2084
  .setMark('textStyle', {
2040
2085
  ...existingStyles,
2041
2086
  color: this.selectedColor,
@@ -2046,22 +2091,27 @@ class TextEditorComponent {
2046
2091
  .run();
2047
2092
  }
2048
2093
  applyGradient() {
2094
+ if (!this.editor)
2095
+ return;
2049
2096
  this.restoreSelection();
2050
2097
  const { from, to } = this.editor.state.selection;
2051
2098
  if (from === to)
2052
2099
  return;
2053
2100
  const existingStyles = this.editor.getAttributes('textStyle');
2054
2101
  const gradient = `
2055
- linear-gradient(
2056
- to right,
2057
- ${this.primaryColor},
2058
- ${this.secondaryColor}
2059
- )
2060
- `;
2102
+ linear-gradient(
2103
+ to right,
2104
+ ${this.primaryColor},
2105
+ ${this.secondaryColor}
2106
+ )
2107
+ `;
2061
2108
  this.editor
2062
2109
  .chain()
2063
2110
  .focus()
2064
- .setTextSelection({ from, to })
2111
+ .setTextSelection({
2112
+ from,
2113
+ to
2114
+ })
2065
2115
  .setMark('textStyle', {
2066
2116
  ...existingStyles,
2067
2117
  backgroundImage: gradient,
@@ -2073,15 +2123,19 @@ class TextEditorComponent {
2073
2123
  .run();
2074
2124
  }
2075
2125
  onMouseDown() {
2126
+ if (!this.isBrowser)
2127
+ return;
2076
2128
  setTimeout(() => {
2077
2129
  if (!this.editor)
2078
2130
  return;
2079
2131
  const { from, to } = this.editor.state.selection;
2080
- this.showToolbar = from !== to;
2132
+ this.showToolbar =
2133
+ from !== to;
2081
2134
  });
2082
2135
  }
2083
2136
  toggleFontSizeMenu(event) {
2084
- this.isFontSizeMenuOpen = !this.isFontSizeMenuOpen;
2137
+ this.isFontSizeMenuOpen =
2138
+ !this.isFontSizeMenuOpen;
2085
2139
  event.stopPropagation();
2086
2140
  }
2087
2141
  getDisplayFontSize() {
@@ -2107,22 +2161,26 @@ class TextEditorComponent {
2107
2161
  this.isFontSizeMenuOpen = false;
2108
2162
  }
2109
2163
  changeFontSize(fontSize) {
2110
- this.selectedFontSize = fontSize;
2164
+ if (!this.editor)
2165
+ return;
2166
+ this.selectedFontSize =
2167
+ fontSize;
2111
2168
  const { from, to } = this.editor.state.selection;
2112
- if (from === to) {
2169
+ if (from === to)
2113
2170
  return;
2114
- }
2115
2171
  this.editor
2116
2172
  .chain()
2117
2173
  .focus()
2118
- .setTextSelection({ from, to })
2119
- // merges with existing styles
2174
+ .setTextSelection({
2175
+ from,
2176
+ to
2177
+ })
2120
2178
  .setMark('textStyle', {
2121
2179
  fontSize
2122
2180
  })
2123
2181
  .run();
2124
2182
  }
2125
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TextEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2183
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TextEditorComponent, deps: [{ token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Component }); }
2126
2184
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: TextEditorComponent, isStandalone: true, selector: "simpo-text-editor", inputs: { value: "value", editable: "editable", sectionId: "sectionId", label: "label", type: "type" }, outputs: { valueChange: "valueChange" }, host: { listeners: { "document:mousedown": "onMouseDown()" } }, viewQueries: [{ propertyName: "editorElement", first: true, predicate: ["editorContainer"], descendants: true }], ngImport: i0, 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 black}.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"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i8.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i8.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i8.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i12.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "component", type: i5.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i6.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: MatFormFieldModule }] }); }
2127
2185
  }
2128
2186
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TextEditorComponent, decorators: [{
@@ -2136,7 +2194,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
2136
2194
  MatFormFieldModule,
2137
2195
  ContenteditableValueAccessor
2138
2196
  ], 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 black}.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: [{
2197
+ }], ctorParameters: () => [{ type: Object, decorators: [{
2198
+ type: Inject,
2199
+ args: [PLATFORM_ID]
2200
+ }] }], propDecorators: { value: [{
2140
2201
  type: Input
2141
2202
  }], valueChange: [{
2142
2203
  type: Output