Merge pull request #2315 from ONLYOFFICE/fix/table-template-list

Fix/table template list
This commit is contained in:
Julia Radzhabova
2023-04-01 12:01:54 +03:00
committed by GitHub
3 changed files with 65 additions and 24 deletions

View File

@ -378,19 +378,20 @@ define([
styles.menuPicker.store.reset([]);
var templates = [];
var groups = [
{id: 'menu-table-group-custom', caption: self.view.__proto__.txtGroupPivot_Custom, templates: []},
{id: 'menu-table-group-light', caption: self.view.__proto__.txtGroupPivot_Light, templates: []},
{id: 'menu-table-group-medium', caption: self.view.__proto__.txtGroupPivot_Medium, templates: []},
{id: 'menu-table-group-dark', caption: self.view.__proto__.txtGroupPivot_Dark, templates: []},
{id: 'menu-table-group-no-name', caption: '&nbsp', templates: []},
{id: 'menu-table-group-custom', caption: self.view.txtGroupPivot_Custom, templates: []},
{id: 'menu-table-group-light', caption: self.view.txtGroupPivot_Light, templates: []},
{id: 'menu-table-group-medium', caption: self.view.txtGroupPivot_Medium, templates: []},
{id: 'menu-table-group-dark', caption: self.view.txtGroupPivot_Dark, templates: []},
{id: 'menu-table-group-no-name', caption: '&nbsp', templates: []},
];
_.each(Templates, function(template, index){
var tip = template.asc_getDisplayName();
var groupItem = '';
var tip = template.asc_getDisplayName(),
groupItem = '',
lastWordInTip = null;
if (template.asc_getType()==0) {
var arr = tip.split(' '),
last = arr.pop();
var arr = tip.split(' ');
lastWordInTip = arr.pop();
if(tip == 'None'){
groupItem = 'menu-table-group-light';
@ -404,7 +405,8 @@ define([
}
}
arr = 'txtTable_' + arr.join('');
tip = self.view.__proto__[arr] ? self.view.__proto__[arr] + ' ' + last : tip;
tip = self.view[arr] ? self.view[arr] + ' ' + lastWordInTip : tip;
lastWordInTip = parseInt(lastWordInTip);
}
else {
groupItem = 'menu-table-group-custom'
@ -418,9 +420,21 @@ define([
group : groupItem,
allowSelected : true,
selected : false,
tip : tip
tip : tip,
numInGroup : (lastWordInTip != null && !isNaN(lastWordInTip) ? lastWordInTip : null)
});
});
var sortFunc = function(a, b) {
var aNum = a.numInGroup,
bNum = b.numInGroup;
return aNum - bNum;
};
groups[1].templates.sort(sortFunc);
groups[2].templates.sort(sortFunc);
groups[3].templates.sort(sortFunc);
groups = groups.filter(function(item, index){
return item.templates.length > 0
});

View File

@ -2275,12 +2275,13 @@ define([
{id: 'menu-table-group-no-name', caption: '&nbsp', templates: []},
];
_.each(images, function(item) {
var tip = item.asc_getDisplayName();
var groupItem = '';
var tip = item.asc_getDisplayName(),
groupItem = '',
lastWordInTip = null;
if (item.asc_getType()==0) {
var arr = tip.split(' '),
last = arr.pop();
var arr = tip.split(' ');
lastWordInTip = arr.pop();
if(tip == 'None'){
groupItem = 'menu-table-group-light';
@ -2294,7 +2295,8 @@ define([
}
}
arr = 'txtTable_' + arr.join('');
tip = me[arr] ? me[arr] + ' ' + last : tip;
tip = me[arr] ? me[arr] + ' ' + lastWordInTip : tip;
lastWordInTip = parseInt(lastWordInTip);
}
else {
groupItem = 'menu-table-group-custom'
@ -2307,10 +2309,22 @@ define([
group : groupItem,
allowSelected : true,
selected : false,
tip : tip
tip : tip,
numInGroup : (lastWordInTip != null && !isNaN(lastWordInTip) ? lastWordInTip : null)
});
});
var sortFunc = function(a, b) {
var aNum = a.numInGroup,
bNum = b.numInGroup;
return aNum - bNum;
};
groups[1].templates.sort(sortFunc);
groups[2].templates.sort(sortFunc);
groups[3].templates.sort(sortFunc);
groups = groups.filter(function(item, index){
return item.templates.length > 0
});

View File

@ -600,12 +600,13 @@ define([
{id: 'menu-table-group-no-name', caption: '&nbsp', templates: []},
];
_.each(Templates, function(item){
var tip = item.asc_getDisplayName();
var groupItem = '';
var tip = item.asc_getDisplayName(),
groupItem = '',
lastWordInTip = null;
if (item.asc_getType()==0) {
var arr = tip.split(' '),
last = arr.pop();
var arr = tip.split(' ');
lastWordInTip = arr.pop();
if(tip == 'None'){
groupItem = 'menu-table-group-light';
@ -619,7 +620,8 @@ define([
}
}
arr = 'txtTable_' + arr.join('');
tip = self[arr] ? self[arr] + ' ' + last : tip;
tip = self[arr] ? self[arr] + ' ' + lastWordInTip : tip;
lastWordInTip = parseInt(lastWordInTip);
}
else {
groupItem = 'menu-table-group-custom'
@ -633,10 +635,21 @@ define([
group : groupItem,
allowSelected : true,
selected : false,
tip : tip
tip : tip,
numInGroup : (lastWordInTip != null && !isNaN(lastWordInTip) ? lastWordInTip : null)
});
});
var sortFunc = function(a, b) {
var aNum = a.numInGroup,
bNum = b.numInGroup;
return aNum - bNum;
};
groups[1].templates.sort(sortFunc);
groups[2].templates.sort(sortFunc);
groups[3].templates.sort(sortFunc);
groups = groups.filter(function(item, index){
return item.templates.length > 0
});