mirror of
https://gitlab.com/RemixDev/deemix-webui.git
synced 2025-01-29 01:28:24 +00:00
implemented clipboard API polyfill for non chromium engines
This commit is contained in:
parent
77b202d88e
commit
8f32ada55f
|
@ -14,6 +14,7 @@ This is just the WebUI for deemix, it should be used with deemix-pyweb or someth
|
||||||
- Download Quality ✅
|
- Download Quality ✅
|
||||||
- Copy Image URL where possible ✅
|
- Copy Image URL where possible ✅
|
||||||
- Resolve problem when positioning out of window (e.g. clicking on the bottom of the window)
|
- Resolve problem when positioning out of window (e.g. clicking on the bottom of the window)
|
||||||
|
- Resolve problem when right clicking on element and then right clicking in another side (menu does not update)
|
||||||
- [ ] Make i18n async (https://kazupon.github.io/vue-i18n/guide/lazy-loading.html)
|
- [ ] Make i18n async (https://kazupon.github.io/vue-i18n/guide/lazy-loading.html)
|
||||||
- Use ES2020 async imports, if possible
|
- Use ES2020 async imports, if possible
|
||||||
- [ ] Make the UI look coherent
|
- [ ] Make the UI look coherent
|
||||||
|
|
5
package-lock.json
generated
5
package-lock.json
generated
|
@ -447,6 +447,11 @@
|
||||||
"source-map": "~0.6.0"
|
"source-map": "~0.6.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"clipboard-polyfill": {
|
||||||
|
"version": "3.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/clipboard-polyfill/-/clipboard-polyfill-3.0.1.tgz",
|
||||||
|
"integrity": "sha512-R/uxBa8apxLJArzpFpuTLqavUcnEX8bezZKSuqkwz7Kny2BmxyKDslYGdrKiasKuD+mU1noF7Lkt/p5pyDqFoQ=="
|
||||||
|
},
|
||||||
"cliui": {
|
"cliui": {
|
||||||
"version": "5.0.0",
|
"version": "5.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz",
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
"build": "npm-run-all --sequential clean build:js build:styles"
|
"build": "npm-run-all --sequential clean build:js build:styles"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"clipboard-polyfill": "^3.0.1",
|
||||||
"jquery": "^3.5.1",
|
"jquery": "^3.5.1",
|
||||||
"lodash-es": "^4.17.15",
|
"lodash-es": "^4.17.15",
|
||||||
"svg-country-flags": "^1.2.7",
|
"svg-country-flags": "^1.2.7",
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -15,7 +15,9 @@
|
||||||
<script>
|
<script>
|
||||||
import Downloads from '@/utils/downloads'
|
import Downloads from '@/utils/downloads'
|
||||||
import downloadQualities from '@js/qualities'
|
import downloadQualities from '@js/qualities'
|
||||||
import { generatePath } from '@/utils/utils'
|
import { generatePath, isChromium } from '@/utils/utils'
|
||||||
|
|
||||||
|
import * as clipboard from 'clipboard-polyfill/text'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
|
@ -55,9 +57,15 @@ export default {
|
||||||
show: false,
|
show: false,
|
||||||
position: 3,
|
position: 3,
|
||||||
action: () => {
|
action: () => {
|
||||||
navigator.clipboard.writeText(this.generalHref).catch(err => {
|
if (isChromium) {
|
||||||
console.error('Link copying failed', err)
|
navigator.clipboard.writeText(this.generalHref).catch(err => {
|
||||||
})
|
console.error('Link copying failed', err)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
clipboard.writeText(this.generalHref).catch(err => {
|
||||||
|
console.error('Link copying failed', err)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
copyImageLink: {
|
copyImageLink: {
|
||||||
|
@ -65,9 +73,15 @@ export default {
|
||||||
show: false,
|
show: false,
|
||||||
position: 4,
|
position: 4,
|
||||||
action: () => {
|
action: () => {
|
||||||
navigator.clipboard.writeText(this.imgSrc).catch(err => {
|
if (isChromium) {
|
||||||
console.error('Image copying failed', err)
|
navigator.clipboard.writeText(this.imgSrc).catch(err => {
|
||||||
})
|
console.error('Image copying failed', err)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
clipboard.writeText(this.imgSrc).catch(err => {
|
||||||
|
console.error('Image copying failed', err)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
copyDeezerLink: {
|
copyDeezerLink: {
|
||||||
|
@ -75,9 +89,15 @@ export default {
|
||||||
show: false,
|
show: false,
|
||||||
position: 5,
|
position: 5,
|
||||||
action: () => {
|
action: () => {
|
||||||
navigator.clipboard.writeText(this.generalHref).catch(err => {
|
if (isChromium) {
|
||||||
console.error('Deezer link copying failed', err)
|
navigator.clipboard.writeText(this.generalHref).catch(err => {
|
||||||
})
|
console.error('Deezer link copying failed', err)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
clipboard.writeText(this.generalHref).catch(err => {
|
||||||
|
console.error('Deezer link copying failed', err)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
paste: {
|
paste: {
|
||||||
|
@ -85,9 +105,15 @@ export default {
|
||||||
show: true,
|
show: true,
|
||||||
position: 6,
|
position: 6,
|
||||||
action: () => {
|
action: () => {
|
||||||
navigator.clipboard.readText().then(text => {
|
if (isChromium) {
|
||||||
document.execCommand('insertText', undefined, text)
|
navigator.clipboard.readText().then(text => {
|
||||||
})
|
document.execCommand('insertText', undefined, text)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
clipboard.readText().then(text => {
|
||||||
|
document.execCommand('insertText', undefined, text)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,7 +149,6 @@ export default {
|
||||||
contextMenuEvent.preventDefault()
|
contextMenuEvent.preventDefault()
|
||||||
|
|
||||||
const { pageX, pageY, target: elementClicked } = contextMenuEvent
|
const { pageX, pageY, target: elementClicked } = contextMenuEvent
|
||||||
|
|
||||||
const path = generatePath(elementClicked)
|
const path = generatePath(elementClicked)
|
||||||
|
|
||||||
this.positionMenu(pageX, pageY)
|
this.positionMenu(pageX, pageY)
|
||||||
|
|
|
@ -17,6 +17,8 @@ export function generatePath(el) {
|
||||||
return path
|
return path
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const isChromium = !!window.chrome
|
||||||
|
|
||||||
export function isValidURL(text) {
|
export function isValidURL(text) {
|
||||||
let lowerCaseText = text.toLowerCase()
|
let lowerCaseText = text.toLowerCase()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue