-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #243 from raaymax/pdf-component
- Loading branch information
Showing
3 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<template> | ||
<div class="CorePDF"> | ||
<object class="pdf" :data="fields.source.value" type="application/pdf"> | ||
<p> | ||
You don't have a PDF plugin, but you can | ||
<a :href="fields.source.value">download the PDF file. </a> | ||
</p> | ||
</object> | ||
<div class="mask" /> | ||
</div> | ||
</template> | ||
|
||
<script lang='ts'> | ||
import { FieldType } from "../streamsyncTypes"; | ||
import { cssClasses } from "../renderer/sharedStyleFields"; | ||
const description = | ||
"A component to embed a PDF document."; | ||
export default { | ||
streamsync: { | ||
name: "PDF", | ||
description, | ||
category: "Embed", | ||
fields: { | ||
source: { | ||
name: "PDF source", | ||
type: FieldType.Text, | ||
desc: "A valid URL. Alternatively, you can provide a state reference to a packed PDF file.", | ||
}, | ||
cssClasses, | ||
}, | ||
}, | ||
}; | ||
</script> | ||
|
||
<script setup lang="ts"> | ||
import { inject } from "vue"; | ||
import injectionKeys from "../injectionKeys"; | ||
const fields = inject(injectionKeys.evaluatedFields); | ||
</script> | ||
|
||
<style scoped> | ||
@import "../renderer/sharedStyles.css"; | ||
.CorePDF { | ||
position: relative; | ||
width: 100%; | ||
height: 80vh; | ||
} | ||
.CorePDF .pdf { | ||
width: 100%; | ||
height: 100%; | ||
display: block; | ||
margin: auto; | ||
border: 1px solid var(--separatorColor); | ||
} | ||
.CorePDF .mask { | ||
pointer-events: none; | ||
} | ||
.CorePDF.beingEdited .mask { | ||
pointer-events: all; | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
background-color: rgba(0, 0, 0, 0); | ||
} | ||
.CorePDF.beingEdited.selected .mask { | ||
pointer-events: none; | ||
} | ||
</style> | ||
|