Merge pull request #45963 from nextcloud/artonge/fix/openfile

This commit is contained in:
John Molakvoæ 2024-06-19 17:04:42 +02:00 committed by GitHub
commit 18cf61df9f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 9 additions and 6 deletions

View file

@ -292,7 +292,7 @@ class ViewController extends Controller {
}
$this->initialState->provideInitialState(
'openFileInfo', [
'fileInfo', [
'id' => $node->getId(),
'name' => $isRoot ? '' : $node->getName(),
'path' => $path,

View file

@ -206,8 +206,7 @@ export default defineComponent({
const mainContent = window.document.querySelector('main.app-content') as HTMLElement
mainContent.addEventListener('dragover', this.onDragOver)
// handle initially opening a given file
const { id } = loadState<{ id?: number }>('files', 'openFileInfo', {})
const { id } = loadState<{ id?: number }>('files', 'fileInfo', {})
this.scrollToFile(id ?? this.fileId)
this.openSidebarForFile(id ?? this.fileId)
this.handleOpenFile(id ?? null)
@ -248,6 +247,10 @@ export default defineComponent({
* @param fileId File to open
*/
handleOpenFile(fileId: number|null) {
if (!this.openFile) {
return
}
if (fileId === null || this.openFileId === fileId) {
return
}

4
dist/files-main.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long