fix(menu): request base tag injection via gui param and fix preview base href

main
Juan Manuel Bardallo 2026-09-17 14:36:43 +02:00
parent 4224af359b
commit 4c2867b1c4
1 changed files with 3 additions and 4 deletions

View File

@ -48,8 +48,8 @@ export class CreateMenuComponent implements OnInit {
}
updateSafeUrl(): void {
const url = `${this.baseUrl}/menu/${this.menuForm.get('publicUrl')?.value}`;
if (url) {
const url = `${this.baseUrl}/menu/${this.menuForm.get('publicUrl')?.value}?gui=1`;
if (url && this.menuForm.get('publicUrl')?.value) {
this.safeUrl = this.sanitizer.bypassSecurityTrustResourceUrl(url);
} else {
this.safeUrl = null;
@ -122,8 +122,7 @@ export class CreateMenuComponent implements OnInit {
this.dataService.previewMenuTemplate(base64Content).subscribe({
next: (renderedHtml) => {
// Ensure relative paths work in the data URL iframe by injecting a <base> tag
const origin = new URL(this.baseUrl).origin;
const baseTag = `<base href="${origin}/">`;
const baseTag = `<base href="${this.baseUrl}/">`;
let finalHtml = renderedHtml;
if (finalHtml.toLowerCase().includes('<head>')) {