mindmup / bootstrap-wysiwyg

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

Multiple instances? #140

Open IntellectProductions opened 10 years ago

IntellectProductions commented 10 years ago

So I viewed this issue:

https://github.com/mindmup/bootstrap-wysiwyg/pull/103

However, he didn't even post any code examples so I couldn't really understand what he meant by wrapper to begin with..

This is what I'm using:

<ul class="btn-toolbar" data-role="editor-toolbar" data-target=".description_text">
    <?php include_once('partial/wysiwyg-toolbar.php'); ?>
</ul>
<textarea name="description" class="description_text wysiwyg"></textarea>

Then I have another textarea on the same page:

<ul class="btn-toolbar" data-role="editor-toolbar" data-target=".short_description_text">
    <?php include_once('partial/wysiwyg-toolbar.php'); ?>
</ul>
<textarea name="description" class="short_description_text wysiwyg"></textarea> 

However, it still throws the typical multiple instance error:

Uncaught TypeError: Cannot read property 'ownerDocument' of undefined

IntellectProductions commented 10 years ago

And setup like how it normally is just by adding a class to the textarea tag of wysiwyg, and in my universal js file, I have:

$('.wysiwyg').wysiwyg();

It works when there is only one textarea with that class, but as soon as I add a second one, it throws the above error. Granted, these text areas are loaded with ajax... but I also called the wysiwyg() method on ajaxStop().

makusu commented 10 years ago

Hi @IntellectProductions

You might want to take a look on this #52