-
Notifications
You must be signed in to change notification settings - Fork 81
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
feat: added iframe component #237
Merged
Merged
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
edcab89
feat: added iframe component
raaymax 10e5a86
fix: removed url from ss-load event
raaymax 4356dd5
style: replaced spaces with tabs
raaymax 26a14ce
chore: changes according to code review
raaymax 1f1da7c
feat: added and used beingEdited class to component proxy
raaymax 78fe86b
chore: changes according to the review
raaymax 07f25b0
chore: updated lock file
raaymax c61f31d
Merge branch 'dev' into iframe-component
raaymax c62526d
chore: code cleanup
raaymax File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,99 @@ | ||
<template> | ||
<div class="CoreIFrame" ref="rootEl"> | ||
<iframe | ||
@load="handleLoad" | ||
:src="fields.src.value" | ||
draggable="false" | ||
/> | ||
<div class="mask" /> | ||
raaymax marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { FieldCategory, FieldType } from "../streamsyncTypes"; | ||
import { cssClasses, secondaryTextColor } from "../renderer/sharedStyleFields"; | ||
import { getClick } from "../renderer/syntheticEvents"; | ||
|
||
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, computed, 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-radius: 12px; | ||
raaymax marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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); | ||
border-radius: 12px; | ||
raaymax marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
.CoreIFrame.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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we keep on latest? They keep adding icons and then people want to use them, but can't find them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just don't think
latest
keyword is valid. And when you install dependencies this way it will install version3.5.0
which definitely is notlatest
. Current version of this library is 4.1.0. If we want to have always the newest version then we should use