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

Error iterating through extensions in wysiwyg.js? #27

Closed carled closed 7 years ago

carled commented 7 years ago

Firstly it doesn't help that the nuget package doesn't include the "wysiwyg.js" file that contains the bindinghandler. When I downloaded the one from git, I get an error when trying to use "wordcount" and "isdirty".

The problem is at line 86 or thereabouts: for ( var name in extensions ) { if ( extensions.hasOwnProperty( name ) ) { binding['extensions'][extensions[name]]( editor, e, args[2], args[4] ); } }

"extensions" is an array, so "name" in this instance is "0" and not "wordcount". Likewise the next iteration would look for "1" and not "isDirty".

Maybe I'm initialising it wrong? I'm doing this: <textarea data-bind="wysiwyg : answerText, wysiwygDirty: TinyMCEIsDirty, wysiwygConfig: { plugins: [ 'wordcount' ] }, wysiwygExtensions: [ 'wordcount', 'dirty' ], wysiwygWordCount: TinyMCEWordCount"></textarea>

carled commented 7 years ago

Weird. Just reinstalled nuget package and this time it's brought through the wysiwyg.js files and dumped them in the "Scripts" root. I'll try using that one and see what happens.

carled commented 7 years ago

Yup, that was it. Nuget install must have gone awry and now I've reinstalled, all is working as expected. Thanks,