diff --git a/core/modules/editor/js/editor.js b/core/modules/editor/js/editor.js
index fba4cc95c9b..022bc9f7c07 100644
--- a/core/modules/editor/js/editor.js
+++ b/core/modules/editor/js/editor.js
@@ -73,7 +73,10 @@
// with it that supports content filtering, then first ask for
// confirmation, because switching text formats might cause certain
// markup to be stripped away.
- if (drupalSettings.editor.formats[newFormatID] && drupalSettings.editor.formats[newFormatID].editorSupportsContentFiltering) {
+ var supportContentFiltering = drupalSettings.editor.formats[newFormatID] && drupalSettings.editor.formats[newFormatID].editorSupportsContentFiltering;
+ // If there is no content yet, it's always safe to change the text format.
+ var hasContent = findFieldForFormatSelector($select).value !== '';
+ if (hasContent && supportContentFiltering) {
var message = Drupal.t('Changing the text format to %text_format will permanently remove content that is not allowed in that text format.
Save your changes before switching the text format to avoid losing data.', {
'%text_format': $select.find('option:selected').text()
});