Merge pull request #1652 from ONLYOFFICE/fix/fix-bugs

Fix/fix bugs
This commit is contained in:
Julia Radzhabova 2022-03-24 21:01:12 +03:00 committed by GitHub
commit a5b73c927f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 70 additions and 0 deletions

View file

@ -128,6 +128,39 @@ define([
recents = Common.localStorage.getItem(this.appPrefix + 'recent-shapes'); recents = Common.localStorage.getItem(this.appPrefix + 'recent-shapes');
recents = recents ? JSON.parse(recents) : []; recents = recents ? JSON.parse(recents) : [];
// check lang
if (recents.length > 0) {
var isTranslated = _.findWhere(groups, {groupName: recents[0].groupName});
if (!isTranslated) {
for (var r = 0; r < recents.length; r++) {
var type = recents[r].data.shapeType,
record;
for (var g = 0; g < groups.length; g++) {
var store = groups[g].groupStore,
groupName = groups[g].groupName;
for (var i = 0; i < store.length; i++) {
if (store.at(i).get('data').shapeType === type) {
record = store.at(i).toJSON();
recents[r] = {
data: record.data,
tip: record.tip,
allowSelected: record.allowSelected,
selected: false,
groupName: groupName
};
break;
}
}
if (record) {
record = undefined;
break;
}
}
}
Common.localStorage.setItem(this.appPrefix + 'recent-shapes', JSON.stringify(recents));
}
}
if (recents.length < 12) { if (recents.length < 12) {
var count = 12 - recents.length; var count = 12 - recents.length;

View file

@ -1387,6 +1387,39 @@ define([
me.recentShapes = recentArr; me.recentShapes = recentArr;
// check lang
if (me.recentShapes.length > 0) {
var isTranslated = _.findWhere(me.groups, {groupName: me.recentShapes[0].groupName});
if (!isTranslated) {
for (var r = 0; r < me.recentShapes.length; r++) {
var type = me.recentShapes[r].data.shapeType,
record;
for (var g = 0; g < me.groups.length; g++) {
var store = me.groups[g].groupStore,
groupName = me.groups[g].groupName;
for (var i = 0; i < store.length; i++) {
if (store.at(i).get('data').shapeType === type) {
record = store.at(i).toJSON();
me.recentShapes[r] = {
data: record.data,
tip: record.tip,
allowSelected: record.allowSelected,
selected: false,
groupName: groupName
};
break;
}
}
if (record) {
record = undefined;
break;
}
}
}
Common.localStorage.setItem(this.appPrefix + 'recent-shapes', JSON.stringify(me.recentShapes));
}
}
// Add default recent // Add default recent
if (me.recentShapes.length < 12) { if (me.recentShapes.length < 12) {

View file

@ -644,6 +644,10 @@ define([
}, },
onPreviewWheel: function (e) { onPreviewWheel: function (e) {
if (e.ctrlKey) {
e.preventDefault();
e.stopImmediatePropagation();
}
var forward = (e.deltaY || (e.detail && -e.detail) || e.wheelDelta) < 0; var forward = (e.deltaY || (e.detail && -e.detail) || e.wheelDelta) < 0;
this.onChangePreviewPage(forward); this.onChangePreviewPage(forward);
}, },