wysihtml5 icon indicating copy to clipboard operation
wysihtml5 copied to clipboard

Focus move up one line after press enter key

Open newset opened this issue 10 years ago • 11 comments

I have this bug, when press enter key once, then press it again, the cursor will first move down, then move up to the line before. and this is only affecting Chrome, anybody help?

newset avatar Jun 09 '14 07:06 newset

:+1:

I first noticed this bug in Chrome Canary few months ago and in Chrome few weeks ago. Not happening in Firefox or Safari.

janvarljen avatar Jun 11 '14 08:06 janvarljen

Does it happen with this version: http://edicy.github.io/wysihtml5/

The repo here is not maintained anymore. I suggest switching over.

Waxolunist avatar Jun 11 '14 11:06 Waxolunist

@Waxolunist Yup. I tested it and it works perfectly.

alvincrespo avatar Jun 11 '14 12:06 alvincrespo

oh, I submitted at the wrong place, this comes with bootstrap-wysihtml5. https://github.com/jhollingworth/bootstrap-wysihtml5

newset avatar Jun 11 '14 13:06 newset

This is not maintained either. If you want an up to date wysihtml5 editor with bootstrap3 integration I strongly suggest my own repo: https://github.com/Waxolunist/bootstrap3-wysihtml5-bower

Waxolunist avatar Jun 11 '14 13:06 Waxolunist

commenting these lines (5869 and 5870) in wysihtml5-0.3.0.js fixes it:

composer.commands.exec("insertLineBreak"); event.preventDefault();

Example:

if (keyCode === wysihtml5.ENTER_KEY && !wysihtml5.browser.insertsLineBreaksOnReturn()) { //composer.commands.exec("insertLineBreak"); //event.preventDefault(); }

htmlboy avatar Sep 15 '14 14:09 htmlboy

@Waxolunist thanks for the link to working versions! :+1: :smile: @htmlboy Your fix worked for me as well :beers:

People following @htmlboy's suggestion, for editing the minified version: Remove the following from line 163: &&(e.commands.exec("insertLineBreak"),g.preventDefault())

kurtfunai avatar Nov 14 '14 16:11 kurtfunai

@htmlboy comment works perfectly. thanks @htmlboy

vijaymchauhan avatar Feb 05 '15 06:02 vijaymchauhan

@htmlboy & @kurtfunai thanks so much! This works great.

nathanhamilton avatar Jun 24 '15 20:06 nathanhamilton

@nathanhamilton I actually ended up having issues with the fix mentioned in @htmlboy's comments. After adding it to our app, newlines were not being correctly added via the wyshtml project.

I actually ended up migrating to a new/active fork of this project: https://github.com/Voog/wysihtml It is pretty similar, but has some nice improvements (no longer uses iFrames, resizes text area by default, and does not have this bug)

Best of luck!

kurtfunai avatar Jun 24 '15 21:06 kurtfunai

@kurtfunai Thank you so much for letting me know you had issues. I will check out that project!

nathanhamilton avatar Jun 25 '15 14:06 nathanhamilton