-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
Extension(@quasar/qpdfviewer): is not compatible with @quasar/app v3.0.0-beta.25 #87
Comments
This the only plugin stopping me from upgrading to Quasar 2 |
@nedadoncic and @Brock-oly This is on the list of app-exts that need conversion. |
I've completed a conversion locally with only one small hiccup: the
import { defineComponent, h } from "vue"
import { useQuasar } from "quasar"
import useModelToggle, { useModelToggleProps, useModelToggleEmits } from "quasar/src/composables/private/use-model-toggle.js"
export default defineComponent({
name: "QPdfviewer",
props: {
src: String,
type: {
type: String,
default: "html5",
validator: (v) => ["html5", "pdfjs"].indexOf(v) !== -1,
},
errorString: {
type: String,
default:
"This browser does not support PDFs. Download the PDF to view it:",
},
contentStyle: [String, Object, Array],
contentClass: [String, Object, Array],
innerContentStyle: [String, Object, Array],
innerContentClass: [String, Object, Array],
...useModelToggleProps,
},
emits: [
...useModelToggleEmits
],
data() {
return {
hashId: "q-pdfviewer-" + Math.random().toString(36).substr(2, 9)
}
},
render(prop) {
const $q = useQuasar()
function __renderObject () {
return h('object', {
class: [prop.innerContentClass],
style: [prop.innerContentStyle],
id: prop.hashId,
data: prop.src,
type: 'application/pdf',
width: '100%',
height: '100%'
}, [
// browser object not supported, try iframe
__renderIFrame()
])
}
function __renderIFrame () {
return h('iframe', {
class: ['q-pdfviewer__iframe'],
src: prop.src,
width: '100%',
height: '100%'
}, [
// iframe not supported either, give user a link to download
__renderText()
])
}
function __renderIFramePDFJS () {
return h('iframe', {
class: ['q-pdfviewer__iframe'],
src: 'pdfjs/web/viewer.html?file=' + encodeURIComponent(prop.src)
}, [
// iframe not supported either, give user a link to download
__renderText()
])
}
function __renderText () {
// TODO: ????
/*return h('p',
'This browser does not support PDFs. Download the PDF to view it:', [
h('a', {
href: prop.src,
target: '_blank'
})
])*/
return h('a', {
href: prop.src,
target: '_blank'
})
}
if (prop.src !== void 0 && prop.src.length > 0) {
return h(
"div",
{
class: ["q-pdfviewer", prop.contentClass],
style: [prop.contentStyle],
},
[
$q.platform.is.electron || prop.type === "pdfjs"
? __renderIFramePDFJS(h)
: __renderObject(h),
]
);
}
return "";
},
setup() {
return {
...useModelToggle
}
}
}) Note the
{
"mixins": [ "composables/private/use-model-toggle" ],
"type": "component",
"props": {
// Unchanged
}
}
import QPdfviewer from '@quasar/quasar-app-extension-qpdfviewer/src/component/QPdfviewer'
export default ({ app }) => {
app.component('q-pdfviewer', QPdfviewer)
}
//api.compatibleWith('@quasar/app', '^1.0.0 || ^2.0.0')
api.compatibleWith('@quasar/app', '^3.0.0') No other changes were necessary. Not quite sure if this should be a PR or should perhaps be a different repo/branch for Vue3/Quasar2. For anyone that needs this ASAP, you can follow the procedure for Manually Testing App Extensions. For remote builds, you'll need to temporarily move the source under your source tree and point |
It'll need to be in a different branch. I won't have any time to do this for a while. |
@hawkeye64 if you provide some high level guidance and whatever access is necessary, I can probably manage. Let me know if you want to coordinate. |
@CharlieDigital DM me on Quasar Discord and I'll give you a link to my personal Discord where we can discuss it. |
Version 2.0.0-alpha.1 is almost complete, thanks to @CharlieDigital for his gracious help. Expect a release sometime next week that works with Quasar v3/Vue v3. |
Hello,
I have this issue and cannot use extension:
Extension(@quasar/qpdfviewer): is not compatible with @quasar/app v3.0.0-beta.25. Required version: ^1.0.0 || ^2.0.0
Thanks in advance
The text was updated successfully, but these errors were encountered: