froala / angular-froala

Angular.js bindings for Froala WYSIWYG HTML Rich Text Editor.
https://froala.com/wysiwyg-editor
MIT License
306 stars 123 forks source link

Converting circular structure to JSON when using the same $scope.options in multiple editors #234

Closed ThePokyWizard closed 4 years ago

ThePokyWizard commented 4 years ago

I have a page with several Froala editors that are displayed as the user clicks a reply button, similar to the way Gmail displays its reply boxes.

If I display the editor below without setting a custom option, no error occurs. <textarea id="editor-{{mail.id}}" froala ng-model="mail.message"></textarea>

But if used with a generic option set in $scope the following error is displayed, and the editor is only displayed in one item. <textarea id="editor-{{mail.id}}" froala="customOptions" ng-model="mail.message"></textarea>

TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'Object'
    |     property '$$parentForm' -> object with constructor 'Object'
    |     property '$$controls' -> object with constructor 'Array'
    --- index 0 closes the circle
    at Object.stringify (<anonymous>)
    at new E.Bootstrap (froala_editor.pkgd.min.js:7)
    at new $e (froala_editor.pkgd.min.js:7)
    at Object.ctrl.createEditor (angular-froala.js:119)
    at Object.ctrl.init (angular-froala.js:60)
    at Object.link (angular-froala.js:222)
    at angular.js:1390
    at angular.js:11263
    at invokeLinkFn (angular.js:11269)
    at nodeLinkFn (angular.js:10588)

This happens if I set a simple option, like setting only my key.

$scope.customOptions = {
        key: 'MY-KEY'
};

How can I fix this? Is there any configuration in the options that is missing?

RHinderiks commented 4 years ago

This is a known issue which should be fixed in the next release (whenever that may be)

RHinderiks commented 4 years ago

This is still not fixed in version 3.2.0

ThePokyWizard commented 4 years ago

After some workaround I managed to make it work.