Skip to content

Commit

Permalink
[FIX] Apps: setting with 'code' type only saving last line (#11992)
Browse files Browse the repository at this point in the history
  • Loading branch information
cardoso authored and sampaiodiego committed Sep 11, 2018
1 parent 962d0dc commit d66c80d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/rocketchat-apps/client/admin/appManage.html
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ <h2> {{_ "Settings"}} </h2>
<div class="rc-input__title">{{_ i18nLabel}}</div>
<div class="rc-input__wrapper">
{{#if isDisabled.disabled}}
{{> CodeMirror name=id options=(getEditorOptions true) code=(i18nDefaultValue) }}
{{> CodeMirror name=id options=(getEditorOptions true) code=(i18nDefaultValue) }}
{{else}}
<div class="code-mirror-box" data-editor-id="{{id}}">
<div class="title">
Expand Down
4 changes: 4 additions & 0 deletions packages/rocketchat-apps/client/admin/appManage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit d66c80d

Please sign in to comment.