Make autofocus works in text editor
This commit is contained in:
parent
453513da29
commit
0c426c6d99
|
|
@ -220,6 +220,7 @@ class FormHelper extends Base
|
|||
'labelPreview' => t('Preview'),
|
||||
'labelWrite' => t('Write'),
|
||||
'placeholder' => t('Write your text in Markdown'),
|
||||
'autofocus' => isset($attributes['autofocus']) && $attributes['autofocus']
|
||||
);
|
||||
|
||||
if (isset($values['project_id'])) {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -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];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue