mindmup / bootstrap-wysiwyg

Tiny bootstrap-compatible WISWYG rich text editor
MIT License
5.55k stars 840 forks source link

Bug with link insertion. #181

Open Dominis13 opened 9 years ago

Dominis13 commented 9 years ago

I found bug with link insertion. Can be easy reproduced on demo.

  1. Select some text.
  2. Click 'Add link' button for open dialog.
  3. Click to the pageurl or some other tab for copying the URL.
  4. Insert url and press ok -> Url will insert into the beginning of editor. For test i add console.log(window.getSelection()) right before the execute command and each time when bug happens it's show element with baseOffset: 0. Unfortunately i not found any way to solve it.

Bug happens in Chrome. Can't reproduce in FF

ishpreetkaur commented 9 years ago

I am also facing same issue. Url is inserting at the beginning of editor.

solomax commented 9 years ago

FF 35.0.1 Ubuntu 14.10, link insertion is not working :( In Chrome works with the issue described here

KELbTIK commented 5 years ago

Hi guys, i was able to solve this: need to clear mouseout event coz it saves wrong selection:

editor.attr('contenteditable', true)
    .on('mouseup keyup mouseout', function () {
        saveSelection();
        updateToolbar();
    });

also for someone who's looking for support of IE11 there is bug with the focus of the input for creating link. Solution is following:

need to wrap these lines:

input.data(options.selectionMarker, color);

input.focus();

with setTimeout, like:

setTimeout(function(){
       input.data(options.selectionMarker, color);
})
setTimeout(function() {
       input.focus();
})

enjoy