Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable30] chore(deps): replace vue-shortkey with vueuse directive #13091

Merged
merged 6 commits into from
Aug 22, 2024
Merged
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
39 changes: 0 additions & 39 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
"vue-frag": "^1.4.3",
"vue-material-design-icons": "^5.3.0",
"vue-router": "^3.6.5",
"vue-shortkey": "^3.1.7",
"vue-virtual-scroller": "^1.1.2",
"vue2-leaflet": "^2.7.1",
"vuex": "^3.6.2",
Expand Down
12 changes: 4 additions & 8 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
-->

<template>
<NcContent v-shortkey.once="disableKeyboardShortcuts ? null : ['ctrl', 'f']"
:class="{ 'icon-loading': loading, 'in-call': isInCall }"
app-name="talk"
@shortkey.native="handleAppSearch">
<NcContent :class="{ 'icon-loading': loading, 'in-call': isInCall }"
app-name="talk">
<LeftSidebar v-if="getUserId && !isFullscreen" ref="leftSidebar" />
<NcAppContent>
<router-view />
Expand All @@ -30,6 +28,7 @@ import { generateUrl } from '@nextcloud/router'

import NcAppContent from '@nextcloud/vue/dist/Components/NcAppContent.js'
import NcContent from '@nextcloud/vue/dist/Components/NcContent.js'
import { useHotKey } from '@nextcloud/vue/dist/Composables/useHotKey.js'
import { useIsMobile } from '@nextcloud/vue/dist/Composables/useIsMobile.js'

import ConversationSettingsDialog from './components/ConversationSettings/ConversationSettingsDialog.vue'
Expand Down Expand Up @@ -186,10 +185,6 @@ export default {
return this.currentConversation?.type === CONVERSATION.TYPE.ONE_TO_ONE
|| this.currentConversation?.type === CONVERSATION.TYPE.ONE_TO_ONE_FORMER
},

disableKeyboardShortcuts() {
return OCP.Accessibility.disableKeyboardShortcuts()
},
},

