Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 3 #77

Open
wants to merge 32 commits into
base: 3.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
43dc0f7
started dev 3 branch
Rovak Oct 25, 2016
5affaf3
update node js version on travis
Rovak Oct 25, 2016
5fa5893
update readme to v3
Rovak Oct 25, 2016
b65217b
added webpack
Rovak Oct 25, 2016
f51a014
added watch command for building sources
Rovak Oct 25, 2016
cc161da
removed callback from watch command
Rovak Oct 25, 2016
5ccabb7
moved Utils to separate class
Rovak Oct 25, 2016
f32c06a
changed classes to es6 syntax
Rovak Oct 25, 2016
f898853
cleanup
Rovak Oct 25, 2016
acee222
changed nodejs version in travis
Rovak Oct 25, 2016
4330b94
updated travis ci to gulp
Rovak Oct 25, 2016
4e63c50
removed tests for now
Rovak Oct 25, 2016
49aec77
remove old dist files
Rovak Oct 26, 2016
ad87577
updated demos
Rovak Oct 26, 2016
8139647
moved bind to constructor
Rovak Oct 26, 2016
60588e3
removed console.log in InlineAttachment constructor
Rovak Oct 26, 2016
de8f5eb
update license
Rovak Jan 7, 2017
888c59d
change indenting
Rovak Jan 7, 2017
350e4c1
fix angular version
Rovak Jan 7, 2017
995597d
restructure folders
Rovak Jan 7, 2017
8463b05
add jquery dev-dependency
Rovak Jan 7, 2017
a870de5
moved codemirror dependencies to bower
Rovak Jan 7, 2017
6c2409d
fix codemirror 3 example
Rovak Jan 7, 2017
accd14c
fix codemirror 4 example
Rovak Jan 7, 2017
21f9c70
bower: dependencies -> devDependencies
Rovak Jan 7, 2017
b6900ca
moved angular 1 example dependencies to bower
Rovak Jan 7, 2017
b6c406e
fixed angular 1 example
Rovak Jan 7, 2017
6543568
fixed jquery example
Rovak Jan 7, 2017
df8b052
minor code cleanup
Rovak Jan 7, 2017
0fed30a
updated readme
Rovak Jan 7, 2017
8c31515
add dist files
Rovak Jan 7, 2017
85b895d
update version number
Rovak Jan 7, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ dist
nbproject
data
node_modules
_build
_build
bower_components
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
96 changes: 0 additions & 96 deletions Gruntfile.js

This file was deleted.

65 changes: 65 additions & 0 deletions Gulpfile.js
Original file line number Diff line number Diff line change
@@ -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());
});
});
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
28 changes: 22 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -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/)
Expand All @@ -28,15 +44,15 @@ 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)

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
Expand Down
10 changes: 8 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"
Expand All @@ -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"
}
}
23 changes: 12 additions & 11 deletions demo/angularjs.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,22 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>AngularJS InlineAttachment Demo</title>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js"></script>
<script src="../bower_components/jquery-1/dist/jquery.js"></script>
<script src="../bower_components/angular-1/angular.js"></script>

<script src="../src/inline-attachment.js"></script>
<script src="../src/input.inline-attachment.js"></script>
<script src="../src/angularjs.inline-attachment.js"></script>
<script src="../dist/angular.js"></script>
<script type="text/javascript">
function textAreaCtrl($scope) {
$scope.receivedFile = function(file) {
console.log('received file!', file);
}
}
angular
.module('demo', ['inlineattachment'])
.controller('textAreaCtrl', function ($scope) {
$scope.receivedFile = function (file) {
console.log('received file!', file);
}
});

</script>
</head>
<body ng-app="inlineattachment">
<body ng-app="demo">
<div ng-controller="textAreaCtrl">
<textarea rows="10" cols="50"
inlineattachment
Expand Down
9 changes: 4 additions & 5 deletions demo/codemirror.html → demo/codemirror-3.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
<title>CodeMirror 3 InlineAttachment Demo</title>
</head>
<body>
<link href="//cdnjs.cloudflare.com/ajax/libs/codemirror/3.24.0/codemirror.css" media="screen" rel="stylesheet" type="text/css">
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/codemirror/3.24.0/codemirror.js"></script>
<link href="../bower_components/codemirror-3/lib/codemirror.css" media="screen" rel="stylesheet" type="text/css">
<script type="text/javascript" src="../bower_components/codemirror-3/lib/codemirror.js"></script>

<textarea id="code" rows="10" cols="50"></textarea>

<script src="../src/inline-attachment.js"></script>
<script src="../src/codemirror.inline-attachment.js"></script>
<script src="../dist/codemirror-3.js"></script>
<script type="text/javascript">
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true,
Expand All @@ -21,7 +20,7 @@
enterMode: "keep",
tabMode: "shift"
});
inlineAttachment.editors.codemirror3.attach(editor);
new InlineAttachment.CodeMirror3(editor);
</script>
</body>
</html>
9 changes: 4 additions & 5 deletions demo/codemirror-4.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
<title>CodeMirror 4 InlineAttachment Demo</title>
</head>
<body>
<link href="//cdnjs.cloudflare.com/ajax/libs/codemirror/4.0.3/codemirror.css" media="screen" rel="stylesheet" type="text/css">
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/codemirror/4.0.3/codemirror.js"></script>
<link href="../bower_components/codemirror-4/lib/codemirror.css" media="screen" rel="stylesheet" type="text/css">
<script type="text/javascript" src="../bower_components/codemirror-4/lib/codemirror.js"></script>

<textarea id="code" rows="10" cols="50"></textarea>

<script src="../src/inline-attachment.js"></script>
<script src="../src/codemirror.inline-attachment.js"></script>
<script src="../dist/codemirror-4.js"></script>
<script type="text/javascript">
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true,
Expand All @@ -21,7 +20,7 @@
enterMode: "keep",
tabMode: "shift"
});
inlineAttachment.editors.codemirror4.attach(editor);
new InlineAttachment.CodeMirror4(editor);
</script>
</body>
</html>
5 changes: 2 additions & 3 deletions demo/input.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@

<textarea id="code" rows="10" cols="50"></textarea>

<script type="text/javascript" src="../src/inline-attachment.js"></script>
<script type="text/javascript" src="../src/input.inline-attachment.js"></script>
<script type="text/javascript" src="../dist/input.js"></script>
<script type="text/javascript">
inlineAttachment.editors.input.attachToInput(document.getElementById("code"));
new InputInlineAttachment(document.getElementById("code"));
</script>
</body>
</html>
7 changes: 3 additions & 4 deletions demo/jquery.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
<textarea rows="10" cols="50"></textarea>
<textarea rows="10" cols="50"></textarea>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="../src/inline-attachment.js"></script>
<script src="../src/jquery.inline-attachment.js"></script>
<script src="../bower_components/jquery-1/dist/jquery.js"></script>
<script src="../dist/jquery.js"></script>
<script type="text/javascript">
$(function() {
$('textarea').inlineattachment({
$('textarea').inlineAttachment({
uploadUrl: 'upload_attachment.php'
});
});
Expand Down
Loading