U4-8822 - Unpublish error with empty RTE

Created by Neil Gaietto 08 Aug 2016, 19:23:51 Updated by Sebastiaan Janssen 13 Mar 2018, 23:11:28

Tags: PR

There is a javascript error when unpublishing content that contains an empty richtext editor. The unpublish request completes but it never finishes the loading animation which prevents further actions.

To reproduce:

  1. Create a new site containing a new doctype that has a richtext editor.
  2. Create a new page with the doctype and publish it leaving the richtext editor empty.
  3. Refresh the page and try to unpublish
    • Sometimes it takes rebuilding the site between publish and unpublish to reproduce the issue. I'm not sure why.
  4. See error in console and publish button will stay spinning.

Here is the exact error from the console:

angular.min.js?cdv=1106324284:63 TypeError: Cannot read property 'length' of null at Object.setContent (tinymce.min.js?umb__rnd= at Object.$scope.model.onValueChanged (umbraco.controllers.js?cdv=1106324284:14076) at Object.reBindChangedProperties (umbraco.services.js?cdv=1106324284:1132) at umbraco.controllers.js?cdv=1106324284:4822 at i (angular.min.js?cdv=1106324284:79) at angular.min.js?cdv=1106324284:80 at Object.$eval (angular.min.js?cdv=1106324284:92) at Object.$digest (angular.min.js?cdv=1106324284:90) at Object.$apply (angular.min.js?cdv=1106324284:92) at j (angular.min.js?cdv=1106324284:101)(anonymous function) @ angular.min.js?cdv=1106324284:63(anonymous function) @ angular.min.js?cdv=1106324284:54i @ angular.min.js?cdv=1106324284:79(anonymous function) @ angular.min.js?cdv=1106324284:80$eval @ angular.min.js?cdv=1106324284:92$digest @ angular.min.js?cdv=1106324284:90$apply @ angular.min.js?cdv=1106324284:92j @ angular.min.js?cdv=1106324284:101r @ angular.min.js?cdv=1106324284:104w.onreadystatechange @ angular.min.js?cdv=1106324284:106

It looks like its getting called in the $scope.model.onValueChanged of the Umbraco.PropertyEditors.RTEController. It's possible that we just need to check for null before calling tinyMceEditor.setContent(newVal, { format: 'raw' });.

This only happens after the site restarts and you click unpublish. If you click publish then immediately click unpublish then you do not get the error.


Neil Gaietto 16 Aug 2016, 13:36:11

Pull request: https://github.com/umbraco/Umbraco-CMS/pull/1435

Priority: Normal

Type: Bug

State: Fixed


Difficulty: Normal


Backwards Compatible: True

Fix Submitted: Pull request

Affected versions: 7.4.3

Due in version: 7.9.3


Story Points: