diff options
author | Julius Härtl <jus@bitgrid.net> | 2022-04-21 13:43:09 +0300 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2022-04-21 19:09:00 +0300 |
commit | fccfa2b42b4ea7086ae7b1108f74ab8f6597c87e (patch) | |
tree | b6dafe9ef34ecc81d34e6efed86620482bfadde5 /src | |
parent | 56357a26b2682183086b6ca6dbe541b7de87810e (diff) |
Expose lock in the text UI
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/components/EditorWrapper.vue | 12 | ||||
-rw-r--r-- | src/services/SyncService.js | 3 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/components/EditorWrapper.vue b/src/components/EditorWrapper.vue index 6395afcfe..782a91434 100644 --- a/src/components/EditorWrapper.vue +++ b/src/components/EditorWrapper.vue @@ -32,6 +32,9 @@ <p v-else-if="hasConnectionIssue" class="msg"> {{ t('text', 'File could not be loaded. Please check your internet connection.') }} <a class="button primary" @click="reconnect">{{ t('text', 'Reconnect') }}</a> </p> + <p v-if="lock" class="msg msg-locked"> + <Lock /> {{ t('text', 'This file is opened read-only as it is currently locked by {user}.', { user: lock.displayName }) }} + </p> </div> <div v-if="displayed" id="editor-wrapper" :class="{'has-conflicts': hasSyncCollission, 'icon-loading': !contentLoaded && !hasConnectionIssue, 'richEditor': isRichEditor, 'show-color-annotations': showAuthorAnnotations}"> <div v-if="tiptap" @@ -106,7 +109,7 @@ import store from './../mixins/store' import Tooltip from '@nextcloud/vue/dist/Directives/Tooltip' import { getVersion, receiveTransaction } from 'prosemirror-collab' import { Step } from 'prosemirror-transform' - +import Lock from 'vue-material-design-icons/Lock' const EDITOR_PUSH_DEBOUNCE = 200 const IMAGE_MIMES = [ @@ -132,6 +135,7 @@ export default { GuestNameDialog: () => import(/* webpackChunkName: "editor-guest" */'./GuestNameDialog'), SessionList: () => import(/* webpackChunkName: "editor-collab" */'./SessionList'), HelpModal: () => import(/* webpackChunkName: "editor-collab" */'./HelpModal'), + Lock, }, directives: { Tooltip, @@ -342,6 +346,7 @@ export default { this.currentSession = session this.document = document this.readOnly = document.readOnly + this.lock = this.syncService.lock localStorage.setItem('nick', this.currentSession.guestName) this.$store.dispatch('setCurrentSession', this.currentSession) }) @@ -692,6 +697,11 @@ export default { .button { margin-left: 8px; } + + &.msg-locked .lock-icon { + padding: 0 10px; + float: left; + } } } diff --git a/src/services/SyncService.js b/src/services/SyncService.js index 1fac516fe..1dfaf0362 100644 --- a/src/services/SyncService.js +++ b/src/services/SyncService.js @@ -93,6 +93,8 @@ class SyncService { this.lastStepPush = Date.now() + this.lock = null + return this } @@ -102,6 +104,7 @@ class SyncService { this.document = connectionData.document this.document.readOnly = connectionData.readOnly this.session = connectionData.session + this.lock = connectionData.lock this.emit('opened', { document: this.document, session: this.session, |