1.0.6 • Published 7 months ago

mail-template-builder v1.0.6

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

Mail Builder Library

Mail Builder is an Angular library designed to help you create, manage, and customize email templates with ease. It provides a user-friendly interface and leverages Angular Material for a consistent and modern design.


Table of Contents


Installation

To install the Mail Builder library, run:

npm install mail-template-builder

Prerequisites

1. Angular Material

This library requires Angular Material to be installed in your project. If you haven’t set up Angular Material, you can install it by following these steps:

ng add @angular/material

2. Browser Animations Module

To enable animations (used by Angular Material), ensure that the BrowserAnimationsModule is configured in your application. This can be done by adding provideAnimationsAsync() to your app.config.ts file.

Example:

import { provideAnimationsAsync } from "@angular/platform-browser/animations";
import { ApplicationConfig } from "@angular/core";

export const appConfig: ApplicationConfig = {
  providers: [provideAnimationsAsync()],
};

3. Font Awesome Icons

The icons used in this library are displayed using a licensed version of Font Awesome. Development is ongoing to ensure all icons are displayed correctly, regardless of the host application's Font Awesome configuration.

  • If the free version of Font Awesome is configured in the host app, some icons will be available.
  • If the Pro version of Font Awesome is configured, all icons used in the library will be displayed as intended.

Getting Started

Once installed, import the MailBuilderModule into your application module or any feature module where you intend to use it.

Import Example:

import { MailBuilderModule } from 'mail-template-builder';

@Component({
  selector: 'app-mail-builder',
  standalone: true,
  imports: [MailBuilderModule],
  templateUrl: './mail-builder.component.html',
  styleUrl: './mail-builder.component.scss'
})
export class MailBuilderComponent

Usage

To use the Mail Builder, simply include its component in your templates.

Example:

<mail-builder color="lightblue" canvasBgColor="white" canvasHeight="calc(100vh - 100px)" propertiesBgColor="white" propertiesHeight="calc(100vh - 100px)" materialColor="primary" [copyHtml]="true" (convertToHtml)="sendEmail($event)"></mail-builder>
import { MailBuilderModule } from 'mail-template-builder';

@Component({
  selector: 'app-mail-builder',
  standalone: true,
  imports: [MailBuilderModule],
  templateUrl: './mail-builder.component.html',
  styleUrl: './mail-builder.component.scss'
})
export class MailBuilderComponent
    sendEmail(html: string) {
        // Place your code here to handle the generated html
}

Configuration

The library provides a set of configurable options for customization:

Inputs

PropertyTypeDefault ValueDescription
Appearance
colorstring'#1236b8'Sets the primary color used in the Mail Builder.
materialColor'primary' \| 'accent''primary'Sets the Angular Material theme color for components.
canvasBgColorstring'white'Sets the background color of the canvas area.
propertiesBgColorstring'white'Sets the background color of the properties panel.
Behavior
copyHtmlbooleanfalseEnables copying the generated HTML to the clipboard.
saveToStoragebooleanfalseEnables saving email templates to local storage.
Layout
canvasHeightstring'calc(100vh - 80px)'Sets the height of the canvas area.
propertiesHeightstring'calc(100vh - 80px)'Sets the height of the properties panel.
Labels
convertLabelstring"Create e-mail"Sets the label for the button that triggers the conversion to HTML.

Outputs

PropertyTypeDescription
convertToHtmlstringEmits the converted HTML when the "Create e-mail" action is triggered.

These options provide flexibility to customize the appearance and behavior of the Mail Builder to suit your application's needs.

For further details or examples, refer to the full documentation.


License

This package is licensed under the MIT License.


1.0.6

7 months ago

1.0.5

7 months ago

1.0.4

7 months ago

1.0.3

7 months ago

1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago