File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -60,4 +60,4 @@ typings/
6060.idea
6161
6262# custom
63- build /painterro. *
63+ build /painterro *
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ Table of contents
2525=================
2626
2727 * [ Table of contents] ( #table-of-contents )
28+ * [ Installation] ( #installation )
2829 * [ Supported hotkeys] ( #supported-hotkeys )
2930 * [ Configuration] ( #configuration )
3031 * [ UI color scheme] ( #ui-color-scheme )
@@ -39,6 +40,21 @@ Table of contents
3940 * [ ToDo list] ( #todo-list )
4041
4142
43+ Installation
44+ ============
45+
46+ If you are using npm you can run:
47+ ``` bash
48+ npm install painterro --save
49+ ```
50+ Then in your code
51+
52+ ``` js
53+ import Painterro from ' painterro'
54+ ...
55+ Painterro ().show ()
56+ ```
57+
4258Supported hotkeys
4359=================
4460
Original file line number Diff line number Diff line change 2828 </ div >
2929</ div >
3030
31- < script src ="/painterro.js "> </ script >
31+ < script src ="/painterro.min.js "> </ script >
32+
3233< script >
3334
3435// Painterro({
4243// }
4344// });
4445
45- Painterro ( {
46- id : 'conatiner' ,
47- activeColor : '#00b400' ,
48- // defaultSize: '200x100',
49- colorScheme : {
50- }
51- } ) . show ( ) ;
46+ Painterro ( ) . show ( ) ;
5247</ script >
5348</ body >
5449</ html >
Original file line number Diff line number Diff line change @@ -381,7 +381,7 @@ class PainterroProc {
381381 '<span class="ptro-bar-right">' + rightBar + '</span>' +
382382 '<input id="ptro-file-input" type="file" style="display: none;" accept="image/x-png,image/gif,image/jpeg" />' +
383383 '</div>' +
384- `<style>${ params . styles } </style>` ;
384+ `<style>${ this . params . styles } </style>` ;
385385
386386 this . saveBtn = document . getElementById ( this . tools . filter ( ( t ) => t . name === 'save' ) [ 0 ] . buttonId ) ;
387387 this . saveBtn . setAttribute ( 'disabled' , true ) ;
Original file line number Diff line number Diff line change 11import { HexToRGBA } from './colorPicker' ;
22
33export function setDefaults ( params ) {
4+ params = params || { } ;
45 params . activeColor = params . activeColor || "#ff0000" ;
56 params . activeColorAlpha = params . activeColorAlpha || 1.0 ;
67 params . activeAlphaColor = HexToRGBA ( params . activeColor , params . activeColorAlpha ) ;
Original file line number Diff line number Diff line change 11{
22 "name" : " painterro" ,
3- "version" : " 0.1.4 " ,
3+ "version" : " 0.1.5 " ,
44 "description" : " Embуedded html image editor" ,
55 "main" : " build/painterro.commonjs2.js" ,
66 "scripts" : {
Original file line number Diff line number Diff line change @@ -3,11 +3,21 @@ var webpack = require('webpack');
33
44
55function webpackConfig ( target ) {
6+ let filename ;
7+ if ( target === 'var' ) {
8+ filename = `painterro-${ require ( "./package.json" ) . version } .min.js`
9+ } else if ( target === 'var-latest' ) {
10+ filename = `painterro.min.js`
11+ target = 'var'
12+ } else {
13+ filename = `painterro.${ target } .js`
14+ }
15+
616 return {
717 entry : './js/main.js' ,
818 output : {
919 path : path . resolve ( __dirname , 'build' ) ,
10- filename : `painterro. ${ target == 'var' && '' || target } .js` ,
20+ filename : filename ,
1121 library : 'Painterro' , // export as library
1222 libraryTarget : target
1323 } ,
@@ -46,6 +56,7 @@ function webpackConfig(target) {
4656
4757module . exports = [
4858 webpackConfig ( 'var' ) ,
59+ webpackConfig ( 'var-latest' ) ,
4960 webpackConfig ( 'commonjs2' ) ,
5061 webpackConfig ( 'amd' ) ,
5162 webpackConfig ( 'umd' )
You can’t perform that action at this time.
0 commit comments