I am using hook_editor_js_settings_alter()
to disallow HTML tags in Ckeditor. It is only working in node edit form, and Ckeditor is in edit mode. Wen I preview the published page it allows the tags in my disallow custom hook.
The following code was a test to disallow <h1>
tags with the class name myHeader2. If I change the class name to myheader, it work in edit mode and published mode. Is the class name the problem?
use Drupal\Core\Form\FormStateInterface;
use Drupal\editor\Entity\Editor;
function mymodule_editor_js_settings_alter(array &$settings) {
foreach ($settings['editor']['formats'] as $name => $value) {
$settings['editor']['formats']['rich_text']['editorSettings']['disallowedContent'] = 'h1(myHeader2)';
}
}