Drupal.behaviors.customCKEditorConfig I am trying to use the Disallowed Content configuration from Ckeditor.
https://docs.ckeditor.com/ckeditor4/latest/guide/dev_disallowed_content.html
I am using Drupal 8.5.3 Lightning 8.x-3 and the built in Ckeditor v4.8

I have placed this js in my theme and the js is loading when I am in page edit mode.

(function ($, Drupal) {
  Drupal.behaviors.customCKEditorConfig = {
    attach: function (context, settings) {
      if (typeof CKEDITOR !== "undefined") {
        config.disallowedContent= 'div span';
      }
    }
  }
})(jQuery, Drupal);


But this is not working. I have tried with the Allowed HTML tags enabled and disabled. I got this information from these sources. http://drucafe.blogspot.com/2016/02/adding-custom-styles-to-ckeditor-in.html
and https://tutel.me/c/drupal/questions/183036/allow+empty+tags and Drupal 8 CKeditor behaves LTR in an RTL site.

I have tried the filter 3 different ways

editor.filter.disallow( 'span div' );
config.disallowedContent( 'span div' );
config.disallowedContent= 'div span';
This is working.

use Drupal\editor\Entity\Editor;

function MYMODULE_editor_js_settings_alter(array &amp;$settings) {
  foreach ($settings['editor']['formats'] as $name =&gt; $value) {
    $settings['editor']['formats'][$name]['editorSettings']['disallowedContent'] =   
'h1 h2 h3';
  }
}


This supersedes any allowed tags in the drupal GUI. But you must enable Allowed HTML tags enabled for this to work. I took the idea from this.drupal-8-ckeditor-behaves-ltr