From 1852e11554b7ef169e29012af793833fb75d2e63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Wed, 6 Sep 2023 17:37:33 +0200 Subject: [PATCH 1/4] fix: Avoid layout jump with rich workspace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- src/files.js | 5 ++++- src/helpers/files.js | 6 ++++++ src/views/RichWorkspace.vue | 36 +++++++++++++++++++++++------------- 3 files changed, 33 insertions(+), 14 deletions(-) diff --git a/src/files.js b/src/files.js index eadbb7b7119..9dcb93108ab 100644 --- a/src/files.js +++ b/src/files.js @@ -21,7 +21,7 @@ */ import { linkTo } from '@nextcloud/router' import { loadState } from '@nextcloud/initial-state' -import { registerFileListHeaders } from '@nextcloud/files' +import { registerFileListHeaders, registerDavProperty } from '@nextcloud/files' import Vue from 'vue' import { logger } from './helpers/logger.js' @@ -35,6 +35,9 @@ __webpack_public_path__ = linkTo('text', 'js/') // eslint-disable-line const workspaceAvailable = loadState('text', 'workspace_available') const workspaceEnabled = loadState('text', 'workspace_enabled') +registerDavProperty('nc:rich-workspace', { nc: 'http://nextcloud.org/ns' }) +registerDavProperty('nc:rich-workspace-file', { nc: 'http://nextcloud.org/ns' }) + document.addEventListener('DOMContentLoaded', () => { if (typeof OCA.Viewer === 'undefined') { logger.error('Viewer app is not installed') diff --git a/src/helpers/files.js b/src/helpers/files.js index 58263b01bb2..f2fbb840aa0 100644 --- a/src/helpers/files.js +++ b/src/helpers/files.js @@ -187,6 +187,7 @@ export const FilesWorkspaceHeader = new Header({ render(el, folder, view) { addMenuRichWorkspace() + const hasRichWorkspace = !!folder.attributes['rich-workspace-file'] import('vue').then((module) => { el.id = 'files-workspace-wrapper' @@ -201,6 +202,8 @@ export const FilesWorkspaceHeader = new Header({ vm = new View({ propsData: { path: folder.path, + hasRichWorkspace, + content: folder.attributes['rich-workspace'], }, store, }).$mount(el) @@ -208,7 +211,10 @@ export const FilesWorkspaceHeader = new Header({ }, updated(folder, view) { + const hasRichWorkspace = !!folder.attributes['rich-workspace-file'] vm.path = folder.path + vm.hasRichWorkspace = hasRichWorkspace + vm.content = folder.attributes['rich-workspace'] }, }) diff --git a/src/views/RichWorkspace.vue b/src/views/RichWorkspace.vue index 1aa82528ef0..44c9acb1e29 100644 --- a/src/views/RichWorkspace.vue +++ b/src/views/RichWorkspace.vue @@ -22,10 +22,10 @@