Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit 8b19cc8

Browse files
committed
Conflicts: README.md
2 parents ed2b184 + 7553e5f commit 8b19cc8

32 files changed

+2761
-639
lines changed

.travis.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1+
# faster builds on new travis setup not using sudo
2+
sudo: false
3+
14
language: node_js
5+
26
node_js:
37
- "0.10"
8+
49
before_script:
510
- npm install -g grunt-cli
611
- npm install -g bower
712
- bower install
13+
814
cache:
915
directories:
1016
- node_modules
11-
- bower_components
17+
- bower_components

CHANGES.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
2+
1.6.1 / 2015-04-30
3+
==================
4+
5+
* Fix initializing plugin without addons
6+
* Trigger the input event after swapping out the preview image for the real one
7+
* Change default formData to null
8+
9+
1.6.0/ 2015-04-16
10+
==================
11+
12+
* Add option ```captions``` (boolean) to images and embeds to enable/disable captions. Captions are enabled by default.
13+
* Expose option ```fileUploadOptions``` in images to enable file upload configuration
14+
* Use medium-editor like placeholders for embeds and captions (using ```:after``` CSS pseudo-element instead of actual DOM element)
15+
* Add support for right click on placeholders (both in embeds and captions) to enable pasting via context menu
16+
* Deprecate ```uploadScript``` and ```formData``` options in images. Use ```fileUploadOptions``` instead.
17+
18+
1.5.2 / 2015-04-15
19+
==================
20+
21+
* Remove contenteditable attr and overlay div from embeds on ```serialize```
22+
* Remove contenteditable attr from figure and figcaption in images on ```serialize```
23+
* Simplify button positioning
24+
25+
1.5.1 / 2015-04-13
26+
==================
27+
28+
* Don't add empty paragraph on image deletion, when empty paragraph already exists
29+
* Fix clicking on placeholder in FF
30+
* Hide editor's placeholder on image upload
31+
* Use https for instagram and vimeo
32+
* Ensure core is ```enabled``` when ```selectEmbed``` or ```selectImage``` are called
33+
34+
1.5.0 / 2015-04-02
35+
==================
36+
37+
* Update medium-editor to v4.1.1
38+
* Add support for editor's new ```destroy``` and ```setup``` methods and removed ```activatePlaceholder``` method
39+
* Add ```formData``` option to images (see [jQuery-File-Upload docs](https://github.com/blueimp/jQuery-File-Upload/wiki/Options#formdata))
40+
* Add ```uploadCompleted``` callback to images
41+
* Trigger ```input``` event also when preview image is inserted to the DOM
42+
* Disable embed toolbars when ```styles```, or ```actions``` options are empty
43+
* Make sure that after removing caption placeholder, caret is placed inside the caption
44+
* Hide buttons when toolbar actions are triggered
45+
* Don't auto remove grid style when removing images

Gruntfile.js

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
module.exports = function(grunt) {
2+
// show elapsed time at the end
3+
require('time-grunt')(grunt);
4+
// load grunt tasks just in time
5+
require('jit-grunt')(grunt, {
6+
usebanner: 'grunt-banner'
7+
});
28

39
grunt.initConfig({
410
pkg: grunt.file.readJSON('package.json'),
@@ -13,7 +19,7 @@ module.exports = function(grunt) {
1319
dest: 'dist/js/<%= pkg.name %>.min.js'
1420
}
1521
},
16-
22+
1723
concat: {
1824
dist: {
1925
options: {
@@ -31,8 +37,12 @@ module.exports = function(grunt) {
3137
files: ['src/js/*.js', '!src/js/templates.js', 'test/*.js']
3238
},
3339

34-
qunit: {
35-
unit: 'test.html'
40+
blanket_qunit: {
41+
options: {
42+
urls: ['test.html?coverage=true&gruntReport'],
43+
threshold: 70
44+
},
45+
unit: {}
3646
},
3747

3848
sass: {
@@ -111,18 +121,7 @@ module.exports = function(grunt) {
111121
}
112122
});
113123

114-
grunt.loadNpmTasks('grunt-contrib-uglify');
115-
grunt.loadNpmTasks('grunt-contrib-jshint');
116-
grunt.loadNpmTasks('grunt-contrib-qunit');
117-
grunt.loadNpmTasks('grunt-contrib-watch');
118-
grunt.loadNpmTasks('grunt-contrib-concat');
119-
grunt.loadNpmTasks('grunt-autoprefixer');
120-
grunt.loadNpmTasks('grunt-sass');
121-
grunt.loadNpmTasks('grunt-csso');
122-
grunt.loadNpmTasks('grunt-banner');
123-
grunt.loadNpmTasks('grunt-contrib-handlebars');
124-
125-
grunt.registerTask('test', ['jshint', 'qunit']);
124+
grunt.registerTask('test', ['jshint', 'blanket_qunit']);
126125
grunt.registerTask('js', ['test', 'handlebars', 'uglify', 'concat']);
127126
grunt.registerTask('css', ['sass', 'autoprefixer', 'csso', 'usebanner']);
128127
grunt.registerTask('default', ['js', 'css']);

README.md

Lines changed: 52 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -1,160 +1,87 @@
1-
jQuery insert plugin for MediumEditor
2-
======================================
1+
# jQuery insert plugin for MediumEditor
32

4-
This plugin expands capabilities of [MediumEditor](https://github.com/daviferreira/medium-editor) (a clone of [medium.com](http://medium.com) WYSIWYG editor).
3+
[![Build Status](https://travis-ci.org/orthes/medium-editor-insert-plugin.png)](https://travis-ci.org/orthes/medium-editor-insert-plugin)
4+
[![Dependency Status](http://www.versioneye.com/user/projects/53f742dce09da3467d000389/badge.svg?style=flat)](http://www.versioneye.com/user/projects/53f742dce09da3467d000389)
5+
[![Dependency Status](http://www.versioneye.com/user/projects/53f742e2e09da3dca800038f/badge.svg?style=flat)](http://www.versioneye.com/user/projects/53f742e2e09da3dca800038f)
6+
[![Codacy Badge](https://www.codacy.com/project/badge/1f8565ed2e554e4fa952ec4da6a2080b)](https://www.codacy.com/public/orthes/mediumeditorinsertplugin)
7+
[![Stories in Ready](https://badge.waffle.io/orthes/medium-editor-insert-plugin.svg?label=ready&title=Ready)](http://waffle.io/orthes/medium-editor-insert-plugin)
58

6-
The plugins enables users to insert into the editor various types of content (depending on available addons).
9+
This plugin expands capabilities of [MediumEditor](https://github.com/daviferreira/medium-editor) (a clone of medium.com WYSIWYG editor) and it enables users to insert into the editor various types of content (depending on available addons).
710

811
Current available addons:
912

10-
- images
11-
- embeds (either through oEmbed proxy, such as [Iframely](https://iframely.com), or pre-defined parsers such as - Youtube, Vimeo, Twitter, Facebook, Instagram)
12-
- tables (basic table creating)
13-
14-
---
15-
16-
This is a legacy version of the plugin. To see the current **1.0 version** go to [master branch](https://github.com/orthes/medium-editor-insert-plugin).
13+
- **images**
14+
- **embeds** (either through oEmbed proxy, such as [Iframely](https://iframely.com/), or pre-defined parsers such as - Youtube, Vimeo, Twitter, Facebook, Instagram)
1715

18-
---
1916

20-
## Table of Contents
17+
## Demo
2118

22-
- [Download](#download)
23-
- [Usage](#usage)
24-
- [Options](#options)
25-
- [Methods](#methods)
26-
- [Development & Contributing](#development)
27-
- [Author](#author)
19+
[http://orthes.github.io/medium-editor-insert-plugin](http://orthes.github.io/medium-editor-insert-plugin)
2820

2921

30-
## <a name="download"></a>Download
22+
## Download
3123

32-
- Bower: ```bower install medium-editor-insert-plugin#^0.3 --save```
33-
- Manual: [Download as ZIP](https://github.com/orthes/medium-editor-insert-plugin/archive/0.3.2.zip)
24+
* Bower (recommended): ```bower install medium-editor-insert-plugin#^1.0 --save```
25+
* Manual: [Download the latest release](https://github.com/orthes/medium-editor-insert-plugin/releases)
3426

3527

36-
## <a name="usage"></a>Usage
28+
## Quick Start
3729

38-
The first step is to add all prerequisites (MediumEditor and jQuery):
30+
The first step is to include the plugin with all its dependencies to your code:
3931

4032
```html
33+
<!-- CSS -->
4134
<link rel="stylesheet" href="bower_components/medium-editor/dist/css/medium-editor.min.css">
42-
<link rel="stylesheet" href="bower_components/medium-editor/dist/css/themes/default.css">
43-
<script src="bower_components/medium-editor/dist/js/medium-editor.min.js"></script>
44-
<script src="bower_components/jquery/jquery.min.js"></script>
45-
```
46-
47-
Now you have two possibilites. You can load all addons at once:
48-
49-
```html
35+
<link rel="stylesheet" href="bower_components/medium-editor/dist/css/themes/default.css" id="medium-editor-theme">
36+
<!-- Font Awesome for awesome icons. You can redefine icons used in a plugin configuration -->
37+
<link href="http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
38+
<!-- The plugin itself -->
5039
<link rel="stylesheet" href="bower_components/medium-editor-insert-plugin/dist/css/medium-editor-insert-plugin.min.css">
51-
<script src="bower_components/medium-editor-insert-plugin/dist/js/medium-editor-insert-plugin.all.min.js"></script>
52-
```
5340

54-
Or if you for some reason want, you can load only addons that you want separately. In this case, don't forget to load medium-editor-insert-plugin.min.js, which is the main plugin file, that initializes addons:
55-
56-
```html
57-
<link rel="stylesheet" href="bower_components/medium-editor-insert-plugin/dist/css/medium-editor-insert-plugin.min.css">
58-
<script src="bower_components/medium-editor-insert-plugin/dist/js/addons/medium-editor-insert-plugin.min.js"></script>
59-
<script src="bower_components/medium-editor-insert-plugin/dist/js/addons/medium-editor-insert-images.min.js"></script>
60-
<script src="bower_components/medium-editor-insert-plugin/dist/js/addons/medium-editor-insert-embeds.min.js"></script>
61-
<script src="bower_components/medium-editor-insert-plugin/dist/js/addons/medium-editor-insert-tables.min.js"></script>
41+
<!-- JS -->
42+
<script src="bower_components/jquery/dist/jquery.min.js"></script>
43+
<script src="bower_components/medium-editor/dist/js/medium-editor.js"></script>
44+
<script src="bower_components/handlebars/handlebars.runtime.min.js"></script>
45+
<script src="bower_components/jquery-sortable/source/js/jquery-sortable-min.js"></script>
46+
<!-- Unfortunately, jQuery File Upload Plugin has a few more dependencies itself -->
47+
<script src="bower_components/blueimp-file-upload/js/vendor/jquery.ui.widget.js"></script>
48+
<script src="bower_components/blueimp-file-upload/js/jquery.iframe-transport.js"></script>
49+
<script src="bower_components/blueimp-file-upload/js/jquery.fileupload.js"></script>
50+
<!-- The plugin itself -->
51+
<script src="bower_components/medium-editor-insert-plugin/dist/js/medium-editor-insert-plugin.min.js"></script>
6252
```
6353

6454
Initialize MediumEditor as you normally would:
6555

66-
```html
67-
<script>var editor = new MediumEditor('.editable');</script>
56+
```javascript
57+
var editor = new MediumEditor('.editable');
6858
```
6959

70-
Finally, you can initialize the insert plugin with images and embed addon:
60+
Finally, you can initialize the insert plugin:
7161

7262
```javascript
7363
$(function () {
74-
$('.editable').mediumInsert({
75-
editor: editor,
76-
addons: {
77-
images: {},
78-
embeds: {
79-
oembedProxy: 'http://medium.iframe.ly/api/oembed?iframe=1'
80-
},
81-
tables: {}
82-
}
83-
});
64+
$('.editable').mediumInsert({
65+
editor: editor
66+
});
8467
});
8568
```
8669

87-
After you have a working editor with the plugin, you will want to get a clean content of the editor without any additional unnecessary placeholders. This could be done by using the editor's ```serialize()``` function, which returns JSON object with elements contents.
88-
89-
```javascript
90-
var allContents = editor.serialize();
91-
var elContent = allContents["element-0"].value;
92-
```
93-
94-
For styling the content in frontend (where it will be read only without editing posibilities) use this CSS:
95-
96-
```html
97-
<link rel="stylesheet" href="bower_components/medium-editor-insert-plugin/dist/css/medium-editor-insert-plugin-frontend.min.css">
98-
```
99-
100-
## <a name="options"></a>Options
101-
102-
- **editor**: (MediumEditor) instance of MediumEditor
103-
- **beginning**: (boolean) whether inserting at the very beginning of the editor should be possible (in other words, if the first placeholder for instering should be placed as the first element of the editor, or after the first parahraph). Default: *false*
104-
- **addons**: (object) keys are names of used addons and values are objects of addons options. (NOTICE: Remember to use medium-editor-insert-plugin.all.min.js, which includes all addons, or separately load medium-editor-insert-plugin.min.js and medium-editor-insert-{ADDON-NAME}.min.js).
105-
- **images**:
106-
- **imagesUploadScript**: (string) relative path to a script that handles file uploads. Default: *upload.php*
107-
- **imagesDeleteScript**: (string) relative path to a script that handles file deleting. Default: *delete.php*
108-
- **useDragAndDrop**: (boolean) active or inactive image's drag and drop. Default: *true*
109-
- **formatData**: (function (file)) function that formats data before sending them to server while uploading an image
110-
- **uploadFile**: (function ($placeholder, file, that)) function uploading an image to a server
111-
- **deleteFile**: (function (file, that)) function deleting an image from a server
112-
- **embeds**:
113-
- **urlPlaceholder**: (string) placeholder displayed when entering URL to embed. Default: *Paste or type a link*
114-
- **oembedProxy**: (string) URL to oEmbed proxy endpoint, such as Iframely, Embedly or your own. You are welcome to use "http://medium.iframe.ly/api/oembed?iframe=1" for your dev and testing needs, courtesy of [Iframely](https://iframely.com). Default: none, which will make the plugin use pre-defined set of embed rules without making server calls.
115-
- **tables**:
116-
- **defaultRows**: (integer) default number of rows. Default: *2*
117-
- **defaultCols**: (integer) default number of columns. Default: *2*
118-
- **enabled**: (boolean) plugin's state: Default *true*.
119-
120-
121-
## <a name="methods"></a>Methods
122-
123-
- **enable**: enables the plugin. It's connected to Medium Editor's own activate function, so if the editor is activated, so is the plugin. (The plugin is enabled automatically. Use it only if you previously disabled the plugin.)
124-
- **disable**: disables the plugin. It's connected to Medium Editor's own deactivate function, so if the editor is deactivated, so is the plugin.
125-
- **registerAddon**: create new addon, like images or maps or embeds. Your addon object should contain `init(options)` method to initialize your addon and `insertButton` method that contains code of button in list of available addons.
126-
- **getAddon**: simple getter for available addons.
127-
128-
Use example:
129-
130-
```javascript
131-
$('.editable').mediumInsert('disable');
132-
```
133-
134-
## <a name="development"></a>Development & Contributing
135-
136-
[![Stories in Ready](https://badge.waffle.io/orthes/medium-editor-insert-plugin.svg?label=ready&title=Ready)](http://waffle.io/orthes/medium-editor-insert-plugin)
137-
138-
I'm happy when you not only use the plugin, but contribute your improvements, too. First of all, go to [waffle.io](http://waffle.io/orthes/medium-editor-insert-plugin) (that's the blue icon above),
139-
where you'll find list of all work, that need to be done. Feel free to grab one issue, assign it to yourself and start working.
140-
141-
The plugin uses [Grunt](http://gruntjs.com/) for automating development tasks and [Bower](http://bower.io/) for package management. To install all the necessities for development run these commands:
142-
143-
```
144-
npm install
145-
bower install
146-
```
147-
148-
These are available Grunt tasks:
149-
150-
- **js**: runs jshint, uglify and copy
151-
- **css**: runs compass
152-
- **test**: runs jshint and qunit
153-
- **watch**: watches for modifications on script/scss files and runs js/css task
70+
## [Documentation](https://github.com/orthes/medium-editor-insert-plugin/wiki)
15471

155-
Please, test you're code to your best knowledge, especially if you're adding new features.
72+
- [Getting Started](https://github.com/orthes/medium-editor-insert-plugin/wiki/v1.0-Getting-Started)
73+
- [Configuration](https://github.com/orthes/medium-editor-insert-plugin/wiki/v1.0-Configuration)
74+
- [Server response](https://github.com/orthes/medium-editor-insert-plugin/wiki/Server-response)
75+
- [Custom addons](https://github.com/orthes/medium-editor-insert-plugin/wiki/v1.0-Custom-addons)
76+
- [Upgrading from v0.3](https://github.com/orthes/medium-editor-insert-plugin/wiki/v1.0-Upgrading-from-v0.3)
77+
- [Versioning](https://github.com/orthes/medium-editor-insert-plugin/wiki/Versioning)
78+
- [Development & Contributing](https://github.com/orthes/medium-editor-insert-plugin/wiki/Development-&-Contributing)
79+
- [License](https://github.com/orthes/medium-editor-insert-plugin/wiki/License)
80+
- [Author & Contributors](https://github.com/orthes/medium-editor-insert-plugin/wiki/Author-&-Contributors)
15681

15782

158-
## <a name="author"></a>Author
83+
## Sponsors
15984

160-
Pavel Linkesch | [@linkesch](http://twitter.com/linkesch) | http://www.linkesch.sk
85+
[creator5](http://www.creator5.com) | [Maker](http://maker.me) | [Nusii](http://nusii.com)
86+
-------- | ----- | -----
87+
[![creator5](http://i.imgur.com/K9uiIuT.png)](http://www.creator5.com) | [![Maker](http://i.imgur.com/8t8wsM8.png)](http://maker.me) | [![nusii](http://i.imgur.com/tvdJ249.png)](http://nusii.com)

bower.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "medium-editor-insert-plugin",
3-
"version": "1.0.2",
3+
"version": "1.6.1",
44
"description": "jQuery insert plugin for MediumEditor",
55
"main": [
66
"dist/js/medium-editor-insert-plugin.js",
@@ -22,15 +22,16 @@
2222
],
2323
"dependencies": {
2424
"jquery": ">=1.9.0",
25-
"medium-editor": "~2.3.0",
26-
"handlebars": "~2.0.0",
25+
"medium-editor": "^4.1.1",
26+
"handlebars": "~3.0.0",
2727
"blueimp-file-upload": "~9.9.0",
2828
"jquery-sortable": "~0.9.12"
2929
},
3030
"devDependencies": {
31-
"qunit": "~1.17.1",
32-
"sinon": "~1.12.1",
31+
"qunit": "~1.18.0",
32+
"sinon": "~1.14.1",
3333
"sinon-qunit": "~2.0.0",
34-
"jquery-cycle2": "~2.1.6"
34+
"jquery-cycle2": "~2.1.6",
35+
"blanket": "~1.1.5"
3536
}
3637
}

0 commit comments

Comments
 (0)