From bd939a735fc65e5f9c4f8492db17df2eb09117ac Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Thu, 25 Apr 2019 09:20:01 +0200 Subject: [PATCH] image: allow overriding css background-image when value is empty (#521) --- CHANGELOG.md | 1 + src/client/app/widgets/plots/image.js | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4c900b9..51bb3aa1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - bug fixes: - modal: `css` not properly applied if the property was previously empty and the modal had been opened at least once + - image: allow overriding css background-image when value is empty ## 0.45.7 diff --git a/src/client/app/widgets/plots/image.js b/src/client/app/widgets/plots/image.js index 5667c3d0..931077cb 100644 --- a/src/client/app/widgets/plots/image.js +++ b/src/client/app/widgets/plots/image.js @@ -79,7 +79,12 @@ module.exports = class Image extends Widget { if (!parser.protocol.match(/http|data/)) url = url.replace(':', '_:_') url = url.replace(/\\/g, '\\\\') - this.widget.style.setProperty('background-image', `url("${url}${cache_query}")`) + + if (url) { + this.widget.style.setProperty('background-image', `url("${url}${cache_query}")`) + } else { + this.widget.style.setProperty('background-image', '') + } if (options.sync) this.changed(options)