Skip to content

Commit

Permalink
Add conflict dialog custom content
Browse files Browse the repository at this point in the history
  • Loading branch information
lookacat committed Oct 5, 2022
1 parent d0d70d0 commit 4ccc4bb
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ export default defineComponent({
areCustomKeyBindingsEnabled() {
const activeElementTag = document.activeElement.tagName
const type = document.activeElement.getAttribute('type')
if (['textarea', 'input', 'select'].includes(activeElementTag.toLowerCase()) && type !== 'checkbox') {
if (
['textarea', 'input', 'select'].includes(activeElementTag.toLowerCase()) &&
type !== 'checkbox'
) {
return true
}
const closestSelectionEl = window.getSelection().focusNode as HTMLElement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class ResourceTransfer extends ConflictDialog {
showResultMessage(errors, movedResources: Array<Resource>, transferType: TransferType) {
if (errors.length === 0) {
const count = movedResources.length
if(count === 0) {
if (count === 0) {
return
}
const ntitle =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,8 @@ export class ConflictDialog {
variation: 'danger',
icon: 'alarm-warning',
title: this.$gettext('Copy here?'),
message: this.$gettext(
'Moving files from one space to another is not possible. Do you want to copy instead? Note: Links and shares of the original file are not copied.'
),
customContent:
'<p>Moving files from one space to another is not possible. Do you want to copy instead?</p><p>Note: Links and shares of the original file are not copied.</p>',
cancelText: this.$gettext('Cancel'),
confirmText: this.$gettext('Copy here'),
onCancel: () => {
Expand Down
6 changes: 5 additions & 1 deletion packages/web-runtime/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@
@confirm-secondary="modal.onConfirmSecondary"
@mounted="focusModal"
@beforeDestroy="focusModal"
/>
>
<template v-if="modal.customContent" #content>
<p v-html="modal.customContent"></p>
</template>
</oc-modal>
</div>
</template>
<script lang="ts">
Expand Down
4 changes: 3 additions & 1 deletion packages/web-runtime/src/store/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ const state = {
onCheckboxValueChanged: emptyReturn,
onConfirmSecondary: emptyReturn,
contextualHelperLabel: '',
contextualHelperData: {}
contextualHelperData: {},
customContent: ''
}

const actions = {
Expand Down Expand Up @@ -75,6 +76,7 @@ const mutations = {
state.onConfirmSecondary = modal.onConfirmSecondary || emptyReturn
state.contextualHelperLabel = modal.contextualHelperLabel
state.contextualHelperData = modal.contextualHelperData
state.customContent = modal.customContent || ''
},

HIDE_MODAL(state) {
Expand Down

0 comments on commit 4ccc4bb

Please sign in to comment.