@pobuca/email-builder 1.2.1 → 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 +275 -43
- 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/pb-email-builder.component.js +46 -3
- package/esm2015/lib/services/internals/pb-email-object-store/pb-email-object-store.service.js +45 -4
- 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 +235 -5
- package/fesm2015/pobuca-email-builder.js.map +1 -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 +15 -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
|
@@ -1168,6 +1168,154 @@ PbStorageService.ctorParameters = () => [
|
|
|
1168
1168
|
{ type: Storage, decorators: [{ type: Inject, args: [PB_TEMPLATES_TEMPORARY_STORAGE,] }] }
|
|
1169
1169
|
];
|
|
1170
1170
|
|
|
1171
|
+
/*
|
|
1172
|
+
* Copyright (c) 2024 Pobuca.
|
|
1173
|
+
* All rights reserved.
|
|
1174
|
+
*/
|
|
1175
|
+
/**
|
|
1176
|
+
* @internal
|
|
1177
|
+
*/
|
|
1178
|
+
var HISTORY;
|
|
1179
|
+
(function (HISTORY) {
|
|
1180
|
+
HISTORY["KEY"] = "[NGB] history stack";
|
|
1181
|
+
})(HISTORY || (HISTORY = {}));
|
|
1182
|
+
/**
|
|
1183
|
+
* @internal
|
|
1184
|
+
*/
|
|
1185
|
+
class IpHistoryService {
|
|
1186
|
+
constructor(storage) {
|
|
1187
|
+
this.storage = storage;
|
|
1188
|
+
this.historyStack = [];
|
|
1189
|
+
this.currentIndex = -1;
|
|
1190
|
+
this.maxHistorySize = 50; // Maximum undo steps
|
|
1191
|
+
this._canUndo$ = new BehaviorSubject(false);
|
|
1192
|
+
this._canRedo$ = new BehaviorSubject(false);
|
|
1193
|
+
this.canUndo$ = this._canUndo$.asObservable();
|
|
1194
|
+
this.canRedo$ = this._canRedo$.asObservable();
|
|
1195
|
+
this.loadFromStorage();
|
|
1196
|
+
}
|
|
1197
|
+
/**
|
|
1198
|
+
* Add a new state to the history stack
|
|
1199
|
+
*/
|
|
1200
|
+
addState(state) {
|
|
1201
|
+
if (!state) {
|
|
1202
|
+
return;
|
|
1203
|
+
}
|
|
1204
|
+
const clonedState = cloneDeep(state);
|
|
1205
|
+
// If we're not at the end of the stack, remove all states after current index
|
|
1206
|
+
// This happens when user undoes and then makes a new change
|
|
1207
|
+
if (this.currentIndex < this.historyStack.length - 1) {
|
|
1208
|
+
this.historyStack = this.historyStack.slice(0, this.currentIndex + 1);
|
|
1209
|
+
}
|
|
1210
|
+
// Add the new state
|
|
1211
|
+
this.historyStack.push(clonedState);
|
|
1212
|
+
this.currentIndex++;
|
|
1213
|
+
// Limit history size to prevent memory issues
|
|
1214
|
+
if (this.historyStack.length > this.maxHistorySize) {
|
|
1215
|
+
this.historyStack.shift();
|
|
1216
|
+
this.currentIndex--;
|
|
1217
|
+
}
|
|
1218
|
+
this.updateUndoRedoStatus();
|
|
1219
|
+
this.saveToStorage();
|
|
1220
|
+
}
|
|
1221
|
+
/**
|
|
1222
|
+
* Get the previous state (undo)
|
|
1223
|
+
*/
|
|
1224
|
+
undo() {
|
|
1225
|
+
if (!this.canUndoNow()) {
|
|
1226
|
+
return null;
|
|
1227
|
+
}
|
|
1228
|
+
this.currentIndex--;
|
|
1229
|
+
this.updateUndoRedoStatus();
|
|
1230
|
+
return cloneDeep(this.historyStack[this.currentIndex]);
|
|
1231
|
+
}
|
|
1232
|
+
/**
|
|
1233
|
+
* Get the next state (redo)
|
|
1234
|
+
*/
|
|
1235
|
+
redo() {
|
|
1236
|
+
if (!this.canRedoNow()) {
|
|
1237
|
+
return null;
|
|
1238
|
+
}
|
|
1239
|
+
this.currentIndex++;
|
|
1240
|
+
this.updateUndoRedoStatus();
|
|
1241
|
+
return cloneDeep(this.historyStack[this.currentIndex]);
|
|
1242
|
+
}
|
|
1243
|
+
/**
|
|
1244
|
+
* Check if undo is available (synchronous)
|
|
1245
|
+
*/
|
|
1246
|
+
canUndoNow() {
|
|
1247
|
+
return this.currentIndex > 0;
|
|
1248
|
+
}
|
|
1249
|
+
/**
|
|
1250
|
+
* Check if redo is available (synchronous)
|
|
1251
|
+
*/
|
|
1252
|
+
canRedoNow() {
|
|
1253
|
+
return this.currentIndex < this.historyStack.length - 1;
|
|
1254
|
+
}
|
|
1255
|
+
/**
|
|
1256
|
+
* Clear history
|
|
1257
|
+
*/
|
|
1258
|
+
clear() {
|
|
1259
|
+
this.historyStack = [];
|
|
1260
|
+
this.currentIndex = -1;
|
|
1261
|
+
this.updateUndoRedoStatus();
|
|
1262
|
+
this.storage.removeItem(HISTORY.KEY);
|
|
1263
|
+
}
|
|
1264
|
+
/**
|
|
1265
|
+
* Get the history size
|
|
1266
|
+
*/
|
|
1267
|
+
getHistorySize() {
|
|
1268
|
+
return this.historyStack.length;
|
|
1269
|
+
}
|
|
1270
|
+
/**
|
|
1271
|
+
* Get current position in history stack
|
|
1272
|
+
*/
|
|
1273
|
+
getCurrentIndex() {
|
|
1274
|
+
return this.currentIndex;
|
|
1275
|
+
}
|
|
1276
|
+
updateUndoRedoStatus() {
|
|
1277
|
+
this._canUndo$.next(this.canUndoNow());
|
|
1278
|
+
this._canRedo$.next(this.canRedoNow());
|
|
1279
|
+
}
|
|
1280
|
+
saveToStorage() {
|
|
1281
|
+
try {
|
|
1282
|
+
const data = {
|
|
1283
|
+
stack: this.historyStack,
|
|
1284
|
+
currentIndex: this.currentIndex
|
|
1285
|
+
};
|
|
1286
|
+
this.storage.setItem(HISTORY.KEY, JSON.stringify(data));
|
|
1287
|
+
}
|
|
1288
|
+
catch (error) {
|
|
1289
|
+
console.warn('[IpHistoryService] Failed to save history to storage:', error);
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
loadFromStorage() {
|
|
1293
|
+
var _a;
|
|
1294
|
+
try {
|
|
1295
|
+
const data = this.storage.getItem(HISTORY.KEY);
|
|
1296
|
+
if (data) {
|
|
1297
|
+
const parsed = JSON.parse(data);
|
|
1298
|
+
this.historyStack = parsed.stack || [];
|
|
1299
|
+
this.currentIndex = (_a = parsed.currentIndex) !== null && _a !== void 0 ? _a : -1;
|
|
1300
|
+
this.updateUndoRedoStatus();
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
catch (error) {
|
|
1304
|
+
console.warn('[IpHistoryService] Failed to load history from storage:', error);
|
|
1305
|
+
this.clear();
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
IpHistoryService.ɵprov = i0.ɵɵdefineInjectable({ factory: function IpHistoryService_Factory() { return new IpHistoryService(i0.ɵɵinject(PB_STORAGE_FACTORY)); }, token: IpHistoryService, providedIn: "any" });
|
|
1310
|
+
IpHistoryService.decorators = [
|
|
1311
|
+
{ type: Injectable, args: [{
|
|
1312
|
+
providedIn: 'any'
|
|
1313
|
+
},] }
|
|
1314
|
+
];
|
|
1315
|
+
IpHistoryService.ctorParameters = () => [
|
|
1316
|
+
{ type: Storage, decorators: [{ type: Inject, args: [PB_STORAGE_FACTORY,] }] }
|
|
1317
|
+
];
|
|
1318
|
+
|
|
1171
1319
|
/*
|
|
1172
1320
|
* Copyright (c) 2024 Pobuca.
|
|
1173
1321
|
* All rights reserved.
|
|
@@ -1177,10 +1325,11 @@ PbStorageService.ctorParameters = () => [
|
|
|
1177
1325
|
* @internal
|
|
1178
1326
|
*/
|
|
1179
1327
|
class PbEmailObjectStoreService {
|
|
1180
|
-
constructor(userRestApi, pbStorage, userMiddleware, googleFonts, config) {
|
|
1328
|
+
constructor(userRestApi, pbStorage, userMiddleware, history, googleFonts, config) {
|
|
1181
1329
|
this.userRestApi = userRestApi;
|
|
1182
1330
|
this.pbStorage = pbStorage;
|
|
1183
1331
|
this.userMiddleware = userMiddleware;
|
|
1332
|
+
this.history = history;
|
|
1184
1333
|
this.googleFonts = googleFonts;
|
|
1185
1334
|
this.config = config;
|
|
1186
1335
|
this.Email = new PBEmail();
|
|
@@ -1201,6 +1350,9 @@ class PbEmailObjectStoreService {
|
|
|
1201
1350
|
this.templateAsObservable$ = this._Template$.asObservable();
|
|
1202
1351
|
this._onTemplateCreated$ = new Subject();
|
|
1203
1352
|
this.onTemplateCreated$ = this._onTemplateCreated$.pipe(withLatestFrom(this._Email$, this._Template$, this._Mjml$), map(([_, ...rest]) => rest));
|
|
1353
|
+
// History/Undo support
|
|
1354
|
+
this.canUndo$ = this.history.canUndo$;
|
|
1355
|
+
this.canRedo$ = this.history.canRedo$;
|
|
1204
1356
|
}
|
|
1205
1357
|
get defaultTemplateThumbPath() {
|
|
1206
1358
|
var _a, _b;
|
|
@@ -1242,6 +1394,8 @@ class PbEmailObjectStoreService {
|
|
|
1242
1394
|
}
|
|
1243
1395
|
markForCheck() {
|
|
1244
1396
|
this._Email$.next(this.Email);
|
|
1397
|
+
// Add to undo/redo history
|
|
1398
|
+
this.history.addState(this.Email);
|
|
1245
1399
|
if (this.Email.structures.length) {
|
|
1246
1400
|
this.pbStorage.addTemplateToLatestUsed(cloneDeep({
|
|
1247
1401
|
templateData: this.Email,
|
|
@@ -1317,8 +1471,40 @@ class PbEmailObjectStoreService {
|
|
|
1317
1471
|
this.clonedEmail = cloneDeep(this.Email);
|
|
1318
1472
|
this.markForCheck();
|
|
1319
1473
|
}
|
|
1474
|
+
/**
|
|
1475
|
+
* Undo the last change
|
|
1476
|
+
* @returns true if undo was successful, false if undo is not available
|
|
1477
|
+
*/
|
|
1478
|
+
undo() {
|
|
1479
|
+
const previousState = this.history.undo();
|
|
1480
|
+
if (previousState) {
|
|
1481
|
+
this.Email = previousState;
|
|
1482
|
+
this._Email$.next(this.Email);
|
|
1483
|
+
// Reset template to force re-generation on next save
|
|
1484
|
+
this._Template$.next(null);
|
|
1485
|
+
this._Mjml$.next(null);
|
|
1486
|
+
return true;
|
|
1487
|
+
}
|
|
1488
|
+
return false;
|
|
1489
|
+
}
|
|
1490
|
+
/**
|
|
1491
|
+
* Redo the last undone change
|
|
1492
|
+
* @returns true if redo was successful, false if redo is not available
|
|
1493
|
+
*/
|
|
1494
|
+
redo() {
|
|
1495
|
+
const nextState = this.history.redo();
|
|
1496
|
+
if (nextState) {
|
|
1497
|
+
this.Email = nextState;
|
|
1498
|
+
this._Email$.next(this.Email);
|
|
1499
|
+
// Reset template to force re-generation on next save
|
|
1500
|
+
this._Template$.next(null);
|
|
1501
|
+
this._Mjml$.next(null);
|
|
1502
|
+
return true;
|
|
1503
|
+
}
|
|
1504
|
+
return false;
|
|
1505
|
+
}
|
|
1320
1506
|
}
|
|
1321
|
-
PbEmailObjectStoreService.ɵprov = i0.ɵɵdefineInjectable({ factory: function PbEmailObjectStoreService_Factory() { return new PbEmailObjectStoreService(i0.ɵɵinject(PbUserRestApiService), i0.ɵɵinject(PbStorageService), i0.ɵɵinject(PbUserMiddlewaresService), i0.ɵɵinject(PB_GOOGLE_FONTS), i0.ɵɵinject(PB_CONFIG)); }, token: PbEmailObjectStoreService, providedIn: "root" });
|
|
1507
|
+
PbEmailObjectStoreService.ɵprov = i0.ɵɵdefineInjectable({ factory: function PbEmailObjectStoreService_Factory() { return new PbEmailObjectStoreService(i0.ɵɵinject(PbUserRestApiService), i0.ɵɵinject(PbStorageService), i0.ɵɵinject(PbUserMiddlewaresService), i0.ɵɵinject(IpHistoryService), i0.ɵɵinject(PB_GOOGLE_FONTS), i0.ɵɵinject(PB_CONFIG)); }, token: PbEmailObjectStoreService, providedIn: "root" });
|
|
1322
1508
|
PbEmailObjectStoreService.decorators = [
|
|
1323
1509
|
{ type: Injectable, args: [{
|
|
1324
1510
|
providedIn: 'root'
|
|
@@ -1328,6 +1514,7 @@ PbEmailObjectStoreService.ctorParameters = () => [
|
|
|
1328
1514
|
{ type: PbUserRestApiService },
|
|
1329
1515
|
{ type: PbStorageService },
|
|
1330
1516
|
{ type: PbUserMiddlewaresService },
|
|
1517
|
+
{ type: IpHistoryService },
|
|
1331
1518
|
{ type: Array, decorators: [{ type: Inject, args: [PB_GOOGLE_FONTS,] }] },
|
|
1332
1519
|
{ type: undefined, decorators: [{ type: Inject, args: [PB_CONFIG,] }] }
|
|
1333
1520
|
];
|
|
@@ -2178,6 +2365,9 @@ class PbEmailBuilderComponent {
|
|
|
2178
2365
|
this.currentHTMLTemplate$ = this.emailObjectStore.templateAsObservable$;
|
|
2179
2366
|
this.activeMatProgress$ = this.userInterfaceService.activeMatProgress$.asObservable();
|
|
2180
2367
|
this.customModuleList$ = this.userRestApiService.getAllUserModules$;
|
|
2368
|
+
// Undo/Redo support
|
|
2369
|
+
this.canUndo$ = this.emailObjectStore.canUndo$;
|
|
2370
|
+
this.canRedo$ = this.emailObjectStore.canRedo$;
|
|
2181
2371
|
this._onDestroy$ = new Subject();
|
|
2182
2372
|
this.includedFonts = new Set();
|
|
2183
2373
|
if (this.doc) {
|
|
@@ -2227,6 +2417,22 @@ class PbEmailBuilderComponent {
|
|
|
2227
2417
|
disableStructureList$(structure) {
|
|
2228
2418
|
return this.middlewares.disableStructureDragFromList(structure).pipe(take(1));
|
|
2229
2419
|
}
|
|
2420
|
+
/**
|
|
2421
|
+
* Undo the last action
|
|
2422
|
+
*/
|
|
2423
|
+
undo() {
|
|
2424
|
+
if (this.emailObjectStore.undo()) {
|
|
2425
|
+
this.userInterfaceService.notify('Undo applied', 'short');
|
|
2426
|
+
}
|
|
2427
|
+
}
|
|
2428
|
+
/**
|
|
2429
|
+
* Redo the last undone action
|
|
2430
|
+
*/
|
|
2431
|
+
redo() {
|
|
2432
|
+
if (this.emailObjectStore.redo()) {
|
|
2433
|
+
this.userInterfaceService.notify('Redo applied', 'short');
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2230
2436
|
trackByFn(block) {
|
|
2231
2437
|
return block.type;
|
|
2232
2438
|
}
|
|
@@ -2334,6 +2540,30 @@ class PbEmailBuilderComponent {
|
|
|
2334
2540
|
});
|
|
2335
2541
|
}
|
|
2336
2542
|
});
|
|
2543
|
+
// Keyboard shortcuts for Undo (Ctrl+Z) and Redo (Ctrl+Shift+Z)
|
|
2544
|
+
fromEvent(this.doc, 'keydown')
|
|
2545
|
+
.pipe(filter(event => {
|
|
2546
|
+
// Check if Ctrl (or Cmd on Mac) is pressed
|
|
2547
|
+
const isCtrlOrCmd = event.ctrlKey || event.metaKey;
|
|
2548
|
+
// Check if we're in a focusable element like input/textarea
|
|
2549
|
+
const isFocusable = event.target instanceof HTMLInputElement ||
|
|
2550
|
+
event.target instanceof HTMLTextAreaElement;
|
|
2551
|
+
return isCtrlOrCmd && !isFocusable;
|
|
2552
|
+
}), takeUntil(this._onDestroy$))
|
|
2553
|
+
.subscribe((event) => {
|
|
2554
|
+
if (event.key === 'z' || event.key === 'Z') {
|
|
2555
|
+
// Undo: Ctrl+Z
|
|
2556
|
+
if (!event.shiftKey) {
|
|
2557
|
+
event.preventDefault();
|
|
2558
|
+
this.undo();
|
|
2559
|
+
}
|
|
2560
|
+
// Redo: Ctrl+Shift+Z
|
|
2561
|
+
else if (event.shiftKey) {
|
|
2562
|
+
event.preventDefault();
|
|
2563
|
+
this.redo();
|
|
2564
|
+
}
|
|
2565
|
+
}
|
|
2566
|
+
});
|
|
2337
2567
|
}
|
|
2338
2568
|
ngOnChanges(changes) {
|
|
2339
2569
|
if (changes.email) {
|
|
@@ -2363,7 +2593,7 @@ class PbEmailBuilderComponent {
|
|
|
2363
2593
|
PbEmailBuilderComponent.decorators = [
|
|
2364
2594
|
{ type: Component, args: [{
|
|
2365
2595
|
selector: 'pb-email-builder',
|
|
2366
|
-
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
|
|
2596
|
+
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",
|
|
2367
2597
|
exportAs: 'pbEmailBuilder',
|
|
2368
2598
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2369
2599
|
providers: [
|
|
@@ -2374,7 +2604,7 @@ PbEmailBuilderComponent.decorators = [
|
|
|
2374
2604
|
},
|
|
2375
2605
|
SlugifyPipe
|
|
2376
2606
|
],
|
|
2377
|
-
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}"]
|
|
2607
|
+
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}"]
|
|
2378
2608
|
},] }
|
|
2379
2609
|
];
|
|
2380
2610
|
PbEmailBuilderComponent.ctorParameters = () => [
|
|
@@ -4722,5 +4952,5 @@ PbEmailBuilderModule.ctorParameters = () => [
|
|
|
4722
4952
|
* Generated bundle index. Do not edit.
|
|
4723
4953
|
*/
|
|
4724
4954
|
|
|
4725
|
-
export { AIPBlock, ButtonBlock, Defaults, DividerBlock, ETemplatesStorage, ImageUploader as FreeUsersImageUploader, ImageBlock, PBEmail, PB_BLOCKS, PB_CONFIG, PB_DEFAULT_BLOCKS, PB_DEFAULT_CONFIG, PB_DEFAULT_FALLBACK_FONTS, PB_DEFAULT_GOOGLE_FONTS, PB_DEFAULT_SOCIAL_NETWORKS, PB_DEFAULT_STRUCTURES, PB_FALLBACK_FONTS, PB_GOOGLE_FONTS, PB_SOCIAL_NETWORKS, PB_STORAGE_FACTORY, PB_STRUCTURES, PB_TEMPLATES_TEMPORARY_STORAGE, PbEmailBuilderComponent, PbEmailBuilderModule, PbEmailBuilderService, PbStorageService, PbUserImageUploaderService, PbUserMiddlewaresService, PbUserRestApiService, PreviewTemplateComponent, SlugifyPipe, SocialBlock, SpacerBlock, Structure, TextBlock, VideoBlock, bytesToSize, cloneDeep, createBackground, createBorder, createCustomRestApiService, createFont, createLineHeight, createMargin, createPadding, createUserMiddlewareService, createUserUploaderService, createUsersIpStorage, createWidthHeight, defaultColumnsOptions, defaultsDeep, deferOf, getAssetByPath, isEqual, ɵ0, PbEmailObjectStoreService as ɵa,
|
|
4955
|
+
export { AIPBlock, ButtonBlock, Defaults, DividerBlock, ETemplatesStorage, ImageUploader as FreeUsersImageUploader, ImageBlock, PBEmail, PB_BLOCKS, PB_CONFIG, PB_DEFAULT_BLOCKS, PB_DEFAULT_CONFIG, PB_DEFAULT_FALLBACK_FONTS, PB_DEFAULT_GOOGLE_FONTS, PB_DEFAULT_SOCIAL_NETWORKS, PB_DEFAULT_STRUCTURES, PB_FALLBACK_FONTS, PB_GOOGLE_FONTS, PB_SOCIAL_NETWORKS, PB_STORAGE_FACTORY, PB_STRUCTURES, PB_TEMPLATES_TEMPORARY_STORAGE, PbEmailBuilderComponent, PbEmailBuilderModule, PbEmailBuilderService, PbStorageService, PbUserImageUploaderService, PbUserMiddlewaresService, PbUserRestApiService, PreviewTemplateComponent, SlugifyPipe, SocialBlock, SpacerBlock, Structure, TextBlock, VideoBlock, bytesToSize, cloneDeep, createBackground, createBorder, createCustomRestApiService, createFont, createLineHeight, createMargin, createPadding, createUserMiddlewareService, createUserUploaderService, createUsersIpStorage, createWidthHeight, defaultColumnsOptions, defaultsDeep, deferOf, getAssetByPath, isEqual, ɵ0, PbEmailObjectStoreService as ɵa, IpHistoryService as ɵb, LinkComponent as ɵba, AlignComponent as ɵbb, DirectionComponent as ɵbc, BackRepatComponent as ɵbd, ConfirmDialogComponent as ɵbe, ImageUploadComponent as ɵbf, BlockSettingsComponent as ɵbg, StructureSettingsComponent as ɵbh, GeneralSettingsComponent as ɵbi, UploadBottomSheetDialogComponent as ɵbj, UploadImageGalleryComponent as ɵbk, TemplateListDialogComponent as ɵbl, ImportDialogComponent as ɵbm, IpInterceptorInterceptor as ɵbn, LIBRARY_IS_PRO as ɵbo, PbUserInterfaceService as ɵc, FreeUsersRestApi as ɵd, FreeUsersPbStorage as ɵe, StructureComponent as ɵf, BlockComponent as ɵg, DynamicComponentDirective as ɵh, TextElementComponent as ɵi, AbstractBlock as ɵj, ImageComponent as ɵk, VideoComponent as ɵl, VideoThumbnailService as ɵm, ButtonComponent as ɵn, DividerComponent as ɵo, SpacerComponent as ɵp, SocialComponent as ɵq, BuilderContainerComponent as ɵr, FontStylesComponent as ɵs, PaddingComponent as ɵt, MarginComponent as ɵu, GapsComponent as ɵv, LineHeightComponent as ɵw, WidthHeightComponent as ɵx, BorderComponent as ɵy, ColorComponent as ɵz };
|
|
4726
4956
|
//# sourceMappingURL=pobuca-email-builder.js.map
|