tiff / wysihtml5

Open source rich text editor based on HTML5 and the progressive-enhancement approach. Uses a sophisticated security concept and aims to generate fully valid HTML5 markup by preventing unmaintainable tag soups and inline styles.
http://xing.github.com/wysihtml5/
MIT License
6.48k stars 995 forks source link

Focus move up one line after press enter key #497

Open newset opened 10 years ago

newset commented 10 years ago

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?

janvarljen commented 10 years ago

:+1:

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

Waxolunist commented 10 years ago

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

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

alvincrespo commented 10 years ago

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

newset commented 10 years ago

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

Waxolunist commented 10 years ago

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

htmlboy commented 10 years ago

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(); }

kurtfunai commented 10 years ago

@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())

vijaymchauhan commented 9 years ago

@htmlboy comment works perfectly. thanks @htmlboy

nathanhamilton commented 9 years ago

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

kurtfunai commented 9 years ago

@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!

nathanhamilton commented 9 years ago

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