Skip to content

Commit

Permalink
1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianWalkerToretto committed Jan 19, 2020
1 parent d1e9d0d commit 8bdb41f
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 28 deletions.
3 changes: 3 additions & 0 deletions README-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ rows | 0 | number | 水印行数 | N
cols | 0 | number | 水印列数 | N

### 版本及功能
+ version 1.2.0(正式版) 更新时间:2020.01.19
+ 修复默认样式:opacity默认值由0.8改为1;
+ react服务器渲染优化:服务器端渲染时返回Fragment
+ version 1.1.6(正式版) 更新时间:2020.01.17
+ 修复ie11防删除失效bug(replaceChild有延迟)
+ 压缩:减少1-2k大小
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ rows | 0 | number | watermark lines | N
cols | 0 | number | watermark columns | N

### Version and features
+ version 1.2.0 (official version) update time:2020.01.19
+ Repair the default styles: opacity default value from 0.8 to 1;
+ React server render optimization: return Fragment when server side render
+ version 1.1.6 (official version) update time:2020.01.17
+ fixed ie11 anti-deletion bug (replaceChild has delay)
+ compression: reduces size by 1-2k
Expand Down
2 changes: 1 addition & 1 deletion dist/native/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/react/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/vue/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/watermark.js

Large diffs are not rendered by default.

12 changes: 3 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@brian-walker-toretto/watermark",
"version": "1.1.6",
"version": "1.2.0",
"description": "canvas/svg watermark",
"main": "dist/watermark.js",
"keywords": [
Expand Down Expand Up @@ -37,7 +37,9 @@
"url": "https://github.com/BrianWalkerToretto/watermark/issues"
},
"homepage": "https://github.com/BrianWalkerToretto/watermark#readme",
"dependencies": {},
"dependencies": {
"react": "^16.11.0"
},
"devDependencies": {
"@babel/core": "^7.6.4",
"@babel/plugin-proposal-class-properties": "^7.5.5",
Expand Down Expand Up @@ -77,7 +79,6 @@
"postcss-loader": "^3.0.0",
"postcss-reporter": "^6.0.1",
"prettier": "^1.18.2",
"react": "^16.11.0",
"react-dom": "^16.11.0",
"react-hot-loader": "^4.12.15",
"rimraf": "^3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/styles/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const index = 0;
const zIndex = 99;
const show = 'pointer-events: none !important;display: block !important;overflow: hidden;visibility: visible !important;opacity: 0.8 !important;';
const show = 'pointer-events: none !important;display: block !important;overflow: hidden;visibility: visible !important;opacity: 1 !important;';

export { show };
export default `position: absolute;top: ${
Expand Down
17 changes: 6 additions & 11 deletions webpack/node-environment-judge-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,12 @@ class NodeEnvironmentJudgePlugin {
for (var filePathName in compilation.assets) {
if(/.js$/ig.test(filePathName)){
let content = compilation.assets[filePathName].source() || '';
// 模块开始前添加node判断,用于服务器端渲染
const text = `try{ if(typeof global === 'object' && window !== global){return null;} }catch(e){return null;}`;
// const text = `
// // react vue
// try{
// if(typeof global === 'object' && window !== global){
// return arguments[0] && arguments[0].Fragment || null;
// }
// }catch(e){
// return arguments[0] && arguments[0].Fragment || null;
// }`;
// 模块开始前添加node判断,用于服务器端渲染::优化了react服务器渲染,然后vue服务器渲染没有优化
// const text = `try{ if(typeof global === 'object' && window !== global){return null;} }catch(e){return null;}`;
const env = `typeof global === 'object' && window !== global`;
const fragment = 'arguments[0] && arguments[0].Fragment || null;';
const text = `try{if(${env}){return ${fragment}}}catch(e){return ${fragment}}`;

content = content.replace(/\.*\)\{(\.*)return/i, `){${text}return`)
// 重写指定输出模块内容
compilation.assets[filePathName] = {
Expand Down

0 comments on commit 8bdb41f

Please sign in to comment.