Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/components/Modal/SaveAs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
-->

<template>
<NcModal :name="t('richdocuments', 'Save as')">
<NcModal :name="t('richdocuments', 'Save as')" @close="cancel">
<div class="saveas-dialog">
<h1>{{ name }}</h1>
<p>{{ description }}</p>
Expand Down Expand Up @@ -149,12 +149,14 @@ export default {
}
}

emit('richdocuments:grab-focus')
this.$emit('close', this.newFileName)
} finally {
this.isChecking = false
}
},
cancel() {
emit('richdocuments:grab-focus')
this.$emit('close', null)
},
},
Expand Down
4 changes: 4 additions & 0 deletions src/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ const PostMessages = new PostMessageService({
loolframe: () => document.getElementById('loleafletframe').contentWindow,
})

subscribe('richdocuments:grab-focus', () => {
PostMessages.sendWOPIPostMessage('loolframe', 'Grab_Focus')
})

if (isDirectEditing()) {
enableScrollLock()
}
Expand Down
10 changes: 10 additions & 0 deletions src/mixins/saveAs.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,21 @@
*/

import { spawnDialog } from '@nextcloud/dialogs'
import { subscribe, unsubscribe } from '@nextcloud/event-bus'
import { basename } from 'path'
import SaveAs from '../components/Modal/SaveAs.vue'

export default {
mounted() {
subscribe('richdocuments:grab-focus', this.grabFocus)
},
beforeDestroy() {
unsubscribe('richdocuments:grab-focus', this.grabFocus)
},
methods: {
grabFocus() {
this.sendPostMessage('Grab_Focus')
},
async saveAs(format) {
spawnDialog(
SaveAs,
Expand Down