Skip to content
This repository has been archived by the owner on Jun 27, 2024. It is now read-only.

Input doesn't autofocus #9

Closed
Josasp opened this issue Aug 14, 2014 · 4 comments
Closed

Input doesn't autofocus #9

Josasp opened this issue Aug 14, 2014 · 4 comments

Comments

@Josasp
Copy link

Josasp commented Aug 14, 2014

Input doesn't autofocus.

Running Brackets 0.42.0-13957 and fix to extension from rarebush

@jkillian
Copy link

+1
I'm encountering this issue as well. I don't know anything about the Brackets API, but I'm happy to submit a pull request if anyone can guide me in the right direction for the fix

@invokablegmbh
Copy link

Just add
$('#surround_input').focus();
as a last line to the surround-function:

 function surround() {
        var _t = _getSelectedText(),
            _output = "";
        Dialogs.showModalDialogUsingTemplate(surroundHtml);
        $('#surround_input').keyup(function (e) {
            if (e.which === 13) {
                e.preventDefault();
                var _c = $('#surround_input').val();

                if (_c === null) {
                    return;
                }
                if (cases[_c] !== undefined) {
                    _output = _c + _t + cases[_c];
                } else {
                    if (_isHTML(_c)) {
                        if (_closeHTML(_c) === false) {
                            Dialogs.cancelModalDialogIfOpen('surround_input');
                            return;
                        }
                        _output = _c + _t + _closeHTML(_c);
                    } else {
                        _output = _c + _t + _c;
                    }
                }
                $('.surround_input').fadeOut(300);
                Dialogs.cancelModalDialogIfOpen('surround_input');
                _replaceActiveSelection(_output);
            }
        });
        $('#surround_input').focus();
    }

@jkillian
Copy link

Thanks jarmediagmbh. Just wanted to point out that this pull request will fix the issue if merged.

@pedelman
Copy link
Owner

This has been resolved, thanks for the feedback. If you had it previously installed through the extensions registry, you can now update and it should work as intended.

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants