jordandelozier / wysibb

WYSIWYG BBcode editor
http://www.wysibb.com
246 stars 86 forks source link

Cursor don't move down, when I clicked Enter key in Safari on OS X. #99

Closed vylgin closed 9 years ago

vylgin commented 9 years ago

If I click on the button Enter, a new text line is added, and the cursor don't move down in Safari on OS X (http://www.wysibb.com/demo).

guysaq commented 9 years ago

1+

guysaq commented 9 years ago

vylgin, can you please let me know if you fixed it? i am still looking for fix for it

vylgin commented 9 years ago

I still did not fix it. I'm looking for too. If I find a solution, then write about it

vylgin commented 9 years ago

File jquery.wysibb.js contains

//insert BR on press enter
this.$body.bind('keydown',$.proxy(function(e) {
    if (e.which == 13) {
        var isLi = this.isContain(this.getSelectNode(),'li');
        if (!isLi) {
            if (e.preventDefault) {e.preventDefault();}
                this.checkForLastBR(this.getSelectNode());
                this.insertAtCursor('<br/>',false);
            }
        }
},this));

I think we can solve the problem by refactor this code.

chuve commented 9 years ago

i have the same problem, any ideas?

OliverIost commented 9 years ago

Problem solved! Added the two bold lines in the context described below.

execNativeCommand: function(cmd,param) {

...

}else if (cmd=="insertHTML") { //fix webkit bug with insertHTML var sel = this.getSelection(); var e = this.elFromString(param); var rng = (this.lastRange) ? this.lastRange:this.getRange(); rng.deleteContents(); rng.insertNode(e); rng.setStartAfter(e); rng.setEndAfter(e); rng.collapse(false); sel.removeAllRanges(); sel.addRange(rng);

vylgin commented 9 years ago

Thanks!

jordandelozier commented 9 years ago

Fixed by Oliverlost. Thanks.