Avoid bad options assignement for text editor

This commit is contained in:
Frederic Guillot 2016-12-01 20:13:06 -05:00
parent 4e9c582e37
commit 9c06bc4ed2
No known key found for this signature in database
GPG Key ID: 92D77191BA7FBC99
2 changed files with 20 additions and 8 deletions

File diff suppressed because one or more lines are too long

View File

@ -50,13 +50,25 @@ KB.component('text-editor', function (containerElement, options) {
])
.build();
textarea = KB.dom('textarea')
.attr('name', options.name)
.attr('tabindex', options.tabindex || '-1')
.attr('required', options.required || false)
.text(options.text) // Order is important for IE11
.attr('placeholder', options.placeholder || null)
.build();
var textareaElement = KB.dom('textarea');
textareaElement.attr('name', options.name);
if (options.tabindex) {
textareaElement.attr('tabindex', options.tabindex);
}
if (options.required) {
textareaElement.attr('required', 'required');
}
// Order is important for IE11 (especially for the placeholder)
textareaElement.text(options.text);
if (options.placeholder) {
textareaElement.attr('placeholder', options.placeholder);
}
textarea = textareaElement.build();
if (options.mentionUrl) {
KB.getComponent('suggest-menu', textarea, {triggers: {'@': options.mentionUrl}}).render();