forked from writer/writer-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into pdf-component
- Loading branch information
Showing
8 changed files
with
109 additions
and
5 deletions.
There are no files selected for viewing
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,96 @@ | ||
<template> | ||
<div class="CoreIFrame" ref="rootEl"> | ||
<iframe | ||
@load="handleLoad" | ||
:src="fields.src.value" | ||
draggable="false" | ||
/> | ||
<div class="mask" /> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { FieldType } from "../streamsyncTypes"; | ||
import { cssClasses } from "../renderer/sharedStyleFields"; | ||
const description = "A component to embed an external resource in an iframe."; | ||
const loadHandlerStub = ` | ||
def load_handler(state): | ||
# Sets status message when resource is loaded | ||
state["status"] = "Page loaded"`; | ||
export default { | ||
streamsync: { | ||
name: "IFrame", | ||
description, | ||
category: "Embed", | ||
fields: { | ||
src: { | ||
name: "Source", | ||
default: '', | ||
desc: "A valid URL", | ||
type: FieldType.Text, | ||
}, | ||
cssClasses, | ||
}, | ||
events: { | ||
"ss-load": { | ||
desc: "Fires when the resource has successfully loaded.", | ||
stub: loadHandlerStub.trim(), | ||
}, | ||
}, | ||
}, | ||
}; | ||
</script> | ||
|
||
<script setup lang="ts"> | ||
import { Ref, inject, ref } from "vue"; | ||
import injectionKeys from "../injectionKeys"; | ||
const rootEl:Ref<HTMLElement> = ref(null); | ||
const fields = inject(injectionKeys.evaluatedFields); | ||
function handleLoad(ev) { | ||
const event = new CustomEvent("ss-load"); | ||
rootEl.value.dispatchEvent(event); | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
@import "../renderer/sharedStyles.css"; | ||
.CoreIFrame { | ||
position: relative; | ||
width: 100%; | ||
height: 80vh; | ||
} | ||
.CoreIFrame iframe { | ||
width: 100%; | ||
height: 100%; | ||
display: block; | ||
margin: auto; | ||
border: 1px solid var(--separatorColor); | ||
} | ||
.CoreIFrame .mask { | ||
pointer-events: none; | ||
} | ||
.CoreIFrame.beingEdited .mask { | ||
pointer-events: all; | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
background-color: rgba(0, 0, 0, 0); | ||
} | ||
.CoreIFrame.beingEdited.selected .mask { | ||
pointer-events: none; | ||
} | ||
</style> |
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