Skip to content

Commit

Permalink
fix when params not passed, generating file with version
Browse files Browse the repository at this point in the history
  • Loading branch information
ivictbor committed Jun 28, 2017
1 parent ec800fb commit 9a3ce02
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ typings/
.idea

# custom
build/painterro.*
build/painterro*
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Table of contents
=================

* [Table of contents](#table-of-contents)
* [Installation](#installation)
* [Supported hotkeys](#supported-hotkeys)
* [Configuration](#configuration)
* [UI color scheme](#ui-color-scheme)
Expand All @@ -39,6 +40,21 @@ Table of contents
* [ToDo list](#todo-list)


Installation
============

If you are using npm you can run:
```bash
npm install painterro --save
```
Then in your code

```js
import Painterro from 'painterro'
...
Painterro().show()
```

Supported hotkeys
=================

Expand Down
11 changes: 3 additions & 8 deletions build/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
</div>
</div>

<script src="/painterro.js"></script>
<script src="/painterro.min.js"></script>

<script>

// Painterro({
Expand All @@ -42,13 +43,7 @@
// }
// });

Painterro({
id: 'conatiner',
activeColor: '#00b400',
// defaultSize: '200x100',
colorScheme: {
}
}).show();
Painterro().show();
</script>
</body>
</html>
2 changes: 1 addition & 1 deletion js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ class PainterroProc {
'<span class="ptro-bar-right">' + rightBar + '</span>' +
'<input id="ptro-file-input" type="file" style="display: none;" accept="image/x-png,image/gif,image/jpeg" />' +
'</div>' +
`<style>${params.styles}</style>`;
`<style>${this.params.styles}</style>`;

this.saveBtn = document.getElementById(this.tools.filter((t) => t.name === 'save')[0].buttonId);
this.saveBtn.setAttribute('disabled', true);
Expand Down
1 change: 1 addition & 0 deletions js/params.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { HexToRGBA } from './colorPicker';

export function setDefaults(params) {
params = params || {};
params.activeColor = params.activeColor || "#ff0000";
params.activeColorAlpha = params.activeColorAlpha || 1.0;
params.activeAlphaColor = HexToRGBA(params.activeColor, params.activeColorAlpha);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "painterro",
"version": "0.1.4",
"version": "0.1.5",
"description": "Embуedded html image editor",
"main": "build/painterro.commonjs2.js",
"scripts": {
Expand Down
13 changes: 12 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,21 @@ var webpack = require('webpack');


function webpackConfig(target) {
let filename;
if (target === 'var') {
filename = `painterro-${require("./package.json").version}.min.js`
} else if (target === 'var-latest') {
filename = `painterro.min.js`
target = 'var'
} else {
filename = `painterro.${target}.js`
}

return {
entry: './js/main.js',
output: {
path: path.resolve(__dirname, 'build'),
filename: `painterro.${target == 'var' && '' || target}.js`,
filename: filename,
library: 'Painterro', // export as library
libraryTarget: target
},
Expand Down Expand Up @@ -46,6 +56,7 @@ function webpackConfig(target) {

module.exports = [
webpackConfig('var'),
webpackConfig('var-latest'),
webpackConfig('commonjs2'),
webpackConfig('amd'),
webpackConfig('umd')
Expand Down

0 comments on commit 9a3ce02

Please sign in to comment.