add drag and drop builder

This commit is contained in:
Krrish Ghimire
2026-07-01 01:14:40 +05:45
parent 65f38d68c5
commit 77b32b4d32
31 changed files with 2187 additions and 1 deletions

View File

@@ -0,0 +1,23 @@
import { Component, Input } from '@angular/core';
import { NgIf } from '@angular/common';
@Component({
selector: 'app-heading-renderer',
standalone: true,
imports: [NgIf],
template: `
<h1 *ngIf="config['level'] === 'h1'" [style]="styleStr">{{ config['text'] }}</h1>
<h2 *ngIf="config['level'] === 'h2' || !config['level']" [style]="styleStr">{{ config['text'] }}</h2>
<h3 *ngIf="config['level'] === 'h3'" [style]="styleStr">{{ config['text'] }}</h3>
<h4 *ngIf="config['level'] === 'h4'" [style]="styleStr">{{ config['text'] }}</h4>
<h5 *ngIf="config['level'] === 'h5'" [style]="styleStr">{{ config['text'] }}</h5>
<h6 *ngIf="config['level'] === 'h6'" [style]="styleStr">{{ config['text'] }}</h6>
`,
})
export class HeadingRenderer {
@Input() config: Record<string, unknown> = {};
@Input() styles: Record<string, unknown> = {};
get styleStr(): string {
return Object.entries(this.styles).map(([k, v]) => `${k.replace(/[A-Z]/g, c => '-' + c.toLowerCase())}: ${v}`).join('; ');
}
}