ckeditor 4.2.3 → 4.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -5
- data/app/assets/javascripts/ckeditor/config.js +1 -1
- data/app/assets/stylesheets/ckeditor/filebrowser/uploader.scss +42 -2
- data/app/controllers/ckeditor/attachment_files_controller.rb +1 -1
- data/app/controllers/ckeditor/pictures_controller.rb +1 -1
- data/app/helpers/ckeditor/application_helper.rb +1 -10
- data/app/views/ckeditor/attachment_files/index.html.erb +1 -1
- data/app/views/ckeditor/pictures/index.html.erb +1 -1
- data/app/views/layouts/ckeditor/application.html.erb +1 -1
- data/lib/ckeditor.rb +15 -9
- data/lib/ckeditor/asset_response.rb +2 -1
- data/lib/ckeditor/backend/dragonfly.rb +2 -2
- data/lib/ckeditor/backend/paperclip.rb +2 -9
- data/lib/ckeditor/backend/refile.rb +1 -1
- data/lib/ckeditor/helpers/controllers.rb +1 -1
- data/lib/ckeditor/orm/base.rb +1 -1
- data/lib/ckeditor/utils.rb +13 -11
- data/lib/ckeditor/version.rb +2 -2
- data/lib/generators/ckeditor/templates/mongoid/carrierwave/ckeditor/asset.rb +1 -1
- data/test/dummy/public/ckeditor_assets/attachments/1/rails.tar.gz +0 -0
- data/test/dummy/public/ckeditor_assets/pictures/1/content_rails.png +0 -0
- data/test/dummy/public/ckeditor_assets/pictures/1/original_rails.png +0 -0
- data/test/dummy/public/ckeditor_assets/pictures/1/thumb_rails.png +0 -0
- data/test/dummy/public/uploads/ckeditor/attachments/1/rails.tar.gz +0 -0
- data/test/dummy/public/uploads/ckeditor/pictures/1/content_rails.png +0 -0
- data/test/dummy/public/uploads/ckeditor/pictures/1/rails.png +0 -0
- data/test/dummy/public/uploads/ckeditor/pictures/1/thumb_rails.png +0 -0
- data/test/models/attachment_file_test.rb +2 -7
- data/test/tmp/app/models/ckeditor/asset.rb +5 -0
- data/test/tmp/app/models/ckeditor/attachment_file.rb +13 -0
- data/test/tmp/app/models/ckeditor/picture.rb +14 -0
- data/test/tmp/config/initializers/ckeditor.rb +58 -0
- data/test/tmp/config/routes.rb +5 -0
- data/vendor/assets/javascripts/ckeditor/CHANGES.md +86 -1
- data/vendor/assets/javascripts/ckeditor/ckeditor.js +619 -570
- data/vendor/assets/javascripts/ckeditor/lang/af.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/ar.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/az.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/bg.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/bn.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/bs.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/ca.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/cs.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/cy.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/da.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/de-ch.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/de.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/el.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/en-au.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/en-ca.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/en-gb.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/en.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/eo.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/es-mx.js +5 -0
- data/vendor/assets/javascripts/ckeditor/lang/es.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/et.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/eu.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/fa.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/fi.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/fo.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/fr-ca.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/fr.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/gl.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/gu.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/he.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/hi.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/hr.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/hu.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/id.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/is.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/it.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/ja.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/ka.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/km.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/ko.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/ku.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/lt.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/lv.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/mk.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/mn.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/ms.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/nb.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/nl.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/no.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/oc.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/pl.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/pt-br.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/pt.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/ro.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/ru.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/si.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/sk.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/sl.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/sq.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/sr-latn.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/sr.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/sv.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/th.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/tr.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/tt.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/ug.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/uk.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/vi.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/zh-cn.js +1 -1
- data/vendor/assets/javascripts/ckeditor/lang/zh.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/a11yhelp.js +5 -5
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/af.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ar.js +3 -2
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/az.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/bg.js +3 -2
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ca.js +4 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/cs.js +4 -4
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/cy.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/da.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/de-ch.js +4 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/de.js +4 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/el.js +4 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/en-gb.js +3 -2
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/en.js +3 -2
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/eo.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/es-mx.js +13 -0
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/es.js +4 -4
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/et.js +3 -2
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/eu.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/fa.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/fi.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/fo.js +3 -2
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/fr-ca.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/fr.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/gl.js +7 -6
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/gu.js +3 -2
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/he.js +3 -2
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/hi.js +3 -2
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/hr.js +5 -5
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/hu.js +5 -4
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/id.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/it.js +4 -4
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ja.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/km.js +3 -2
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ko.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ku.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/lt.js +3 -2
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/lv.js +3 -2
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/mk.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/mn.js +3 -2
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/nb.js +4 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/nl.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/no.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/oc.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/pl.js +5 -5
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/pt-br.js +4 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/pt.js +4 -4
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ro.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ru.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/si.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/sk.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/sl.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/sq.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/sr-latn.js +3 -2
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/sr.js +3 -2
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/sv.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/th.js +3 -2
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/tr.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/tt.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ug.js +4 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/uk.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/vi.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/zh-cn.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/zh.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/div/dialogs/div.js +2 -2
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/checkbox.js +2 -2
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/radio.js +2 -2
- data/vendor/assets/javascripts/ckeditor/plugins/link/dialogs/anchor.js +4 -3
- data/vendor/assets/javascripts/ckeditor/plugins/link/dialogs/link.js +23 -23
- data/vendor/assets/javascripts/ckeditor/plugins/pastefromword/filter/default.js +48 -39
- data/vendor/assets/javascripts/ckeditor/plugins/scayt/dialogs/dialog.css +23 -0
- data/vendor/assets/javascripts/ckeditor/plugins/scayt/dialogs/options.js +32 -19
- data/vendor/assets/javascripts/ckeditor/plugins/scayt/skins/moono-lisa/scayt.css +6 -1
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/cs.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/da.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/en-au.js +13 -0
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/en-ca.js +13 -0
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/en-gb.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/es-mx.js +13 -0
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/hr.js +9 -9
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ko.js +6 -6
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/zh-cn.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/tableselection/styles/tableselection.css +32 -0
- data/vendor/assets/javascripts/ckeditor/plugins/wsc/dialogs/wsc.js +80 -80
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor_gecko.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor_ie.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor_ie8.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor_iequirks.css +1 -1
- data/vendor/assets/javascripts/ckeditor/styles.js +1 -1
- metadata +36 -4
- data/vendor/assets/javascripts/ckeditor/plugins/clipboard/dialogs/paste.js +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8322d6cb4547b48c4919776004ded1a350c05545
|
4
|
+
data.tar.gz: 9ab657aaca72e69a847357666e1da8eb46684295
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0434a28caf6681dc5a769a12f75019e05042611d62b5ceb0d3f3b5703c07bb10de4ed7b254cfa5cf87ba4dd7e42f0659314acc70de7b319951acf0ed615e19a
|
7
|
+
data.tar.gz: 1842897fba7ae53915db54f91104fa73c71ac1fd2a4390b9fdb72779fa87d858f330ef153c57fbac6a129346c2c1fd3f41d2580222f37c40da05c240457966a1
|
data/README.md
CHANGED
@@ -8,8 +8,8 @@ CKEditor is a WYSIWYG text editor designed to simplify web content creation. It
|
|
8
8
|
|
9
9
|
## Features
|
10
10
|
|
11
|
-
* CKEditor version 4.
|
12
|
-
* Rails 5.0.x, 4.2.x integration
|
11
|
+
* CKEditor version 4.7.1 full (28 Jun 2017)
|
12
|
+
* Rails 5.0.x, 5.1.x, 4.2.x integration
|
13
13
|
* Files browser
|
14
14
|
* HTML5 file uploader
|
15
15
|
* Hooks for formtastic and simple_form forms generators
|
@@ -194,7 +194,7 @@ When overriding the default `config.js` file, you must set all configuration opt
|
|
194
194
|
|
195
195
|
### Deployment (only if you use ckeditor from gem vendor)
|
196
196
|
|
197
|
-
For Rails 4, add the following to `config/initializers/assets.rb`:
|
197
|
+
For Rails 4 and 5, add the following to `config/initializers/assets.rb`:
|
198
198
|
|
199
199
|
```ruby
|
200
200
|
Rails.application.config.assets.precompile += %w( ckeditor/* )
|
@@ -267,10 +267,10 @@ Create a file app/assets/javascripts/init_ckeditor.coffee
|
|
267
267
|
```coffee
|
268
268
|
ready = ->
|
269
269
|
$('.ckeditor').each ->
|
270
|
-
|
270
|
+
CKEDITOR.replace $(this).attr('id')
|
271
271
|
|
272
272
|
$(document).ready(ready)
|
273
|
-
$(document).on('page:load', ready)
|
273
|
+
$(document).on('page:load', ready)
|
274
274
|
```
|
275
275
|
Make sure the file is loaded from your app/assets/javascripts/application.js
|
276
276
|
|
@@ -26,7 +26,7 @@ CKEDITOR.editorConfig = function( config )
|
|
26
26
|
config.filebrowserImageBrowseUrl = "/ckeditor/pictures";
|
27
27
|
|
28
28
|
// The location of a script that handles file uploads in the Image dialog.
|
29
|
-
config.filebrowserImageUploadUrl = "/ckeditor/pictures";
|
29
|
+
config.filebrowserImageUploadUrl = "/ckeditor/pictures?";
|
30
30
|
|
31
31
|
// The location of a script that handles file uploads.
|
32
32
|
config.filebrowserUploadUrl = "/ckeditor/attachment_files";
|
@@ -127,6 +127,46 @@ img {
|
|
127
127
|
text-decoration: underline;
|
128
128
|
}
|
129
129
|
|
130
|
-
.pagination
|
131
|
-
|
130
|
+
.pagination {
|
131
|
+
margin: 0;
|
132
|
+
padding: 0;
|
133
|
+
border: 0;
|
134
|
+
font-weight: inherit;
|
135
|
+
font-style: inherit;
|
136
|
+
height: 40px;
|
137
|
+
text-align: center;
|
138
|
+
vertical-align: middle;
|
139
|
+
}
|
140
|
+
|
141
|
+
.pagination a {
|
142
|
+
height: 40px;
|
143
|
+
width: 50%;
|
144
|
+
padding-right: 5px;
|
145
|
+
padding-left: 5px;
|
146
|
+
text-decoration: none;
|
147
|
+
|
148
|
+
background: #f8f8f8;
|
149
|
+
border-color: #f5c002;
|
150
|
+
color: #000;
|
151
|
+
|
152
|
+
position: relative;
|
153
|
+
display: inline-block;
|
154
|
+
vertical-align: middle;
|
155
|
+
line-height: 40px;
|
156
|
+
font-weight: 400;
|
157
|
+
font-size: 13px;
|
158
|
+
|
159
|
+
padding: 0 20px;
|
160
|
+
|
161
|
+
box-sizing: border-box;
|
162
|
+
border: 1px solid #bcbcbc;
|
163
|
+
-webkit-border-radius: 2px;
|
164
|
+
-moz-border-radius: 2px;
|
165
|
+
-ms-border-radius: 2px;
|
166
|
+
-o-border-radius: 2px;
|
167
|
+
border-radius: 2px;
|
168
|
+
}
|
169
|
+
|
170
|
+
.pagination a:hover {
|
171
|
+
background: #fff;
|
132
172
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class Ckeditor::AttachmentFilesController < Ckeditor::ApplicationController
|
2
|
-
skip_before_action :verify_authenticity_token, only: :create
|
2
|
+
skip_before_action :verify_authenticity_token, only: :create, raise: false
|
3
3
|
|
4
4
|
def index
|
5
5
|
@attachments = Ckeditor.attachment_file_adapter.find_all(ckeditor_attachment_files_scope)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class Ckeditor::PicturesController < Ckeditor::ApplicationController
|
2
|
-
skip_before_action :verify_authenticity_token, only: :create
|
2
|
+
skip_before_action :verify_authenticity_token, only: :create, raise: false
|
3
3
|
|
4
4
|
def index
|
5
5
|
@pictures = Ckeditor.picture_adapter.find_all(ckeditor_pictures_scope)
|
@@ -1,11 +1,2 @@
|
|
1
1
|
module Ckeditor::ApplicationHelper
|
2
|
-
|
3
|
-
if Gem::Version.new(::Rails.version.to_s) >= Gem::Version.new('4.0.0')
|
4
|
-
defined?(Sprockets::Rails)
|
5
|
-
elsif Gem::Version.new(::Rails.version.to_s) >= Gem::Version.new('3.0.0')
|
6
|
-
Rails.application.config.assets.enabled
|
7
|
-
else
|
8
|
-
false
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
2
|
+
end
|
@@ -11,7 +11,7 @@
|
|
11
11
|
|
12
12
|
<% unless @attachments.last_page? %>
|
13
13
|
<div class="pagination">
|
14
|
-
<%= link_to I18n.t("ckeditor.buttons.next"), ckeditor.attachment_files_path(
|
14
|
+
<%= link_to I18n.t("ckeditor.buttons.next"), ckeditor.attachment_files_path(page: @attachments.next_page), class: "next", rel: "next" %>
|
15
15
|
</div>
|
16
16
|
<% end -%>
|
17
17
|
|
@@ -11,7 +11,7 @@
|
|
11
11
|
|
12
12
|
<% unless @pictures.last_page? %>
|
13
13
|
<div class="pagination">
|
14
|
-
<%= link_to I18n.t("ckeditor.buttons.next"), ckeditor.pictures_path(
|
14
|
+
<%= link_to I18n.t("ckeditor.buttons.next"), ckeditor.pictures_path(page: @pictures.next_page), class: "next", rel: "next" %>
|
15
15
|
</div>
|
16
16
|
<% end -%>
|
17
17
|
|
@@ -7,7 +7,7 @@
|
|
7
7
|
<title><%= I18n.t('page_title', scope: [:ckeditor]) %></title>
|
8
8
|
<script src="//code.jquery.com/jquery-1.11.3.min.js" type="text/javascript"></script>
|
9
9
|
|
10
|
-
<% if assets_pipeline_enabled? -%>
|
10
|
+
<% if Ckeditor.assets_pipeline_enabled? -%>
|
11
11
|
<%= stylesheet_link_tag "ckeditor/application" %>
|
12
12
|
<%= javascript_include_tag "ckeditor/application" %>
|
13
13
|
<% else -%>
|
data/lib/ckeditor.rb
CHANGED
@@ -28,7 +28,7 @@ module Ckeditor
|
|
28
28
|
autoload :Refile, 'ckeditor/backend/refile'
|
29
29
|
end
|
30
30
|
|
31
|
-
IMAGE_TYPES = %w
|
31
|
+
IMAGE_TYPES = %w[image/jpeg image/png image/gif image/jpg image/pjpeg image/tiff image/x-png].freeze
|
32
32
|
|
33
33
|
DEFAULT_AUTHORIZE = -> {}
|
34
34
|
|
@@ -41,17 +41,17 @@ module Ckeditor
|
|
41
41
|
# Allowed image file types for upload.
|
42
42
|
# Set to nil or [] (empty array) for all file types
|
43
43
|
mattr_accessor :image_file_types
|
44
|
-
@@image_file_types = %w
|
44
|
+
@@image_file_types = %w[jpg jpeg png gif tiff]
|
45
45
|
|
46
46
|
# Allowed flash file types for upload.
|
47
47
|
# Set to nil or [] (empty array) for all file types
|
48
48
|
mattr_accessor :flash_file_types
|
49
|
-
@@flash_file_types = %w
|
49
|
+
@@flash_file_types = %w[swf]
|
50
50
|
|
51
51
|
# Allowed attachment file types for upload.
|
52
52
|
# Set to nil or [] (empty array) for all file types
|
53
53
|
mattr_accessor :attachment_file_types
|
54
|
-
@@attachment_file_types = %w
|
54
|
+
@@attachment_file_types = %w[doc docx xls odt ods pdf rar zip tar tar.gz swf]
|
55
55
|
|
56
56
|
# Ckeditor files destination path
|
57
57
|
mattr_accessor :relative_path
|
@@ -65,10 +65,6 @@ module Ckeditor
|
|
65
65
|
mattr_accessor :run_on_precompile
|
66
66
|
@@run_on_precompile = true
|
67
67
|
|
68
|
-
# Turn on/off filename parameterize
|
69
|
-
mattr_accessor :parameterize_filenames
|
70
|
-
@@parameterize_filenames = true
|
71
|
-
|
72
68
|
# Paginate assets
|
73
69
|
mattr_accessor :default_per_page
|
74
70
|
@@default_per_page = 24
|
@@ -99,12 +95,17 @@ module Ckeditor
|
|
99
95
|
mattr_accessor :controller_layout
|
100
96
|
@@controller_layout = 'ckeditor/application'
|
101
97
|
|
98
|
+
# Turn on/off assets pipeline
|
99
|
+
# By default ckeditor will check assets pipeline
|
100
|
+
mattr_accessor :assets_pipeline_enabled
|
101
|
+
@@assets_pipeline_enabled = nil
|
102
|
+
|
102
103
|
# Default way to setup Ckeditor. Run rails generate ckeditor to create
|
103
104
|
# a fresh initializer with all configuration values.
|
104
105
|
#
|
105
106
|
# @example
|
106
107
|
# Ckeditor.setup do |config|
|
107
|
-
# config.
|
108
|
+
# config.default_per_page = 30
|
108
109
|
# config.attachment_file_types += ["xml"]
|
109
110
|
# end
|
110
111
|
#
|
@@ -237,6 +238,11 @@ module Ckeditor
|
|
237
238
|
@current_user = block if block_given?
|
238
239
|
@current_user || DEFAULT_CURRENT_USER
|
239
240
|
end
|
241
|
+
|
242
|
+
def self.assets_pipeline_enabled?
|
243
|
+
@@assets_pipeline_enabled = Utils.assets_pipeline_enabled? if @@assets_pipeline_enabled.nil?
|
244
|
+
@@assets_pipeline_enabled
|
245
|
+
end
|
240
246
|
end
|
241
247
|
|
242
248
|
require 'ckeditor/rails'
|
@@ -7,6 +7,7 @@ module Ckeditor
|
|
7
7
|
include ActionView::Helpers::JavaScriptHelper
|
8
8
|
|
9
9
|
FUNCTION = 'window.parent.CKEDITOR.tools.callFunction'.freeze
|
10
|
+
JSON_TYPE = 'json'.freeze
|
10
11
|
|
11
12
|
attr_reader :asset, :params
|
12
13
|
|
@@ -19,7 +20,7 @@ module Ckeditor
|
|
19
20
|
end
|
20
21
|
|
21
22
|
def json?
|
22
|
-
params[:responseType] ==
|
23
|
+
params[:responseType] == JSON_TYPE
|
23
24
|
end
|
24
25
|
|
25
26
|
def ckeditor?
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Ckeditor
|
2
2
|
module Backend
|
3
3
|
module Dragonfly
|
4
|
-
FORMATS = %w
|
4
|
+
FORMATS = %w[bz2 gz lzma xz].freeze
|
5
5
|
|
6
6
|
def self.included(base)
|
7
7
|
base.send(:extend, ::Dragonfly::Model)
|
@@ -28,7 +28,7 @@ module Ckeditor
|
|
28
28
|
end
|
29
29
|
|
30
30
|
module InstanceMethods
|
31
|
-
delegate :url, :path, :
|
31
|
+
delegate :url, :path, :image?, :width, :height, to: :data
|
32
32
|
|
33
33
|
alias_attribute :data_file_name, :data_name
|
34
34
|
alias_attribute :data_content_type, :"data.mime_type"
|
@@ -10,9 +10,9 @@ module Ckeditor
|
|
10
10
|
def self.extended(base)
|
11
11
|
base.class_eval do
|
12
12
|
before_validation :extract_content_type
|
13
|
-
before_create :extract_dimensions
|
13
|
+
before_create :extract_dimensions
|
14
14
|
|
15
|
-
delegate :url, :path, :styles, :
|
15
|
+
delegate :url, :path, :styles, :content_type, to: :data
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -28,13 +28,6 @@ module Ckeditor
|
|
28
28
|
@file ||= data.respond_to?(:queued_for_write) ? data.queued_for_write[:original] : data.to_file
|
29
29
|
end
|
30
30
|
|
31
|
-
def parameterize_filename
|
32
|
-
unless data_file_name.blank?
|
33
|
-
filename = Ckeditor::Utils.parameterize_filename(data_file_name)
|
34
|
-
data.instance_write(:file_name, filename)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
31
|
def extract_dimensions
|
39
32
|
if image? && has_dimensions?
|
40
33
|
self.width = geometry.width
|
@@ -5,7 +5,7 @@ module Ckeditor
|
|
5
5
|
|
6
6
|
included do
|
7
7
|
validates :data, presence: true
|
8
|
-
delegate :rewind, :download, :to_io, :exists?, :delete, :
|
8
|
+
delegate :rewind, :download, :to_io, :exists?, :delete, :close, :eof?, :read, to: :data
|
9
9
|
alias_attribute :data_file_name, :data_filename
|
10
10
|
alias_attribute :data_file_size, :data_size
|
11
11
|
end
|
data/lib/ckeditor/orm/base.rb
CHANGED
data/lib/ckeditor/utils.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
+
|
2
3
|
require 'active_support/json/encoding'
|
3
4
|
|
4
5
|
module Ckeditor
|
@@ -8,16 +9,7 @@ module Ckeditor
|
|
8
9
|
|
9
10
|
class << self
|
10
11
|
def escape_single_quotes(str)
|
11
|
-
str.gsub('\\','\0\0').gsub('</','<\/').gsub(/\r\n|\n|\r/, "\\n").gsub(/["']/) { |m| "\\#{m}" }
|
12
|
-
end
|
13
|
-
|
14
|
-
def parameterize_filename(filename)
|
15
|
-
return filename unless Ckeditor.parameterize_filenames
|
16
|
-
|
17
|
-
extension = File.extname(filename)
|
18
|
-
basename = filename.gsub(/#{extension}$/, '')
|
19
|
-
|
20
|
-
[basename.parameterize('_'), extension].join.downcase
|
12
|
+
str.gsub('\\', '\0\0').gsub('</', '<\/').gsub(/\r\n|\n|\r/, "\\n").gsub(/["']/) { |m| "\\#{m}" }
|
21
13
|
end
|
22
14
|
|
23
15
|
def js_replace(dom_id, options = nil)
|
@@ -41,7 +33,7 @@ module Ckeditor
|
|
41
33
|
end
|
42
34
|
|
43
35
|
def js_fileuploader(uploader_type, options = {})
|
44
|
-
options = { multiple: true, element: 'fileupload' }.merge(options)
|
36
|
+
options = { multiple: true, element: 'fileupload' }.merge!(options)
|
45
37
|
|
46
38
|
case uploader_type.to_s.downcase
|
47
39
|
when 'image' then
|
@@ -71,6 +63,16 @@ module Ckeditor
|
|
71
63
|
File.join(Ckeditor.relative_path, 'filebrowser/thumbs', image)
|
72
64
|
end
|
73
65
|
|
66
|
+
def assets_pipeline_enabled?
|
67
|
+
if Gem::Version.new(::Rails.version.to_s) >= Gem::Version.new('4.0.0')
|
68
|
+
defined?(Sprockets::Rails)
|
69
|
+
elsif Gem::Version.new(::Rails.version.to_s) >= Gem::Version.new('3.0.0')
|
70
|
+
Rails.application.config.assets.enabled
|
71
|
+
else
|
72
|
+
false
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
74
76
|
def select_assets(path, relative_path)
|
75
77
|
relative_folder = Ckeditor.root_path.join(relative_path)
|
76
78
|
folder = relative_folder.join(path)
|
data/lib/ckeditor/version.rb
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -5,15 +5,10 @@ class AttachmentFileTest < ActiveSupport::TestCase
|
|
5
5
|
@attachment.destroy rescue nil
|
6
6
|
end
|
7
7
|
|
8
|
-
test
|
8
|
+
test 'Set file content_type and size' do
|
9
9
|
@attachment = create_attachment
|
10
10
|
|
11
|
-
|
12
|
-
if CKEDITOR_BACKEND == :paperclip
|
13
|
-
assert_equal "rails_tar.gz", @attachment.data_file_name
|
14
|
-
else
|
15
|
-
assert_equal "rails.tar.gz", @attachment.data_file_name
|
16
|
-
end
|
11
|
+
assert_equal "rails.tar.gz", @attachment.data_file_name
|
17
12
|
|
18
13
|
assert_match /application\/(x-)?gzip/, @attachment.data_content_type
|
19
14
|
assert_equal 6823, @attachment.data_file_size
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class Ckeditor::AttachmentFile < Ckeditor::Asset
|
2
|
+
has_mongoid_attached_file :data,
|
3
|
+
url: '/ckeditor_assets/attachments/:id/:filename',
|
4
|
+
path: ':rails_root/public/ckeditor_assets/attachments/:id/:filename'
|
5
|
+
|
6
|
+
validates_attachment_presence :data
|
7
|
+
validates_attachment_size :data, less_than: 100.megabytes
|
8
|
+
do_not_validate_attachment_file_type :data
|
9
|
+
|
10
|
+
def url_thumb
|
11
|
+
@url_thumb ||= Ckeditor::Utils.filethumb(filename)
|
12
|
+
end
|
13
|
+
end
|