Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,52 +31,9 @@ export class AngularEditorToolbarComponent {
foreColour;
backColor;

headings: SelectOption[] = [
{
label: 'Heading 1',
value: 'h1',
},
{
label: 'Heading 2',
value: 'h2',
},
{
label: 'Heading 3',
value: 'h3',
},
{
label: 'Heading 4',
value: 'h4',
},
{
label: 'Heading 5',
value: 'h5',
},
{
label: 'Heading 6',
value: 'h6',
},
{
label: 'Heading 7',
value: 'h7',
},
{
label: 'Paragraph',
value: 'p',
},
{
label: 'Predefined',
value: 'pre'
},
{
label: 'Standard',
value: 'div'
},
{
label: 'default',
value: 'default'
}
];
// headings: SelectOption[] = [

// ];

fontSizes: SelectOption[] = [
{
Expand Down Expand Up @@ -130,6 +87,7 @@ export class AngularEditorToolbarComponent {
@Input() upload: (file: File) => Observable<HttpEvent<UploadResponse>>;
@Input() showToolbar: boolean;
@Input() fonts: SelectOption[] = [{label: '', value: ''}];
@Input() headings: SelectOption[] = [{label: '', value: ''}];

@Input()
set customClasses(classes: CustomClass[]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
[upload]="config.upload"
[showToolbar]="config.showToolbar !== undefined ? config.showToolbar : true"
[fonts]="getFonts()"
[headings]="getHeadings()"
[customClasses]="config.customClasses"
[defaultFontName]="config.defaultFontName"
[defaultFontSize]="config.defaultFontSize"
Expand Down
6 changes: 6 additions & 0 deletions projects/angular-editor/src/lib/angular-editor.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,12 @@ export class AngularEditorComponent implements OnInit, ControlValueAccessor, Aft
});
}

getHeadings(){
const headings = this.config.headings ? this.config.headings : angularEditorConfig.headings;

return headings;
}

getCustomTags() {
const tags = ['span'];
this.config.customClasses.forEach(x => {
Expand Down
52 changes: 52 additions & 0 deletions projects/angular-editor/src/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ export interface Font {
class: string;
}

export interface Headings {
label: string;
value: string;
}

export interface AngularEditorConfig {
editable?: boolean;
spellcheck?: boolean;
Expand All @@ -32,6 +37,7 @@ export interface AngularEditorConfig {
upload?: (file: File) => Observable<HttpEvent<UploadResponse>>;
uploadWithCredentials?: boolean;
fonts?: Font[];
headings?: Headings[];
customClasses?: CustomClass[];
sanitize?: boolean;
toolbarPosition?: 'top' | 'bottom';
Expand Down Expand Up @@ -61,6 +67,52 @@ export const angularEditorConfig: AngularEditorConfig = {
{class: 'calibri', name: 'Calibri'},
{class: 'comic-sans-ms', name: 'Comic Sans MS'}
],
headings:[
{
label: 'Heading 1',
value: 'h1',
},
{
label: 'Heading 2',
value: 'h2',
},
{
label: 'Heading 3',
value: 'h3',
},
{
label: 'Heading 4',
value: 'h4',
},
{
label: 'Heading 5',
value: 'h5',
},
{
label: 'Heading 6',
value: 'h6',
},
{
label: 'Heading 7',
value: 'h7',
},
{
label: 'Paragraph',
value: 'p',
},
{
label: 'Predefined',
value: 'pre'
},
{
label: 'Standard',
value: 'div'
},
{
label: 'default',
value: 'default'
}
],
uploadUrl: 'v1/image',
uploadWithCredentials: false,
sanitize: true,
Expand Down