From f864bc8fec86997cddc8d48bf91bbc9d6dda861c Mon Sep 17 00:00:00 2001 From: yuri Date: Mon, 11 Mar 2019 11:01:18 +0200 Subject: [PATCH] text field displayRawText param --- application/Espo/Resources/i18n/en_US/Admin.json | 3 ++- application/Espo/Resources/metadata/fields/text.json | 4 ++++ client/res/templates/fields/text/detail.tpl | 2 +- client/res/templates/fields/text/list.tpl | 2 +- client/src/views/fields/text.js | 4 +++- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/application/Espo/Resources/i18n/en_US/Admin.json b/application/Espo/Resources/i18n/en_US/Admin.json index 1174566a41..d02c1600d1 100644 --- a/application/Espo/Resources/i18n/en_US/Admin.json +++ b/application/Espo/Resources/i18n/en_US/Admin.json @@ -182,7 +182,8 @@ "inlineEditDisabled": "Disable Inline Edit", "allowCustomOptions": "Allow Custom Options", "displayAsLabel": "Display as Label", - "maxCount": "Max Item Count" + "maxCount": "Max Item Count", + "displayRawText": "Display raw text (no markdown)" }, "messages": { "upgradeVersion": "EspoCRM will be upgraded to version {version}. Please be patient as this may take a while.", diff --git a/application/Espo/Resources/metadata/fields/text.json b/application/Espo/Resources/metadata/fields/text.json index e9792c7c8f..c3097e8df9 100644 --- a/application/Espo/Resources/metadata/fields/text.json +++ b/application/Espo/Resources/metadata/fields/text.json @@ -30,6 +30,10 @@ "default": 200, "min": 1 }, + { + "name": "displayRawText", + "type":"bool" + }, { "name":"readOnly", "type":"bool" diff --git a/client/res/templates/fields/text/detail.tpl b/client/res/templates/fields/text/detail.tpl index 6ed97dc65b..1905d762c8 100644 --- a/client/res/templates/fields/text/detail.tpl +++ b/client/res/templates/fields/text/detail.tpl @@ -1,3 +1,3 @@ -{{#if isNotEmpty}}
{{complexText value}}
+{{#if isNotEmpty}}
{{#unless displayRawText}}{{complexText value}}{{else}}{{breaklines value}}{{/unless}}
{{#if isCut}}{{/if}} {{else}}{{#if valueIsSet}}{{translate 'None'}}{{else}}...{{/if}}{{/if}} \ No newline at end of file diff --git a/client/res/templates/fields/text/list.tpl b/client/res/templates/fields/text/list.tpl index 7ab6087794..1e6081bc78 100644 --- a/client/res/templates/fields/text/list.tpl +++ b/client/res/templates/fields/text/list.tpl @@ -1,3 +1,3 @@ -{{#if isNotEmpty}}
{{complexText value}}
+{{#if isNotEmpty}}
{{#unless displayRawText}}{{complexText value}}{{else}}{{breaklines value}}{{/unless}}
{{#if isCut}}{{/if}} {{/if}} diff --git a/client/src/views/fields/text.js b/client/src/views/fields/text.js index af12a0939b..26c1581507 100644 --- a/client/src/views/fields/text.js +++ b/client/src/views/fields/text.js @@ -117,12 +117,14 @@ Espo.define('views/fields/text', 'views/fields/base', function (Dep) { } data.valueIsSet = this.model.has(this.name); - if (this.mode == 'detail' || this.mode == 'list') { + if (this.isReadMode()) { data.isCut = this.isCut(); if (data.isCut) { data.cutHeight = this.cutHeight; } + + data.displayRawText = this.params.displayRawText; } return data;