From 757a42f1abf1caf858465eb6a37a0f5dd72b6ef1 Mon Sep 17 00:00:00 2001 From: Johannes Hoermann <j.hoermann@adito.de> Date: Thu, 5 Sep 2019 13:12:21 +0200 Subject: [PATCH] fix state of content in document template --- .../entityfields/content/stateProcess.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/entity/DocumentTemplate_entity/entityfields/content/stateProcess.js b/entity/DocumentTemplate_entity/entityfields/content/stateProcess.js index bfa1132cc4..635b6ea244 100644 --- a/entity/DocumentTemplate_entity/entityfields/content/stateProcess.js +++ b/entity/DocumentTemplate_entity/entityfields/content/stateProcess.js @@ -5,10 +5,14 @@ import("system.neon"); if (vars.get("$field.Content") || !vars.get("$field.BINDATA")) { - // Workaround: prevent removing images via html-editor -> use only preview-field if it's html var type = DocumentTemplateUtils.getContentType(vars.get("$field.DOCUMENTTEMPLATEID"), new FileUpload(vars.get("$field.BINDATA"))) - if (type == DocumentTemplate.types.HTML && !(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$field.BINDATA"))) + if ((type != DocumentTemplate.types.TXT || + // Workaround: prevent removing images via html-editor -> use only the preview-field if it's html and not the content field + // That's why type HTML -> invisible + type == DocumentTemplate.types.HTML) && !(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$field.BINDATA"))) + { result.string(neon.COMPONENTSTATE_INVISIBLE); + } else result.string(neon.COMPONENTSTATE_EDITABLE); } -- GitLab