watch: {
Expand Down Expand Up @@ -246,6 +241,7 @@ export default {

created() {
window.addEventListener('beforeunload', this.preventUnload)
useHotKey('f', this.handleAppSearch, { ctrl: true, stop: true, prevent: true })
},

beforeDestroy() {
Expand Down
3 changes: 1 addition & 2 deletions src/PublicShareAuthRequestPasswordButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
type="primary"
:wide="true"
:disabled="isRequestInProgress"
@click="requestPassword"
@keydown.enter="requestPassword">
@click="requestPassword">
{{ t('spreed', 'Request password') }}
</NcButton>
</div>
Expand Down
10 changes: 7 additions & 3 deletions src/components/CallView/shared/LocalAudioControlButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
-->

<template>
<NcButton v-shortkey.once="disableKeyboardShortcuts ? null : ['m']"
v-tooltip="audioButtonTooltip"
<NcButton v-tooltip="audioButtonTooltip"
:type="type"
:aria-label="audioButtonAriaLabel"
:class="{ 'no-audio-available': !isAudioAllowed || !model.attributes.audioAvailable }"
@shortkey="toggleAudio"
@click.stop="toggleAudio">
<template #icon>
<VolumeIndicator :audio-preview-available="model.attributes.audioAvailable"
Expand All @@ -26,6 +24,7 @@ import { emit, subscribe, unsubscribe } from '@nextcloud/event-bus'
import { t } from '@nextcloud/l10n'

import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import { useHotKey } from '@nextcloud/vue/dist/Composables/useHotKey.js'
import Tooltip from '@nextcloud/vue/dist/Directives/Tooltip.js'

import VolumeIndicator from '../../UIShared/VolumeIndicator.vue'
Expand Down Expand Up @@ -128,6 +127,11 @@ export default {
},
},

created() {
useHotKey('m', this.toggleAudio)
useHotKey(' ', this.toggleAudio, { push: true })
},

mounted() {
subscribe('local-audio-control-button:toggle-audio', this.updateDeviceState)
},
Expand Down
17 changes: 6 additions & 11 deletions src/components/CallView/shared/LocalVideoControlButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
-->

<template>
<NcButton v-shortkey.once="disableKeyboardShortcuts ? null : ['v']"
v-tooltip="videoButtonTooltip"
<NcButton v-tooltip="videoButtonTooltip"
:type="type"
:aria-label="videoButtonAriaLabel"
:class="{ 'no-video-available': !isVideoAllowed || !model.attributes.videoAvailable }"
@shortkey="toggleVideo"
@click.stop="toggleVideo">
<template #icon>
<VideoIcon v-if="showVideoOn" :size="20" />
Expand All @@ -26,6 +24,7 @@ import { emit, subscribe, unsubscribe } from '@nextcloud/event-bus'
import { t } from '@nextcloud/l10n'

import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import { useHotKey } from '@nextcloud/vue/dist/Composables/useHotKey.js'
import Tooltip from '@nextcloud/vue/dist/Directives/Tooltip.js'

import { PARTICIPANT } from '../../../constants.js'
Expand Down Expand Up @@ -123,6 +122,10 @@ export default {
},
},

created() {
useHotKey('v', this.toggleVideo)
},

mounted() {
subscribe('local-video-control-button:toggle-video', this.updateDeviceState)
},
Expand All @@ -134,14 +137,6 @@ export default {
methods: {
t,
toggleVideo() {
/**
* Abort toggling the video if the 'v' key is lifted when pasting an
* image in the new message form.
*/
if (document.getElementsByClassName('upload-editor').length !== 0) {
return
}

if (!this.model.attributes.videoAvailable) {
emit('talk:media-settings:show')
return
Expand Down
6 changes: 2 additions & 4 deletions src/components/ConversationSettings/LinkShareSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,15 @@

<div class="app-settings-subsection__buttons">
<NcButton ref="copyLinkButton"
@click="handleCopyLink"
@keydown.enter="handleCopyLink">
@click="handleCopyLink">
<template #icon>
<ClipboardTextOutline />
</template>
{{ t('spreed', 'Copy conversation link') }}
</NcButton>
<NcButton v-if="isSharedPublicly && canModerate"
:disabled="isSendingInvitations"
@click="handleResendInvitations"
@keydown.enter="handleResendInvitations">
@click="handleResendInvitations">
<template #icon>
<Email />
</template>
Expand Down
11 changes: 5 additions & 6 deletions src/components/NewMessage/NewMessage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
<p>{{ t('spreed','Adding a mention will only notify users who did not read the message.') }}</p>
</NcNoteCard>
<NcRichContenteditable ref="richContenteditable"
v-shortkey.once="$options.disableKeyboardShortcuts ? null : ['c']"
:value.sync="text"
:auto-complete="autoComplete"
:disabled="disabled"
Expand All @@ -83,7 +82,6 @@
:placeholder="placeholderText"
:aria-label="placeholderText"
dir="auto"
@shortkey="focusInput"
@keydown.esc="handleInputEsc"
@keydown.ctrl.up="handleEditLastMessage"
@input="handleTyping"
Expand Down Expand Up @@ -192,6 +190,7 @@ import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import NcEmojiPicker from '@nextcloud/vue/dist/Components/NcEmojiPicker.js'
import NcNoteCard from '@nextcloud/vue/dist/Components/NcNoteCard.js'
import NcRichContenteditable from '@nextcloud/vue/dist/Components/NcRichContenteditable.js'
import { useHotKey } from '@nextcloud/vue/dist/Composables/useHotKey.js'

import NewMessageAbsenceInfo from './NewMessageAbsenceInfo.vue'
import NewMessageAttachments from './NewMessageAttachments.vue'
Expand All @@ -215,13 +214,9 @@ import { fetchClipboardContent } from '../../utils/clipboard.js'
import { isDarkTheme } from '../../utils/isDarkTheme.js'
import { parseSpecialSymbols } from '../../utils/textParse.ts'

const disableKeyboardShortcuts = OCP.Accessibility.disableKeyboardShortcuts()

export default {
name: 'NewMessage',

disableKeyboardShortcuts,

components: {
FilePickerVue,
NcActionButton,
Expand Down Expand Up @@ -537,6 +532,10 @@ export default {
},
},

created() {
useHotKey('c', this.focusInput, { stop: true, prevent: true })
},

mounted() {
EventBus.on('focus-chat-input', this.focusInput)
EventBus.on('upload-start', this.handleUploadSideEffects)
Expand Down
36 changes: 2 additions & 34 deletions src/components/TopBar/TopBarMediaControls.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
<div v-shortkey.push="disableKeyboardShortcuts ? null : ['space']"
class="buttons-bar"
@shortkey="handleShortkey">
<div class="buttons-bar">
<div class="network-connection-state">
<NcPopover v-if="qualityWarningTooltip"
:boundary="boundaryElement"
Expand Down Expand Up @@ -44,8 +42,7 @@
</NcPopover>
</div>

<LocalAudioControlButton ref="audioControl"
:token="token"
<LocalAudioControlButton :token="token"
:conversation="conversation"
:model="model"
type="tertiary" />
Expand Down Expand Up @@ -191,8 +188,6 @@ export default {
boundaryElement: document.querySelector('.main-view'),
mouseover: false,
qualityWarningInGracePeriodTimeout: null,
audioEnabledBeforeSpacebarKeydown: undefined,
spacebarKeyDown: false,
}
},

Expand Down Expand Up @@ -377,10 +372,6 @@ export default {

return tooltip
},

disableKeyboardShortcuts() {
return OCP.Accessibility.disableKeyboardShortcuts()
},
},

watch: {
Expand Down Expand Up @@ -409,29 +400,6 @@ export default {

methods: {
t,
/**
* This method executes on spacebar keydown and keyup
*/
handleShortkey() {
if (!this.model.attributes.audioAvailable) {
return
}

if (!this.spacebarKeyDown) {
this.audioEnabledBeforeSpacebarKeydown = this.model.attributes.audioEnabled
this.spacebarKeyDown = true
this.$refs.audioControl.toggleAudio()
} else {
this.spacebarKeyDown = false
if (this.audioEnabledBeforeSpacebarKeydown) {
this.model.enableAudio()
} else {
this.model.disableAudio()
}
this.audioEnabledBeforeSpacebarKeydown = undefined
}

},

setSpeakingWhileMutedNotification(message) {
this.speakingWhileMutedNotification = message
Expand Down
Loading
Loading