Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
mtsee committed Sep 17, 2019
1 parent 2e5c932 commit 10cfcf0
Show file tree
Hide file tree
Showing 10 changed files with 4 additions and 28,129 deletions.
140 changes: 3 additions & 137 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default Editor;

# 直接使用JS-SDK

### editor.html 编辑器文件
### index.html 双击打开即可

```html
<!DOCTYPE html>
Expand All @@ -124,7 +124,7 @@ export default Editor;
<!-- 编辑器所需第三方资源库 -->
<script src="https://cdn.h5ds.com/lib/plugins/swiper.min.js"></script>
<script src="https://cdn.h5ds.com/lib/plugins/jquery.min.js"></script>
<script src="https://cdn.h5ds.com/lib/plugins/h5ds-vendor.min.js"></script>
<script src="https://cdn.h5ds.com/lib/plugins/h5ds.vendor.min.js"></script>
<!-- 外部引入antd --->
<script src="https://cdn.bootcss.com/moment.js/2.24.0/moment.min.js"></script>
<script src="https://cdn.bootcss.com/antd/3.23.0-beta.0/antd.min.js"></script>
Expand Down Expand Up @@ -195,138 +195,4 @@ export default Editor;
</html>


```

### app-preview.html 预览页面

```html

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>H5DS</title>
<link rel="stylesheet" href="https://cdn.h5ds.com/umd/swiper/style.css" />
<link href="https://cdn.bootcss.com/Swiper/4.5.0/css/swiper.min.css" rel="stylesheet"/>
<link href="https://cdn.bootcss.com/antd/3.23.0-beta.0/antd.min.css" rel="stylesheet"/>
<!-- 编辑器所需第三方资源库 -->
<script src="https://cdn.h5ds.com/lib/plugins/swiper.min.js"></script>
<script src="https://cdn.h5ds.com/lib/plugins/jquery.min.js"></script>
<script src="https://cdn.h5ds.com/lib/plugins/h5ds-vendor-preview.min.js"></script>
<!-- es6语法支持 -->
<script src="https://cdn.staticfile.org/babel-standalone/6.26.0/babel.min.js"></script>
<!-- H5DS资源 -->
<script src="https://cdn.h5ds.com/umd/swiper/index.js"></script>
<script src="data.js"></script>
<script>
window.Component = React.Component;
</script>
<style>
body {
margin: 0;
padding: 0;
}
#H5DS-APP {
height: 100%;
width: 100%;
}
</style>
</head>
<body>
<div id="H5DS-APP"></div>
</body>
<script type="text/babel">
class App extends Component {
state = {
width: window.innerWidth,
height: window.innerHeight
};
resize = () => {
this.setState(
{
width: window.innerWidth,
height: window.innerHeight
},
() => {
this.H5SwiperRef.swiperInstance.update();
}
);
};
setSize = (width, height) => {
this.setState({ width, height }, () => {
this.H5SwiperRef.swiperInstance.update();
});
};
componentDidMount() {
const innerHeight = window.innerHeight;
// 兼容安卓键盘弹起事件
window.addEventListener("resize", () => {
const newInnerHeight = window.innerHeight;
if (innerHeight > newInnerHeight) {
// 键盘弹出事件处理
this.resize();
} else {
// 键盘收起事件处理
this.resize();
}
});
// 兼容 IOS 键盘弹起事件,兼容IOS表单的问题
document.body.addEventListener("focusin", () => {
window.scroll(0, 0);
});
document.body.addEventListener("focusout", () => {
window.scroll(0, 0);
});
}
componentWillUnmount() {
if (this.settime) {
clearTimeout(this.settime);
}
}
render() {
const { width, height } = this.state;
return (
<H5dsSwiper
key={this.state.keys}
ref={c => (this.H5SwiperRef = c)}
scale={this.props.data.type === "pc" ? 1 : width / 320}
style={{ width, height }}
renderIn="render_in_publish"
data={this.props.data}
plugins={{
pluginsKey: window.H5DS_GLOBAL.plugins,
scripts: window.H5DS_GLOBAL.scripts
}}
/>
);
}
}
function initData(appId, data) {
document.title = data.name;
const plus = data.plugins || [];
const { installPlugins } = window.H5DS_GLOBAL.swiper;
installPlugins(plus).then(plugins => {
ReactDOM.render(
<App appId={appId} data={data} plugins={plugins} />,
document.getElementById("H5DS-APP")
);
});
}
initData("test_app_id", h5dsAppData);
</script>
</html>

```
```
133 changes: 0 additions & 133 deletions app-preview.html

This file was deleted.

1 change: 0 additions & 1 deletion data.js

This file was deleted.

2 changes: 1 addition & 1 deletion editor.html → index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<!-- 编辑器所需第三方资源库 -->
<script src="https://cdn.h5ds.com/lib/plugins/swiper.min.js"></script>
<script src="https://cdn.h5ds.com/lib/plugins/jquery.min.js"></script>
<script src="https://cdn.h5ds.com/lib/plugins/h5ds-vendor-0.0.2.min.js"></script>
<script src="https://cdn.h5ds.com/lib/plugins/h5ds.vendor.min.js"></script>
<!-- 外部引入antd --->
<script src="https://cdn.bootcss.com/moment.js/2.24.0/moment.min.js"></script>
<script src="https://cdn.bootcss.com/antd/3.23.0-beta.0/antd.min.js"></script>
Expand Down
Loading

0 comments on commit 10cfcf0

Please sign in to comment.