Permalink
Browse files

Escape quotes and parenthesis before setting backgroundImage style

(cherry picked from commit 06a7b52)
  • Loading branch information...
1 parent 72f88e2 commit a31c71d6103e12061375d93a2c4866f6de9f773d @cdujeu cdujeu committed Jul 6, 2016
Showing with 2 additions and 0 deletions.
  1. +2 −0 core/src/plugins/gui.ajax/res/js/ui/prototype/class.PreviewFactory.js
@@ -89,6 +89,8 @@ Class.create("PreviewFactory", {
if(img == null || oImageToLoad.PFacLoader == null) return;
if(oImageToLoad.editorClass.prototype.getCoveringBackgroundSource && oImageToLoad.mainObject && oImageToLoad.mainObject.hasClassName('background-cover') && Modernizr.backgroundsize){
img.setStyle({display:'none'});
+ var bgUrl = oImageToLoad.editorClass.prototype.getCoveringBackgroundSource(oImageToLoad.ajxpNode);
+ bgUrl = bgUrl.replace('(', '\\(').replace(')', '\\)').replace('\'', '\\\'');
oImageToLoad.mainObject.setStyle({
backgroundImage:'url(' + oImageToLoad.editorClass.prototype.getCoveringBackgroundSource(oImageToLoad.ajxpNode) + ')',
backgroundSize : 'cover'

0 comments on commit a31c71d

Please sign in to comment.