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
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(); .build();
textarea = KB.dom('textarea') var textareaElement = KB.dom('textarea');
.attr('name', options.name) textareaElement.attr('name', options.name);
.attr('tabindex', options.tabindex || '-1')
.attr('required', options.required || false) if (options.tabindex) {
.text(options.text) // Order is important for IE11 textareaElement.attr('tabindex', options.tabindex);
.attr('placeholder', options.placeholder || null) }
.build();
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) { if (options.mentionUrl) {
KB.getComponent('suggest-menu', textarea, {triggers: {'@': options.mentionUrl}}).render(); KB.getComponent('suggest-menu', textarea, {triggers: {'@': options.mentionUrl}}).render();