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

Drop v-clipboard in favor of native browser API #1478

Merged
merged 1 commit into from
Feb 2, 2023
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
11 changes: 0 additions & 11 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 @@ -41,7 +41,6 @@
"p-queue": "^7.3.0",
"regenerator-runtime": "^0.13.11",
"v-click-outside": "^3.2.0",
"v-clipboard": "^2.2.3",
"vue": "^2.7.14",
"vue-material-design-icons": "^5.1.2",
"vue-router": "^3.6.5",
Expand Down
9 changes: 3 additions & 6 deletions src/mixins/ShareLinkMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
*/
import { generateUrl } from '@nextcloud/router'
import { showError, showSuccess } from '@nextcloud/dialogs'
import Clipboard from 'v-clipboard'
import Vue from 'vue'

Vue.use(Clipboard)

export default {
methods: {
Expand Down Expand Up @@ -57,9 +53,10 @@ export default {
*/
async copyLink(event, link) {
// Copy link, boolean return indicates success or fail.
if (this.$clipboard(link)) {
try {
await navigator.clipboard.writeText(link)
showSuccess(t('forms', 'Form link copied'))
} else {
} catch (error) {
showError(t('forms', 'Cannot copy, please copy the link manually'))
}
// Set back focus as clipboard removes focus
Expand Down
4 changes: 0 additions & 4 deletions src/mixins/ViewsMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,12 @@
import { generateOcsUrl } from '@nextcloud/router'
import { showError } from '@nextcloud/dialogs'
import axios from '@nextcloud/axios'
import Clipboard from 'v-clipboard'
import MarkdownIt from 'markdown-it'
import Vue from 'vue'

import CancelableRequest from '../utils/CancelableRequest.js'
import OcsResponse2Data from '../utils/OcsResponse2Data.js'
import logger from '../utils/Logger.js'

Vue.use(Clipboard)

export default {
provide() {
return {
Expand Down