From ae8bcad8c5bcc1a5ab4ee554608d5da71b28bcc7 Mon Sep 17 00:00:00 2001 From: webchick Date: Sun, 4 Oct 2015 22:54:42 -0700 Subject: [PATCH] Issue #2563505 by javivf, adooo, Wim Leers, Truptti, DuaelFr, Reinmar, quicksketch, FMB: "Enter caption here" text missing due to auto-created
--- .../ckeditor/js/plugins/drupalimagecaption/plugin.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/modules/ckeditor/js/plugins/drupalimagecaption/plugin.js b/core/modules/ckeditor/js/plugins/drupalimagecaption/plugin.js index f61a5457270..e68c8092c9a 100644 --- a/core/modules/ckeditor/js/plugins/drupalimagecaption/plugin.js +++ b/core/modules/ckeditor/js/plugins/drupalimagecaption/plugin.js @@ -210,6 +210,15 @@ // upcasting existing elements (see widgetDefinition.upcast). if (dialogReturnValues.attributes.hasCaption) { actualWidget.editables.caption.setAttribute('data-placeholder', placeholderText); + + // Some browsers will add a
tag to a newly created DOM + // element with no content. Remove this
if it is the only + // thing in the caption. Our placeholder support requires the + // element be entirely empty. See filter-caption.css. + var captionElement = actualWidget.editables.caption.$; + if (captionElement.childNodes.length === 1 && captionElement.childNodes.item(0).nodeName === 'BR') { + captionElement.removeChild(captionElement.childNodes.item(0)); + } } }; };