Skip to content

Commit

Permalink
[Embed] Handle customization.logo.visible parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
JuliaRadzhabova committed Feb 16, 2024
1 parent 7242854 commit 43d3283
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 50 deletions.
19 changes: 12 additions & 7 deletions apps/documenteditor/embed/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -196,20 +196,25 @@

var params = getUrlParams(),
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
hideLogo = params["headerlogo"]==='',
logo = params["headerlogo"] ? encodeUrlParam(params["headerlogo"]) : null,
isForm = params["isForm"];

window.frameEditorId = params["frameEditorId"];
window.parentOrigin = params["parentOrigin"];

var elem = document.querySelector('.loading-logo');
if (elem && logo) {
elem.style.backgroundImage= 'none';
elem.style.width = 'auto';
elem.style.height = 'auto';
var img = document.querySelector('.loading-logo img');
img && img.setAttribute('src', logo);
img.style.opacity = 1;
if (elem) {
if (hideLogo) {
elem.style.display = 'none';
} else if (logo) {
elem.style.backgroundImage= 'none';
elem.style.width = 'auto';
elem.style.height = 'auto';
var img = document.querySelector('.loading-logo img');
img && img.setAttribute('src', logo);
img.style.opacity = 1;
}
}
</script>

Expand Down
21 changes: 13 additions & 8 deletions apps/documenteditor/embed/index.html.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -188,20 +188,25 @@

var params = getUrlParams(),
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
hideLogo = params["headerlogo"]==='',
logo = params["headerlogo"] ? encodeUrlParam(params["headerlogo"]) : null,
isForm = params["isForm"];

window.frameEditorId = params["frameEditorId"];
window.parentOrigin = params["parentOrigin"];
var elem = document.querySelector('.loading-logo');
if (elem && logo) {
elem.style.backgroundImage= 'none';
elem.style.width = 'auto';
elem.style.height = 'auto';
var img = document.querySelector('.loading-logo img');
img && img.setAttribute('src', logo);
img.style.opacity = 1;
}
if (elem) {
if (hideLogo) {
elem.style.display = 'none';
} else if (logo) {
elem.style.backgroundImage= 'none';
elem.style.width = 'auto';
elem.style.height = 'auto';
var img = document.querySelector('.loading-logo img');
img && img.setAttribute('src', logo);
img.style.opacity = 1;
}
}
</script>

<div id="editor_sdk" class="viewer" style="overflow: hidden;" tabindex="-1"></div>
Expand Down
9 changes: 7 additions & 2 deletions apps/documenteditor/embed/js/ApplicationController.js
Original file line number Diff line number Diff line change
Expand Up @@ -668,9 +668,9 @@ DE.ApplicationController = new(function(){
_right_width = $parent.next().outerWidth();

if ( _left_width < _right_width )
$parent.css('padding-left', _right_width - _left_width);
$parent.css('padding-left', parseFloat($parent.css('padding-left')) + _right_width - _left_width);
else
$parent.css('padding-right', _left_width - _right_width);
$parent.css('padding-right', parseFloat($parent.css('padding-right')) + _left_width - _right_width);

onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);

Expand Down Expand Up @@ -884,6 +884,11 @@ DE.ApplicationController = new(function(){
function setBranding(value) {
if ( value && value.logo) {
var logo = $('#header-logo');
if (value.logo.visible===false) {
logo.addClass('hidden');
return;
}

if (value.logo.image || value.logo.imageEmbedded) {
logo.html('<img src="'+(value.logo.image || value.logo.imageEmbedded)+'" style="max-width:100px; max-height:20px;"/>');
logo.css({'background-image': 'none', width: 'auto', height: 'auto'});
Expand Down
19 changes: 12 additions & 7 deletions apps/presentationeditor/embed/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -217,19 +217,24 @@

var params = getUrlParams(),
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
hideLogo = params["headerlogo"]==='',
logo = params["headerlogo"] ? encodeUrlParam(params["headerlogo"]) : null;

window.frameEditorId = params["frameEditorId"];
window.parentOrigin = params["parentOrigin"];

var elem = document.querySelector('.loading-logo');
if (elem && logo) {
elem.style.backgroundImage= 'none';
elem.style.width = 'auto';
elem.style.height = 'auto';
var img = document.querySelector('.loading-logo img');
img && img.setAttribute('src', logo);
img.style.opacity = 1;
if (elem) {
if (hideLogo) {
elem.style.display = 'none';
} else if (logo) {
elem.style.backgroundImage= 'none';
elem.style.width = 'auto';
elem.style.height = 'auto';
var img = document.querySelector('.loading-logo img');
img && img.setAttribute('src', logo);
img.style.opacity = 1;
}
}
</script>

Expand Down
21 changes: 13 additions & 8 deletions apps/presentationeditor/embed/index.html.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -211,20 +211,25 @@

var params = getUrlParams(),
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
hideLogo = params["headerlogo"]==='',
logo = params["headerlogo"] ? encodeUrlParam(params["headerlogo"]) : null;

window.frameEditorId = params["frameEditorId"];
window.parentOrigin = params["parentOrigin"];

var elem = document.querySelector('.loading-logo');
if (elem && logo) {
elem.style.backgroundImage= 'none';
elem.style.width = 'auto';
elem.style.height = 'auto';
var img = document.querySelector('.loading-logo img');
img && img.setAttribute('src', logo);
img.style.opacity = 1;
}
if (elem) {
if (hideLogo) {
elem.style.display = 'none';
} else if (logo) {
elem.style.backgroundImage= 'none';
elem.style.width = 'auto';
elem.style.height = 'auto';
var img = document.querySelector('.loading-logo img');
img && img.setAttribute('src', logo);
img.style.opacity = 1;
}
}
</script>

<div id="box-preview">
Expand Down
9 changes: 7 additions & 2 deletions apps/presentationeditor/embed/js/ApplicationController.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,9 +514,9 @@ PE.ApplicationController = new(function(){
_right_width = $parent.next().outerWidth();

if ( _left_width < _right_width )
$parent.css('padding-left', _right_width - _left_width);
$parent.css('padding-left', parseFloat($parent.css('padding-left')) + _right_width - _left_width);
else
$parent.css('padding-right', _left_width - _right_width);
$parent.css('padding-right', parseFloat($parent.css('padding-right')) + _left_width - _right_width);

onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
api.asc_setViewMode(true);
Expand Down Expand Up @@ -736,6 +736,11 @@ PE.ApplicationController = new(function(){
function setBranding(value) {
if ( value && value.logo) {
var logo = $('#header-logo');
if (value.logo.visible===false) {
logo.addClass('hidden');
return;
}

if (value.logo.image || value.logo.imageEmbedded) {
logo.html('<img src="'+(value.logo.image || value.logo.imageEmbedded)+'" style="max-width:100px; max-height:20px;"/>');
logo.css({'background-image': 'none', width: 'auto', height: 'auto'});
Expand Down
19 changes: 12 additions & 7 deletions apps/spreadsheeteditor/embed/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -193,19 +193,24 @@

var params = getUrlParams(),
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
hideLogo = params["headerlogo"]==='',
logo = params["headerlogo"] ? encodeUrlParam(params["headerlogo"]) : null;

window.frameEditorId = params["frameEditorId"];
window.parentOrigin = params["parentOrigin"];

var elem = document.querySelector('.loading-logo');
if (elem && logo) {
elem.style.backgroundImage= 'none';
elem.style.width = 'auto';
elem.style.height = 'auto';
var img = document.querySelector('.loading-logo img');
img && img.setAttribute('src', logo);
img.style.opacity = 1;
if (elem) {
if (hideLogo) {
elem.style.display = 'none';
} else if (logo) {
elem.style.backgroundImage= 'none';
elem.style.width = 'auto';
elem.style.height = 'auto';
var img = document.querySelector('.loading-logo img');
img && img.setAttribute('src', logo);
img.style.opacity = 1;
}
}
</script>

Expand Down
19 changes: 12 additions & 7 deletions apps/spreadsheeteditor/embed/index.html.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -184,19 +184,24 @@

var params = getUrlParams(),
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
hideLogo = params["headerlogo"]==='',
logo = params["headerlogo"] ? encodeUrlParam(params["headerlogo"]) : null;

window.frameEditorId = params["frameEditorId"];
window.parentOrigin = params["parentOrigin"];

var elem = document.querySelector('.loading-logo');
if (elem && logo) {
elem.style.backgroundImage= 'none';
elem.style.width = 'auto';
elem.style.height = 'auto';
var img = document.querySelector('.loading-logo img');
img && img.setAttribute('src', logo);
img.style.opacity = 1;
if (elem) {
if (hideLogo) {
elem.style.display = 'none';
} else if (logo) {
elem.style.backgroundImage= 'none';
elem.style.width = 'auto';
elem.style.height = 'auto';
var img = document.querySelector('.loading-logo img');
img && img.setAttribute('src', logo);
img.style.opacity = 1;
}
}
</script>

Expand Down
9 changes: 7 additions & 2 deletions apps/spreadsheeteditor/embed/js/ApplicationController.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,9 +413,9 @@ SSE.ApplicationController = new(function(){
_right_width = $parent.next().outerWidth();

if ( _left_width < _right_width )
$parent.css('padding-left', _right_width - _left_width);
$parent.css('padding-left', parseFloat($parent.css('padding-left')) + _right_width - _left_width);
else
$parent.css('padding-right', _left_width - _right_width);
$parent.css('padding-right', parseFloat($parent.css('padding-right')) + _left_width - _right_width);

onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
api.asc_setViewMode(true);
Expand Down Expand Up @@ -695,6 +695,11 @@ SSE.ApplicationController = new(function(){
function setBranding(value) {
if ( value && value.logo) {
var logo = $('#header-logo');
if (value.logo.visible===false) {
logo.addClass('hidden');
return;
}

if (value.logo.image || value.logo.imageEmbedded) {
logo.html('<img src="'+(value.logo.image || value.logo.imageEmbedded)+'" style="max-width:100px; max-height:20px;"/>');
logo.css({'background-image': 'none', width: 'auto', height: 'auto'});
Expand Down

0 comments on commit 43d3283

Please sign in to comment.