From 723df026b496f7b01d27266fc787816016e9a9dc Mon Sep 17 00:00:00 2001
From: Johannes Hoermann <j.hoermann@adito.de>
Date: Tue, 10 Sep 2019 16:15:37 +0200
Subject: [PATCH] Bulkmail: some content editor fiexes

---
 .../entityfields/content/stateProcess.js            | 13 +++++++++----
 .../BulkMailContent_view/BulkMailContent_view.aod   |  4 ++++
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/entity/BulkMail_entity/entityfields/content/stateProcess.js b/entity/BulkMail_entity/entityfields/content/stateProcess.js
index 6911573910a..237d5230c07 100644
--- a/entity/BulkMail_entity/entityfields/content/stateProcess.js
+++ b/entity/BulkMail_entity/entityfields/content/stateProcess.js
@@ -3,15 +3,20 @@ import("system.vars");
 import("system.neon");
 import("DocumentTemplate_lib");
 
+// in edit mode
 if (vars.get("$sys.recordstate") != neon.OPERATINGSTATE_VIEW && 
     (vars.get("$context.currentTemplateType") == DocumentTemplate.types.EML
       || vars.get("$context.currentTemplateType") == DocumentTemplate.types.HTML)) // TODO: invisible for html as there are problems with images which are removed by the html-editor
 {
     result.string(neon.COMPONENTSTATE_INVISIBLE);
 }
-// keep in invisible mode to prevent a visible editor directly after save which needs much time to initiate (for eml)
-// somehow the edit view is in view mode and the editor doesn't know anything about it and initializes itself...
-else if (vars.get("$context.currentTemplateType") == DocumentTemplate.types.EML || vars.get("$context.currentTemplateType") == DocumentTemplate.types.HTML)
+// in view mode disable for eml
+else if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_VIEW && 
+        (vars.get("$context.currentTemplateType") == DocumentTemplate.types.EML 
+        // in view mode also disable for html to work around missing image-support for the html-editor
+            || vars.get("$context.currentTemplateType") == DocumentTemplate.types.HTML))
     result.string(neon.COMPONENTSTATE_INVISIBLE);
 else
-    result.string(neon.COMPONENTSTATE_EDITABLE);
\ No newline at end of file
+{
+    result.string(neon.COMPONENTSTATE_EDITABLE);
+}
\ No newline at end of file
diff --git a/neonView/BulkMailContent_view/BulkMailContent_view.aod b/neonView/BulkMailContent_view/BulkMailContent_view.aod
index 83d2fdaa7b9..06a0bc7b789 100644
--- a/neonView/BulkMailContent_view/BulkMailContent_view.aod
+++ b/neonView/BulkMailContent_view/BulkMailContent_view.aod
@@ -35,6 +35,10 @@
           <name>af0d45a2-a96f-4031-a93d-62ac177efb43</name>
           <entityField>content</entityField>
         </entityFieldLink>
+        <entityFieldLink>
+          <name>5ae4212f-4107-447e-af57-9ab60fb8075a</name>
+          <entityField>preview</entityField>
+        </entityFieldLink>
       </fields>
     </genericViewTemplate>
   </children>
-- 
GitLab