Merge pull request #694 from ONLYOFFICE/fix/bugfix

[PE mobile] Fix Bug 48566, Fix Bug 48567
This commit is contained in:
Julia Radzhabova 2021-02-04 14:23:52 +03:00 committed by GitHub
commit 805265a40c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 7 deletions

View file

@ -103,9 +103,14 @@ define([
renderLayouts: function() { renderLayouts: function() {
var $layoutContainer = $('.container-add .slide-layout'); var $layoutContainer = $('.container-add .slide-layout');
if ($layoutContainer.length > 0 && _layouts.length>0) { if ($layoutContainer.length > 0 && _layouts.length>0) {
var columns = parseInt(($layoutContainer.width()-20) / (_layouts[0].itemWidth+2)), // magic var itemWidth = _layouts[0].itemWidth,
columns = parseInt(($layoutContainer.width()-20) / (itemWidth+2)), // magic
row = -1, row = -1,
layouts = []; layouts = [];
if (columns<1) {
columns = 1;
itemWidth = $layoutContainer.width()-20;
}
_.each(_layouts, function (layout, index) { _.each(_layouts, function (layout, index) {
if (0 == index % columns) { if (0 == index % columns) {
@ -120,13 +125,14 @@ define([
'<ul class="row">', '<ul class="row">',
'<% _.each(row, function(item) { %>', '<% _.each(row, function(item) { %>',
'<li data-type="<%= item.idx %>">', '<li data-type="<%= item.idx %>">',
'<img src="<%= item.imageUrl %>" width="<%= item.itemWidth %>" height="<%= item.itemHeight %>">', '<img src="<%= item.imageUrl %>" width="<%= itemWidth %>" height="<%= item.itemHeight %>">',
'</li>', '</li>',
'<% }); %>', '<% }); %>',
'</ul>', '</ul>',
'<% }); %>' '<% }); %>'
].join(''))({ ].join(''))({
layouts: layouts layouts: layouts,
itemWidth: itemWidth
}); });
$layoutContainer.html(template); $layoutContainer.html(template);

View file

@ -259,10 +259,14 @@ define([
renderLayouts: function() { renderLayouts: function() {
var $layoutContainer = $('.container-edit .slide-layout'); var $layoutContainer = $('.container-edit .slide-layout');
if ($layoutContainer.length > 0 && _layouts.length>0) { if ($layoutContainer.length > 0 && _layouts.length>0) {
var columns = parseInt(($layoutContainer.width()-20) / (_layouts[0].itemWidth+2)), // magic var itemWidth = _layouts[0].itemWidth,
columns = parseInt(($layoutContainer.width()-20) / (itemWidth+2)), // magic
row = -1, row = -1,
layouts = []; layouts = [];
if (columns<1) {
columns = 1;
itemWidth = $layoutContainer.width()-20;
}
_.each(_layouts, function (layout, index) { _.each(_layouts, function (layout, index) {
if (0 == index % columns) { if (0 == index % columns) {
layouts.push([]); layouts.push([]);
@ -276,13 +280,14 @@ define([
'<ul class="row">', '<ul class="row">',
'<% _.each(row, function(item) { %>', '<% _.each(row, function(item) { %>',
'<li data-type="<%= item.idx %>">', '<li data-type="<%= item.idx %>">',
'<img src="<%= item.imageUrl %>" width="<%= item.itemWidth %>" height="<%= item.itemHeight %>">', '<img src="<%= item.imageUrl %>" width="<%= itemWidth %>" height="<%= item.itemHeight %>">',
'</li>', '</li>',
'<% }); %>', '<% }); %>',
'</ul>', '</ul>',
'<% }); %>' '<% }); %>'
].join(''))({ ].join(''))({
layouts: layouts layouts: layouts,
itemWidth: itemWidth
}); });
$layoutContainer.html(template); $layoutContainer.html(template);