mirror of
https://github.com/ONLYOFFICE/web-apps.git
synced 2026-07-24 03:19:32 +08:00
[desktop] fix recents opening
This commit is contained in:
@ -60,7 +60,7 @@ define([
|
||||
'btn-save': 'save',
|
||||
'btn-save-coauth': 'coauth',
|
||||
'btn-synch': 'synch' };
|
||||
let recents;
|
||||
let recents = [];
|
||||
|
||||
var nativevars,
|
||||
helpUrl;
|
||||
@ -163,7 +163,7 @@ define([
|
||||
|
||||
window.onupdaterecents = function (params) {
|
||||
recents = _parseRecents(params);
|
||||
Common.NotificationCenter.trigger('update:recents');
|
||||
Common.NotificationCenter.trigger('update:recents', recents);
|
||||
}
|
||||
|
||||
// hide mask for modal window
|
||||
@ -593,8 +593,8 @@ define([
|
||||
name: Common.Utils.String.htmlDecode(model.get('title')),
|
||||
path: Common.Utils.String.htmlDecode(model.get('url')),
|
||||
};
|
||||
if ( model.get('fileid') ) {
|
||||
params.id = model.fileid;
|
||||
if ( model.get('fileid') != undefined && model.get('fileid') != null ) {
|
||||
params.id = model.get('fileid');
|
||||
params.type = model.type;
|
||||
} else {
|
||||
params.id = -1;
|
||||
|
||||
@ -61,6 +61,15 @@ define([
|
||||
this.menu = options.menu;
|
||||
this.recent = options.recent;
|
||||
this.el = options.el;
|
||||
|
||||
Common.NotificationCenter.on('update:recents', function (arr) {
|
||||
if ( this.viewRecentPicker ) {
|
||||
const store = this.viewRecentPicker.store;
|
||||
if ( store ) {
|
||||
store.reset(this.recent.concat(arr))
|
||||
}
|
||||
}
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
render: function() {
|
||||
@ -102,7 +111,8 @@ define([
|
||||
|
||||
onRecentFileClick: function(view, itemview, record){
|
||||
if ( this.menu ) {
|
||||
!Common.Controllers.Desktop.openRecent(record) && this.menu.fireEvent('recent:open', [this.menu, record.get('url')]);
|
||||
!Common.Controllers.Desktop.openRecent(record) &&
|
||||
this.menu.fireEvent('recent:open', [this.menu, record.get('url')]);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@ -421,10 +421,8 @@ define([
|
||||
this.appOptions.user.anonymous && Common.localStorage.setItem("guest-id", this.appOptions.user.id);
|
||||
|
||||
this.appOptions.isDesktopApp = this.editorConfig.targetApp == 'desktop' || Common.Controllers.Desktop.isActive();
|
||||
if(this.appOptions.isDesktopApp){
|
||||
var desktopRecent = Common.Controllers.Desktop.recentFiles();
|
||||
if (desktopRecent && desktopRecent.length > 0)
|
||||
this.editorConfig.recent = !this.editorConfig.recent ? desktopRecent : this.editorConfig.recent = this.editorConfig.recent.concat(desktopRecent);
|
||||
if( Common.Controllers.Desktop.isActive() ){
|
||||
!this.editorConfig.recent && (this.editorConfig.recent = []);
|
||||
}
|
||||
|
||||
this.appOptions.canCreateNew = this.editorConfig.canRequestCreateNew || !_.isEmpty(this.editorConfig.createUrl) || this.editorConfig.templates && this.editorConfig.templates.length;
|
||||
|
||||
@ -334,8 +334,13 @@ define([
|
||||
me.scroller.update();
|
||||
});
|
||||
}
|
||||
|
||||
this.applyMode();
|
||||
|
||||
if ( Common.Controllers.Desktop.isActive() ) {
|
||||
Common.NotificationCenter.trigger('update:recents', Common.Controllers.Desktop.recentFiles());
|
||||
}
|
||||
|
||||
if ( !!this.api ) {
|
||||
this.panels['info'].setApi(this.api);
|
||||
if (this.panels['opts']) this.panels['opts'].setApi(this.api);
|
||||
|
||||
Reference in New Issue
Block a user