diff --git a/.gitignore b/.gitignore index 74ba1cf..4b64901 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ dist nbproject data node_modules -_build \ No newline at end of file +_build +bower_components \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 65929f8..6e1a6c5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: node_js node_js: - - 0.10 + - 6.1 before_script: - - npm install -g grunt-cli + - npm install -g gulp script: - - grunt qa + - gulp diff --git a/Gruntfile.js b/Gruntfile.js deleted file mode 100644 index 0b27ea8..0000000 --- a/Gruntfile.js +++ /dev/null @@ -1,96 +0,0 @@ -/** - * Grunt Build File - */ -module.exports = function(grunt) { - - var banner = '/*! <%= pkg.name %> - v<%= pkg.version %> - ' + - '<%= grunt.template.today("yyyy-mm-dd") %> */\n'; - - // Project configuration. - grunt.initConfig({ - pkg: require('./package.json'), - concat: { - options: { - banner: banner - }, - normal: { - src: ['', 'src/inline-attachment.js', 'src/input.inline-attachment.js'], - dest: 'dist/inline-attachment.js' - }, - jquery: { - src: ['', 'src/inline-attachment.js', 'src/jquery.inline-attachment.js'], - dest: 'dist/jquery.inline-attachment.js' - }, - codemirror3: { - src: ['', 'src/inline-attachment.js', 'src/codemirror-3.inline-attachment.js'], - dest: 'dist/codemirror-3.inline-attachment.js' - }, - codemirror4: { - src: ['', 'src/inline-attachment.js', 'src/codemirror-4.inline-attachment.js'], - dest: 'dist/codemirror-4.inline-attachment.js' - }, - angularjs: { - src: ['', 'src/inline-attachment.js', 'src/input.inline-attachment.js', 'src/angularjs.inline-attachment.js'], - dest: 'dist/angularjs.inline-attachment.js' - } - }, - // Lists of files to be minified with UglifyJS. - uglify: { - options: { - banner: banner - }, - normal: { - src: ['', 'dist/inline-attachment.js'], - dest: 'dist/inline-attachment.min.js', - separator: ';' - }, - jquery: { - src: ['', 'dist/jquery.inline-attachment.js'], - dest: 'dist/jquery.inline-attachment.min.js', - separator: ';' - }, - codemirror3: { - src: ['', 'dist/codemirror-3.inline-attachment.js'], - dest: 'dist/codemirror-3.inline-attachment.min.js', - separator: ';' - }, - codemirror4: { - src: ['', 'dist/codemirror-4.inline-attachment.js'], - dest: 'dist/codemirror-4.inline-attachment.min.js', - separator: ';' - }, - angularjs: { - src: ['', 'dist/angularjs.inline-attachment.js'], - dest: 'dist/angularjs.inline-attachment.min.js', - separator: ';' - } - }, - jshint: { - all: ['src/*.js'], - options: { - curly: true, - eqeqeq: true, - eqnull: true, - browser: true, - undef: true, - unused: true, - strict: true, - trailing: true, - indent: 2 - } - }, - casperjs: { - options: { - }, - files: ['tests/*.js'] - } - }); - - grunt.loadNpmTasks('grunt-contrib-jshint'); - grunt.loadNpmTasks('grunt-contrib-concat'); - grunt.loadNpmTasks('grunt-contrib-uglify'); - grunt.loadNpmTasks('grunt-casperjs'); - - grunt.registerTask('qa', ['jshint']); - grunt.registerTask('default', ['qa', 'concat', 'uglify']); -}; diff --git a/Gulpfile.js b/Gulpfile.js new file mode 100644 index 0000000..af078e6 --- /dev/null +++ b/Gulpfile.js @@ -0,0 +1,65 @@ +const gulp = require("gulp"); +const gutil = require("gulp-util"); +const webpack = require("webpack"); +var path = require("path"); + +function webpackOptions(options) { + return { + watch: options.watch, + entry: { + "angular": './src/angular/main.js', + "input": './src/input/main.js', + "jquery": './src/jquery/main.js', + "codemirror-3": './src/codemirror-3/main.js', + "codemirror-4": './src/codemirror-4/main.js', + }, + devtool: options.debug ? 'inline-source-map' : '', + debug: options.debug, + output: { + path: __dirname + "/dist", + filename: "[name].js", + publicPath: options.publicPath, + }, + resolve: { + root: [ + path.join(__dirname, "packages") + ], + extensions: ['', '.js'] + }, + module: { + loaders: [ + { + test: /\.js$/, + include: [ + path.join(__dirname, "src") + ], + loader: 'babel-loader', + query: { + presets: ['es2015'] + } + } + ] + } + }; +} + +gulp.task("default", function (callback) { + webpack(webpackOptions({ + watch: false, + debug: false + }), function (err, stats) { + if (err) throw new gutil.PluginError("webpack", err); + gutil.log("[webpack]", stats.toString()); + callback(); + }); +}); + +gulp.task("watch", function () { + webpack(webpackOptions({ + watch: true, + debug: true + }), function (err, stats) { + if (err) throw new gutil.PluginError("webpack", err); + gutil.log("[webpack]", stats.toString()); + }); +}); diff --git a/LICENSE b/LICENSE index 56e60df..bd4f02e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2013 Roy van Kaathoven +Copyright (c) 2017 Roy van Kaathoven Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/README.md b/README.md index 3ea67e9..d54163d 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,39 @@ -# Inline Attachment 2.0.3 [![Master Branch Build Status](https://api.travis-ci.org/Rovak/InlineAttachment.png?branch=master)](http://travis-ci.org/Rovak/InlineAttachment) +# Inline Attachment 3.0.0 [![Master Branch Build Status](https://api.travis-ci.org/Rovak/InlineAttachment.png?branch=master)](http://travis-ci.org/Rovak/InlineAttachment) -Adds upload functionality to a textarea or CodeMirror instance by either drag-dropping or pasting (only in chrome) an image inside it. +Adds upload functionality to a textarea instance by either drag-dropping or pasting (only in chrome) an image inside it. -It's similar to pasting of images in Github. +It's similar to pasting images in Github. ![demo](https://f.cloud.github.com/assets/21/678/248aac6a-40a2-11e2-9a76-fd59ded28bbe.gif) +## Supported + +* Input and textarea +* jQuery +* CodeMirror 3 +* CodeMirror 4 +* Angular 1 + ## Getting started The latest versions are available [here](https://github.com/Rovak/InlineAttachment/tree/master/dist) **Bower** -The package can be installed using [Bower](http://bower.io/) +The package can be installed using [Bower](http://bower.io) ``` bower install inline-attachment ``` +**NPM** + +The package can be installed using [NPM](https://www.npmjs.com) + +``` +npm install inlineattachment +``` + ## Documentation Documentation can be found on [ReadTheDocs](http://inlineattachment.readthedocs.org/en/latest/) @@ -28,7 +44,7 @@ The Demo folder contains an example in PHP on how to handle uploads. ## Build -To build the project you need node, npm and grunt installed. These tools can be installed on Ubuntu as follows: +To build the project you need node, npm and gulp installed. These tools can be installed on Ubuntu as follows: Follow the Node.js guide: [Node.js installation](https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager) @@ -36,7 +52,7 @@ Go to the project folder and run the following: ```sh npm install -grunt +npm build ``` This should build the project and the files will appear in the `dist/` folder diff --git a/bower.json b/bower.json index 12b7108..ba932f3 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "inline-attachment", - "version": "2.0.0", + "version": "3.0.0", "homepage": "https://github.com/Rovak/InlineAttachment", "authors": [ "Roy van Kaathoven " @@ -17,5 +17,11 @@ "bower_components", "test", "tests" - ] + ], + "devDependencies": { + "codemirror-3": "codemirror#3.23.0", + "codemirror-4": "codemirror#4.13.0", + "angular-1": "angular#1.6.1", + "jquery-1": "jquery#3.1.1" + } } diff --git a/demo/angularjs.html b/demo/angularjs.html index 73655f0..0215900 100644 --- a/demo/angularjs.html +++ b/demo/angularjs.html @@ -4,21 +4,22 @@ AngularJS InlineAttachment Demo - - + + - - - + - +
- - + \ No newline at end of file diff --git a/demo/codemirror-4.html b/demo/codemirror-4.html index 6f03595..3f3a289 100644 --- a/demo/codemirror-4.html +++ b/demo/codemirror-4.html @@ -5,13 +5,12 @@ CodeMirror 4 InlineAttachment Demo - - + + - - + \ No newline at end of file diff --git a/demo/input.html b/demo/input.html index 1848c7e..79bd45d 100644 --- a/demo/input.html +++ b/demo/input.html @@ -8,10 +8,9 @@ - - + \ No newline at end of file diff --git a/demo/jquery.html b/demo/jquery.html index dab4b14..dee2cc9 100644 --- a/demo/jquery.html +++ b/demo/jquery.html @@ -9,12 +9,11 @@ - - - + + - - - - - \ No newline at end of file diff --git a/tests/page/pacman.jpg b/tests/page/pacman.jpg deleted file mode 100644 index 8f57acc..0000000 Binary files a/tests/page/pacman.jpg and /dev/null differ diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..591e816 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,3 @@ +module.exports = function(options) { + +};