From d66c80de25a7287c25b58a605fd9f6187fae85e3 Mon Sep 17 00:00:00 2001 From: Matheus Cardoso Date: Tue, 11 Sep 2018 13:50:37 -0300 Subject: [PATCH] [FIX] Apps: setting with 'code' type only saving last line (#11992) --- packages/rocketchat-apps/client/admin/appManage.html | 2 +- packages/rocketchat-apps/client/admin/appManage.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/rocketchat-apps/client/admin/appManage.html b/packages/rocketchat-apps/client/admin/appManage.html index 78016830b9b7..ec439cf1b43f 100644 --- a/packages/rocketchat-apps/client/admin/appManage.html +++ b/packages/rocketchat-apps/client/admin/appManage.html @@ -245,7 +245,7 @@

{{_ "Settings"}}

{{_ i18nLabel}}
{{#if isDisabled.disabled}} - {{> CodeMirror name=id options=(getEditorOptions true) code=(i18nDefaultValue) }} + {{> CodeMirror name=id options=(getEditorOptions true) code=(i18nDefaultValue) }} {{else}}
diff --git a/packages/rocketchat-apps/client/admin/appManage.js b/packages/rocketchat-apps/client/admin/appManage.js index ad382b66e6e7..7b88a898b1a5 100644 --- a/packages/rocketchat-apps/client/admin/appManage.js +++ b/packages/rocketchat-apps/client/admin/appManage.js @@ -388,12 +388,16 @@ Template.appManage.events({ 'input input, input textarea, change input[type="color"]': _.throttle(function(e, t) { let value = s.trim($(e.target).val()); + switch (this.type) { case 'int': value = parseInt(value); break; case 'boolean': value = value === '1'; + break; + case 'code': + value = $(`.code-mirror-box[data-editor-id="${ this.id }"] .CodeMirror`)[0].CodeMirror.getValue(); } const setting = t.settings.get()[this.id];