@pobuca/email-builder 1.3.0 → 1.3.1
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 +3 -44
- 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/services/internals/pb-history/pb-history.service.js +5 -48
- package/fesm2015/pobuca-email-builder.js +3 -44
- package/fesm2015/pobuca-email-builder.js.map +1 -1
- package/lib/services/internals/pb-history/pb-history.service.d.ts +1 -4
- package/package.json +1 -1
- package/pobuca-email-builder.metadata.json +1 -1
|
@@ -1700,19 +1700,11 @@
|
|
|
1700
1700
|
* Copyright (c) 2024 Pobuca.
|
|
1701
1701
|
* All rights reserved.
|
|
1702
1702
|
*/
|
|
1703
|
-
/**
|
|
1704
|
-
* @internal
|
|
1705
|
-
*/
|
|
1706
|
-
var HISTORY;
|
|
1707
|
-
(function (HISTORY) {
|
|
1708
|
-
HISTORY["KEY"] = "[NGB] history stack";
|
|
1709
|
-
})(HISTORY || (HISTORY = {}));
|
|
1710
1703
|
/**
|
|
1711
1704
|
* @internal
|
|
1712
1705
|
*/
|
|
1713
1706
|
var IpHistoryService = /** @class */ (function () {
|
|
1714
|
-
function IpHistoryService(
|
|
1715
|
-
this.storage = storage;
|
|
1707
|
+
function IpHistoryService() {
|
|
1716
1708
|
this.historyStack = [];
|
|
1717
1709
|
this.currentIndex = -1;
|
|
1718
1710
|
this.maxHistorySize = 50; // Maximum undo steps
|
|
@@ -1720,7 +1712,6 @@
|
|
|
1720
1712
|
this._canRedo$ = new rxjs.BehaviorSubject(false);
|
|
1721
1713
|
this.canUndo$ = this._canUndo$.asObservable();
|
|
1722
1714
|
this.canRedo$ = this._canRedo$.asObservable();
|
|
1723
|
-
this.loadFromStorage();
|
|
1724
1715
|
}
|
|
1725
1716
|
/**
|
|
1726
1717
|
* Add a new state to the history stack
|
|
@@ -1744,7 +1735,6 @@
|
|
|
1744
1735
|
this.currentIndex--;
|
|
1745
1736
|
}
|
|
1746
1737
|
this.updateUndoRedoStatus();
|
|
1747
|
-
this.saveToStorage();
|
|
1748
1738
|
};
|
|
1749
1739
|
/**
|
|
1750
1740
|
* Get the previous state (undo)
|
|
@@ -1787,7 +1777,6 @@
|
|
|
1787
1777
|
this.historyStack = [];
|
|
1788
1778
|
this.currentIndex = -1;
|
|
1789
1779
|
this.updateUndoRedoStatus();
|
|
1790
|
-
this.storage.removeItem(HISTORY.KEY);
|
|
1791
1780
|
};
|
|
1792
1781
|
/**
|
|
1793
1782
|
* Get the history size
|
|
@@ -1805,45 +1794,15 @@
|
|
|
1805
1794
|
this._canUndo$.next(this.canUndoNow());
|
|
1806
1795
|
this._canRedo$.next(this.canRedoNow());
|
|
1807
1796
|
};
|
|
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
1797
|
return IpHistoryService;
|
|
1837
1798
|
}());
|
|
1838
|
-
IpHistoryService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function IpHistoryService_Factory() { return new IpHistoryService(
|
|
1799
|
+
IpHistoryService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function IpHistoryService_Factory() { return new IpHistoryService(); }, token: IpHistoryService, providedIn: "any" });
|
|
1839
1800
|
IpHistoryService.decorators = [
|
|
1840
1801
|
{ type: i0.Injectable, args: [{
|
|
1841
1802
|
providedIn: 'any'
|
|
1842
1803
|
},] }
|
|
1843
1804
|
];
|
|
1844
|
-
IpHistoryService.ctorParameters = function () { return [
|
|
1845
|
-
{ type: Storage, decorators: [{ type: i0.Inject, args: [PB_STORAGE_FACTORY,] }] }
|
|
1846
|
-
]; };
|
|
1805
|
+
IpHistoryService.ctorParameters = function () { return []; };
|
|
1847
1806
|
|
|
1848
1807
|
// https://www.npmjs.com/package/recursive-diff
|
|
1849
1808
|
/**
|