🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

react-iframe

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-iframe - npm Package Compare versions

Comparing version

to
1.8.2

.husky/pre-commit

4

CHANGELOG.md

@@ -5,2 +5,6 @@ # Change Log

## [1.8.2](https://github.com/svenanders/react-iframe/compare/v1.8.1...v1.8.2) (2022-09-26)
## [1.8.1](https://github.com/svenanders/react-iframe/compare/v1.8.0...v1.8.1) (2022-09-26)

@@ -7,0 +11,0 @@

171

demo/iframe.js

@@ -1,100 +0,71 @@

import React from "react"
import objectAssign from "object-assign"
const Iframe = ({
url,
allowFullScreen,
position,
display,
height,
width,
overflow,
styles,
onLoad,
onMouseOver,
onMouseOut,
scrolling,
id,
frameBorder,
ariaHidden,
sandbox,
allow,
className,
title,
ariaLabel,
ariaLabelledby,
name,
target,
loading,
importance,
referrerpolicy,
allowpaymentrequest,
src,
key
}) => {
const defaultProps = objectAssign({
src: src || url,
target: target || null,
style: {
position: position || null,
display: display || "initial",
overflow: overflow || null
},
scrolling: scrolling || null,
allowpaymentrequest: allowpaymentrequest || null,
importance: importance || null,
sandbox: (sandbox && [...sandbox].join(" ")) || null,
loading: loading || null,
styles: styles || null,
name: name || null,
className: className || null,
referrerpolicy: referrerpolicy || null,
title: title || null,
allow: allow || null,
id: id || null,
"aria-labelledby": ariaLabelledby || null,
"aria-hidden": ariaHidden || null,
"aria-label": ariaLabel || null,
width: width || null,
height: height || null,
onLoad: onLoad || null,
onMouseOver: onMouseOver || null,
onMouseOut: onMouseOut || null,
key: key || "iframe"
})
let props = Object.create(null)
for (let prop of Object.keys(defaultProps)) {
if (defaultProps[prop] != null) {
props[prop] = defaultProps[prop]
}
}
for (let i of Object.keys(props.style)) {
if (props.style[i] == null) {
delete props.style[i]
}
}
if (props.styles) {
for (let key of Object.keys(props.styles)) {
if (props.styles.hasOwnProperty(key)) {
props.style[key] = props.styles[key]
}
if (Object.keys(props.styles).pop() == key) {
delete props.styles
}
}
}
if (allowFullScreen) {
if ("allow" in props) {
const currentAllow = props.allow.replace("fullscreen", "")
props.allow = `fullscreen ${currentAllow.trim()}`.trim()
} else {
props.allow = "fullscreen"
}
}
if (frameBorder >= 0) {
if (!props.style.hasOwnProperty("border")) {
props.style.border = frameBorder
}
}
return React.createElement("iframe", Object.assign({}, props))
}
export default Iframe
import React from "react";
import objectAssign from "object-assign";
const Iframe = ({ url, allowFullScreen, position, display, height, width, overflow, styles, onLoad, onMouseOver, onMouseOut, scrolling, id, frameBorder, ariaHidden, sandbox, allow, className, title, ariaLabel, ariaLabelledby, name, target, loading, importance, referrerpolicy, allowpaymentrequest, src, key }) => {
const defaultProps = objectAssign({
src: src || url,
target: target || null,
style: {
position: position || null,
display: display || "initial",
overflow: overflow || null
},
scrolling: scrolling || null,
allowpaymentrequest: allowpaymentrequest || null,
importance: importance || null,
sandbox: (sandbox && [...sandbox].join(" ")) || null,
loading: loading || null,
styles: styles || null,
name: name || null,
className: className || null,
referrerpolicy: referrerpolicy || null,
title: title || null,
allow: allow || null,
id: id || null,
"aria-labelledby": ariaLabelledby || null,
"aria-hidden": ariaHidden || null,
"aria-label": ariaLabel || null,
width: width || null,
height: height || null,
onLoad: onLoad || null,
onMouseOver: onMouseOver || null,
onMouseOut: onMouseOut || null,
key: key || "iframe"
});
let props = Object.create(null);
for (let prop of Object.keys(defaultProps)) {
if (defaultProps[prop] != null) {
props[prop] = defaultProps[prop];
}
}
for (let i of Object.keys(props.style)) {
if (props.style[i] == null) {
delete props.style[i];
}
}
if (props.styles) {
for (let key of Object.keys(props.styles)) {
if (props.styles.hasOwnProperty(key)) {
props.style[key] = props.styles[key];
}
if (Object.keys(props.styles).pop() == key) {
delete props.styles;
}
}
}
if (allowFullScreen) {
if ("allow" in props) {
const currentAllow = props.allow.replace("fullscreen", "");
props.allow = `fullscreen ${currentAllow.trim()}`.trim();
}
else {
props.allow = "fullscreen";
}
}
if (frameBorder >= 0) {
if (!props.style.hasOwnProperty("border")) {
props.style.border = frameBorder;
}
}
return React.createElement("iframe", Object.assign({ allowfullscreen: "allowfullscreen" }, props));
};
export default Iframe;

@@ -17,3 +17,3 @@ {

"react-dom": "^16.14.0",
"react-iframe": "^1.8.0",
"react-iframe": "^1.8.1",
"webpack": "^4.46.0",

@@ -20,0 +20,0 @@ "webpack-dev-server": "^3.11.3"

{
"name": "react-iframe",
"version": "1.8.1",
"version": "1.8.2",
"description": "Easy peasy lemon squeezy iframes with react",

@@ -39,3 +39,3 @@ "main": "dist/cjs/iframe.js",

"eslint-plugin-react": "7.31.8",
"husky": "^1.3.1",
"husky": "^7.0.0",
"jest": "^24.9.0",

@@ -60,3 +60,3 @@ "lint-staged": "^8.2.1",

"*.js": [
"prettier --semi false --single-quote false --write",
"prettier --semi false false --write",
"git add"

@@ -88,3 +88,4 @@ ]

"lint": "eslint src/iframe.tsx --config .eslintrc.json",
"release": "standard-version"
"release": "standard-version",
"prepare": "husky install"
},

@@ -91,0 +92,0 @@ "husky": {

@@ -13,7 +13,7 @@ # React Iframe

import Iframe from 'react-iframe'
<Iframe url="http://www.youtube.com/embed/xDMP3i36naA"
width="450px"
height="450px"
id="myId"
className="myClassname"
<Iframe url="https://www.sdrive.app/embed/1ptBQD"
width="640px"
height="320px"
id=""
className=""
display="block"

@@ -20,0 +20,0 @@ position="relative"/>

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet