diff options
author | John Molakvoæ <skjnldsv@protonmail.com> | 2022-12-14 17:36:17 +0100 |
---|---|---|
committer | John Molakvoæ <skjnldsv@protonmail.com> | 2023-01-04 16:45:54 +0100 |
commit | 8f1bf13ae3046400ce6248fb13e5515e8e9ed5c4 (patch) | |
tree | 99226cda65fe6c836fb8c52740a5a94de72bdaab /apps/files/js | |
parent | 5c987a0ff4530cd0951920fcbfaf97411aeec17a (diff) | |
download | nextcloud-server-8f1bf13ae3046400ce6248fb13e5515e8e9ed5c4.tar.gz nextcloud-server-8f1bf13ae3046400ce6248fb13e5515e8e9ed5c4.zip |
Fix preview crop
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files/js')
-rw-r--r-- | apps/files/js/app.js | 26 | ||||
-rw-r--r-- | apps/files/js/favoritesfilelist.js | 2 | ||||
-rw-r--r-- | apps/files/js/filelist.js | 7 | ||||
-rw-r--r-- | apps/files/js/recentfilelist.js | 2 |
4 files changed, 22 insertions, 15 deletions
diff --git a/apps/files/js/app.js b/apps/files/js/app.js index a2f8fa58d30..36d80c03770 100644 --- a/apps/files/js/app.js +++ b/apps/files/js/app.js @@ -66,7 +66,7 @@ this._filesConfig = OCP.InitialState.loadState('files', 'config', {}) - var urlParams = OC.Util.History.parseUrlQuery(); + var { fileid, scrollto, openfile } = OC.Util.History.parseUrlQuery(); var fileActions = new OCA.Files.FileActions(); // default actions fileActions.registerDefaultActions(); @@ -86,8 +86,8 @@ folderDropOptions: folderDropOptions, fileActions: fileActions, allowLegacyActions: true, - scrollTo: urlParams.scrollto, - openFile: urlParams.openfile, + scrollTo: scrollto, + openFile: openfile, filesClient: OC.Files.getClient(), multiSelectMenu: [ { @@ -136,7 +136,8 @@ this._setupEvents(); // trigger URL change event handlers - this._onPopState(urlParams); + console.debug('F2V init', { ...OC.Util.History.parseUrlQuery(), view: this.navigation?.active?.id }) + this._onPopState({ ...OC.Util.History.parseUrlQuery(), view: this.navigation?.active?.id }); this._debouncedPersistShowHiddenFilesState = _.debounce(this._persistShowHiddenFilesState, 1200); this._debouncedPersistCropImagePreviewsState = _.debounce(this._persistCropImagePreviewsState, 1200); @@ -216,7 +217,8 @@ * @param viewId view id */ setActiveView: function(viewId) { - window._nc_event_bus.emit('files:navigation:changed', { id: viewId }) + // The Navigation API will handle the final event + window._nc_event_bus.emit('files:legacy-navigation:changed', { id: viewId }) }, /** @@ -308,20 +310,25 @@ * Event handler for when the URL changed */ _onPopState: function(params) { + console.debug('F2V onPopState', params); params = _.extend({ dir: '/', view: 'files' }, params); + var lastId = this.navigation.active; if (!this.navigation.views.find(view => view.id === params.view)) { params.view = 'files'; } + this.setActiveView(params.view, {silent: true}); if (lastId !== this.getActiveView()) { - this.getCurrentAppContainer().trigger(new $.Event('show')); + this.getCurrentAppContainer().trigger(new $.Event('show', params)); } - // this.getCurrentAppContainer().trigger(new $.Event('urlChanged', params)); + + this.getCurrentAppContainer().trigger(new $.Event('urlChanged', params)); window._nc_event_bus.emit('files:navigation:changed') + }, /** @@ -341,7 +348,8 @@ * Change the URL to point to the given dir and view */ _changeUrl: function(view, dir, fileId) { - var params = {dir: dir}; + console.debug('F2V changeUrl', { arguments }); + var params = { dir: dir }; if (view !== 'files') { params.view = view; } else if (fileId) { @@ -349,7 +357,7 @@ } var currentParams = OC.Util.History.parseUrlQuery(); if (currentParams.dir === params.dir && currentParams.view === params.view) { - if (parseInt(currentParams.fileid) !== parseInt(params.fileid)) { + if (currentParams.fileid !== params.fileid) { // if only fileid changed or was added, replace instead of push console.debug('F2V 1', currentParams.fileid, params.fileid, params); OC.Util.History.replaceState(this._makeUrlParams(params)); diff --git a/apps/files/js/favoritesfilelist.js b/apps/files/js/favoritesfilelist.js index 7ea41da8143..2c6b3c63e15 100644 --- a/apps/files/js/favoritesfilelist.js +++ b/apps/files/js/favoritesfilelist.js @@ -67,7 +67,7 @@ window.addEventListener('DOMContentLoaded', function() { reload: function() { this.showMask(); - if (this._reloadCall) { + if (this._reloadCall?.abort) { this._reloadCall.abort(); } diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 37aa9139850..4feb7ad990d 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -395,7 +395,6 @@ this.$fileList.on('change', 'td.selection>.selectCheckBox', _.bind(this._onClickFileCheckbox, this)); this.$fileList.on('mouseover', 'td.selection', _.bind(this._onMouseOverCheckbox, this)); - console.debug('F2V', this.$el); this.$el.on('show', _.bind(this._onShow, this)); this.$el.on('urlChanged', _.bind(this._onUrlChanged, this)); this.$el.find('.select-all').click(_.bind(this._onClickSelectAll, this)); @@ -416,7 +415,7 @@ this._setCurrentDir(options.dir || '/', false); } - if(options.openFile) { + if (options.openFile) { // Wait for some initialisation process to be over before triggering the default action. _.defer(() => { try { @@ -757,7 +756,7 @@ * Event handler when leaving previously hidden state */ _onShow: function(e) { - console.debug('F2V', 'onShow', e); + console.debug('F2V onShow', [e.dir, e.itemId], e); OCA.Files.App && OCA.Files.App.updateCurrentFileList(this); if (e.itemId === this.id) { this._setCurrentDir('/', false); @@ -772,7 +771,7 @@ * Event handler for when the URL changed */ _onUrlChanged: function(e) { - console.debug('F2V', 'onUrlChanged', e); + console.debug('F2V onUrlChanged', [e.dir], e); if (e && _.isString(e.dir)) { var currentDir = this.getCurrentDirectory(); // this._currentDirectory is NULL when fileList is first initialised diff --git a/apps/files/js/recentfilelist.js b/apps/files/js/recentfilelist.js index 3b7cd035f2a..c4de59b8465 100644 --- a/apps/files/js/recentfilelist.js +++ b/apps/files/js/recentfilelist.js @@ -72,7 +72,7 @@ window.addEventListener('DOMContentLoaded', function () { reload: function () { this.showMask(); - if (this._reloadCall) { + if (this._reloadCall?.abort) { this._reloadCall.abort(); } |