[FIX] Apps: setting with 'code' type only saving last line (#11992)

pull/12044/head
Matheus Cardoso 7 years ago committed by Diego Sampaio
parent d40354d85e
commit 7763d0b2f8
  1. 2
      packages/rocketchat-apps/client/admin/appManage.html
  2. 4
      packages/rocketchat-apps/client/admin/appManage.js

@ -245,7 +245,7 @@
<div class="rc-input__title">{{_ i18nLabel}}</div> <div class="rc-input__title">{{_ i18nLabel}}</div>
<div class="rc-input__wrapper"> <div class="rc-input__wrapper">
{{#if isDisabled.disabled}} {{#if isDisabled.disabled}}
{{> CodeMirror name=id options=(getEditorOptions true) code=(i18nDefaultValue) }} {{> CodeMirror name=id options=(getEditorOptions true) code=(i18nDefaultValue) }}
{{else}} {{else}}
<div class="code-mirror-box" data-editor-id="{{id}}"> <div class="code-mirror-box" data-editor-id="{{id}}">
<div class="title"> <div class="title">

@ -388,12 +388,16 @@ Template.appManage.events({
'input input, input textarea, change input[type="color"]': _.throttle(function(e, t) { 'input input, input textarea, change input[type="color"]': _.throttle(function(e, t) {
let value = s.trim($(e.target).val()); let value = s.trim($(e.target).val());
switch (this.type) { switch (this.type) {
case 'int': case 'int':
value = parseInt(value); value = parseInt(value);
break; break;
case 'boolean': case 'boolean':
value = value === '1'; 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]; const setting = t.settings.get()[this.id];

Loading…
Cancel
Save