angular-ui / ui-tinymce

AngularUI wrapper for TinyMCE
MIT License
488 stars 371 forks source link

Error destroying when closing dialog or navigating in Firefox (47.0.1) #282

Open johnwpowell opened 7 years ago

johnwpowell commented 7 years ago

To reproduce Put the editor on a dialog Close the dialog without editing any of the text An error occurs in in the tinyInstance.remove() calls Put the editor on a view Navigate away from the view without making any changes An error occurs in the tinyInstance.remove() calls

The code in the directive is: scope.$on('$destroy', function () { ensureInstance();

              if (tinyInstance) {
                  **tinyInstance.remove();** /// <-- This call errors
                  tinyInstance = null;
              }
          });

          function ensureInstance() {
              if (!tinyInstance) {
                  tinyInstance = tinymce.get(attrs.id);
              }
          }

Stack trace:

.serialize@http://localhost:43548/Scripts/vendor/tinymce.min.js:5:19133 A.prototype.getContent@http://localhost:43548/Scripts/vendor/tinymce.min.js:11:19898 A.prototype.save@http://localhost:43548/Scripts/vendor/tinymce.min.js:11:18533 A.prototype.remove@http://localhost:43548/Scripts/vendor/tinymce.min.js:11:21799 .link/<@http://localhost:43548/Scripts/angular-ui/tinymce.js:194:23 $RootScopeProvider/this.$get</Scope.prototype.$broadcast@http://localhost:43548/Scripts/vendor/angular.js:17767:15 $RootScopeProvider/this.$get</Scope.prototype.$destroy@http://localhost:43548/Scripts/vendor/angular.js:17385:9 afterAnimating@http://localhost:43548/Scripts/angular-ui/ui-bootstrap-tpls.js:3826:11 processQueue@http://localhost:43548/Scripts/vendor/angular.js:16170:28 scheduleProcessQueue/<@http://localhost:43548/Scripts/vendor/angular.js:16186:27 $RootScopeProvider/this.$get</Scope.prototype.$eval@http://localhost:43548/Scripts/vendor/angular.js:17444:16 $RootScopeProvider/this.$get</Scope.prototype.$digest@http://localhost:43548/Scripts/vendor/angular.js:17257:15 $RootScopeProvider/this.$get</Scope.prototype.$evalAsync/<@http://localhost:43548/Scripts/vendor/angular.js:17483:15 completeOutstandingRequest@http://localhost:43548/Scripts/vendor/angular.js:5955:7 Browser/self.defer/timeoutId<@http://localhost:43548/Scripts/vendor/angular.js:6234:7

calbear47 commented 7 years ago

I am getting the same error under the same circumstances as @johnwpowell, however I only get this exception thrown w/ FireFox 47.x

I believe this thread is related. [https://github.com/tinymce/tinymce/issues/794]

deeg commented 7 years ago

Could you please post a plunker reproducing the issue. From @calbear47's comment it might be an issue with TinyMCE core, and not this library. I could take a closer look if you put up a plunker.

piRstone commented 6 years ago

I had the same issue and updating tinymce and ui-tinymce with the latest versions resolved everything.