michaelpapworth / tinymce-knockout-binding

A KnockoutJS custom binding that applies a TinyMCE Editor to the bound HTML element
MIT License
39 stars 19 forks source link

Visibility binding property doesn't work #5

Closed cxs6056 closed 10 years ago

cxs6056 commented 10 years ago

The visibility property only works on the original element, not the element created by TinyMCE .

For example

<div data-bind="foreach: cards">
    <textarea class="tinymce" data-bind="wysiwyg: text, visible: isCurrentCard"></textarea>
</div>

When isCurrentCard is set to true, the textarea element will appear but the <div> created by TinyMCE will not. The <textarea> should remain hidden and the new TinyMCE control should be displayed instead.

Thanks for the great work.

Best,

Chuck

michaelpapworth commented 10 years ago

@cxs6056 Thanks for raising this. I'll ensure that it features in my next release. In the meantime, may I suggest the following workaround?

<div data-bind="foreach: cards">
    <!-- ko if: isCurrentCard -->
    <textarea class="tinymce" data-bind="wysiwyg: text"></textarea>
    <!-- /ko -->
</div>
cxs6056 commented 10 years ago

Thanks Michael!

I'm experimenting with using CKEdit now.

On Fri, Jan 24, 2014 at 4:55 AM, Michael Papworth notifications@github.comwrote:

@cxs6056 https://github.com/cxs6056 Thanks for raising this. I'll ensure that it features in my next release. In the meantime, may I suggest the following workaround?

— Reply to this email directly or view it on GitHubhttps://github.com/michaelpapworth/tinymce-knockout-binding/issues/5#issuecomment-33210111 .

michaelpapworth commented 10 years ago

The work around I provided in my previous comment is in fact the correct way to apply the if binding in this scenario according to the documentation. The fault lies with tinymce-knockout-binding not controlling descendent bindings. This is now fixed as part of v1.1.0. and if you try to apply the if or ifnot binding in conjunction with the wysiwyg binding an error is thrown.

ghost commented 8 years ago

when I bind using tinymce-knockout-binding it shows the wysiwyg editor but, on click event it adds style="visibility: hidden;" to my text field(to the field I applied wysiwyg binding). why?