@pobuca/email-builder 1.4.1 → 1.5.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.
@@ -1,6 +1,8 @@
1
1
  import { IBlockState, IButtonBlockOptions, IDividerBlockOptions, IImageBLockOptions, IVideoBlockOptions, ISocialBlockOptions, ISocialNetwork, ISpacerBlockOptions, ITextBlockOptions } from '../interfaces/interfaces';
2
2
  export declare type TBlocksOptions = ITextBlockOptions | IImageBLockOptions | IVideoBlockOptions | IButtonBlockOptions | IDividerBlockOptions | ISpacerBlockOptions | ISocialBlockOptions;
3
+ export declare function createBlockId(): string;
3
4
  export declare abstract class AIPBlock {
5
+ readonly id?: string;
4
6
  readonly type: string;
5
7
  readonly icon: string;
6
8
  abstract readonly title: string;
@@ -10,6 +12,7 @@ export declare abstract class AIPBlock {
10
12
  export declare class TextBlock implements AIPBlock {
11
13
  innerText?: string;
12
14
  state: IBlockState;
15
+ readonly id: string;
13
16
  readonly type = "text";
14
17
  readonly icon = "text_format";
15
18
  options: ITextBlockOptions;
@@ -19,6 +22,7 @@ export declare class TextBlock implements AIPBlock {
19
22
  export declare class ImageBlock implements AIPBlock {
20
23
  src: string;
21
24
  state: IBlockState;
25
+ readonly id: string;
22
26
  readonly type = "image";
23
27
  readonly icon = "image";
24
28
  options: IImageBLockOptions;
@@ -29,6 +33,7 @@ export declare class VideoBlock implements AIPBlock {
29
33
  src: string;
30
34
  posterSrc: string;
31
35
  state: IBlockState;
36
+ readonly id: string;
32
37
  readonly type = "video";
33
38
  readonly icon = "videocam";
34
39
  options: IVideoBlockOptions;
@@ -38,6 +43,7 @@ export declare class VideoBlock implements AIPBlock {
38
43
  export declare class ButtonBlock implements AIPBlock {
39
44
  innerText: string;
40
45
  state: IBlockState;
46
+ readonly id: string;
41
47
  readonly type = "button";
42
48
  readonly icon = "radio_button_checked";
43
49
  options: IButtonBlockOptions;
@@ -46,6 +52,7 @@ export declare class ButtonBlock implements AIPBlock {
46
52
  }
47
53
  export declare class DividerBlock implements AIPBlock {
48
54
  state: IBlockState;
55
+ readonly id: string;
49
56
  readonly type = "divider";
50
57
  readonly icon = "remove";
51
58
  options: IDividerBlockOptions;
@@ -54,6 +61,7 @@ export declare class DividerBlock implements AIPBlock {
54
61
  }
55
62
  export declare class SpacerBlock implements AIPBlock {
56
63
  state: IBlockState;
64
+ readonly id: string;
57
65
  readonly type = "spacer";
58
66
  readonly icon = "vertical_align_center";
59
67
  title: string;
@@ -63,6 +71,7 @@ export declare class SpacerBlock implements AIPBlock {
63
71
  export declare class SocialBlock implements AIPBlock {
64
72
  networks: ISocialNetwork[];
65
73
  state: IBlockState;
74
+ readonly id: string;
66
75
  readonly type = "social";
67
76
  readonly icon = "share";
68
77
  title: string;
@@ -70,3 +79,4 @@ export declare class SocialBlock implements AIPBlock {
70
79
  constructor(networks?: ISocialNetwork[], options?: ISocialBlockOptions, state?: IBlockState);
71
80
  }
72
81
  export declare type TBlocks = TextBlock | ImageBlock | VideoBlock | ButtonBlock | DividerBlock | SpacerBlock | SocialBlock;
82
+ export declare function assignBlockId(block: AIPBlock, replace?: boolean): string;
@@ -1,4 +1,4 @@
1
- import { DoCheck, OnDestroy, OnInit, ChangeDetectorRef } from '@angular/core';
1
+ import { DoCheck, OnDestroy, OnInit, ChangeDetectorRef, ElementRef } from '@angular/core';
2
2
  import { TBlocks } from '../../classes/Elements';
3
3
  import { PbUserInterfaceService } from '../../services/internals/user-interfaces/user-interface.service';
4
4
  import { PbEmailObjectStoreService } from '../../services/internals/pb-email-object-store/pb-email-object-store.service';
@@ -8,16 +8,23 @@ export declare class BlockComponent implements DoCheck, OnDestroy, OnInit {
8
8
  private userInterfaceService;
9
9
  private emailObjectStore;
10
10
  private chRef;
11
+ private elementRef;
11
12
  block: TBlocks;
12
13
  column: TBlocks[];
13
14
  index: number;
14
15
  isActive: boolean;
16
+ isHighlighted: boolean;
17
+ isDimmed: boolean;
15
18
  private readonly componentIsDestroyed$;
16
19
  onHostClick(event: MouseEvent): void;
17
20
  get isBlockActive(): boolean;
18
- constructor(pbMiddlewaresService: PbUserMiddlewaresService, userInterfaceService: PbUserInterfaceService, emailObjectStore: PbEmailObjectStoreService, chRef: ChangeDetectorRef);
21
+ get isBlockHighlighted(): boolean;
22
+ get isBlockDimmed(): boolean;
23
+ get blockId(): string;
24
+ constructor(pbMiddlewaresService: PbUserMiddlewaresService, userInterfaceService: PbUserInterfaceService, emailObjectStore: PbEmailObjectStoreService, chRef: ChangeDetectorRef, elementRef: ElementRef<HTMLElement>);
19
25
  removeBlock(): void;
20
26
  duplicateBlock(): void;
27
+ clearHighlight(event: Event): void;
21
28
  editBlock(): void;
22
29
  ngOnInit(): void;
23
30
  ngDoCheck(): void;
@@ -272,6 +272,26 @@ export interface IBlockState {
272
272
  */
273
273
  message: string;
274
274
  }
275
+ /**
276
+ * Controls how a highlighted canvas block is brought into view.
277
+ */
278
+ export interface IBlockHighlightOptions {
279
+ /**
280
+ * Scroll the highlighted block into view.
281
+ * @default true
282
+ */
283
+ scrollIntoView?: boolean;
284
+ /**
285
+ * Browser scrolling animation.
286
+ * @default smooth
287
+ */
288
+ behavior?: ScrollBehavior;
289
+ /**
290
+ * Vertical alignment used while scrolling.
291
+ * @default center
292
+ */
293
+ block?: ScrollLogicalPosition;
294
+ }
275
295
  /**
276
296
  * Builder {@link TextElementComponent} options interface.
277
297
  */
@@ -1,5 +1,5 @@
1
1
  import { Observable } from 'rxjs';
2
- import { IForRootConf, IUserModule, IUserTemplate } from './interfaces/interfaces';
2
+ import { IBlockHighlightOptions, IForRootConf, IUserModule, IUserTemplate } from './interfaces/interfaces';
3
3
  import { PBEmail } from './classes/DefaultEmail';
4
4
  import { PbEmailObjectStoreService } from './services/internals/pb-email-object-store/pb-email-object-store.service';
5
5
  import { PbUserMiddlewaresService } from './services/user-middleware-service/pb-middlewares.service';
@@ -36,6 +36,13 @@ export declare class PbEmailBuilderService {
36
36
  readonly isLoading: Observable<boolean>;
37
37
  readonly isLoading$: Observable<boolean>;
38
38
  openCustomSidebarTab(): void;
39
+ /**
40
+ * Highlights a canvas block by its persistent design JSON identifier.
41
+ * Returns false when the identifier is not present in the current email.
42
+ */
43
+ highlightBlock(blockId: string, options?: IBlockHighlightOptions): boolean;
44
+ /** Clears the current canvas block highlight. */
45
+ clearBlockHighlight(): void;
39
46
  constructor(config: IForRootConf, emailObjectStore: PbEmailObjectStoreService, pbMiddleWares: PbUserMiddlewaresService, pbUserInterface: PbUserInterfaceService);
40
47
  /**
41
48
  * Save current Email Template
@@ -330,6 +330,9 @@ export declare const PB_EMAIL_TEMPLATE_SCHEMA: {
330
330
  TextBlock: {
331
331
  type: string;
332
332
  properties: {
333
+ id: {
334
+ type: string;
335
+ };
333
336
  type: {
334
337
  type: string;
335
338
  enum: string[];
@@ -446,6 +449,9 @@ export declare const PB_EMAIL_TEMPLATE_SCHEMA: {
446
449
  ImageBlock: {
447
450
  type: string;
448
451
  properties: {
452
+ id: {
453
+ type: string;
454
+ };
449
455
  type: {
450
456
  type: string;
451
457
  enum: string[];
@@ -526,6 +532,9 @@ export declare const PB_EMAIL_TEMPLATE_SCHEMA: {
526
532
  VideoBlock: {
527
533
  type: string;
528
534
  properties: {
535
+ id: {
536
+ type: string;
537
+ };
529
538
  type: {
530
539
  type: string;
531
540
  enum: string[];
@@ -585,6 +594,9 @@ export declare const PB_EMAIL_TEMPLATE_SCHEMA: {
585
594
  ButtonBlock: {
586
595
  type: string;
587
596
  properties: {
597
+ id: {
598
+ type: string;
599
+ };
588
600
  type: {
589
601
  type: string;
590
602
  enum: string[];
@@ -650,6 +662,9 @@ export declare const PB_EMAIL_TEMPLATE_SCHEMA: {
650
662
  DividerBlock: {
651
663
  type: string;
652
664
  properties: {
665
+ id: {
666
+ type: string;
667
+ };
653
668
  type: {
654
669
  type: string;
655
670
  enum: string[];
@@ -688,6 +703,9 @@ export declare const PB_EMAIL_TEMPLATE_SCHEMA: {
688
703
  SpacerBlock: {
689
704
  type: string;
690
705
  properties: {
706
+ id: {
707
+ type: string;
708
+ };
691
709
  type: {
692
710
  type: string;
693
711
  enum: string[];
@@ -726,6 +744,9 @@ export declare const PB_EMAIL_TEMPLATE_SCHEMA: {
726
744
  SocialBlock: {
727
745
  type: string;
728
746
  properties: {
747
+ id: {
748
+ type: string;
749
+ };
729
750
  type: {
730
751
  type: string;
731
752
  enum: string[];
@@ -324,6 +324,9 @@ export declare const GENERATED_EMAIL_TEMPLATE_SCHEMA: {
324
324
  TextBlock: {
325
325
  type: string;
326
326
  properties: {
327
+ id: {
328
+ type: string;
329
+ };
327
330
  type: {
328
331
  type: string;
329
332
  enum: string[];
@@ -440,6 +443,9 @@ export declare const GENERATED_EMAIL_TEMPLATE_SCHEMA: {
440
443
  ImageBlock: {
441
444
  type: string;
442
445
  properties: {
446
+ id: {
447
+ type: string;
448
+ };
443
449
  type: {
444
450
  type: string;
445
451
  enum: string[];
@@ -520,6 +526,9 @@ export declare const GENERATED_EMAIL_TEMPLATE_SCHEMA: {
520
526
  VideoBlock: {
521
527
  type: string;
522
528
  properties: {
529
+ id: {
530
+ type: string;
531
+ };
523
532
  type: {
524
533
  type: string;
525
534
  enum: string[];
@@ -579,6 +588,9 @@ export declare const GENERATED_EMAIL_TEMPLATE_SCHEMA: {
579
588
  ButtonBlock: {
580
589
  type: string;
581
590
  properties: {
591
+ id: {
592
+ type: string;
593
+ };
582
594
  type: {
583
595
  type: string;
584
596
  enum: string[];
@@ -644,6 +656,9 @@ export declare const GENERATED_EMAIL_TEMPLATE_SCHEMA: {
644
656
  DividerBlock: {
645
657
  type: string;
646
658
  properties: {
659
+ id: {
660
+ type: string;
661
+ };
647
662
  type: {
648
663
  type: string;
649
664
  enum: string[];
@@ -682,6 +697,9 @@ export declare const GENERATED_EMAIL_TEMPLATE_SCHEMA: {
682
697
  SpacerBlock: {
683
698
  type: string;
684
699
  properties: {
700
+ id: {
701
+ type: string;
702
+ };
685
703
  type: {
686
704
  type: string;
687
705
  enum: string[];
@@ -720,6 +738,9 @@ export declare const GENERATED_EMAIL_TEMPLATE_SCHEMA: {
720
738
  SocialBlock: {
721
739
  type: string;
722
740
  properties: {
741
+ id: {
742
+ type: string;
743
+ };
723
744
  type: {
724
745
  type: string;
725
746
  enum: string[];
@@ -40,6 +40,7 @@ export declare class PbEmailObjectStoreService {
40
40
  canRedo$: import("rxjs").Observable<boolean>;
41
41
  constructor(userRestApi: PbUserRestApiService, pbStorage: PbStorageService, userMiddleware: PbUserMiddlewaresService, history: IpHistoryService, googleFonts: string[], config: IForRootConf);
42
42
  private get defaultTemplateThumbPath();
43
+ private assignBlockIds;
43
44
  createHTMLTemplate$(): import("rxjs").Observable<IMjmlServerResponse>;
44
45
  markForCheck(): void;
45
46
  setEmail(newEmail: PBEmail): void;
@@ -2,10 +2,14 @@ import { MatSnackBar } from '@angular/material/snack-bar';
2
2
  import { MatDialog } from '@angular/material/dialog';
3
3
  import { MatBottomSheet } from '@angular/material/bottom-sheet';
4
4
  import { Observable, ReplaySubject } from 'rxjs';
5
- import { IStructure, IUserTemplate, IUserTemplateCategory } from '../../../interfaces/interfaces';
5
+ import { IBlockHighlightOptions, IStructure, IUserTemplate, IUserTemplateCategory } from '../../../interfaces/interfaces';
6
6
  import { TBlocks } from '../../../classes/Elements';
7
7
  import { PbEmailObjectStoreService } from '../pb-email-object-store/pb-email-object-store.service';
8
8
  import { PBEmail } from '../../../classes/DefaultEmail';
9
+ export interface IBlockHighlightRequest {
10
+ blockId: string;
11
+ options: IBlockHighlightOptions;
12
+ }
9
13
  /**
10
14
  * @internal
11
15
  */
@@ -20,6 +24,8 @@ export declare class PbUserInterfaceService {
20
24
  readonly currentEditingStructure$: Observable<IStructure>;
21
25
  private readonly _currentEditingBlock$;
22
26
  readonly currentEditingBlock$: Observable<TBlocks>;
27
+ private readonly _blockHighlight$;
28
+ readonly blockHighlight$: Observable<IBlockHighlightRequest>;
23
29
  private readonly _editGeneralSettings$;
24
30
  readonly editGeneralSettings$: Observable<"general" | "structure" | "block">;
25
31
  private readonly _currentTabIndex$;
@@ -29,6 +35,8 @@ export declare class PbUserInterfaceService {
29
35
  editStructure(structure: IStructure): void;
30
36
  editGeneralSettings(): void;
31
37
  changeTabIndex(index: number): void;
38
+ highlightBlock(blockId: string, options?: IBlockHighlightOptions): void;
39
+ clearBlockHighlight(): void;
32
40
  confirmDialog$(): Observable<boolean>;
33
41
  templatesListDialog$(templateList: IUserTemplateCategory[]): Observable<{
34
42
  category: string;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@pobuca/email-builder",
3
3
  "description": "Email Builder",
4
4
  "private": false,
5
- "version": "1.4.1",
5
+ "version": "1.5.1",
6
6
  "homepage": "https://pobuca.com",
7
7
  "peerDependencies": {
8
8
  "@angular/common": ">=9",