@pobuca/email-builder 1.2.0 → 1.3.0
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/bundles/pobuca-email-builder.umd.js +347 -71
- package/bundles/pobuca-email-builder.umd.js.map +1 -1
- package/bundles/pobuca-email-builder.umd.min.js +1 -1
- package/bundles/pobuca-email-builder.umd.min.js.map +1 -1
- package/esm2015/lib/classes/Elements.js +3 -2
- package/esm2015/lib/elements/image/image.component.js +13 -3
- package/esm2015/lib/elements/video/video.component.js +16 -4
- package/esm2015/lib/pb-email-builder.component.js +46 -3
- package/esm2015/lib/services/internals/pb-email-object-store/pb-email-object-store.service.js +51 -5
- package/esm2015/lib/services/internals/pb-history/pb-history.service.js +154 -0
- package/esm2015/pobuca-email-builder.js +41 -40
- package/fesm2015/pobuca-email-builder.js +270 -12
- package/fesm2015/pobuca-email-builder.js.map +1 -1
- package/lib/elements/image/image.component.d.ts +2 -0
- package/lib/elements/video/video.component.d.ts +3 -1
- package/lib/pb-email-builder.component.d.ts +10 -0
- package/lib/services/internals/pb-email-object-store/pb-email-object-store.service.d.ts +16 -1
- package/lib/services/internals/pb-history/pb-history.service.d.ts +51 -0
- package/package.json +1 -1
- package/pobuca-email-builder.d.ts +40 -39
- package/pobuca-email-builder.metadata.json +1 -1
- package/assets/placeholders/error.svg +0 -1
- package/assets/placeholders/image.svg +0 -1
- package/assets/placeholders/small-image.svg +0 -1
- package/assets/placeholders/video.svg +0 -1
|
@@ -816,7 +816,7 @@
|
|
|
816
816
|
}());
|
|
817
817
|
var ImageBlock = /** @class */ (function () {
|
|
818
818
|
function ImageBlock(src, options, state) {
|
|
819
|
-
if (src === void 0) { src = '
|
|
819
|
+
if (src === void 0) { src = ''; }
|
|
820
820
|
if (state === void 0) { state = {
|
|
821
821
|
disabled: false,
|
|
822
822
|
message: ''
|
|
@@ -903,6 +903,7 @@
|
|
|
903
903
|
units: ['px']
|
|
904
904
|
},
|
|
905
905
|
align: 'center',
|
|
906
|
+
title: '',
|
|
906
907
|
padding: {
|
|
907
908
|
top: 10,
|
|
908
909
|
right: 25,
|
|
@@ -1695,16 +1696,166 @@
|
|
|
1695
1696
|
{ type: Storage, decorators: [{ type: i0.Inject, args: [PB_TEMPLATES_TEMPORARY_STORAGE,] }] }
|
|
1696
1697
|
]; };
|
|
1697
1698
|
|
|
1699
|
+
/*
|
|
1700
|
+
* Copyright (c) 2024 Pobuca.
|
|
1701
|
+
* All rights reserved.
|
|
1702
|
+
*/
|
|
1703
|
+
/**
|
|
1704
|
+
* @internal
|
|
1705
|
+
*/
|
|
1706
|
+
var HISTORY;
|
|
1707
|
+
(function (HISTORY) {
|
|
1708
|
+
HISTORY["KEY"] = "[NGB] history stack";
|
|
1709
|
+
})(HISTORY || (HISTORY = {}));
|
|
1710
|
+
/**
|
|
1711
|
+
* @internal
|
|
1712
|
+
*/
|
|
1713
|
+
var IpHistoryService = /** @class */ (function () {
|
|
1714
|
+
function IpHistoryService(storage) {
|
|
1715
|
+
this.storage = storage;
|
|
1716
|
+
this.historyStack = [];
|
|
1717
|
+
this.currentIndex = -1;
|
|
1718
|
+
this.maxHistorySize = 50; // Maximum undo steps
|
|
1719
|
+
this._canUndo$ = new rxjs.BehaviorSubject(false);
|
|
1720
|
+
this._canRedo$ = new rxjs.BehaviorSubject(false);
|
|
1721
|
+
this.canUndo$ = this._canUndo$.asObservable();
|
|
1722
|
+
this.canRedo$ = this._canRedo$.asObservable();
|
|
1723
|
+
this.loadFromStorage();
|
|
1724
|
+
}
|
|
1725
|
+
/**
|
|
1726
|
+
* Add a new state to the history stack
|
|
1727
|
+
*/
|
|
1728
|
+
IpHistoryService.prototype.addState = function (state) {
|
|
1729
|
+
if (!state) {
|
|
1730
|
+
return;
|
|
1731
|
+
}
|
|
1732
|
+
var clonedState = cloneDeep(state);
|
|
1733
|
+
// If we're not at the end of the stack, remove all states after current index
|
|
1734
|
+
// This happens when user undoes and then makes a new change
|
|
1735
|
+
if (this.currentIndex < this.historyStack.length - 1) {
|
|
1736
|
+
this.historyStack = this.historyStack.slice(0, this.currentIndex + 1);
|
|
1737
|
+
}
|
|
1738
|
+
// Add the new state
|
|
1739
|
+
this.historyStack.push(clonedState);
|
|
1740
|
+
this.currentIndex++;
|
|
1741
|
+
// Limit history size to prevent memory issues
|
|
1742
|
+
if (this.historyStack.length > this.maxHistorySize) {
|
|
1743
|
+
this.historyStack.shift();
|
|
1744
|
+
this.currentIndex--;
|
|
1745
|
+
}
|
|
1746
|
+
this.updateUndoRedoStatus();
|
|
1747
|
+
this.saveToStorage();
|
|
1748
|
+
};
|
|
1749
|
+
/**
|
|
1750
|
+
* Get the previous state (undo)
|
|
1751
|
+
*/
|
|
1752
|
+
IpHistoryService.prototype.undo = function () {
|
|
1753
|
+
if (!this.canUndoNow()) {
|
|
1754
|
+
return null;
|
|
1755
|
+
}
|
|
1756
|
+
this.currentIndex--;
|
|
1757
|
+
this.updateUndoRedoStatus();
|
|
1758
|
+
return cloneDeep(this.historyStack[this.currentIndex]);
|
|
1759
|
+
};
|
|
1760
|
+
/**
|
|
1761
|
+
* Get the next state (redo)
|
|
1762
|
+
*/
|
|
1763
|
+
IpHistoryService.prototype.redo = function () {
|
|
1764
|
+
if (!this.canRedoNow()) {
|
|
1765
|
+
return null;
|
|
1766
|
+
}
|
|
1767
|
+
this.currentIndex++;
|
|
1768
|
+
this.updateUndoRedoStatus();
|
|
1769
|
+
return cloneDeep(this.historyStack[this.currentIndex]);
|
|
1770
|
+
};
|
|
1771
|
+
/**
|
|
1772
|
+
* Check if undo is available (synchronous)
|
|
1773
|
+
*/
|
|
1774
|
+
IpHistoryService.prototype.canUndoNow = function () {
|
|
1775
|
+
return this.currentIndex > 0;
|
|
1776
|
+
};
|
|
1777
|
+
/**
|
|
1778
|
+
* Check if redo is available (synchronous)
|
|
1779
|
+
*/
|
|
1780
|
+
IpHistoryService.prototype.canRedoNow = function () {
|
|
1781
|
+
return this.currentIndex < this.historyStack.length - 1;
|
|
1782
|
+
};
|
|
1783
|
+
/**
|
|
1784
|
+
* Clear history
|
|
1785
|
+
*/
|
|
1786
|
+
IpHistoryService.prototype.clear = function () {
|
|
1787
|
+
this.historyStack = [];
|
|
1788
|
+
this.currentIndex = -1;
|
|
1789
|
+
this.updateUndoRedoStatus();
|
|
1790
|
+
this.storage.removeItem(HISTORY.KEY);
|
|
1791
|
+
};
|
|
1792
|
+
/**
|
|
1793
|
+
* Get the history size
|
|
1794
|
+
*/
|
|
1795
|
+
IpHistoryService.prototype.getHistorySize = function () {
|
|
1796
|
+
return this.historyStack.length;
|
|
1797
|
+
};
|
|
1798
|
+
/**
|
|
1799
|
+
* Get current position in history stack
|
|
1800
|
+
*/
|
|
1801
|
+
IpHistoryService.prototype.getCurrentIndex = function () {
|
|
1802
|
+
return this.currentIndex;
|
|
1803
|
+
};
|
|
1804
|
+
IpHistoryService.prototype.updateUndoRedoStatus = function () {
|
|
1805
|
+
this._canUndo$.next(this.canUndoNow());
|
|
1806
|
+
this._canRedo$.next(this.canRedoNow());
|
|
1807
|
+
};
|
|
1808
|
+
IpHistoryService.prototype.saveToStorage = function () {
|
|
1809
|
+
try {
|
|
1810
|
+
var data = {
|
|
1811
|
+
stack: this.historyStack,
|
|
1812
|
+
currentIndex: this.currentIndex
|
|
1813
|
+
};
|
|
1814
|
+
this.storage.setItem(HISTORY.KEY, JSON.stringify(data));
|
|
1815
|
+
}
|
|
1816
|
+
catch (error) {
|
|
1817
|
+
console.warn('[IpHistoryService] Failed to save history to storage:', error);
|
|
1818
|
+
}
|
|
1819
|
+
};
|
|
1820
|
+
IpHistoryService.prototype.loadFromStorage = function () {
|
|
1821
|
+
var _a;
|
|
1822
|
+
try {
|
|
1823
|
+
var data = this.storage.getItem(HISTORY.KEY);
|
|
1824
|
+
if (data) {
|
|
1825
|
+
var parsed = JSON.parse(data);
|
|
1826
|
+
this.historyStack = parsed.stack || [];
|
|
1827
|
+
this.currentIndex = (_a = parsed.currentIndex) !== null && _a !== void 0 ? _a : -1;
|
|
1828
|
+
this.updateUndoRedoStatus();
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
catch (error) {
|
|
1832
|
+
console.warn('[IpHistoryService] Failed to load history from storage:', error);
|
|
1833
|
+
this.clear();
|
|
1834
|
+
}
|
|
1835
|
+
};
|
|
1836
|
+
return IpHistoryService;
|
|
1837
|
+
}());
|
|
1838
|
+
IpHistoryService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function IpHistoryService_Factory() { return new IpHistoryService(i0__namespace.ɵɵinject(PB_STORAGE_FACTORY)); }, token: IpHistoryService, providedIn: "any" });
|
|
1839
|
+
IpHistoryService.decorators = [
|
|
1840
|
+
{ type: i0.Injectable, args: [{
|
|
1841
|
+
providedIn: 'any'
|
|
1842
|
+
},] }
|
|
1843
|
+
];
|
|
1844
|
+
IpHistoryService.ctorParameters = function () { return [
|
|
1845
|
+
{ type: Storage, decorators: [{ type: i0.Inject, args: [PB_STORAGE_FACTORY,] }] }
|
|
1846
|
+
]; };
|
|
1847
|
+
|
|
1698
1848
|
// https://www.npmjs.com/package/recursive-diff
|
|
1699
1849
|
/**
|
|
1700
1850
|
* @internal
|
|
1701
1851
|
*/
|
|
1702
1852
|
var PbEmailObjectStoreService = /** @class */ (function () {
|
|
1703
|
-
function PbEmailObjectStoreService(userRestApi, pbStorage, userMiddleware, googleFonts, config) {
|
|
1853
|
+
function PbEmailObjectStoreService(userRestApi, pbStorage, userMiddleware, history, googleFonts, config) {
|
|
1704
1854
|
var _this = this;
|
|
1705
1855
|
this.userRestApi = userRestApi;
|
|
1706
1856
|
this.pbStorage = pbStorage;
|
|
1707
1857
|
this.userMiddleware = userMiddleware;
|
|
1858
|
+
this.history = history;
|
|
1708
1859
|
this.googleFonts = googleFonts;
|
|
1709
1860
|
this.config = config;
|
|
1710
1861
|
this.Email = new PBEmail();
|
|
@@ -1717,8 +1868,8 @@
|
|
|
1717
1868
|
// shareReplay(),
|
|
1718
1869
|
// tap((isDirty) => console.log('IsDirty', isDirty)),
|
|
1719
1870
|
);
|
|
1720
|
-
this.builderContainerStyles$ = this.generalEmailOptionsAsObservable$.pipe(operators.map(function (
|
|
1721
|
-
var background =
|
|
1871
|
+
this.builderContainerStyles$ = this.generalEmailOptionsAsObservable$.pipe(operators.map(function (_c) {
|
|
1872
|
+
var background = _c.background, padding = _c.padding, direction = _c.direction;
|
|
1722
1873
|
return (Object.assign({ direction: direction, backgroundRepeat: background.repeat, backgroundColor: background.color, backgroundSize: createWidthHeight(background.size), backgroundPosition: 'top center' }, createPadding(padding)));
|
|
1723
1874
|
}));
|
|
1724
1875
|
// public readonly emailBodyWidth$ = this.generalEmailOptionsAsObservable$.pipe(map(({ width }) => createWidthHeight(width)));
|
|
@@ -1727,11 +1878,23 @@
|
|
|
1727
1878
|
this._Template$ = new rxjs.BehaviorSubject('');
|
|
1728
1879
|
this.templateAsObservable$ = this._Template$.asObservable();
|
|
1729
1880
|
this._onTemplateCreated$ = new rxjs.Subject();
|
|
1730
|
-
this.onTemplateCreated$ = this._onTemplateCreated$.pipe(operators.withLatestFrom(this._Email$, this._Template$, this._Mjml$), operators.map(function (
|
|
1731
|
-
var
|
|
1881
|
+
this.onTemplateCreated$ = this._onTemplateCreated$.pipe(operators.withLatestFrom(this._Email$, this._Template$, this._Mjml$), operators.map(function (_c) {
|
|
1882
|
+
var _d = __read(_c), _ = _d[0], rest = _d.slice(1);
|
|
1732
1883
|
return rest;
|
|
1733
1884
|
}));
|
|
1885
|
+
// History/Undo support
|
|
1886
|
+
this.canUndo$ = this.history.canUndo$;
|
|
1887
|
+
this.canRedo$ = this.history.canRedo$;
|
|
1734
1888
|
}
|
|
1889
|
+
Object.defineProperty(PbEmailObjectStoreService.prototype, "defaultTemplateThumbPath", {
|
|
1890
|
+
get: function () {
|
|
1891
|
+
var _a, _b;
|
|
1892
|
+
var apiPath = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.apiPath) === null || _b === void 0 ? void 0 : _b.replace(/\/+$/, '');
|
|
1893
|
+
return apiPath + "/images/placeholders/image-placeholder.png";
|
|
1894
|
+
},
|
|
1895
|
+
enumerable: false,
|
|
1896
|
+
configurable: true
|
|
1897
|
+
});
|
|
1735
1898
|
PbEmailObjectStoreService.prototype.createHTMLTemplate$ = function () {
|
|
1736
1899
|
var _this = this;
|
|
1737
1900
|
return this.emailAsObservable$.pipe(operators.switchMap(function (email) {
|
|
@@ -1739,13 +1902,13 @@
|
|
|
1739
1902
|
throw new Error('Please add some structures and blocks to perform this action.');
|
|
1740
1903
|
}
|
|
1741
1904
|
return deferOf(email);
|
|
1742
|
-
}), operators.withLatestFrom(rxjs.combineLatest([this.currentEmailHasChanges$, this.templateAsObservable$])), operators.exhaustMap(function (
|
|
1743
|
-
var
|
|
1905
|
+
}), operators.withLatestFrom(rxjs.combineLatest([this.currentEmailHasChanges$, this.templateAsObservable$])), operators.exhaustMap(function (_c) {
|
|
1906
|
+
var _d = __read(_c, 2), email = _d[0], _e = __read(_d[1], 2), hasChanges = _e[0], currentHtml = _e[1];
|
|
1744
1907
|
if (hasChanges || !currentHtml) {
|
|
1745
1908
|
return _this.userMiddleware.createHTMLTemplate(email).pipe(operators.exhaustMap(function (em) { return _this.userRestApi.createHTMLTemplate$(Object.assign(Object.assign({}, em), { googleFonts: _this.googleFonts }), _this.config.apiPath); }), operators.map(function (res) {
|
|
1746
1909
|
if (res.errors.length) {
|
|
1747
|
-
var error = res.errors.map(function (
|
|
1748
|
-
var message =
|
|
1910
|
+
var error = res.errors.map(function (_c) {
|
|
1911
|
+
var message = _c.message, tagName = _c.tagName;
|
|
1749
1912
|
return tagName + " > " + message;
|
|
1750
1913
|
}).join('\n');
|
|
1751
1914
|
throw new Error(error);
|
|
@@ -1767,19 +1930,21 @@
|
|
|
1767
1930
|
return res;
|
|
1768
1931
|
}));
|
|
1769
1932
|
}
|
|
1770
|
-
return rxjs.combineLatest([_this._Mjml$, _this._Template$]).pipe(operators.map(function (
|
|
1771
|
-
var
|
|
1933
|
+
return rxjs.combineLatest([_this._Mjml$, _this._Template$]).pipe(operators.map(function (_c) {
|
|
1934
|
+
var _d = __read(_c, 2), mjml = _d[0], html = _d[1];
|
|
1772
1935
|
return ({ html: html, mjml: mjml, errors: [] });
|
|
1773
1936
|
}));
|
|
1774
1937
|
}));
|
|
1775
1938
|
};
|
|
1776
1939
|
PbEmailObjectStoreService.prototype.markForCheck = function () {
|
|
1777
1940
|
this._Email$.next(this.Email);
|
|
1941
|
+
// Add to undo/redo history
|
|
1942
|
+
this.history.addState(this.Email);
|
|
1778
1943
|
if (this.Email.structures.length) {
|
|
1779
1944
|
this.pbStorage.addTemplateToLatestUsed(cloneDeep({
|
|
1780
1945
|
templateData: this.Email,
|
|
1781
1946
|
title: 'last-edited',
|
|
1782
|
-
thumbPath:
|
|
1947
|
+
thumbPath: this.defaultTemplateThumbPath
|
|
1783
1948
|
}));
|
|
1784
1949
|
}
|
|
1785
1950
|
// console.log(getDiff(this.clonedEmail, this.Email));
|
|
@@ -1791,9 +1956,9 @@
|
|
|
1791
1956
|
this.Email = newEmail;
|
|
1792
1957
|
this.reset();
|
|
1793
1958
|
};
|
|
1794
|
-
PbEmailObjectStoreService.prototype.addStructure = function (
|
|
1795
|
-
var
|
|
1796
|
-
var
|
|
1959
|
+
PbEmailObjectStoreService.prototype.addStructure = function (_c) {
|
|
1960
|
+
var _d = _c.currentIndex, currentIndex = _d === void 0 ? 0 : _d, item = _c.item;
|
|
1961
|
+
var _e = this.Email.structures, structures = _e === void 0 ? [] : _e;
|
|
1797
1962
|
var isModule = true;
|
|
1798
1963
|
if (!item.data.elements.length) {
|
|
1799
1964
|
isModule = false;
|
|
@@ -1804,25 +1969,25 @@
|
|
|
1804
1969
|
this.markForCheck();
|
|
1805
1970
|
return newStructure;
|
|
1806
1971
|
};
|
|
1807
|
-
PbEmailObjectStoreService.prototype.changeStructureOrder = function (
|
|
1808
|
-
var
|
|
1972
|
+
PbEmailObjectStoreService.prototype.changeStructureOrder = function (_c) {
|
|
1973
|
+
var _d = _c.previousIndex, previousIndex = _d === void 0 ? 0 : _d, _e = _c.currentIndex, currentIndex = _e === void 0 ? 0 : _e;
|
|
1809
1974
|
dragDrop.moveItemInArray(this.Email.structures, previousIndex, currentIndex);
|
|
1810
1975
|
this.markForCheck();
|
|
1811
1976
|
};
|
|
1812
1977
|
PbEmailObjectStoreService.prototype.duplicateStructure = function (index) {
|
|
1813
|
-
var
|
|
1978
|
+
var _c = this.Email.structures, structures = _c === void 0 ? [] : _c;
|
|
1814
1979
|
var newStructure = cloneDeep(Object.assign(Object.assign({}, structures[index]), { id: Date.now() }));
|
|
1815
1980
|
structures.splice(index, 0, newStructure);
|
|
1816
1981
|
this.markForCheck();
|
|
1817
1982
|
return newStructure;
|
|
1818
1983
|
};
|
|
1819
1984
|
PbEmailObjectStoreService.prototype.removeStructure = function (index) {
|
|
1820
|
-
var
|
|
1985
|
+
var _c = this.Email.structures, structures = _c === void 0 ? [] : _c;
|
|
1821
1986
|
structures.splice(index, 1);
|
|
1822
1987
|
this.markForCheck();
|
|
1823
1988
|
};
|
|
1824
|
-
PbEmailObjectStoreService.prototype.addBlock = function (
|
|
1825
|
-
var
|
|
1989
|
+
PbEmailObjectStoreService.prototype.addBlock = function (_c, column) {
|
|
1990
|
+
var _d = _c.previousIndex, previousIndex = _d === void 0 ? 0 : _d, _e = _c.currentIndex, currentIndex = _e === void 0 ? 0 : _e, item = _c.item, _f = _c.previousContainer, id = _f.id, data = _f.data;
|
|
1826
1991
|
// console.log(id);
|
|
1827
1992
|
// console.log(item);
|
|
1828
1993
|
if (id === 'block-elements') {
|
|
@@ -1833,8 +1998,8 @@
|
|
|
1833
1998
|
}
|
|
1834
1999
|
this.markForCheck();
|
|
1835
2000
|
};
|
|
1836
|
-
PbEmailObjectStoreService.prototype.changeBlockOrder = function (
|
|
1837
|
-
var
|
|
2001
|
+
PbEmailObjectStoreService.prototype.changeBlockOrder = function (_c, column) {
|
|
2002
|
+
var _d = _c.previousIndex, previousIndex = _d === void 0 ? 0 : _d, _e = _c.currentIndex, currentIndex = _e === void 0 ? 0 : _e;
|
|
1838
2003
|
dragDrop.moveItemInArray(column, previousIndex, currentIndex);
|
|
1839
2004
|
this.markForCheck();
|
|
1840
2005
|
};
|
|
@@ -1854,9 +2019,41 @@
|
|
|
1854
2019
|
this.clonedEmail = cloneDeep(this.Email);
|
|
1855
2020
|
this.markForCheck();
|
|
1856
2021
|
};
|
|
2022
|
+
/**
|
|
2023
|
+
* Undo the last change
|
|
2024
|
+
* @returns true if undo was successful, false if undo is not available
|
|
2025
|
+
*/
|
|
2026
|
+
PbEmailObjectStoreService.prototype.undo = function () {
|
|
2027
|
+
var previousState = this.history.undo();
|
|
2028
|
+
if (previousState) {
|
|
2029
|
+
this.Email = previousState;
|
|
2030
|
+
this._Email$.next(this.Email);
|
|
2031
|
+
// Reset template to force re-generation on next save
|
|
2032
|
+
this._Template$.next(null);
|
|
2033
|
+
this._Mjml$.next(null);
|
|
2034
|
+
return true;
|
|
2035
|
+
}
|
|
2036
|
+
return false;
|
|
2037
|
+
};
|
|
2038
|
+
/**
|
|
2039
|
+
* Redo the last undone change
|
|
2040
|
+
* @returns true if redo was successful, false if redo is not available
|
|
2041
|
+
*/
|
|
2042
|
+
PbEmailObjectStoreService.prototype.redo = function () {
|
|
2043
|
+
var nextState = this.history.redo();
|
|
2044
|
+
if (nextState) {
|
|
2045
|
+
this.Email = nextState;
|
|
2046
|
+
this._Email$.next(this.Email);
|
|
2047
|
+
// Reset template to force re-generation on next save
|
|
2048
|
+
this._Template$.next(null);
|
|
2049
|
+
this._Mjml$.next(null);
|
|
2050
|
+
return true;
|
|
2051
|
+
}
|
|
2052
|
+
return false;
|
|
2053
|
+
};
|
|
1857
2054
|
return PbEmailObjectStoreService;
|
|
1858
2055
|
}());
|
|
1859
|
-
PbEmailObjectStoreService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function PbEmailObjectStoreService_Factory() { return new PbEmailObjectStoreService(i0__namespace.ɵɵinject(PbUserRestApiService), i0__namespace.ɵɵinject(PbStorageService), i0__namespace.ɵɵinject(PbUserMiddlewaresService), i0__namespace.ɵɵinject(PB_GOOGLE_FONTS), i0__namespace.ɵɵinject(PB_CONFIG)); }, token: PbEmailObjectStoreService, providedIn: "root" });
|
|
2056
|
+
PbEmailObjectStoreService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function PbEmailObjectStoreService_Factory() { return new PbEmailObjectStoreService(i0__namespace.ɵɵinject(PbUserRestApiService), i0__namespace.ɵɵinject(PbStorageService), i0__namespace.ɵɵinject(PbUserMiddlewaresService), i0__namespace.ɵɵinject(IpHistoryService), i0__namespace.ɵɵinject(PB_GOOGLE_FONTS), i0__namespace.ɵɵinject(PB_CONFIG)); }, token: PbEmailObjectStoreService, providedIn: "root" });
|
|
1860
2057
|
PbEmailObjectStoreService.decorators = [
|
|
1861
2058
|
{ type: i0.Injectable, args: [{
|
|
1862
2059
|
providedIn: 'root'
|
|
@@ -1866,6 +2063,7 @@
|
|
|
1866
2063
|
{ type: PbUserRestApiService },
|
|
1867
2064
|
{ type: PbStorageService },
|
|
1868
2065
|
{ type: PbUserMiddlewaresService },
|
|
2066
|
+
{ type: IpHistoryService },
|
|
1869
2067
|
{ type: Array, decorators: [{ type: i0.Inject, args: [PB_GOOGLE_FONTS,] }] },
|
|
1870
2068
|
{ type: undefined, decorators: [{ type: i0.Inject, args: [PB_CONFIG,] }] }
|
|
1871
2069
|
]; };
|
|
@@ -2765,6 +2963,9 @@
|
|
|
2765
2963
|
this.currentHTMLTemplate$ = this.emailObjectStore.templateAsObservable$;
|
|
2766
2964
|
this.activeMatProgress$ = this.userInterfaceService.activeMatProgress$.asObservable();
|
|
2767
2965
|
this.customModuleList$ = this.userRestApiService.getAllUserModules$;
|
|
2966
|
+
// Undo/Redo support
|
|
2967
|
+
this.canUndo$ = this.emailObjectStore.canUndo$;
|
|
2968
|
+
this.canRedo$ = this.emailObjectStore.canRedo$;
|
|
2768
2969
|
this._onDestroy$ = new rxjs.Subject();
|
|
2769
2970
|
this.includedFonts = new Set();
|
|
2770
2971
|
if (this.doc) {
|
|
@@ -2829,6 +3030,22 @@
|
|
|
2829
3030
|
PbEmailBuilderComponent.prototype.disableStructureList$ = function (structure) {
|
|
2830
3031
|
return this.middlewares.disableStructureDragFromList(structure).pipe(operators.take(1));
|
|
2831
3032
|
};
|
|
3033
|
+
/**
|
|
3034
|
+
* Undo the last action
|
|
3035
|
+
*/
|
|
3036
|
+
PbEmailBuilderComponent.prototype.undo = function () {
|
|
3037
|
+
if (this.emailObjectStore.undo()) {
|
|
3038
|
+
this.userInterfaceService.notify('Undo applied', 'short');
|
|
3039
|
+
}
|
|
3040
|
+
};
|
|
3041
|
+
/**
|
|
3042
|
+
* Redo the last undone action
|
|
3043
|
+
*/
|
|
3044
|
+
PbEmailBuilderComponent.prototype.redo = function () {
|
|
3045
|
+
if (this.emailObjectStore.redo()) {
|
|
3046
|
+
this.userInterfaceService.notify('Redo applied', 'short');
|
|
3047
|
+
}
|
|
3048
|
+
};
|
|
2832
3049
|
PbEmailBuilderComponent.prototype.trackByFn = function (block) {
|
|
2833
3050
|
return block.type;
|
|
2834
3051
|
};
|
|
@@ -2948,6 +3165,30 @@
|
|
|
2948
3165
|
});
|
|
2949
3166
|
}
|
|
2950
3167
|
});
|
|
3168
|
+
// Keyboard shortcuts for Undo (Ctrl+Z) and Redo (Ctrl+Shift+Z)
|
|
3169
|
+
rxjs.fromEvent(this.doc, 'keydown')
|
|
3170
|
+
.pipe(operators.filter(function (event) {
|
|
3171
|
+
// Check if Ctrl (or Cmd on Mac) is pressed
|
|
3172
|
+
var isCtrlOrCmd = event.ctrlKey || event.metaKey;
|
|
3173
|
+
// Check if we're in a focusable element like input/textarea
|
|
3174
|
+
var isFocusable = event.target instanceof HTMLInputElement ||
|
|
3175
|
+
event.target instanceof HTMLTextAreaElement;
|
|
3176
|
+
return isCtrlOrCmd && !isFocusable;
|
|
3177
|
+
}), operators.takeUntil(this._onDestroy$))
|
|
3178
|
+
.subscribe(function (event) {
|
|
3179
|
+
if (event.key === 'z' || event.key === 'Z') {
|
|
3180
|
+
// Undo: Ctrl+Z
|
|
3181
|
+
if (!event.shiftKey) {
|
|
3182
|
+
event.preventDefault();
|
|
3183
|
+
_this.undo();
|
|
3184
|
+
}
|
|
3185
|
+
// Redo: Ctrl+Shift+Z
|
|
3186
|
+
else if (event.shiftKey) {
|
|
3187
|
+
event.preventDefault();
|
|
3188
|
+
_this.redo();
|
|
3189
|
+
}
|
|
3190
|
+
}
|
|
3191
|
+
});
|
|
2951
3192
|
};
|
|
2952
3193
|
PbEmailBuilderComponent.prototype.ngOnChanges = function (changes) {
|
|
2953
3194
|
if (changes.email) {
|
|
@@ -2978,7 +3219,7 @@
|
|
|
2978
3219
|
PbEmailBuilderComponent.decorators = [
|
|
2979
3220
|
{ type: i0.Component, args: [{
|
|
2980
3221
|
selector: 'pb-email-builder',
|
|
2981
|
-
template: "<!--\n ~ Copyright (c) 2024 Pobuca.\n ~ All rights reserved.\n -->\n\n<mat-sidenav-container>\n <div class=\"pb-builder-container\" fxLayout=\"column\" fxFlex>\n <mat-progress-bar *ngIf=\"activeMatProgress$ | async\" mode=\"buffer\"></mat-progress-bar>\n <mat-toolbar fxLayoutGap=\"1rem\" fxLayoutAlign=\"space-between center\">\n <ng-content fxLayout fxLayoutGap=\"0.5rem\" select=\".top-actions\"></ng-content>\n\n <div fxFlexlayout fxLayoutGap=\"0.5rem\">\n <button *ngIf=\"ngb.config.useSaveButton\" type=\"button\" (click)=\"saveEmail()\" mat-stroked-button color=\"primary\"\n i18n=\"actions|Save Email\">\n Save Email\n </button>\n <button *ngIf=\"ngb.config.usePreviewButton\" type=\"button\" (click)=\"togglePreview()\" mat-stroked-button>\n <ng-container [ngSwitch]=\"previewTemplate\">\n <span *ngSwitchDefault i18n=\"actions|Preview\">Preview</span>\n <span *ngSwitchCase=\"true\" i18n=\"actions|Close Preview\">Close Preview</span>\n </ng-container>\n </button>\n\n <button mat-button mat-stroked-button i18n=\"actions|Import\" (click)=\"importFile()\">\n Import\n </button>\n\n <ng-container *ngIf=\"ngb.config.useDownloadButton\">\n <button mat-button [matMenuTriggerFor]=\"downloadMenu\" mat-stroked-button i18n=\"actions|Export\">\n Export\n </button>\n <mat-menu #downloadMenu=\"matMenu\">\n <button mat-menu-item (click)=\"download('html')\" i18n=\"actions|Export HTML\">\n Export HTML\n </button>\n <button mat-menu-item (click)=\"download('mjml')\" i18n=\"actions|Export MJML\">\n Export MJML\n </button>\n <button mat-menu-item (click)=\"download('json')\" i18n=\"actions|Export JSON\">\n Export JSON\n </button>\n </mat-menu>\n </ng-container>\n\n </div>\n
|
|
3222
|
+
template: "<!--\n ~ Copyright (c) 2024 Pobuca.\n ~ All rights reserved.\n -->\n\n<mat-sidenav-container>\n <div class=\"pb-builder-container\" fxLayout=\"column\" fxFlex>\n <mat-progress-bar *ngIf=\"activeMatProgress$ | async\" mode=\"buffer\"></mat-progress-bar>\n <mat-toolbar fxLayoutGap=\"1rem\" fxLayoutAlign=\"space-between center\">\n <ng-content fxLayout fxLayoutGap=\"0.5rem\" select=\".top-actions\"></ng-content>\n\n <div fxFlexlayout fxLayoutGap=\"0.5rem\">\n <button *ngIf=\"ngb.config.useSaveButton\" type=\"button\" (click)=\"saveEmail()\" mat-stroked-button color=\"primary\"\n i18n=\"actions|Save Email\">\n Save Email\n </button>\n <button *ngIf=\"ngb.config.usePreviewButton\" type=\"button\" (click)=\"togglePreview()\" mat-stroked-button>\n <ng-container [ngSwitch]=\"previewTemplate\">\n <span *ngSwitchDefault i18n=\"actions|Preview\">Preview</span>\n <span *ngSwitchCase=\"true\" i18n=\"actions|Close Preview\">Close Preview</span>\n </ng-container>\n </button>\n\n <button mat-button mat-stroked-button i18n=\"actions|Import\" (click)=\"importFile()\">\n Import\n </button>\n\n <ng-container *ngIf=\"ngb.config.useDownloadButton\">\n <button mat-button [matMenuTriggerFor]=\"downloadMenu\" mat-stroked-button i18n=\"actions|Export\">\n Export\n </button>\n <mat-menu #downloadMenu=\"matMenu\">\n <button mat-menu-item (click)=\"download('html')\" i18n=\"actions|Export HTML\">\n Export HTML\n </button>\n <button mat-menu-item (click)=\"download('mjml')\" i18n=\"actions|Export MJML\">\n Export MJML\n </button>\n <button mat-menu-item (click)=\"download('json')\" i18n=\"actions|Export JSON\">\n Export JSON\n </button>\n </mat-menu>\n </ng-container>\n\n </div>\n <div class=\"history-actions\">\n <button type=\"button\" mat-icon-button (click)=\"undo()\" [disabled]=\"!(canUndo$ | async)\"\n matTooltip=\"Undo (Ctrl+Z)\" i18n-matTooltip=\"actions|undo shortcut tooltip\"\n class=\"history-btn\">\n <mat-icon>undo</mat-icon>\n </button>\n <button type=\"button\" mat-icon-button (click)=\"redo()\" [disabled]=\"!(canRedo$ | async)\"\n matTooltip=\"Redo (Ctrl+Shift+Z)\" i18n-matTooltip=\"actions|redo shortcut tooltip\"\n class=\"history-btn\">\n <mat-icon>redo</mat-icon>\n </button>\n </div>\n </mat-toolbar>\n <ng-container [ngSwitch]=\"previewTemplate\">\n <pb-builder-container *ngSwitchDefault [ngStyle]=\"getBuilderContainerStyles$ | async\">\n <ng-content select=\".rewrited-empty-email\"></ng-content>\n </pb-builder-container>\n\n <pb-preview-template fxLayout fxFlex=\"auto\" fxLayoutAlign=\"center\" [template]=\"currentHTMLTemplate$ | async\"\n *ngSwitchCase=\"true\">\n </pb-preview-template>\n </ng-container>\n </div>\n <mat-sidenav mode=\"side\" fxFlex=\"0 0 310px\" [opened]=\"!previewTemplate\" position=\"end\" class=\"pb-builder-content\">\n <mat-tab-group [selectedIndex]=\"currentTabIndex$ | async\" (selectedIndexChange)=\"changeTabIndex($event)\">\n <mat-tab i18n-label=\"Content\" label=\"Content\">\n <div class=\"main-padding\">\n <cdk-drop-list class=\"elements\" [cdkDropListConnectedTo]=\"cdkDropListConnectedTo$ | async\"\n [cdkDropListData]=\"blocks\" [cdkDropListSortingDisabled]=\"true\" id=\"block-elements\">\n <div cdkDrag *ngFor=\"let block of blocks; trackBy: trackByFn\" [cdkDragData]=\"block\"\n [cdkDragDisabled]=\"disableBlocksList$(block) | async\" class=\"drag-element\"\n [matTooltip]=\"block.state.message\">\n <mat-icon>{{ block.icon }}</mat-icon>\n <div class=\"drag-element-title\">{{ block.title }}</div>\n </div>\n </cdk-drop-list>\n\n <mat-divider style=\"margin: 1em 0;\"></mat-divider>\n <!-- <h3 class=\"divider\"><span>Structures</span></h3> -->\n <cdk-drop-list class=\"elements structure-elements\" cdkDropListConnectedTo=\"structures-drop-list\"\n [cdkDropListSortingDisabled]=\"true\" [cdkDropListData]=\"structures\">\n <div cdkDrag *ngFor=\"let structure of structures; trackBy: trackByFn\" [cdkDragData]=\"structure\"\n [cdkDragDisabled]=\"disableStructureList$(structure) | async\" class=\"drag-element structure-element\"\n [ngClass]=\"structure.type\">\n <div *ngFor=\"let column of createArrayFromStructureColumns(structure)\"></div>\n </div>\n </cdk-drop-list>\n <ng-content fxLayout fxLayoutGap=\"0.5rem\" select=\".after-structure-blocks\"></ng-content>\n </div>\n </mat-tab>\n <mat-tab i18n-label=\"Modules\" label=\"Modules\" class=\"modules-tab\">\n <cdk-virtual-scroll-viewport itemSize=\"54\" [minBufferPx]=\"54 * 10\" [maxBufferPx]=\"54 * 20\"\n style=\"height: inherit;\"\n *ngIf=\"customModuleList$ | async as modules; else emptyModuleList\">\n <div class=\"main-padding\">\n <div class=\"custom-modules\" cdkDropList cdkDropListConnectedTo=\"structures-drop-list\"\n [cdkDropListData]=\"modules\" [cdkDropListSortingDisabled]=\"true\">\n <div fxLayout=\"column\" fxLayoutGap=\"1rem\">\n <ng-container *cdkVirtualFor=\"let module of modules\">\n <div cdkDrag [cdkDragData]=\"module.module\"\n [cdkDragDisabled]=\"disableStructureList$(module.module) | async\" class=\"drag-element\"\n style=\"padding: 1em;text-transform: uppercase;height: 54px;\">\n <span *ngIf=\"module.name\">{{module.name}}</span>\n <!-- <img *ngIf=\"module.thumb\" [src]=\"module.thumb\" /> -->\n </div>\n </ng-container>\n </div>\n </div>\n <ng-content fxLayout fxLayoutGap=\"0.5rem\" select=\".after-content-blocks\"></ng-content>\n </div>\n </cdk-virtual-scroll-viewport>\n <ng-template #emptyModuleList>\n <h4 class=\"main-padding\" style=\"text-align: center;\" i18n=\"modules|empty list message\">\n Module list is empty\n </h4>\n </ng-template>\n </mat-tab>\n <mat-tab i18n-label=\"Settings\" label=\"Settings\">\n <div class=\"pb-builder-options\" [ngSwitch]=\"showGeneralSettings$ | async\">\n <pb-general-settings *ngSwitchDefault></pb-general-settings>\n <pb-block-settings *ngSwitchCase=\"'block'\"></pb-block-settings>\n <pb-structure-settings *ngSwitchCase=\"'structure'\" fxLayout=\"column\"></pb-structure-settings>\n </div>\n </mat-tab>\n </mat-tab-group>\n </mat-sidenav>\n</mat-sidenav-container>\n",
|
|
2982
3223
|
exportAs: 'pbEmailBuilder',
|
|
2983
3224
|
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
2984
3225
|
providers: [
|
|
@@ -2989,7 +3230,7 @@
|
|
|
2989
3230
|
},
|
|
2990
3231
|
SlugifyPipe
|
|
2991
3232
|
],
|
|
2992
|
-
styles: ["/*!\n * Copyright (c) 2024 Pobuca.\n * All rights reserved.\n */:host{display:block;height:100vh}.hide{display:none}::ng-deep mat-sidenav-container{height:100%}::ng-deep mat-sidenav-container mat-sidenav-content{width:100%;z-index:unset!important;overflow:unset!important}::ng-deep h3.divider{text-align:center;display:block;overflow:hidden;margin:0 0 1rem}::ng-deep h3.divider span{font-weight:100;position:relative;display:inline-block}::ng-deep h3.divider span:after,::ng-deep h3.divider span:before{content:\"\";position:absolute;top:50%;height:1px;background:#ccc;width:99999px}::ng-deep h3.divider span:before{left:100%;margin-left:10px}::ng-deep h3.divider span:after{right:100%;margin-right:10px}::ng-deep .pb-builder-content{border-right:1px solid rgba(0,0,0,.12)}::ng-deep .pb-builder-content .overflow{position:absolute;top:0;bottom:0;left:0;right:0;background-color:#fff;opacity:.5;display:none;z-index:3}::ng-deep .pb-builder-content.disabled .overflow{display:block}::ng-deep .pb-builder-content .mat-tab-label{width:50%;min-width:auto;height:64px;font-size:medium;text-transform:uppercase;padding:0 12px}::ng-deep .pb-builder-content .mat-tab-body-wrapper,::ng-deep .pb-builder-content .mat-tab-group{height:100%}::ng-deep .pb-builder-content .mat-tab-body-wrapper .mat-tab-body{padding:0}::ng-deep .pb-builder-content .mat-tab-body-wrapper .mat-tab-body .elements{display:grid;grid-gap:.5rem;margin-bottom:1rem;grid-template:repeat(2,1fr)/repeat(3,1fr)}::ng-deep .pb-builder-content .mat-tab-body-wrapper .mat-tab-body .elements.structure-elements{grid-template:repeat(4,1fr)/1fr}::ng-deep .pb-builder-content .mat-tab-body-wrapper .mat-tab-body .elements.cdk-drop-list-dragging .cdk-drag{transform:none!important}::ng-deep .pb-builder-content .mat-tab-body-wrapper .mat-tab-body input{height:auto;border:none}::ng-deep .pb-builder-content .mat-tab-body-wrapper .mat-tab-body .custom-modules .drag-element img{max-width:100%}::ng-deep .pb-builder-container{position:relative;height:100%}::ng-deep .pb-builder-container mat-progress-bar{position:absolute}::ng-deep .pb-builder-container mat-toolbar{background-color:#fff}::ng-deep .pb-builder-options .mat-expansion-panel{box-shadow:none!important}::ng-deep .pb-builder-options .mat-expansion-panel.mat-expanded{overflow:visible}::ng-deep .pb-builder-options mat-expansion-panel-header:not(.mat-expanded){background:rgba(0,0,0,.04)}::ng-deep .pb-builder-options ::ng-deep .group{display:grid;grid-template:auto/repeat(2,1fr);grid-gap:1rem}::ng-deep .pb-builder-options ::ng-deep .group>*{align-self:center}::ng-deep .pb-builder-options ::ng-deep .group+.group{margin-top:1em}::ng-deep .pb-builder-options ::ng-deep .group.four{grid-template-columns:repeat(4,1fr)}::ng-deep .pb-builder-options ::ng-deep .group.f-large{grid-template-columns:2fr 1fr}::ng-deep .pb-builder-options ::ng-deep .group.l-large{grid-template-columns:1fr 2fr}::ng-deep .pb-builder-options ::ng-deep .group.three{grid-template-columns:repeat(3,1fr)}::ng-deep .pb-builder-options ::ng-deep .group.three.f-small{grid-template-columns:1fr repeat(2,2fr)}::ng-deep .pb-builder-options ::ng-deep .group.three.f-large{grid-template-columns:2fr repeat(2,1fr)}::ng-deep .pb-builder-options ::ng-deep .group.three.l-large{grid-template-columns:repeat(2,1fr) 2fr}::ng-deep .pb-builder-options ::ng-deep .group .mat-form-field-infix{width:auto!important}::ng-deep .drag-element{text-align:center;border:1px solid #ccc;box-sizing:border-box;background:#fff;color:#7b7b7b;cursor:move;transition:box-shadow .3s ease-in-out;will-change:box-shadow;border-radius:3px}::ng-deep .drag-element.cdk-drag-disabled,::ng-deep .drag-element.cdk-drag-placeholder{cursor:not-allowed;opacity:.6}::ng-deep .drag-element:hover{box-shadow:0 3px 1px -2px rgba(0,0,0,.2),0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12)}::ng-deep .drag-element .mat-icon{font-size:40px!important;padding:.5rem;width:auto;height:auto}::ng-deep .drag-element img{max-width:100%}::ng-deep .drag-element-title{font-size:.9em;text-transform:uppercase;margin-bottom:.5rem}::ng-deep .drag-element.structure-element{height:60px;position:relative;padding:4px;display:grid;grid-template:1fr/1fr}::ng-deep .drag-element.structure-element>div{background:#ccc;border:4px solid #bbb}::ng-deep .drag-element.structure-element.cols_2{grid-template-columns:repeat(2,5fr)}::ng-deep .drag-element.structure-element.cols_3{grid-template-columns:repeat(3,3.33fr)}::ng-deep .drag-element.structure-element.cols_4{grid-template-columns:repeat(4,2.5fr)}::ng-deep .drag-element.structure-element.cols_12{grid-template-columns:6fr 4fr}::ng-deep .drag-element.structure-element.cols_21{grid-template-columns:4fr 6fr}::ng-deep .main-padding{padding:1rem}::ng-deep .cdk-drop-list-receiving>:not(.cdk-drag){opacity:.6}::ng-deep .cdk-drop-list-dragging>*{pointer-events:none}@keyframes drag-animation{0%{opacity:0;height:0}to{opacity:1}}::ng-deep .cdk-drag-animating{animation:drag-animation 1s cubic-bezier(0,0,.2,1) infinite}::ng-deep .cdk-drag-preview{border-radius:4px;box-shadow:0 0 0 2px rgba(63,81,181,.5);min-height:60px;min-width:100px;background-color:#fff}::ng-deep .cdk-drag.structure-element.cdk-drag-placeholder{box-shadow:0 0 1px 2px #ff4081;width:100%;pointer-events:none}"]
|
|
3233
|
+
styles: ["/*!\n * Copyright (c) 2024 Pobuca.\n * All rights reserved.\n */:host{display:block;height:100vh}.hide{display:none}::ng-deep mat-sidenav-container{height:100%}::ng-deep mat-sidenav-container mat-sidenav-content{width:100%;z-index:unset!important;overflow:unset!important}::ng-deep h3.divider{text-align:center;display:block;overflow:hidden;margin:0 0 1rem}::ng-deep h3.divider span{font-weight:100;position:relative;display:inline-block}::ng-deep h3.divider span:after,::ng-deep h3.divider span:before{content:\"\";position:absolute;top:50%;height:1px;background:#ccc;width:99999px}::ng-deep h3.divider span:before{left:100%;margin-left:10px}::ng-deep h3.divider span:after{right:100%;margin-right:10px}::ng-deep .pb-builder-content{border-right:1px solid rgba(0,0,0,.12)}::ng-deep .pb-builder-content .overflow{position:absolute;top:0;bottom:0;left:0;right:0;background-color:#fff;opacity:.5;display:none;z-index:3}::ng-deep .pb-builder-content.disabled .overflow{display:block}::ng-deep .pb-builder-content .mat-tab-label{width:50%;min-width:auto;height:64px;font-size:medium;text-transform:uppercase;padding:0 12px}::ng-deep .pb-builder-content .mat-tab-body-wrapper,::ng-deep .pb-builder-content .mat-tab-group{height:100%}::ng-deep .pb-builder-content .mat-tab-body-wrapper .mat-tab-body{padding:0}::ng-deep .pb-builder-content .mat-tab-body-wrapper .mat-tab-body .elements{display:grid;grid-gap:.5rem;margin-bottom:1rem;grid-template:repeat(2,1fr)/repeat(3,1fr)}::ng-deep .pb-builder-content .mat-tab-body-wrapper .mat-tab-body .elements.structure-elements{grid-template:repeat(4,1fr)/1fr}::ng-deep .pb-builder-content .mat-tab-body-wrapper .mat-tab-body .elements.cdk-drop-list-dragging .cdk-drag{transform:none!important}::ng-deep .pb-builder-content .mat-tab-body-wrapper .mat-tab-body input{height:auto;border:none}::ng-deep .pb-builder-content .mat-tab-body-wrapper .mat-tab-body .custom-modules .drag-element img{max-width:100%}::ng-deep .pb-builder-container{position:relative;height:100%}::ng-deep .pb-builder-container mat-progress-bar{position:absolute}::ng-deep .pb-builder-container mat-toolbar{background-color:#fff}::ng-deep .pb-builder-options .mat-expansion-panel{box-shadow:none!important}::ng-deep .pb-builder-options .mat-expansion-panel.mat-expanded{overflow:visible}::ng-deep .pb-builder-options mat-expansion-panel-header:not(.mat-expanded){background:rgba(0,0,0,.04)}::ng-deep .pb-builder-options ::ng-deep .group{display:grid;grid-template:auto/repeat(2,1fr);grid-gap:1rem}::ng-deep .pb-builder-options ::ng-deep .group>*{align-self:center}::ng-deep .pb-builder-options ::ng-deep .group+.group{margin-top:1em}::ng-deep .pb-builder-options ::ng-deep .group.four{grid-template-columns:repeat(4,1fr)}::ng-deep .pb-builder-options ::ng-deep .group.f-large{grid-template-columns:2fr 1fr}::ng-deep .pb-builder-options ::ng-deep .group.l-large{grid-template-columns:1fr 2fr}::ng-deep .pb-builder-options ::ng-deep .group.three{grid-template-columns:repeat(3,1fr)}::ng-deep .pb-builder-options ::ng-deep .group.three.f-small{grid-template-columns:1fr repeat(2,2fr)}::ng-deep .pb-builder-options ::ng-deep .group.three.f-large{grid-template-columns:2fr repeat(2,1fr)}::ng-deep .pb-builder-options ::ng-deep .group.three.l-large{grid-template-columns:repeat(2,1fr) 2fr}::ng-deep .pb-builder-options ::ng-deep .group .mat-form-field-infix{width:auto!important}::ng-deep .drag-element{text-align:center;border:1px solid #ccc;box-sizing:border-box;background:#fff;color:#7b7b7b;cursor:move;transition:box-shadow .3s ease-in-out;will-change:box-shadow;border-radius:3px}::ng-deep .drag-element.cdk-drag-disabled,::ng-deep .drag-element.cdk-drag-placeholder{cursor:not-allowed;opacity:.6}::ng-deep .drag-element:hover{box-shadow:0 3px 1px -2px rgba(0,0,0,.2),0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12)}::ng-deep .drag-element .mat-icon{font-size:40px!important;padding:.5rem;width:auto;height:auto}::ng-deep .drag-element img{max-width:100%}::ng-deep .drag-element-title{font-size:.9em;text-transform:uppercase;margin-bottom:.5rem}::ng-deep .drag-element.structure-element{height:60px;position:relative;padding:4px;display:grid;grid-template:1fr/1fr}::ng-deep .drag-element.structure-element>div{background:#ccc;border:4px solid #bbb}::ng-deep .drag-element.structure-element.cols_2{grid-template-columns:repeat(2,5fr)}::ng-deep .drag-element.structure-element.cols_3{grid-template-columns:repeat(3,3.33fr)}::ng-deep .drag-element.structure-element.cols_4{grid-template-columns:repeat(4,2.5fr)}::ng-deep .drag-element.structure-element.cols_12{grid-template-columns:6fr 4fr}::ng-deep .drag-element.structure-element.cols_21{grid-template-columns:4fr 6fr}::ng-deep .main-padding{padding:1rem}::ng-deep .history-actions{margin-inline-start:auto;display:flex;gap:.5rem;align-items:center}::ng-deep .history-actions .history-btn{transition:all .2s ease-in-out;color:rgba(0,0,0,.54)}::ng-deep .history-actions .history-btn:hover:not([disabled]){background-color:rgba(0,0,0,.08);border-radius:4px;color:rgba(0,0,0,.87)}::ng-deep .history-actions .history-btn[disabled]{opacity:.38}::ng-deep .cdk-drop-list-receiving>:not(.cdk-drag){opacity:.6}::ng-deep .cdk-drop-list-dragging>*{pointer-events:none}@keyframes drag-animation{0%{opacity:0;height:0}to{opacity:1}}::ng-deep .cdk-drag-animating{animation:drag-animation 1s cubic-bezier(0,0,.2,1) infinite}::ng-deep .cdk-drag-preview{border-radius:4px;box-shadow:0 0 0 2px rgba(63,81,181,.5);min-height:60px;min-width:100px;background-color:#fff}::ng-deep .cdk-drag.structure-element.cdk-drag-placeholder{box-shadow:0 0 1px 2px #ff4081;width:100%;pointer-events:none}"]
|
|
2993
3234
|
},] }
|
|
2994
3235
|
];
|
|
2995
3236
|
PbEmailBuilderComponent.ctorParameters = function () { return [
|
|
@@ -3117,6 +3358,11 @@
|
|
|
3117
3358
|
_this.imageUploader = imageUploader;
|
|
3118
3359
|
_this.chRef = chRef;
|
|
3119
3360
|
_this.ngb = ngb;
|
|
3361
|
+
_this.defaultImageWidth = {
|
|
3362
|
+
value: 110,
|
|
3363
|
+
unit: 'px',
|
|
3364
|
+
auto: false
|
|
3365
|
+
};
|
|
3120
3366
|
return _this;
|
|
3121
3367
|
}
|
|
3122
3368
|
Object.defineProperty(ImageComponent.prototype, "align", {
|
|
@@ -3129,7 +3375,14 @@
|
|
|
3129
3375
|
});
|
|
3130
3376
|
Object.defineProperty(ImageComponent.prototype, "src", {
|
|
3131
3377
|
get: function () {
|
|
3132
|
-
return this.block.src ||
|
|
3378
|
+
return this.block.src || this.defaultImageSrc;
|
|
3379
|
+
},
|
|
3380
|
+
enumerable: false,
|
|
3381
|
+
configurable: true
|
|
3382
|
+
});
|
|
3383
|
+
Object.defineProperty(ImageComponent.prototype, "defaultImageSrc", {
|
|
3384
|
+
get: function () {
|
|
3385
|
+
return this.ngb.config.apiPath + "/images/placeholders/image-placeholder.png";
|
|
3133
3386
|
},
|
|
3134
3387
|
enumerable: false,
|
|
3135
3388
|
configurable: true
|
|
@@ -3153,7 +3406,9 @@
|
|
|
3153
3406
|
};
|
|
3154
3407
|
ImageComponent.prototype.getImageStyles = function () {
|
|
3155
3408
|
var _a = this.block.options, border = _a.border, width = _a.width, height = _a.height, padding = _a.padding;
|
|
3156
|
-
|
|
3409
|
+
var hasPlaceholderImage = !(this.block.src || '').trim();
|
|
3410
|
+
var imageWidth = hasPlaceholderImage ? this.defaultImageWidth : width;
|
|
3411
|
+
return Object.assign(Object.assign({ width: createWidthHeight(imageWidth), height: createWidthHeight(height) }, createPadding(padding)), createBorder(border));
|
|
3157
3412
|
};
|
|
3158
3413
|
return ImageComponent;
|
|
3159
3414
|
}(AbstractBlock));
|
|
@@ -3339,10 +3594,14 @@
|
|
|
3339
3594
|
_this.chRef = chRef;
|
|
3340
3595
|
_this.ngb = ngb;
|
|
3341
3596
|
_this.videoThumbnailService = videoThumbnailService;
|
|
3597
|
+
_this.defaultPosterWidth = {
|
|
3598
|
+
value: 160,
|
|
3599
|
+
unit: 'px',
|
|
3600
|
+
auto: false
|
|
3601
|
+
};
|
|
3342
3602
|
_this.destroy$ = new rxjs.Subject();
|
|
3343
3603
|
_this.srcChange$ = new rxjs.Subject();
|
|
3344
3604
|
_this.previousSrc = '';
|
|
3345
|
-
_this.defaultPosterSrc = 'assets/placeholders/video.svg';
|
|
3346
3605
|
_this.isGeneratingThumbnail = false;
|
|
3347
3606
|
return _this;
|
|
3348
3607
|
}
|
|
@@ -3367,6 +3626,20 @@
|
|
|
3367
3626
|
enumerable: false,
|
|
3368
3627
|
configurable: true
|
|
3369
3628
|
});
|
|
3629
|
+
Object.defineProperty(VideoComponent.prototype, "defaultPosterSrc", {
|
|
3630
|
+
get: function () {
|
|
3631
|
+
return this.ngb.config.apiPath + "/images/placeholders/video-placeholder.png";
|
|
3632
|
+
},
|
|
3633
|
+
enumerable: false,
|
|
3634
|
+
configurable: true
|
|
3635
|
+
});
|
|
3636
|
+
Object.defineProperty(VideoComponent.prototype, "errorPosterSrc", {
|
|
3637
|
+
get: function () {
|
|
3638
|
+
return this.ngb.config.apiPath + "/images/placeholders/error-placeholder.png";
|
|
3639
|
+
},
|
|
3640
|
+
enumerable: false,
|
|
3641
|
+
configurable: true
|
|
3642
|
+
});
|
|
3370
3643
|
Object.defineProperty(VideoComponent.prototype, "videoUrl", {
|
|
3371
3644
|
get: function () {
|
|
3372
3645
|
return this.block.src || '';
|
|
@@ -3443,7 +3716,7 @@
|
|
|
3443
3716
|
case 3:
|
|
3444
3717
|
error_1 = _a.sent();
|
|
3445
3718
|
console.error('Error generating thumbnail:', error_1);
|
|
3446
|
-
this.block.posterSrc =
|
|
3719
|
+
this.block.posterSrc = this.errorPosterSrc;
|
|
3447
3720
|
return [3 /*break*/, 5];
|
|
3448
3721
|
case 4:
|
|
3449
3722
|
this.isGeneratingThumbnail = false;
|
|
@@ -3490,7 +3763,9 @@
|
|
|
3490
3763
|
};
|
|
3491
3764
|
VideoComponent.prototype.getVideoStyles = function () {
|
|
3492
3765
|
var _a = this.block.options, border = _a.border, width = _a.width, height = _a.height, padding = _a.padding;
|
|
3493
|
-
|
|
3766
|
+
var hasPlaceholderPoster = !!(this.block.posterSrc || '').trim();
|
|
3767
|
+
var posterWidth = hasPlaceholderPoster ? width : this.defaultPosterWidth;
|
|
3768
|
+
return Object.assign(Object.assign({ width: createWidthHeight(posterWidth), height: createWidthHeight(height) }, createPadding(padding)), createBorder(border));
|
|
3494
3769
|
};
|
|
3495
3770
|
return VideoComponent;
|
|
3496
3771
|
}(AbstractBlock));
|
|
@@ -5082,45 +5357,46 @@
|
|
|
5082
5357
|
exports.isEqual = isEqual;
|
|
5083
5358
|
exports["ɵ0"] = ɵ0;
|
|
5084
5359
|
exports["ɵa"] = PbEmailObjectStoreService;
|
|
5085
|
-
exports["ɵb"] =
|
|
5086
|
-
exports["ɵba"] =
|
|
5087
|
-
exports["ɵbb"] =
|
|
5088
|
-
exports["ɵbc"] =
|
|
5089
|
-
exports["ɵbd"] =
|
|
5090
|
-
exports["ɵbe"] =
|
|
5091
|
-
exports["ɵbf"] =
|
|
5092
|
-
exports["ɵbg"] =
|
|
5093
|
-
exports["ɵbh"] =
|
|
5094
|
-
exports["ɵbi"] =
|
|
5095
|
-
exports["ɵbj"] =
|
|
5096
|
-
exports["ɵbk"] =
|
|
5097
|
-
exports["ɵbl"] =
|
|
5098
|
-
exports["ɵbm"] =
|
|
5099
|
-
exports["ɵbn"] =
|
|
5100
|
-
exports["
|
|
5101
|
-
exports["
|
|
5102
|
-
exports["
|
|
5103
|
-
exports["
|
|
5104
|
-
exports["
|
|
5105
|
-
exports["
|
|
5106
|
-
exports["
|
|
5107
|
-
exports["
|
|
5108
|
-
exports["
|
|
5109
|
-
exports["
|
|
5110
|
-
exports["
|
|
5111
|
-
exports["
|
|
5112
|
-
exports["
|
|
5113
|
-
exports["
|
|
5114
|
-
exports["
|
|
5115
|
-
exports["
|
|
5116
|
-
exports["
|
|
5117
|
-
exports["
|
|
5118
|
-
exports["
|
|
5119
|
-
exports["
|
|
5120
|
-
exports["
|
|
5121
|
-
exports["
|
|
5122
|
-
exports["
|
|
5123
|
-
exports["
|
|
5360
|
+
exports["ɵb"] = IpHistoryService;
|
|
5361
|
+
exports["ɵba"] = LinkComponent;
|
|
5362
|
+
exports["ɵbb"] = AlignComponent;
|
|
5363
|
+
exports["ɵbc"] = DirectionComponent;
|
|
5364
|
+
exports["ɵbd"] = BackRepatComponent;
|
|
5365
|
+
exports["ɵbe"] = ConfirmDialogComponent;
|
|
5366
|
+
exports["ɵbf"] = ImageUploadComponent;
|
|
5367
|
+
exports["ɵbg"] = BlockSettingsComponent;
|
|
5368
|
+
exports["ɵbh"] = StructureSettingsComponent;
|
|
5369
|
+
exports["ɵbi"] = GeneralSettingsComponent;
|
|
5370
|
+
exports["ɵbj"] = UploadBottomSheetDialogComponent;
|
|
5371
|
+
exports["ɵbk"] = UploadImageGalleryComponent;
|
|
5372
|
+
exports["ɵbl"] = TemplateListDialogComponent;
|
|
5373
|
+
exports["ɵbm"] = ImportDialogComponent;
|
|
5374
|
+
exports["ɵbn"] = IpInterceptorInterceptor;
|
|
5375
|
+
exports["ɵbo"] = LIBRARY_IS_PRO;
|
|
5376
|
+
exports["ɵc"] = PbUserInterfaceService;
|
|
5377
|
+
exports["ɵd"] = FreeUsersRestApi;
|
|
5378
|
+
exports["ɵe"] = FreeUsersPbStorage;
|
|
5379
|
+
exports["ɵf"] = StructureComponent;
|
|
5380
|
+
exports["ɵg"] = BlockComponent;
|
|
5381
|
+
exports["ɵh"] = DynamicComponentDirective;
|
|
5382
|
+
exports["ɵi"] = TextElementComponent;
|
|
5383
|
+
exports["ɵj"] = AbstractBlock;
|
|
5384
|
+
exports["ɵk"] = ImageComponent;
|
|
5385
|
+
exports["ɵl"] = VideoComponent;
|
|
5386
|
+
exports["ɵm"] = VideoThumbnailService;
|
|
5387
|
+
exports["ɵn"] = ButtonComponent;
|
|
5388
|
+
exports["ɵo"] = DividerComponent;
|
|
5389
|
+
exports["ɵp"] = SpacerComponent;
|
|
5390
|
+
exports["ɵq"] = SocialComponent;
|
|
5391
|
+
exports["ɵr"] = BuilderContainerComponent;
|
|
5392
|
+
exports["ɵs"] = FontStylesComponent;
|
|
5393
|
+
exports["ɵt"] = PaddingComponent;
|
|
5394
|
+
exports["ɵu"] = MarginComponent;
|
|
5395
|
+
exports["ɵv"] = GapsComponent;
|
|
5396
|
+
exports["ɵw"] = LineHeightComponent;
|
|
5397
|
+
exports["ɵx"] = WidthHeightComponent;
|
|
5398
|
+
exports["ɵy"] = BorderComponent;
|
|
5399
|
+
exports["ɵz"] = ColorComponent;
|
|
5124
5400
|
|
|
5125
5401
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5126
5402
|
|