diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-11-27 18:57:05 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-11-27 18:57:05 -0500 |
commit | 0c426c6d998fa4e53fc07e2465313ed8c08411fd (patch) | |
tree | a1666df80f27393b3f791220fe6d86bb6ebaae01 /assets/js/components | |
parent | 453513da298534702baef8f2416695bfb2ff1a90 (diff) |
Make autofocus works in text editor
Diffstat (limited to 'assets/js/components')
-rw-r--r-- | assets/js/components/suggest-menu.js | 1 | ||||
-rw-r--r-- | assets/js/components/text-editor.js | 5 |
2 files changed, 4 insertions, 2 deletions
diff --git a/assets/js/components/suggest-menu.js b/assets/js/components/suggest-menu.js index 22a58787..63a7551c 100644 --- a/assets/js/components/suggest-menu.js +++ b/assets/js/components/suggest-menu.js @@ -55,7 +55,6 @@ KB.component('suggest-menu', function(containerElement, options) { var lines = element.value.substring(0, element.selectionEnd).split("\n"); var lastLine = lines[lines.length - 1]; var words = lastLine.split(' '); - console.log(words); return words[words.length - 1]; } diff --git a/assets/js/components/text-editor.js b/assets/js/components/text-editor.js index 9b4be55c..8b601c01 100644 --- a/assets/js/components/text-editor.js +++ b/assets/js/components/text-editor.js @@ -10,6 +10,10 @@ KB.component('text-editor', function (containerElement, options) { .add(viewModeElement) .add(writeModeElement) .build()); + + if (options.autofocus) { + textarea.focus(); + } }; function buildViewMode() { @@ -50,7 +54,6 @@ KB.component('text-editor', function (containerElement, options) { .attr('name', options.name) .attr('tabindex', options.tabindex || '-1') .attr('required', options.required || false) - .attr('autofocus', options.autofocus || null) .text(options.text) // Order is important for IE11 .attr('placeholder', options.placeholder || null) .build(); |