-
Notifications
You must be signed in to change notification settings - Fork 121
Expand file tree
/
Copy pathCollisionResolveDialog.vue
More file actions
82 lines (79 loc) · 1.87 KB
/
CollisionResolveDialog.vue
File metadata and controls
82 lines (79 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!--
- SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
<div id="resolve-conflicts" class="collision-resolve-dialog" :class="{'icon-loading': clicked }">
<NcButton :wide="true"
size="large"
:disabled="clicked"
data-cy="resolveThisVersion"
@click="resolveThisVersion">
{{ t('text', 'Overwrite the file and save the current changes') }}
</NcButton>
<NcButton :wide="true"
:disabled="clicked"
data-cy="resolveServerVersion"
@click="resolveServerVersion">
{{ t('text', 'Discard the current changes and load the latest version') }}
</NcButton>
</div>
</template>
<script>
import {
useEditorMixin,
useIsRichEditorMixin,
useSyncServiceMixin,
} from './Editor.provider.js'
import NcButton from '@nextcloud/vue/components/NcButton'
import setContent from './../mixins/setContent.js'
export default {
name: 'CollisionResolveDialog',
components: {
NcButton,
},
mixins: [
useEditorMixin,
useIsRichEditorMixin,
setContent,
useSyncServiceMixin,
],
props: {
syncError: {
type: Object,
default: null,
},
},
data() {
return {
clicked: false,
}
},
methods: {
resolveThisVersion() {
this.clicked = true
this.$syncService.forceSave().then(() => this.$syncService.syncUp())
this.$editor.setEditable(!this.readOnly)
},
resolveServerVersion() {
const { outsideChange } = this.syncError.data
this.clicked = true
this.$editor.setEditable(!this.readOnly)
this.setContent(outsideChange, { isRichEditor: this.$isRichEditor })
this.$syncService.forceSave().then(() => this.$syncService.syncUp())
},
},
}
</script>
<style scoped lang="scss">
#resolve-conflicts {
position: sticky;
display: flex;
z-index: 1;
margin: auto;
padding: 0 var(--default-grid-baseline);
button {
margin: 0 var(--default-grid-baseline) ;
}
}
</style>