Skip to content
Open

v2 #4

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions .eslintrc.json

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
dist
.rpt2_cache
32 changes: 17 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"name": "react-iframe-resizer",
"version": "1.0.1",
"version": "2.0.0-dev",
"description": "iframe component enhanced by iframe-resizer",
"main": "dist/index.js",
"js:next": "src/index.js",
"module": "dist/index.es.js",
"source": "src/index.tsx",
"types": "dist/index.d.ts",
"directories": {
"test": "test"
},
Expand All @@ -12,9 +14,10 @@
"LICENSE.md"
],
"scripts": {
"prepare": "tsc --outDir dist && microbundle",
"build": "rollup -c",
"lint": "eslint --ext .js --ignore-path .gitignore --ignore-pattern rollup.config.js .",
"prepublish": "npm run build"
"dev": "rollup -c --watch",
"test": "jest"
},
"author": "James Canning <james@jamescanning.com> (http://brudil.com)",
"license": "MIT",
Expand All @@ -23,21 +26,20 @@
"url": "https://github.com/theprate/react-iframe-resizer.git"
},
"devDependencies": {
"eslint": "^3.4.0",
"eslint-config-airbnb": "^10.0.1",
"eslint-loader": "^1.5.0",
"eslint-plugin-import": "^1.14.0",
"eslint-plugin-jsx-a11y": "^2.2.0",
"eslint-plugin-react": "^6.2.0",
"rollup": "^0.34.10",
"rollup-plugin-buble": "^0.13.0"
"@types/iframe-resizer": "^3.5.4",
"@types/lodash.omit": "^4.5.3",
"@types/react": "^16.0.35",
"microbundle": "^0.4.3",
"react": "^16.2.0",
"rollup": "^0.55.1",
"rollup-plugin-typescript2": "^0.10.0",
"rollup-plugin-uglify": "^3.0.0",
"typescript": "^2.6.2"
},
"peerDependencies": {
"iframe-resizer": "*",
"react": "*"
},
"dependencies": {
"lodash.omit": "^4.5.0",
"object-assign": "^4.1.0"
"lodash.omit": "^4.5.0"
}
}
35 changes: 18 additions & 17 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import buble from 'rollup-plugin-buble';

const external = [
'iframe-resizer/js/iframeResizer',
'react',
'object-assign',
'lodash.omit',
];
import typescript from 'rollup-plugin-typescript2';
import uglify from 'rollup-plugin-uglify';

export default {
entry: 'src/index.js',
external,
plugins: [
buble({
objectAssign: 'objectAssign',
}),
input: './src/index.tsx',
output: [
{
file: './dist/index.js',
format: 'cjs',
},
{
file: './dist/index.es.js',
format: 'es',
}
],
format: 'cjs',
dest: 'dist/index.js',
};
external: ['react', 'iframe-resizer/js/iframeResizer'],
plugins: [
typescript(),
uglify()
]
}
39 changes: 0 additions & 39 deletions src/index.js

This file was deleted.

36 changes: 36 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React from 'react';
import omit from 'lodash.omit';
// @ts-ignore
import iframeResizer from 'iframe-resizer/js/iframeResizer';

export interface IProps {
options?: any;
id: string;
src: string;
}

class ResizerManagedIframe extends React.Component<IProps> {
private iframeResizer: any;
private iframeElement: any;

componentDidMount() {
this.iframeResizer = iframeResizer(this.props.options, this.iframeElement);
}

componentWillUnmount() {
this.iframeResizer.close();
}

render() {
return (
<iframe
{...omit(this.props, ['children', 'options']) }
ref={ref => {
this.iframeElement = ref;
}}
>{this.props.children}</iframe>
);
}
}

export default ResizerManagedIframe;
32 changes: 32 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"compileOnSave": false,
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"lib": [
"dom",
"es2015",
"es2016",
"es2017"
],
"jsx": "react",
"target": "es5",
"module": "esnext",
"moduleResolution": "node",
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"removeComments": false,
"preserveConstEnums": true,
"sourceMap": true,
"skipLibCheck": true,
"declaration": true
},
"exclude": [
"dist"
],
"include": [
"./src/**/*"
]
}
Loading