steveathon / bootstrap-wysiwyg

Tiny bootstrap-compatible WYSIWYG rich text editor
MIT License
662 stars 1.7k forks source link

Multiple Editors and Link Editing #38

Closed Prozak78 closed 9 years ago

Prozak78 commented 9 years ago

Hi,

first of all let me thank you for this piece of code that I intend to use, and hopefully contribute to make it better.

I have 2 fields on a form that require html editing for simple things, bold, link editing, and not much more.

Getting the link editing to work on one editor was hard enough, having to make sure the input doesnt auto-close on focus, and other small bugs/issues.

But as soon as I added the second editor, I noticed that pressing the Bold button on editor 2 would also affect text on editor 1. It was also impossible for me to make the add link button work on editor 2.

Can you replicate this behavior on your side? Do you know its root causes? Is there a quick fix, or a bug fix on the horizon for it?

Tell me how I can help. Thank you very much.

codewithtyler commented 9 years ago

This bug is known. I originally mentioned it on issue #31. To my knowledge a bug fix has not been started. I'd have to review the code again but I believe all that would have to be done is get which editor the user is typing in and assign that to a variable. Then use that variable too apply the change only to that editor.

If you think you can add the bug fix then you are welcome to start it. If not, then I might can look at it this weekend. If you do the big fix, then I'll be happy to test. If I do it then I'll need a tester.

jtkDvlp commented 9 years ago

The problem seems to be solved very easy. The bindToolbar function gets an array of toolbars, because the query dont include the target attribute. Just include it and it should work (I didnt test it). That should also solve your bug in #31. Both editors bound both toolbars because jquery can handle arrays.

steveathon commented 9 years ago

Thanks for the suggestion - let me see if that does indeed fix it.