mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-21 03:42:00 +01:00
* refactor: var to const and let * fix: missed global bootbox usage * refactor: align with eslint expectations
37 lines
699 B
JavaScript
37 lines
699 B
JavaScript
'use strict';
|
|
|
|
define('settings/textarea', function () {
|
|
let Settings = null;
|
|
|
|
const SettingsArea = {
|
|
types: ['textarea'],
|
|
use: function () {
|
|
Settings = this;
|
|
},
|
|
create: function () {
|
|
return Settings.helper.createElement('textarea');
|
|
},
|
|
set: function (element, value, trim) {
|
|
if (trim && value != null && typeof value.trim === 'function') {
|
|
value = value.trim();
|
|
}
|
|
element.val(value || '');
|
|
},
|
|
get: function (element, trim, empty) {
|
|
let value = element.val();
|
|
if (trim) {
|
|
if (value == null) {
|
|
value = undefined;
|
|
} else {
|
|
value = value.trim();
|
|
}
|
|
}
|
|
if (empty || value) {
|
|
return value;
|
|
}
|
|
},
|
|
};
|
|
|
|
return SettingsArea;
|
|
});
|