Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with spacebar #52

Open
pidompa opened this issue Oct 8, 2015 · 0 comments
Open

Problems with spacebar #52

pidompa opened this issue Oct 8, 2015 · 0 comments

Comments

@pidompa
Copy link

pidompa commented Oct 8, 2015

Hi,
first of all congratulation for the great and lighweight module.
I had an issue when pressing spacebar. The editor doesn't print the space but it falls down with the default behaviour of scrolling the whole webpage.
I checked the code and fixed it by adding

event.stopPropagation();

at the end of the event handler on keydown

Following the piece of code

textarea.on('keydown', function (event) {
            if (event.keyCode == 9) {
              var TAB_SPACES = 4;
              var html = textarea.html();
              var selection = window.getSelection();
              var position = selection.anchorOffset;
              event.preventDefault();  // html = insertTab(html, position);
                                       // textarea.html(html);
                                       // selection.collapse(textarea[0].firstChild, position + TAB_SPACES);    
            }

            // THIS IS THE LINE I ADDED <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
            event.stopPropagation();
          });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant