-
Notifications
You must be signed in to change notification settings - Fork 120
Expand file tree
/
Copy pathCollisionResolveDialog.vue
More file actions
75 lines (71 loc) · 1.68 KB
/
CollisionResolveDialog.vue
File metadata and controls
75 lines (71 loc) · 1.68 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
<!--
- 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 :disabled="clicked" data-cy="resolveThisVersion" @click="resolveThisVersion">
{{ t('text', 'Use current version') }}
</NcButton>
<NcButton :disabled="clicked" data-cy="resolveServerVersion" @click="resolveServerVersion">
{{ t('text', 'Use the saved 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 {
display: flex;
width: 100%;
margin: auto;
padding: 20px 0;
button {
margin: auto;
}
}
</style>