steveathon / bootstrap-wysiwyg

Tiny bootstrap-compatible WYSIWYG rich text editor
MIT License
661 stars 1.71k forks source link

Editor losses focus with dropdown #73

Closed SMLDuarte closed 8 years ago

SMLDuarte commented 8 years ago

When you have a button in the toolbar with a dropdown (for example to add a link) the editor loses focus meaning that the selection is lost and certain commands won't work. See http://dev.madreloca.com/editortest.html and try to add a link to see the issue.

codewithtyler commented 8 years ago

@SMLDuarte thanks for posting about this. I'll take a look at it tonight and see if I can figure out what is causing the issue for you. I'm able to replicate it on your site but not on anything else.

codewithtyler commented 8 years ago

@SMLDuarte I was able to replicate this on one of our example files. I'd say that this is a regression because it was only introduced in the last merge or two that we've done.

SMLDuarte commented 8 years ago

@RandomlyKnighted I just noticed that the version of the editor that I'm using, and the one that it's available on Microsoft Nuget (I'm using this in an ASP.NET MVC project), is a fork maintained by someone else, so I'm not sure how up to date it is.

I tried using your latest release but It made the editor stop working (when you start typing it automatically adds a blockquote tag to the editor and every key press ads a div inside the blockquote instead of the text that is being typed).

codewithtyler commented 8 years ago

@SMLDuarte can you provide a link to the Nuget package you were using?

That's strange. I haven't ran into that problem.

SMLDuarte commented 8 years ago

Sorry for the delay. Here is the link to the Nuget package: https://www.nuget.org/packages/Bootstrap.Wysiwyg And this is the github fork of the package: https://github.com/drc-devs/bootstrap-wysiwyg

codewithtyler commented 8 years ago

That repo looks like a modified version of the 1.0.3-beta release.

Edit:You mentioned that you used the file from the latest release. Could you try the 1.0.3-rc release and tell me if the issue you see still occurs?

codewithtyler commented 8 years ago

Ok, so I just did some testing to determine at what point the hyperlink button was broken. Below are my results:

Version Test Results
1.0.4 Regressed
1.0.3-rc OK
1.0.3-beta OK
1.0.2 OK

So I did a file comparison between versions 1.0.4 and 1.0.3-rc. You can find that comparison here

Really the only thing that was changed between the two version was that underscoreThrottle was updated and then called each time for the execCommand function. This was done to fix the issue mentioned in #58.

I should mention that during my tests I also tested the effects on this issue and the problem mentioned in #58 with the underscoreThrottle function removed. After removing the function I found that both issues worked like they should. The main reason for having this function is to prevent users from clicking the button too much. I can see the use of this function in a form scenario say on a form submit button but for a WYSIWYG editor I'm not quite sure that it's worth keeping.

However, I'd like to get @steveathon's opinion before we remove the function from the project.