Skip to content

Commit 74568fa

Browse files
committed
Make saving indicator a button for force-save
Fixes: #2421 Signed-off-by: Jonas <jonas@freesources.org>
1 parent 99c9c29 commit 74568fa

File tree

2 files changed

+41
-7
lines changed

2 files changed

+41
-7
lines changed

src/components/Editor/Status.vue

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,13 @@
2323
<template>
2424
<div class="text-editor__session-list">
2525
<div v-tooltip="lastSavedStatusTooltip" class="save-status" :class="saveStatusClass">
26-
<SavingIndicator :saving="saveStatusClass === 'saving'"
27-
:error="saveStatusClass === 'error'" />
26+
<NcButton type="tertiary"
27+
@click="onClickSave">
28+
<template #icon>
29+
<SavingIndicator :saving="saveStatusClass === 'saving'"
30+
:error="saveStatusClass === 'error'" />
31+
</template>
32+
</NcButton>
2833
</div>
2934
<SessionList :sessions="sessions">
3035
<p slot="lastSaved" class="last-saved">
@@ -38,19 +43,21 @@
3843
<script>
3944
4045
import SavingIndicator from '../SavingIndicator.vue'
41-
import { ERROR_TYPE } from './../../services/SyncService.js'
46+
import { ERROR_TYPE } from '../../services/SyncService.js'
4247
import moment from '@nextcloud/moment'
43-
import { Tooltip } from '@nextcloud/vue'
48+
import { NcButton, Tooltip } from '@nextcloud/vue'
4449
import {
4550
useIsMobileMixin,
4651
useIsPublicMixin,
52+
useSyncServiceMixin,
4753
} from '../Editor.provider.js'
4854
import refreshMoment from '../../mixins/refreshMoment.js'
4955
5056
export default {
5157
name: 'Status',
5258
5359
components: {
60+
NcButton,
5461
SavingIndicator,
5562
SessionList: () => import(/* webpackChunkName: "editor-collab" */'./SessionList.vue'),
5663
GuestNameDialog: () => import(/* webpackChunkName: "editor-guest" */'./GuestNameDialog.vue'),
@@ -60,7 +67,12 @@ export default {
6067
Tooltip,
6168
},
6269
63-
mixins: [useIsMobileMixin, useIsPublicMixin, refreshMoment],
70+
mixins: [
71+
useIsMobileMixin,
72+
useIsPublicMixin,
73+
useSyncServiceMixin,
74+
refreshMoment,
75+
],
6476
6577
props: {
6678
hasConnectionIssue: {
@@ -124,13 +136,20 @@ export default {
124136
return Object.values(this.sessions).find((session) => session.isCurrent)
125137
},
126138
lastSavedString() {
127-
// Make this a dependent of refreshMoment so it will be recomputed
139+
// Make this a dependent of refreshMoment, so it will be recomputed
128140
/* eslint-disable-next-line no-unused-expressions */
129141
this.refreshMoment
130142
return moment(this.document.lastSavedVersionTime * 1000).fromNow()
131143
},
132144
},
133145
146+
methods: {
147+
onClickSave() {
148+
if (this.dirtyStateIndicator) {
149+
this.$syncService.forceSave()
150+
}
151+
},
152+
},
134153
}
135154
</script>
136155

src/components/SavingIndicator.vue

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
<template>
2222
<span class="material-design-icon">
23-
<CheckIcon />
23+
<CheckIcon class="saving-indicator-check" />
2424
<span class="saving-indicator-container" :class="{error, saving}">
2525
<CircleMedium class="saving-indicator" />
2626
</span>
@@ -53,6 +53,14 @@ export default defineComponent({
5353
</script>
5454

5555
<style lang="scss" scoped>
56+
.saving-indicator-check {
57+
cursor: pointer;
58+
59+
:deep(svg) {
60+
fill: var(--color-text-lighter);
61+
}
62+
}
63+
5664
.saving-indicator-container {
5765
display: none;
5866
position: absolute;
@@ -63,14 +71,21 @@ export default defineComponent({
6371
position: relative;
6472
top: 6px;
6573
left: 6px;
74+
cursor: pointer;
6675
}
6776
}
6877
6978
&.saving > span {
7079
color: var(--color-primary);
80+
:deep(svg) {
81+
fill: var(--color-primary);
82+
}
7183
}
7284
&.error > span {
7385
color: var(--color-error);
86+
:deep(svg) {
87+
fill: var(--color-primary);
88+
}
7489
}
7590
}
7691
</style>

0 commit comments

Comments
 (0)