Uncaught TypeError: Cannot set property ‘isNotDirty’ of null WordPress error

I am having an issue with my WordPress installation. I am hoping some people familiar with WordPress can help me out.

I am trying to add custom CSS using the Visual Composer plugin but when I click save after entering the CSS it does not do anything.

Read More

If I delete everything and keep it as it was then it allows the save button to work. I have included the error in the console below.

After researching this a little bit I see that the isNotDirty property is part of tinyMCE. It detects if the CSS stored in the database has changed in the window.

To troubleshoot I have uninstalled all the plugins and reinstalled them. I have restored a previous known working database but am still getting the error. Any ideas on where to look next? I would have thought reinstalling visual composer would have corrected the issue but apparently not.

Here is some info

Here is another link with more info

Uncaught TypeError: Cannot set property 'isNotDirty' of null composer-view.js?ver=4.2.2:293
vc.post_custom_css_block_view.Backbone.View.extend.setAlertOnDataChange composer-view.js?ver=4.2.2:293
vc.post_custom_css_block_view.Backbone.View.extend.save composer-view.js?ver=4.2.2:277
n.event.dispatch load-scripts.php?c=0&load%5B%5D=jquery-core,jquery-migrate,utils,plupload,json2,farbtastic&ver=3.9.1:3
r.handle load-scripts.php?c=0&load%5B%5D=jquery-core,jquery-migrate,utils,plupload,json2,farbtastic&ver=3.9.1:3

UPDATE:
I have installed a fresh copy of the theme on a different virtual host and it seems to be working fine on there. I noticed that the working version has one extra line of HTML which is listed below. The non working version does not have this.

<ul class="ui-autocomplete ui-front ui-menu ui-widget ui-widget-content ui-corner-all" id="ui-id-1" tabindex="0" style="display: none;"></ul>

I changed the themes on the non-working version and it still does not work.

UPDATE:
Something very strange happened. I am always using the backend editor, so I decided I would try out the frontend editor to see if I could add custom CSS. Sure enough it allows you to do it and I was able to save the custom CSS. So I went back into backend editor mode and now all of a sudden the custom CSS in the backend is working.

Related posts

Leave a Reply

1 comment

  1. I experience this issue on one of my WordPress projects. I managed to fix it by taking the following steps:

    • FTP to ‘/wp-content/plugins/js_composer/assets/js/backend’
    • Edit ‘composer-view.js’
    • Locate the following lines of code and remove them:

      1. (line 277 for me; may differ for you)
       this.setAlertOnDataChange();
    
    1. (line 291-295 for me; may differ for you)
     setAlertOnDataChange: function() {
        if(vc.saved_custom_css !== this.$editor.val() && window.tinymce) {
          window.tinymce.get('content').isNotDirty = false;
        }
      }
    
    • Save your changes to ‘composer-view.js’ but keep the file open as you’ll need to undo these changes in a moment…
    • Go back over to WordPress and refresh, making sure ‘composer-view.js’ in particular is refreshed and not cached in your browser, and try now to click the previously dead ‘Save’ button in the visual composer Custom CSS editor
    • It should now work so make some changes (when I did it the only change I made was to remove the last line of CSS I added before the thing became unresponsive in the first place but perhaps any change will be accepted I don’t know?…)
    • Now, if everything is working as usual again, go back to ‘composer-view.js’ and undo the changes you made (i.e. put the above lines of code back in).
    • Everything should now work as it did before – or at least it did for me.