From f5a7a09be5f0728b2f27d42b142c4c620f10d0b8 Mon Sep 17 00:00:00 2001
From: rhenck <richard.henck@iqb.hu-berlin.de>
Date: Mon, 1 Aug 2022 17:50:19 +0200
Subject: [PATCH] [editor] Fix reading of inline images in test elements

The TipTap editor needs a setting to be able to read base64 encoded
images.

Also improve method name.

#297
---
 .../editor/src/app/text-editor/rich-text-editor.component.html | 2 +-
 .../editor/src/app/text-editor/rich-text-editor.component.ts   | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/projects/editor/src/app/text-editor/rich-text-editor.component.html b/projects/editor/src/app/text-editor/rich-text-editor.component.html
index 4991d39c0..e746d813b 100644
--- a/projects/editor/src/app/text-editor/rich-text-editor.component.html
+++ b/projects/editor/src/app/text-editor/rich-text-editor.component.html
@@ -252,7 +252,7 @@
         <button mat-button (click)="insertSpecialChar('&diams;')">&diams;</button>
       </mat-menu>
       <button mat-icon-button matTooltip="Bild" [matTooltipShowDelay]="300"
-              (click)="addImage()">
+              (click)="insertImage()">
         <mat-icon>image</mat-icon>
       </button>
       <button mat-icon-button matTooltip="Zitat" [matTooltipShowDelay]="300"
diff --git a/projects/editor/src/app/text-editor/rich-text-editor.component.ts b/projects/editor/src/app/text-editor/rich-text-editor.component.ts
index 1865ffab6..26eda925d 100644
--- a/projects/editor/src/app/text-editor/rich-text-editor.component.ts
+++ b/projects/editor/src/app/text-editor/rich-text-editor.component.ts
@@ -74,6 +74,7 @@ export class RichTextEditorComponent implements OnInit, AfterViewInit {
     HangingIndent,
     Image.configure({
       inline: true,
+      allowBase64: true,
       HTMLAttributes: {
         style: 'display: inline-block; height: 1em; vertical-align: middle'
       }
@@ -210,7 +211,7 @@ export class RichTextEditorComponent implements OnInit, AfterViewInit {
     this.editor.commands.unhangIndent(this.selectedIndentSize);
   }
 
-  async addImage(): Promise<void> {
+  async insertImage(): Promise<void> {
     const mediaSrc = await FileService.loadImage();
     this.editor.commands.setImage({ src: mediaSrc });
   }
-- 
GitLab