summaryrefslogtreecommitdiff
path: root/assets/js/components
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-12-01 20:13:06 -0500
committerFrederic Guillot <fred@kanboard.net>2016-12-01 20:13:06 -0500
commit9c06bc4ed25a08e75d4677834a29f801f6e42423 (patch)
tree34538d31265081a1dea65e27c1fb1e784a7b7e16 /assets/js/components
parent4e9c582e37e7652d4e2004474751633a5624114f (diff)
Avoid bad options assignement for text editor
Diffstat (limited to 'assets/js/components')
-rw-r--r--assets/js/components/text-editor.js26
1 files changed, 19 insertions, 7 deletions
diff --git a/assets/js/components/text-editor.js b/assets/js/components/text-editor.js
index f94b72f8..9a185cf2 100644
--- a/assets/js/components/text-editor.js
+++ b/assets/js/components/text-editor.js
@@ -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();