Skip to content

Commit

Permalink
Prevent template flickering on layout changes (e.g: left/right switch…
Browse files Browse the repository at this point in the history
… in sidearticle block)

related to the new img preloading code.
  • Loading branch information
bago committed May 4, 2022
1 parent 87d91ad commit fb71ef1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/js/bindings/wysiwygs.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ ko.bindingHandlers.wysiwygSrc = {
if (src == undefined || src == null || src == "") {
element.removeAttribute('src');
} else if (element.getAttribute('src') !== src) {
if (ko.bindingHandlers['wysiwygSrc'].preload && isWysiwygMode) {
// when the current src is null we don't do preloading to avoid flickering (e.g on wizard button for sideimage block)
if (ko.bindingHandlers['wysiwygSrc'].preload && isWysiwygMode && element.getAttribute('src') !== null) {
// if we are waiting for a remote placeholder, let's generate an SVG placeholder on the clientsize!
if (typeof ko.bindingHandlers.wysiwygSrc.svg == 'string' && isPlaceholder) {
var svgcode = ko.bindingHandlers.wysiwygSrc.svg.replace('__WIDTH__', w).replace('__HEIGHT__', h).replace('__TEXT__', text);
Expand Down

0 comments on commit fb71ef1

Please sign in to comment.