tinymce-rails-imageupload 3.5.8.6 → 4.0.16.beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +6 -14
- checksums.yaml.gz.asc +14 -14
- data.tar.gz.asc +14 -14
- data/CHANGELOG.md +3 -4
- data/README.md +69 -55
- data/app/assets/javascripts/tinymce/plugins/uploadimage/langs/de.js +11 -0
- data/app/assets/javascripts/tinymce/plugins/uploadimage/langs/en.js +11 -0
- data/app/assets/javascripts/tinymce/plugins/uploadimage/langs/es.js +11 -0
- data/app/assets/javascripts/tinymce/plugins/uploadimage/langs/fr.js +11 -0
- data/app/assets/javascripts/tinymce/plugins/uploadimage/langs/nb.js +11 -0
- data/app/assets/javascripts/tinymce/plugins/uploadimage/langs/pt.js +11 -0
- data/app/assets/javascripts/tinymce/plugins/uploadimage/langs/pt_BR.js +11 -0
- data/app/assets/javascripts/tinymce/plugins/uploadimage/langs/ru.js +11 -0
- data/app/assets/javascripts/tinymce/plugins/uploadimage/langs/zh-cn.js +11 -0
- data/app/assets/javascripts/tinymce/plugins/uploadimage/plugin.js +228 -0
- data/lib/tasks/tinymce-uploadimage-assets.rake +3 -11
- data/lib/tinymce-rails-imageupload/version.rb +1 -1
- metadata +49 -59
- metadata.gz.asc +14 -14
- data/.gitignore +0 -4
- data/Gemfile +0 -4
- data/Rakefile +0 -1
- data/tinymce-rails-imageupload.gemspec +0 -23
- data/vendor/assets/javascripts/tinymce/plugins/uploadimage/dialog.html +0 -147
- data/vendor/assets/javascripts/tinymce/plugins/uploadimage/editor_plugin.js +0 -38
- data/vendor/assets/javascripts/tinymce/plugins/uploadimage/img/spinner.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/uploadimage/img/uploadimage.png +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/uploadimage/langs/de.js +0 -3
- data/vendor/assets/javascripts/tinymce/plugins/uploadimage/langs/de_dlg.js +0 -12
- data/vendor/assets/javascripts/tinymce/plugins/uploadimage/langs/en.js +0 -3
- data/vendor/assets/javascripts/tinymce/plugins/uploadimage/langs/en_dlg.js +0 -12
- data/vendor/assets/javascripts/tinymce/plugins/uploadimage/langs/es.js +0 -3
- data/vendor/assets/javascripts/tinymce/plugins/uploadimage/langs/es_dlg.js +0 -12
- data/vendor/assets/javascripts/tinymce/plugins/uploadimage/langs/fr.js +0 -3
- data/vendor/assets/javascripts/tinymce/plugins/uploadimage/langs/fr_dlg.js +0 -12
- data/vendor/assets/javascripts/tinymce/plugins/uploadimage/langs/nb.js +0 -3
- data/vendor/assets/javascripts/tinymce/plugins/uploadimage/langs/nb_dlg.js +0 -12
- data/vendor/assets/javascripts/tinymce/plugins/uploadimage/langs/pt.js +0 -3
- data/vendor/assets/javascripts/tinymce/plugins/uploadimage/langs/pt_BR.js +0 -3
- data/vendor/assets/javascripts/tinymce/plugins/uploadimage/langs/pt_BR_dlg.js +0 -12
- data/vendor/assets/javascripts/tinymce/plugins/uploadimage/langs/pt_dlg.js +0 -12
- data/vendor/assets/javascripts/tinymce/plugins/uploadimage/langs/ru.js +0 -3
- data/vendor/assets/javascripts/tinymce/plugins/uploadimage/langs/ru_dlg.js +0 -12
- data/vendor/assets/javascripts/tinymce/plugins/uploadimage/langs/zh-cn.js +0 -3
- data/vendor/assets/javascripts/tinymce/plugins/uploadimage/langs/zh-cn_dlg.js +0 -12
checksums.yaml
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
metadata.gz: !binary |-
|
|
9
|
-
YzljZjc0YTc2MGFmODFhYjY3NTIzMjI0NWIxNjUwZWU0ZTg2ZmNlNDI4Mjc4
|
|
10
|
-
NzNiODU5ZTYxZmYyNjBmNzYzZjYwOTg0ZTY0Mzc0MWE5NTAwZjFjZDMyODUy
|
|
11
|
-
OGUwNzJlZjM0OWE0ZDllMjAyMGY4OTAxNjhlNDRkNTZjYTQ2Yjk=
|
|
12
|
-
data.tar.gz: !binary |-
|
|
13
|
-
M2JhMGViOTgwNjNmYzgyOTY0ZDhjYzUwOTFlZDhmZjJlMjY5NTlkZGQwNDIx
|
|
14
|
-
MjgwNWFiMWNiMTA1OGM1YzdkMmM3YzQ2NDkzYTQ1NzMwNjU2NzljM2Y2YWQ5
|
|
15
|
-
MzY2MDBkM2QyYzM2MDYxODZlODIzM2RmMTkwYWUzNjI3NmI0Zjk=
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 5d5dcfd7e60f10e0a26e45843ac5c648c95ce294
|
|
4
|
+
data.tar.gz: c187795f946b3a370fd7c721e9f80f46dd67db2f
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 9c301208b269f59e0b2836ce80958df93a266d90e8c96684405ac796e20b06de39dff928de3672d8f5ef34dc10226807cc2aeb22cc65d2b727fbd28c6c14fbbf
|
|
7
|
+
data.tar.gz: 0ca6207e817adf957a60cf0f3e0afde1577fe4cb74c95c9c47b6838f1a3824320bde9ed4245bf21cb5f4cbf9798cb80e534c07619beef4eff61975958b6215b3
|
checksums.yaml.gz.asc
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
-----BEGIN PGP SIGNATURE-----
|
|
2
|
-
Version: GnuPG/MacGPG2 v2.0.
|
|
2
|
+
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
|
|
3
3
|
Comment: GPGTools - http://gpgtools.org
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
=
|
|
5
|
+
iQIcBAABAgAGBQJTB0BaAAoJEH1ncb0Txu7XQwsP/1NseaDvnBek45KXo8LDZn1a
|
|
6
|
+
VHAPgAedA6Pd+Q4pAA0KEnB0+Smw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
-
|
|
5
|
-
* Add license information to the gemspec
|
|
3
|
+
* Rewrite the plugin to work with TinyMCE 4. TinyMCE 3.x is supported in the
|
|
4
|
+
tinymce3-branch.
|
|
6
5
|
|
|
7
6
|
# 3.5.8.5 / 2013-05-07
|
|
8
7
|
|
data/README.md
CHANGED
|
@@ -1,47 +1,60 @@
|
|
|
1
|
+
# IMPORTANT NOTE:
|
|
2
|
+
This version is being rewritten to work with TinyMCE 4.x, and is
|
|
3
|
+
currently **not usable**. For the stable version targetting TinyMCE 3, see
|
|
4
|
+
the [tinymce3 branch](https://github.com/PerfectlyNormal/tinymce-rails-imageupload/tree/tinymce3)
|
|
5
|
+
|
|
1
6
|
# tinymce-rails-imageupload
|
|
2
7
|
|
|
3
|
-
|
|
4
|
-
|
|
8
|
+
Simple plugin for TinyMCE that allows uploading images and inserting.
|
|
9
|
+
It makes no assumptions about how you store the images, it simply POSTs to a
|
|
10
|
+
URL and expects JSON back (see the Setup section).
|
|
5
11
|
|
|
6
|
-
|
|
12
|
+
This plugin started as a copy of work done by [Peter Shoukry](http://77effects.com/),
|
|
13
|
+
but has since mutated into something entirely different.
|
|
7
14
|
|
|
8
|
-
|
|
15
|
+
Support for TinyMCE 3 is currently available in the [tinymce3 branch](https://github.com/PerfectlyNormal/tinymce-rails-imageupload/tree/tinymce3).
|
|
16
|
+
The master branch is targetting TinyMCE 4.x.
|
|
9
17
|
|
|
10
|
-
## Requirements
|
|
11
18
|
|
|
12
|
-
|
|
13
|
-
* TinyMCE3 using the advanced theme
|
|
19
|
+
## Requirements
|
|
14
20
|
|
|
15
|
-
|
|
21
|
+
* Rails >= 3.1
|
|
22
|
+
* TinyMCE4 using the advanced theme
|
|
16
23
|
|
|
17
24
|
## Setup
|
|
18
25
|
|
|
19
26
|
### Add the gem to your Gemfile
|
|
20
27
|
|
|
21
|
-
gem 'tinymce-rails-imageupload', '~>
|
|
28
|
+
gem 'tinymce-rails-imageupload', '~> 4.0.0'
|
|
22
29
|
|
|
23
30
|
### Set up TinyMCE as you would normally, but in the call to `.tinymce()`, add
|
|
24
31
|
|
|
25
32
|
plugins: "uploadimage"
|
|
26
|
-
#
|
|
33
|
+
# toolbar option must include "uploadimage" somewhere to have the button appear
|
|
27
34
|
|
|
28
|
-
|
|
35
|
+
and the rest should happen automatically.
|
|
29
36
|
|
|
30
37
|
### Set up upload URL and handler
|
|
31
38
|
|
|
32
|
-
|
|
39
|
+
The plugin defaults to POSTing to `/tinymce_assets`. You may modify it by
|
|
40
|
+
supplying the option `uploadimage_form_url` in the call to `.tinymce()`
|
|
33
41
|
|
|
34
|
-
|
|
42
|
+
Routing to your controller must be done manually.
|
|
43
|
+
Set it up using something similar in `routes.rb`:
|
|
35
44
|
|
|
36
45
|
post '/tinymce_assets' => 'tinymce_assets#create'
|
|
37
46
|
|
|
38
|
-
|
|
47
|
+
The plugin will relay option `uploadimage_hint` in the call to `.tinymce()`
|
|
48
|
+
to the POSTed URL as param `hint`. You may use this to relay any hints
|
|
49
|
+
you wish (for example, blog post ID #) to the controller.
|
|
39
50
|
|
|
40
|
-
|
|
51
|
+
This action gets called with a file parameter creatively called `file`,
|
|
52
|
+
and must respond with JSON, containing the URL to the image.
|
|
41
53
|
|
|
42
|
-
|
|
54
|
+
The JSON has to be returned with a content type of "text/html" to work, which
|
|
55
|
+
is hopefully going to be fixed ([issue #7](https://github.com/PerfectlyNormal/tinymce-rails-imageupload/issues/7)).
|
|
43
56
|
|
|
44
|
-
|
|
57
|
+
Example:
|
|
45
58
|
|
|
46
59
|
class TinymceAssetsController < ApplicationController
|
|
47
60
|
def create
|
|
@@ -56,60 +69,60 @@ For TinyMCE4 support, use the master branch.
|
|
|
56
69
|
end
|
|
57
70
|
end
|
|
58
71
|
|
|
59
|
-
|
|
72
|
+
If the JSON response contains a `width` and/or `height` key,
|
|
73
|
+
those will be used in the inserted HTML (`<img src="..." width="..." height="...">`),
|
|
74
|
+
but if those are not present, the inserted HTML is just `<img src="...">`.
|
|
60
75
|
|
|
61
76
|
### Default class for img tag
|
|
62
77
|
|
|
63
|
-
|
|
78
|
+
By default the plugin doesn't assign any class to the img tag.
|
|
79
|
+
You can set the class(es) by supplying the `uploadimage_default_img_class`
|
|
80
|
+
option in the call to `.tinymce()`.
|
|
64
81
|
|
|
65
|
-
|
|
82
|
+
`class="..."` will only be added to the img tag if a default is specified.
|
|
83
|
+
Otherwise the inserted HTML is just `<img src="...">`.
|
|
66
84
|
|
|
67
85
|
## Error handling
|
|
68
86
|
|
|
69
|
-
To notify the uploader that an error occurred, return JSON containing
|
|
70
|
-
The message gets show in a paragraph with the
|
|
87
|
+
To notify the uploader that an error occurred, return JSON containing an
|
|
88
|
+
`error` key with a `message`. The message gets show in a paragraph with the
|
|
89
|
+
ID `error_message`, and the input label gets the class `invalid`.
|
|
71
90
|
|
|
72
91
|
Example response:
|
|
73
92
|
|
|
74
|
-
"{"error": {
|
|
93
|
+
"{"error": {
|
|
94
|
+
"message": "Invalid file type. Only .jpg, .png and .gif allowed"
|
|
95
|
+
}}"
|
|
75
96
|
|
|
76
97
|
## Internationalization
|
|
77
98
|
|
|
78
|
-
I18n is taken care of by `tinymce-rails`.
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
title: 'Insert image',
|
|
100
|
-
header: "Insert image",
|
|
101
|
-
input: "Choose an image",
|
|
102
|
-
uploading: "Uploading…",
|
|
103
|
-
blank_input: "Must choose a file",
|
|
104
|
-
bad_response: "Got a bad response from the server",
|
|
105
|
-
blank_response: "Didn't get a response from the server",
|
|
106
|
-
insert: "Insert",
|
|
107
|
-
cancel: "Cancel"
|
|
99
|
+
I18n is taken care of by `tinymce-rails`.
|
|
100
|
+
This gem includes strings for `en`, `de`, `es`, `fr`, `nb`, `pt`, `pt_BR`,
|
|
101
|
+
`ru` and `zh-cn`.
|
|
102
|
+
To add your own language, create the files `<code>.js` in
|
|
103
|
+
`app/assets/javascripts/tinymce/plugins/uploadimage/langs` in your
|
|
104
|
+
application, or fork the gem and add your own translations there.
|
|
105
|
+
|
|
106
|
+
The format and available strings are listed below:
|
|
107
|
+
|
|
108
|
+
### nb.js
|
|
109
|
+
|
|
110
|
+
tinyMCE.addI18n('nb', {
|
|
111
|
+
'Insert an image from your computer': 'Sett inn et bilde fra datamaskinen',
|
|
112
|
+
'Insert image': "Sett inn bilde",
|
|
113
|
+
'Choose an image': "Velg et bilde",
|
|
114
|
+
'You must choose a file': "Du m\u00e5 velge en fil",
|
|
115
|
+
'Got a bad response from the server': "Fikk et ugyldig svar fra serveren",
|
|
116
|
+
"Didn't get a response from the server": "Fikk ikke svar fra serveren",
|
|
117
|
+
'Insert': "Sett inn",
|
|
118
|
+
'Cancel': "Avbryt",
|
|
119
|
+
'Image description': "Alternativ tekst for bilde",
|
|
108
120
|
});
|
|
109
121
|
|
|
110
122
|
## Versioning
|
|
111
123
|
|
|
112
|
-
The major, minor and patch version of this gem will be mirroring the
|
|
124
|
+
The major, minor and patch version of this gem will be mirroring the
|
|
125
|
+
release of `tinymce-rails` it is tested against.
|
|
113
126
|
|
|
114
127
|
## Signing
|
|
115
128
|
|
|
@@ -127,4 +140,5 @@ The plugin is released under the MIT license.
|
|
|
127
140
|
|
|
128
141
|
TinyMCE is released under the LGPL Version 2.1.
|
|
129
142
|
|
|
130
|
-
The icon used for the button comes from the icon set Silk from famfamfam,
|
|
143
|
+
The icon used for the button comes from the icon set Silk from famfamfam,
|
|
144
|
+
released under the [Creative Commons Attribution 3.0 License](http://creativecommons.org/licenses/by/3.0/)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
tinyMCE.addI18n('de', {
|
|
2
|
+
'Insert an image from your computer': 'Bild vom Computer einfügen',
|
|
3
|
+
'Insert image': 'Bild einfügen',
|
|
4
|
+
'Choose an image': "Bild auswählen",
|
|
5
|
+
'You must choose a file': "Datei auswählen",
|
|
6
|
+
'Got a bad response from the server': "Ungültige Antwort vom Server",
|
|
7
|
+
"Didn't get a response from the server": "Server antwortet nicht",
|
|
8
|
+
'Insert': "Einfügen",
|
|
9
|
+
'Cancel': "Abbrechen",
|
|
10
|
+
'Image description': "Bildbeschreibung"
|
|
11
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
tinyMCE.addI18n('en', {
|
|
2
|
+
'Insert an image from your computer': 'Insert an image from your computer',
|
|
3
|
+
'Insert image': 'Insert image',
|
|
4
|
+
'Choose an image': "Choose an image",
|
|
5
|
+
'You must choose a file': "You must choose a file",
|
|
6
|
+
'Got a bad response from the server': "Got a bad response from the server",
|
|
7
|
+
"Didn't get a response from the server": "Didn't get a response from the server",
|
|
8
|
+
'Insert': "Insert",
|
|
9
|
+
'Cancel': "Cancel",
|
|
10
|
+
'Image description': "Image description",
|
|
11
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
tinyMCE.addI18n('es', {
|
|
2
|
+
'Insert an image from your computer': 'Insertar una imagen desde su computadora',
|
|
3
|
+
'Insert image': 'Insertar una imagen',
|
|
4
|
+
'Choose an image': "Elija una imagen",
|
|
5
|
+
'You must choose a file': "Debe elegir un archivo",
|
|
6
|
+
'Got a bad response from the server': "Mala respuesta del servidor",
|
|
7
|
+
"Didn't get a response from the server": "No se recibió respuesta del servidor",
|
|
8
|
+
'Insert': "Insertar",
|
|
9
|
+
'Cancel': "Cancelar",
|
|
10
|
+
'Image description': "Descripción de la imagen",
|
|
11
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
tinyMCE.addI18n('fr', {
|
|
2
|
+
'Insert an image from your computer': "Envoyer une image de votre ordinateur",
|
|
3
|
+
'Insert image': "Insérer une image",
|
|
4
|
+
'Choose an image': "Choisissez une image",
|
|
5
|
+
'You must choose a file': "Vous devez sélectionner un fichier",
|
|
6
|
+
'Got a bad response from the server': "Le serveur a envoyé une réponse erronée",
|
|
7
|
+
"Didn't get a response from the server": "Le serveur n'a pas renvoyé de réponse",
|
|
8
|
+
'Insert': "Insérer",
|
|
9
|
+
'Cancel': "Annuler",
|
|
10
|
+
'Image description': "Description de l'image",
|
|
11
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
tinyMCE.addI18n('nb', {
|
|
2
|
+
'Insert an image from your computer': 'Sett inn et bilde fra datamaskinen',
|
|
3
|
+
'Insert image': "Sett inn bilde",
|
|
4
|
+
'Choose an image': "Velg et bilde",
|
|
5
|
+
'You must choose a file': "Du m\u00e5 velge en fil",
|
|
6
|
+
'Got a bad response from the server': "Fikk et ugyldig svar fra serveren",
|
|
7
|
+
"Didn't get a response from the server": "Fikk ikke svar fra serveren",
|
|
8
|
+
'Insert': "Sett inn",
|
|
9
|
+
'Cancel': "Avbryt",
|
|
10
|
+
'Image description': "Alternativ tekst for bilde",
|
|
11
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
tinyMCE.addI18n('pt', {
|
|
2
|
+
'Insert an image from your computer': 'Inserir uma imagem do seu computador',
|
|
3
|
+
'Insert image': 'Inserir imagem',
|
|
4
|
+
'Choose an image': "Escolher uma imagem",
|
|
5
|
+
'You must choose a file': "É necessário seleccionar um ficheiro",
|
|
6
|
+
'Got a bad response from the server': "Resposta inesperada do servidor",
|
|
7
|
+
"Didn't get a response from the server": "Não foi obtida uma resposta do servidor",
|
|
8
|
+
'Insert': "Inserir",
|
|
9
|
+
'Cancel': "Cancelar",
|
|
10
|
+
'Image description': "Image description",
|
|
11
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
tinyMCE.addI18n('pt_BR', {
|
|
2
|
+
'Insert an image from your computer': 'Inserir uma imagem do computador',
|
|
3
|
+
'Insert image': 'Inserir imagem',
|
|
4
|
+
'Choose an image': "Escolher uma imagem",
|
|
5
|
+
'You must choose a file': "É necessário selecionar um diretório",
|
|
6
|
+
'Got a bad response from the server': "Resposta inesperada do servidor",
|
|
7
|
+
"Didn't get a response from the server": "Servidor não está respondendo",
|
|
8
|
+
'Insert': "Inserir",
|
|
9
|
+
'Cancel': "Cancelar",
|
|
10
|
+
'Image description': "Image description",
|
|
11
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
tinyMCE.addI18n('ru', {
|
|
2
|
+
'Insert an image from your computer': 'Вставить изображение с вашего компьютера',
|
|
3
|
+
'Insert image': "Вставить изображение",
|
|
4
|
+
'Choose an image': "Выберите изображение",
|
|
5
|
+
'You must choose a file': "Необходимо выбрать файл",
|
|
6
|
+
'Got a bad response from the server': "Получен некорректный ответ с сервера",
|
|
7
|
+
"Didn't get a response from the server": "Не получен ответ с сервера",
|
|
8
|
+
'Insert': "Вставить",
|
|
9
|
+
'Cancel': "Отмена",
|
|
10
|
+
'Image description': "Информация об изображении",
|
|
11
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
tinyMCE.addI18n('zh-cn', {
|
|
2
|
+
'Insert an image from your computer': "\u4e0a\u4f20\u56fe\u7247",
|
|
3
|
+
'Insert image': "\u63d2\u5165\u56fe\u7247",
|
|
4
|
+
'Choose an image': "\u9009\u62e9\u56fe\u7247",
|
|
5
|
+
'You must choose a file': "\u5fc5\u987b\u9009\u62e9\u6587\u4ef6",
|
|
6
|
+
'Got a bad response from the server': "\u670d\u52a1\u5668\u8fd4\u56de\u9519\u8bef",
|
|
7
|
+
"Didn't get a response from the server": "\u670d\u52a1\u5668\u6ca1\u6709\u54cd\u5e94",
|
|
8
|
+
'Insert': "\u63d2\u5165",
|
|
9
|
+
'Cancel': "\u53d6\u6d88",
|
|
10
|
+
'Image description': "\u56fe\u7247\u63cf\u8ff0",
|
|
11
|
+
});
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
(function() {
|
|
2
|
+
tinymce.PluginManager.requireLangPack('uploadimage');
|
|
3
|
+
|
|
4
|
+
tinymce.create('tinymce.plugins.UploadImage', {
|
|
5
|
+
UploadImage: function(ed, url) {
|
|
6
|
+
var form,
|
|
7
|
+
iframe,
|
|
8
|
+
win,
|
|
9
|
+
throbber,
|
|
10
|
+
editor = ed;
|
|
11
|
+
|
|
12
|
+
function showDialog() {
|
|
13
|
+
win = editor.windowManager.open({
|
|
14
|
+
title: ed.translate('Insert an image from your computer'),
|
|
15
|
+
width: 500 + parseInt(editor.getLang('uploadimage.delta_width', 0), 10),
|
|
16
|
+
height: 180 + parseInt(editor.getLang('uploadimage.delta_height', 0), 10),
|
|
17
|
+
body: [
|
|
18
|
+
{type: 'iframe', url: 'javascript:void(0)'},
|
|
19
|
+
{type: 'textbox', name: 'file', label: ed.translate('Choose an image'), subtype: 'file'},
|
|
20
|
+
{type: 'textbox', name: 'alt', label: ed.translate('Image description')},
|
|
21
|
+
{type: 'container', classes: 'error', html: "<p style='color: #b94a48;'> </p>"},
|
|
22
|
+
],
|
|
23
|
+
buttons: [
|
|
24
|
+
{
|
|
25
|
+
text: ed.translate('Insert'),
|
|
26
|
+
onclick: insertImage,
|
|
27
|
+
subtype: 'primary'
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
text: ed.translate('Cancel'),
|
|
31
|
+
onclick: ed.windowManager.close
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
}, {
|
|
35
|
+
plugin_url: url
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// TinyMCE likes pointless submit handlers
|
|
39
|
+
win.off('submit');
|
|
40
|
+
win.on('submit', insertImage);
|
|
41
|
+
|
|
42
|
+
/* WHY DO YOU HATE <form>, TINYMCE!? */
|
|
43
|
+
iframe = win.find("iframe")[0];
|
|
44
|
+
form = createElement('form', {
|
|
45
|
+
action: ed.getParam("uploadimage_form_url", "/tinymce_assets"),
|
|
46
|
+
target: iframe._id,
|
|
47
|
+
method: "POST",
|
|
48
|
+
enctype: 'multipart/form-data',
|
|
49
|
+
accept_charset: "UTF-8",
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// Might have several instances on the same page,
|
|
53
|
+
// so we TinyMCE create unique IDs and use those.
|
|
54
|
+
iframe.getEl().name = iframe._id;
|
|
55
|
+
|
|
56
|
+
// Create some needed hidden inputs
|
|
57
|
+
form.appendChild(createElement('input', {type: "hidden", name: "utf8", value: "✓"}));
|
|
58
|
+
form.appendChild(createElement('input', {type: 'hidden', name: 'authenticity_token', value: getMetaContents('csrf-token')}));
|
|
59
|
+
form.appendChild(createElement('input', {type: 'hidden', name: 'hint', value: ed.getParam("uploadimage_hint", "")}));
|
|
60
|
+
|
|
61
|
+
var el = win.getEl();
|
|
62
|
+
var body = document.getElementById(el.id + "-body");
|
|
63
|
+
|
|
64
|
+
// Copy everything TinyMCE made into our form
|
|
65
|
+
var containers = body.getElementsByClassName('mce-container');
|
|
66
|
+
for(var i = 0; i < containers.length; i++) {
|
|
67
|
+
form.appendChild(containers[i]);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Fix inputs, since TinyMCE hates HTML and forms
|
|
71
|
+
var inputs = form.getElementsByTagName('input');
|
|
72
|
+
for(var i = 0; i < inputs.length; i++) {
|
|
73
|
+
var ctrl = inputs[i];
|
|
74
|
+
|
|
75
|
+
if(ctrl.tagName.toLowerCase() == 'input' && ctrl.type != "hidden") {
|
|
76
|
+
ctrl.name = ctrl.type == "file" ? "file" : "alt";
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
body.appendChild(form);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function insertImage() {
|
|
84
|
+
if(getInputValue("file") == "") {
|
|
85
|
+
return handleError('You must choose a file');
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
throbber = new top.tinymce.ui.Throbber(win.getEl());
|
|
89
|
+
throbber.show();
|
|
90
|
+
|
|
91
|
+
clearErrors();
|
|
92
|
+
|
|
93
|
+
/* Add event listeners.
|
|
94
|
+
* We remove the existing to avoid them being called twice in case
|
|
95
|
+
* of errors and re-submitting afterwards.
|
|
96
|
+
*/
|
|
97
|
+
var target = iframe.getEl();
|
|
98
|
+
if(target.attachEvent) {
|
|
99
|
+
target.detachEvent('onload', uploadDone);
|
|
100
|
+
target.attachEvent('onload', uploadDone);
|
|
101
|
+
} else {
|
|
102
|
+
target.removeEventListener('load', uploadDone);
|
|
103
|
+
target.addEventListener('load', uploadDone, false);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
form.submit();
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function uploadDone() {
|
|
110
|
+
if(throbber) {
|
|
111
|
+
throbber.hide();
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
var target = iframe.getEl();
|
|
115
|
+
if(target.document || target.contentDocument) {
|
|
116
|
+
var doc = target.contentDocument || target.contentWindow.document;
|
|
117
|
+
handleResponse(doc.getElementsByTagName("body")[0].innerHTML);
|
|
118
|
+
} else {
|
|
119
|
+
handleError("Didn't get a response from the server");
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function handleResponse(ret) {
|
|
124
|
+
console.group("Handling response");
|
|
125
|
+
console.log("Raw", ret)
|
|
126
|
+
try {
|
|
127
|
+
var json = tinymce.util.JSON.parse(ret);
|
|
128
|
+
console.log("Parsed", json);
|
|
129
|
+
|
|
130
|
+
if(json["error"]) {
|
|
131
|
+
console.log("It has an error!", json["error"]["message"]);
|
|
132
|
+
handleError(json["error"]["message"]);
|
|
133
|
+
} else {
|
|
134
|
+
console.log("Inserting", buildHTML(json));
|
|
135
|
+
ed.execCommand('mceInsertContent', false, buildHTML(json));
|
|
136
|
+
ed.windowManager.close();
|
|
137
|
+
}
|
|
138
|
+
} catch(e) {
|
|
139
|
+
console.log("Bad response :(", e);
|
|
140
|
+
handleError('Got a bad response from the server');
|
|
141
|
+
}
|
|
142
|
+
console.groupEnd();
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function clearErrors() {
|
|
146
|
+
var message = win.find(".error")[0].getEl();
|
|
147
|
+
|
|
148
|
+
if(message)
|
|
149
|
+
message.getElementsByTagName("p")[0].innerHTML = " ";
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function handleError(error) {
|
|
153
|
+
console.log("Handling error", error);
|
|
154
|
+
var message = win.find(".error")[0].getEl();
|
|
155
|
+
|
|
156
|
+
if(message)
|
|
157
|
+
message.getElementsByTagName("p")[0].innerHTML = ed.translate(error);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function createElement(element, attributes) {
|
|
161
|
+
var el = document.createElement(element);
|
|
162
|
+
for(var property in attributes) {
|
|
163
|
+
if (!(attributes[property] instanceof Function)) {
|
|
164
|
+
el[property] = attributes[property];
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return el;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function buildHTML(json) {
|
|
172
|
+
var default_class = ed.getParam("uploadimage_default_img_class", "");
|
|
173
|
+
var alt_text = getInputValue("alt");
|
|
174
|
+
|
|
175
|
+
var imgstr = "<img src='" + json["image"]["url"] + "'";
|
|
176
|
+
|
|
177
|
+
if(default_class != "")
|
|
178
|
+
imgstr += " class='" + default_class + "'";
|
|
179
|
+
|
|
180
|
+
if(json["image"]["height"])
|
|
181
|
+
imgstr += " height='" + json["image"]["height"] + "'";
|
|
182
|
+
if(json["image"]["width"])
|
|
183
|
+
imgstr += " width='" + json["image"]["width"] + "'";
|
|
184
|
+
|
|
185
|
+
imgstr += " alt='" + alt_text + "'/>";
|
|
186
|
+
|
|
187
|
+
return imgstr;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function getInputValue(name) {
|
|
191
|
+
var inputs = form.getElementsByTagName("input");
|
|
192
|
+
|
|
193
|
+
for(var i in inputs)
|
|
194
|
+
if(inputs[i].name == name)
|
|
195
|
+
return inputs[i].value;
|
|
196
|
+
|
|
197
|
+
return "";
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function getMetaContents(mn) {
|
|
201
|
+
var m = document.getElementsByTagName('meta');
|
|
202
|
+
|
|
203
|
+
for(var i in m)
|
|
204
|
+
if(m[i].name == mn)
|
|
205
|
+
return m[i].content;
|
|
206
|
+
|
|
207
|
+
return null;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// Add a button that opens a window
|
|
211
|
+
editor.addButton('uploadimage', {
|
|
212
|
+
tooltip: ed.translate('Insert an image from your computer'),
|
|
213
|
+
icon : 'image',
|
|
214
|
+
onclick: showDialog
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
// Adds a menu item to the tools menu
|
|
218
|
+
editor.addMenuItem('uploadimage', {
|
|
219
|
+
text: ed.translate('Insert an image from your computer'),
|
|
220
|
+
icon : 'image',
|
|
221
|
+
context: 'insert',
|
|
222
|
+
onclick: showDialog
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
tinymce.PluginManager.add('uploadimage', tinymce.plugins.UploadImage);
|
|
228
|
+
})();
|