From 42b77ab4ceb2e9ad42707337737f42feb93a3666 Mon Sep 17 00:00:00 2001 From: Jonas Date: Tue, 12 Sep 2023 16:01:03 +0200 Subject: [PATCH 1/5] feat(page): Add toggle for full width page view Fixes: #242 Signed-off-by: Jonas --- package-lock.json | 1 + package.json | 1 + src/components/Collective.vue | 2 - src/components/Page.vue | 9 +++- src/components/Page/Editor.vue | 8 +--- src/components/Page/LandingPageWidgets.vue | 6 +-- .../LandingPageWidgets/RecentPagesWidget.vue | 1 - src/components/Page/PageActionMenu.vue | 32 +++++++++++-- src/components/Page/PageInfoBar.vue | 12 +++-- src/components/Page/RichText.vue | 5 -- src/components/Page/TextEditor.vue | 7 +-- src/components/Page/Version.vue | 3 +- src/components/PagePrint.vue | 11 ++--- src/components/SkeletonLoading.vue | 21 ++++++++- src/css/editor.scss | 16 +++++++ src/store/actions.js | 2 + src/store/mutations.js | 1 + src/store/pages.js | 47 +++++++++++++++++++ 18 files changed, 146 insertions(+), 39 deletions(-) create mode 100644 src/css/editor.scss diff --git a/package-lock.json b/package-lock.json index 98fe817c8..4338e275d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "dependencies": { "@nextcloud/auth": "^2.1.0", "@nextcloud/axios": "^2.4.0", + "@nextcloud/browser-storage": "^0.2.0", "@nextcloud/dialogs": "^4.1.0", "@nextcloud/event-bus": "^3.1.0", "@nextcloud/files": "^3.0.0-beta.21", diff --git a/package.json b/package.json index a6e14c3d7..cf466e777 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "dependencies": { "@nextcloud/auth": "^2.1.0", "@nextcloud/axios": "^2.4.0", + "@nextcloud/browser-storage": "^0.2.0", "@nextcloud/dialogs": "^4.1.0", "@nextcloud/event-bus": "^3.1.0", "@nextcloud/files": "^3.0.0-beta.21", diff --git a/src/components/Collective.vue b/src/components/Collective.vue index 72fc37bce..32493c8ed 100644 --- a/src/components/Collective.vue +++ b/src/components/Collective.vue @@ -203,8 +203,6 @@ export default { position: sticky; top: 0; padding: 8px 0px 2px 8px; - margin: auto; - max-width: 670px; display: flex; align-items: center; background-color: var(--color-main-background); diff --git a/src/components/Page.vue b/src/components/Page.vue index 3614be17a..c1c1c4adb 100644 --- a/src/components/Page.vue +++ b/src/components/Page.vue @@ -1,6 +1,6 @@ + + + {{ t('collectives', 'Full width') }} + @@ -33,7 +42,7 @@ :close-after-click="true"> {{ t('collectives', 'Show in Files') }} - @@ -52,7 +61,7 @@ {{ editTemplateString }} - @@ -41,8 +49,6 @@ export default { height: 44px; padding: 3px 8px 3px 14px; display: flex; - max-width: 670px; - margin: auto; flex-wrap: nowrap; align-items: center; overflow: hidden; diff --git a/src/components/Page/RichText.vue b/src/components/Page/RichText.vue index ec4a4b66a..b64947b20 100644 --- a/src/components/Page/RichText.vue +++ b/src/components/Page/RichText.vue @@ -251,11 +251,6 @@ export default { diff --git a/src/css/editor.scss b/src/css/editor.scss index da43166de..1274ed293 100644 --- a/src/css/editor.scss +++ b/src/css/editor.scss @@ -7,6 +7,11 @@ max-width: var(--text-editor-max-width); margin: auto; + &.page-title { + max-width: 100%; + margin: 0 0 0 max(0px, calc(50% - (var(--text-editor-max-width) / 2))); + } + // Editor document status bar .document-status { max-width: var(--text-editor-max-width); From 7f6a6b7bb7341182f35a819100cfe313d3a914ae Mon Sep 17 00:00:00 2001 From: Jonas Date: Thu, 14 Sep 2023 13:51:41 +0200 Subject: [PATCH 5/5] fix(persistentStorage): Prefix persistent storage key with `text-` We might want to use this within Text later on, so let's already prefix it with `text-` instead of `collectives-`. Signed-off-by: Jonas --- src/store/pages.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/store/pages.js b/src/store/pages.js index b80fd7be6..edc07499b 100644 --- a/src/store/pages.js +++ b/src/store/pages.js @@ -786,7 +786,7 @@ export default { * @param {Function} store.commit commit changes */ [INIT_FULL_WIDTH_PAGEIDS]({ commit }) { - commit(SET_FULL_WIDTH_PAGEIDS, JSON.parse(persistentStorage.getItem('fullWidthPageIds') ?? '[]')) + commit(SET_FULL_WIDTH_PAGEIDS, JSON.parse(persistentStorage.getItem('text-fullWidthPageIds') ?? '[]')) }, /** @@ -799,15 +799,15 @@ export default { */ [SET_FULL_WIDTH_VIEW]({ commit, getters }, fullWidthView) { const pageId = getters.currentPage.id - const fullWidthPageIds = JSON.parse(persistentStorage.getItem('fullWidthPageIds') ?? '[]') + const fullWidthPageIds = JSON.parse(persistentStorage.getItem('text-fullWidthPageIds') ?? '[]') if (fullWidthView && !fullWidthPageIds.includes(pageId)) { fullWidthPageIds.push(pageId) commit(SET_FULL_WIDTH_PAGEIDS, fullWidthPageIds) - persistentStorage.setItem('fullWidthPageIds', JSON.stringify(fullWidthPageIds)) + persistentStorage.setItem('text-fullWidthPageIds', JSON.stringify(fullWidthPageIds)) } else if (!fullWidthView && fullWidthPageIds.includes(pageId)) { fullWidthPageIds.splice(fullWidthPageIds.indexOf(pageId), 1) commit(SET_FULL_WIDTH_PAGEIDS, fullWidthPageIds) - persistentStorage.setItem('fullWidthPageIds', JSON.stringify(fullWidthPageIds)) + persistentStorage.setItem('text-fullWidthPageIds', JSON.stringify(fullWidthPageIds)) } }, },