ckeditor 4.0.6 → 4.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +54 -6
- data/app/assets/javascripts/ckeditor/config.js +10 -10
- data/app/assets/javascripts/ckeditor/filebrowser/javascripts/{application.js → application.js.erb} +1 -2
- data/app/assets/javascripts/ckeditor/filebrowser/stylesheets/{uploader.css → uploader.css.erb} +2 -2
- data/app/assets/javascripts/ckeditor/init.js.erb +2 -2
- data/app/assets/javascripts/ckeditor/override.js.erb +21 -0
- data/app/controllers/ckeditor/application_controller.rb +2 -1
- data/app/controllers/ckeditor/attachment_files_controller.rb +4 -4
- data/app/controllers/ckeditor/pictures_controller.rb +4 -4
- data/app/views/ckeditor/shared/_asset.html.erb +1 -1
- data/app/views/ckeditor/shared/_asset_tmpl.html.erb +2 -2
- data/app/views/layouts/ckeditor/application.html.erb +0 -1
- data/lib/ckeditor.rb +49 -7
- data/lib/ckeditor/utils.rb +1 -1
- data/lib/ckeditor/version.rb +2 -2
- data/lib/generators/ckeditor/templates/ckeditor.rb +4 -0
- data/test/ckeditor_test.rb +53 -0
- data/test/support/helpers.rb +2 -2
- data/vendor/assets/javascripts/ckeditor/CHANGES.md +259 -102
- data/vendor/assets/javascripts/ckeditor/build-config.js +3 -2
- data/vendor/assets/javascripts/ckeditor/ckeditor.js +778 -732
- data/vendor/assets/javascripts/ckeditor/contents.css +20 -17
- 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/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.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.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/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/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/lang/el.js +6 -6
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/et.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/he.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/id.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ja.js +3 -4
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ko.js +9 -0
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/nl.js +2 -2
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/pt.js +6 -6
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/sr-latn.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/sr.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/sv.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ug.js +4 -4
- data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/vi.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/div/dialogs/div.js +5 -5
- data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/form.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/icons.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/icons_hidpi.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/image/dialogs/image.js +21 -21
- data/vendor/assets/javascripts/ckeditor/plugins/link/dialogs/link.js +7 -6
- data/vendor/assets/javascripts/ckeditor/plugins/pastefromword/filter/default.js +20 -20
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/angel_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/angel_smile.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/angry_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/angry_smile.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/broken_heart.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/broken_heart.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/confused_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/confused_smile.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/cry_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/cry_smile.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/devil_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/devil_smile.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/embaressed_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/embarrassed_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/embarrassed_smile.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/envelope.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/envelope.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/heart.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/heart.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/kiss.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/kiss.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/lightbulb.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/lightbulb.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/omg_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/omg_smile.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/regular_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/regular_smile.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/sad_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/sad_smile.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/shades_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/shades_smile.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/teeth_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/teeth_smile.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/thumbs_down.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/thumbs_down.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/thumbs_up.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/thumbs_up.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/tongue_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/tongue_smile.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/tounge_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/whatchutalkingabout_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/whatchutalkingabout_smile.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/wink_smile.gif +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/smiley/images/wink_smile.png +0 -0
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ar.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/el.js +9 -9
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/et.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/he.js +8 -9
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/id.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ja.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/km.js +13 -0
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/nl.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/pt.js +4 -4
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/sl.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/sq.js +2 -2
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ug.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/uk.js +1 -1
- data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/vi.js +11 -10
- data/vendor/assets/javascripts/ckeditor/plugins/table/dialogs/table.js +3 -3
- data/vendor/assets/javascripts/ckeditor/plugins/wsc/dialogs/tmp.html +5 -18
- data/vendor/assets/javascripts/ckeditor/plugins/wsc/dialogs/wsc.js +62 -62
- data/vendor/assets/javascripts/ckeditor/skins/moono/dialog.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie7.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie8.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_iequirks.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_opera.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor_gecko.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie7.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie8.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/moono/editor_iequirks.css +1 -1
- data/vendor/assets/javascripts/ckeditor/skins/moono/icons.png +0 -0
- data/vendor/assets/javascripts/ckeditor/skins/moono/icons_hidpi.png +0 -0
- metadata +28 -41
- data/vendor/assets/javascripts/ckeditor/samples/ajax.html +0 -82
- data/vendor/assets/javascripts/ckeditor/samples/api.html +0 -207
- data/vendor/assets/javascripts/ckeditor/samples/appendto.html +0 -57
- data/vendor/assets/javascripts/ckeditor/samples/assets/inlineall/logo.png +0 -0
- data/vendor/assets/javascripts/ckeditor/samples/assets/outputxhtml/outputxhtml.css +0 -204
- data/vendor/assets/javascripts/ckeditor/samples/assets/posteddata.php +0 -59
- data/vendor/assets/javascripts/ckeditor/samples/assets/sample.css +0 -3
- data/vendor/assets/javascripts/ckeditor/samples/assets/sample.jpg +0 -0
- data/vendor/assets/javascripts/ckeditor/samples/assets/uilanguages/languages.js +0 -7
- data/vendor/assets/javascripts/ckeditor/samples/datafiltering.html +0 -401
- data/vendor/assets/javascripts/ckeditor/samples/divreplace.html +0 -141
- data/vendor/assets/javascripts/ckeditor/samples/index.html +0 -128
- data/vendor/assets/javascripts/ckeditor/samples/inlineall.html +0 -311
- data/vendor/assets/javascripts/ckeditor/samples/inlinebycode.html +0 -121
- data/vendor/assets/javascripts/ckeditor/samples/inlinetextarea.html +0 -110
- data/vendor/assets/javascripts/ckeditor/samples/jquery.html +0 -97
- data/vendor/assets/javascripts/ckeditor/samples/plugins/dialog/assets/my_dialog.js +0 -48
- data/vendor/assets/javascripts/ckeditor/samples/plugins/dialog/dialog.html +0 -187
- data/vendor/assets/javascripts/ckeditor/samples/plugins/enterkey/enterkey.html +0 -103
- data/vendor/assets/javascripts/ckeditor/samples/plugins/htmlwriter/assets/outputforflash/outputforflash.fla +0 -0
- data/vendor/assets/javascripts/ckeditor/samples/plugins/htmlwriter/assets/outputforflash/outputforflash.swf +0 -0
- data/vendor/assets/javascripts/ckeditor/samples/plugins/htmlwriter/assets/outputforflash/swfobject.js +0 -18
- data/vendor/assets/javascripts/ckeditor/samples/plugins/htmlwriter/outputforflash.html +0 -280
- data/vendor/assets/javascripts/ckeditor/samples/plugins/htmlwriter/outputhtml.html +0 -221
- data/vendor/assets/javascripts/ckeditor/samples/plugins/magicline/magicline.html +0 -207
- data/vendor/assets/javascripts/ckeditor/samples/plugins/toolbar/toolbar.html +0 -232
- data/vendor/assets/javascripts/ckeditor/samples/plugins/wysiwygarea/fullpage.html +0 -77
- data/vendor/assets/javascripts/ckeditor/samples/readonly.html +0 -73
- data/vendor/assets/javascripts/ckeditor/samples/replacebyclass.html +0 -57
- data/vendor/assets/javascripts/ckeditor/samples/replacebycode.html +0 -56
- data/vendor/assets/javascripts/ckeditor/samples/sample.css +0 -339
- data/vendor/assets/javascripts/ckeditor/samples/sample.js +0 -33
- data/vendor/assets/javascripts/ckeditor/samples/sample_posteddata.php +0 -16
- data/vendor/assets/javascripts/ckeditor/samples/tabindex.html +0 -75
- data/vendor/assets/javascripts/ckeditor/samples/uicolor.html +0 -69
- data/vendor/assets/javascripts/ckeditor/samples/uilanguages.html +0 -119
- data/vendor/assets/javascripts/ckeditor/samples/xhtmlstyle.html +0 -231
data/README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# Ckeditor
|
2
2
|
|
3
|
-
CKEditor is a ready-for-use HTML text editor designed to simplify web content creation. It's a WYSIWYG editor that brings common word processor features directly to your web pages. Enhance your website experience with our community maintained editor.
|
3
|
+
CKEditor is a ready-for-use HTML text editor designed to simplify web content creation. It's a WYSIWYG editor that brings common word processor features directly to your web pages. Enhance your website experience with our community maintained editor.
|
4
4
|
[ckeditor.com](http://ckeditor.com/)
|
5
5
|
|
6
6
|
## Features
|
7
7
|
|
8
|
-
* Ckeditor version 4.
|
8
|
+
* Ckeditor version 4.3 (full)
|
9
9
|
* Rails 4 integration
|
10
10
|
* Files browser
|
11
11
|
* HTML5 files uploader
|
@@ -36,7 +36,7 @@ gem "paperclip"
|
|
36
36
|
|
37
37
|
rails generate ckeditor:install --orm=active_record --backend=paperclip
|
38
38
|
```
|
39
|
-
|
39
|
+
|
40
40
|
#### ActiveRecord + carrierwave
|
41
41
|
|
42
42
|
```
|
@@ -110,13 +110,61 @@ app/assets/javascripts/ckeditor/config.js
|
|
110
110
|
app/assets/javascripts/ckeditor/contents.css
|
111
111
|
```
|
112
112
|
|
113
|
+
### Usage with Rails 4 assets
|
114
|
+
|
115
|
+
In order to use rails 4 assets with digest in production environment you need some preparing.
|
116
|
+
|
117
|
+
First, you need to include in `application.js` **before** `ckeditor/init`
|
118
|
+
|
119
|
+
```
|
120
|
+
//= require ckeditor/override
|
121
|
+
```
|
122
|
+
|
123
|
+
It forces ckeditor core to respect digested assets.
|
124
|
+
|
125
|
+
Next you need to check, that some non-core plugins and skins don't use core ckeditor functions
|
126
|
+
to determine path to assets. Therefore we have to create a rake task thats copies the original assets and creates a non-digest version of it. Some example of such rake task is:
|
127
|
+
|
128
|
+
```ruby
|
129
|
+
namespace :ckeditor do
|
130
|
+
desc 'Create nondigest versions of some ckeditor assets (e.g. moono skin png)'
|
131
|
+
task :create_nondigest_assets do
|
132
|
+
fingerprint = /\-[0-9a-f]{32}\./
|
133
|
+
for file in Dir['public/assets/ckeditor/contents-*.css', 'public/assets/ckeditor/skins/moono/*.png']
|
134
|
+
next unless file =~ fingerprint
|
135
|
+
nondigest = file.sub fingerprint, '.' # contents-0d8ffa186a00f5063461bc0ba0d96087.css => contents.css
|
136
|
+
FileUtils.cp file, nondigest, verbose: true
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
# auto run ckeditor:create_nondigest_assets after assets:precompile
|
142
|
+
Rake::Task['assets:precompile'].enhance do
|
143
|
+
Rake::Task['ckeditor:create_nondigest_assets'].invoke
|
144
|
+
end
|
145
|
+
```
|
146
|
+
This also works on heroku. Even after restarting dynos running on a cedar stack, the assets will remain.
|
147
|
+
|
148
|
+
You can include this rake task in a capistrano task (if you are deploying via capistrano):
|
149
|
+
|
150
|
+
```ruby
|
151
|
+
desc 'copy ckeditor nondigest assets'
|
152
|
+
task :copy_nondigest_assets, roles: :app do
|
153
|
+
run "cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} ckeditor:copy_nondigest_assets"
|
154
|
+
end
|
155
|
+
after 'deploy:assets:precompile', 'copy_nondigest_assets'
|
156
|
+
```
|
157
|
+
|
158
|
+
Periodically check your error monitoring tool, if you see some part of ckeditor try to load
|
159
|
+
unexisting non-digest asset - if so just add it in the ckeditor rake task.
|
160
|
+
|
113
161
|
### AJAX
|
114
162
|
|
115
163
|
jQuery sample:
|
116
164
|
|
117
165
|
```html
|
118
166
|
<script type='text/javascript' charset='UTF-8'>
|
119
|
-
$(document).ready(function(){
|
167
|
+
$(document).ready(function(){
|
120
168
|
$('form[data-remote]').bind("ajax:before", function(){
|
121
169
|
for (instance in CKEDITOR.instances){
|
122
170
|
CKEDITOR.instances[instance].updateElement();
|
@@ -182,11 +230,11 @@ en:
|
|
182
230
|
$> rake test
|
183
231
|
$> rake test CKEDITOR_ORM=mongoid
|
184
232
|
$> rake test CKEDITOR_BACKEND=carrierwave
|
185
|
-
|
233
|
+
|
186
234
|
$> rake test:controllers
|
187
235
|
$> rake test:generators
|
188
236
|
$> rake test:integration
|
189
237
|
$> rake test:models
|
190
238
|
```
|
191
239
|
|
192
|
-
This project rocks and uses MIT-LICENSE.
|
240
|
+
This project rocks and uses MIT-LICENSE.
|
@@ -8,7 +8,7 @@ CKEDITOR.editorConfig = function( config )
|
|
8
8
|
// Define changes to default configuration here. For example:
|
9
9
|
// config.language = 'fr';
|
10
10
|
// config.uiColor = '#AADC6E';
|
11
|
-
|
11
|
+
|
12
12
|
/* Filebrowser routes */
|
13
13
|
// The location of an external file browser, that should be launched when "Browse Server" button is pressed.
|
14
14
|
config.filebrowserBrowseUrl = "/ckeditor/attachment_files";
|
@@ -18,7 +18,7 @@ CKEDITOR.editorConfig = function( config )
|
|
18
18
|
|
19
19
|
// The location of a script that handles file uploads in the Flash dialog.
|
20
20
|
config.filebrowserFlashUploadUrl = "/ckeditor/attachment_files";
|
21
|
-
|
21
|
+
|
22
22
|
// The location of an external file browser, that should be launched when "Browse Server" button is pressed in the Link tab of Image dialog.
|
23
23
|
config.filebrowserImageBrowseLinkUrl = "/ckeditor/pictures";
|
24
24
|
|
@@ -27,16 +27,16 @@ CKEDITOR.editorConfig = function( config )
|
|
27
27
|
|
28
28
|
// The location of a script that handles file uploads in the Image dialog.
|
29
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";
|
33
|
-
|
33
|
+
|
34
34
|
// Rails CSRF token
|
35
35
|
config.filebrowserParams = function(){
|
36
36
|
var csrf_token, csrf_param, meta,
|
37
37
|
metas = document.getElementsByTagName('meta'),
|
38
38
|
params = new Object();
|
39
|
-
|
39
|
+
|
40
40
|
for ( var i = 0 ; i < metas.length ; i++ ){
|
41
41
|
meta = metas[i];
|
42
42
|
|
@@ -55,10 +55,10 @@ CKEDITOR.editorConfig = function( config )
|
|
55
55
|
if (csrf_param !== undefined && csrf_token !== undefined) {
|
56
56
|
params[csrf_param] = csrf_token;
|
57
57
|
}
|
58
|
-
|
58
|
+
|
59
59
|
return params;
|
60
60
|
};
|
61
|
-
|
61
|
+
|
62
62
|
config.addQueryString = function( url, params ){
|
63
63
|
var queryString = [];
|
64
64
|
|
@@ -71,18 +71,18 @@ CKEDITOR.editorConfig = function( config )
|
|
71
71
|
|
72
72
|
return url + ( ( url.indexOf( "?" ) != -1 ) ? "&" : "?" ) + queryString.join( "&" );
|
73
73
|
};
|
74
|
-
|
74
|
+
|
75
75
|
// Integrate Rails CSRF token into file upload dialogs (link, image, attachment and flash)
|
76
76
|
CKEDITOR.on( 'dialogDefinition', function( ev ){
|
77
77
|
// Take the dialog name and its definition from the event data.
|
78
78
|
var dialogName = ev.data.name;
|
79
79
|
var dialogDefinition = ev.data.definition;
|
80
80
|
var content, upload;
|
81
|
-
|
81
|
+
|
82
82
|
if (CKEDITOR.tools.indexOf(['link', 'image', 'attachment', 'flash'], dialogName) > -1) {
|
83
83
|
content = (dialogDefinition.getContents('Upload') || dialogDefinition.getContents('upload'));
|
84
84
|
upload = (content == null ? null : content.get('upload'));
|
85
|
-
|
85
|
+
|
86
86
|
if (upload && upload.filebrowser && upload.filebrowser['params'] === undefined) {
|
87
87
|
upload.filebrowser['params'] = config.filebrowserParams();
|
88
88
|
upload.action = config.addQueryString(upload.action, upload.filebrowser['params']);
|
data/app/assets/javascripts/ckeditor/filebrowser/javascripts/{application.js → application.js.erb}
RENAMED
@@ -76,7 +76,6 @@ qq.FileUploaderInput = function(o){
|
|
76
76
|
this._classes = this._options.classes;
|
77
77
|
|
78
78
|
this._button = this._createUploadButton(this._find(this._element, 'button'));
|
79
|
-
this._path = $('meta[name="ckeditor-path"]').attr('content');
|
80
79
|
|
81
80
|
//this._setupDragDrop();
|
82
81
|
|
@@ -188,7 +187,7 @@ qq.extend(qq.FileUploaderInput.prototype, {
|
|
188
187
|
format_created_at: '',
|
189
188
|
url_content: "#",
|
190
189
|
controller: "assets",
|
191
|
-
url_thumb:
|
190
|
+
url_thumb: "<%= asset_path('ckeditor/filebrowser/images/preloader.gif') %>"
|
192
191
|
};
|
193
192
|
|
194
193
|
var item = $(this._options.template_id)
|
data/app/assets/javascripts/ckeditor/filebrowser/stylesheets/{uploader.css → uploader.css.erb}
RENAMED
@@ -56,7 +56,7 @@ img {
|
|
56
56
|
.gal-holder .gal-item .gal-upload-holder .add {
|
57
57
|
display: block;
|
58
58
|
color: #2e5aff;
|
59
|
-
background: url(
|
59
|
+
background: url(<%= asset_path('ckeditor/filebrowser/images/gal_add.png') %>) no-repeat left center;
|
60
60
|
padding-left: 33px;
|
61
61
|
line-height: 25px;
|
62
62
|
text-decoration: none;
|
@@ -108,7 +108,7 @@ img {
|
|
108
108
|
}
|
109
109
|
.gal-more a {
|
110
110
|
color: #2e5aff;
|
111
|
-
background: url(
|
111
|
+
background: url(<%= asset_path('ckeditor/filebrowser/images/gal_more.gif') %>) no-repeat left center;
|
112
112
|
padding-left: 15px;
|
113
113
|
font-size: 14px;
|
114
114
|
text-decoration: none;
|
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
(function() {
|
5
5
|
if (typeof window['CKEDITOR_BASEPATH'] === "undefined" || window['CKEDITOR_BASEPATH'] === null) {
|
6
|
-
window['CKEDITOR_BASEPATH'] = "<%=
|
6
|
+
window['CKEDITOR_BASEPATH'] = "<%= asset_path('ckeditor') %>/";
|
7
7
|
}
|
8
8
|
}).call(this);
|
9
9
|
|
@@ -13,4 +13,4 @@ function ck_load() {
|
|
13
13
|
});
|
14
14
|
}
|
15
15
|
|
16
|
-
$(document).on('page:load', ck_load);
|
16
|
+
$(document).on('page:load', ck_load);
|
@@ -0,0 +1,21 @@
|
|
1
|
+
window['CKEDITOR_BASEPATH'] = "/assets/ckeditor/";
|
2
|
+
|
3
|
+
window.CKEDITOR_ASSETS_MAPPING = {
|
4
|
+
<% Rails.application.assets.each_logical_path(->(path){ path =~ /ckeditor/ && path != 'ckeditor/override.js' }) do |asset| %>
|
5
|
+
"<%= asset %>": "<%= asset_path(asset) %>",
|
6
|
+
<% end %>
|
7
|
+
}
|
8
|
+
|
9
|
+
window.CKEDITOR_GETURL = function( resource ) {
|
10
|
+
// If this is not a full or absolute path.
|
11
|
+
if ( resource.indexOf( ':/' ) == -1 && resource.indexOf( '/' ) !== 0 )
|
12
|
+
resource = this.basePath + resource;
|
13
|
+
|
14
|
+
// Add the timestamp, except for directories.
|
15
|
+
if ( resource.charAt( resource.length - 1 ) != '/' ){
|
16
|
+
var url = resource.match( /^(.*?:\/\/[^\/]*)\/assets\/(.+)/ );
|
17
|
+
if(url) resource = url[1] + (CKEDITOR_ASSETS_MAPPING[url[2]] || '/assets/' + url[2]);
|
18
|
+
}
|
19
|
+
|
20
|
+
return resource;
|
21
|
+
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
class Ckeditor::ApplicationController < ::ApplicationController
|
2
2
|
respond_to :html, :json
|
3
|
+
layout 'ckeditor/application'
|
3
4
|
|
4
5
|
before_filter :find_asset, :only => [:destroy]
|
5
6
|
before_filter :ckeditor_authorize!
|
@@ -15,7 +16,7 @@ class Ckeditor::ApplicationController < ::ApplicationController
|
|
15
16
|
|
16
17
|
if callback && asset.save
|
17
18
|
body = params[:CKEditor].blank? ? asset.to_json(:only=>[:id, :type]) : %Q"<script type='text/javascript'>
|
18
|
-
window.parent.CKEDITOR.tools.callFunction(#{params[:CKEditorFuncNum]}, '#{Ckeditor::Utils.escape_single_quotes(asset.url_content)}');
|
19
|
+
window.parent.CKEDITOR.tools.callFunction(#{params[:CKEditorFuncNum]}, '#{config.relative_url_root}#{Ckeditor::Utils.escape_single_quotes(asset.url_content)}');
|
19
20
|
</script>"
|
20
21
|
|
21
22
|
render :text => body
|
@@ -1,12 +1,12 @@
|
|
1
1
|
class Ckeditor::AttachmentFilesController < Ckeditor::ApplicationController
|
2
2
|
|
3
3
|
def index
|
4
|
-
@attachments = Ckeditor.
|
4
|
+
@attachments = Ckeditor.attachment_file_adapter.find_all(ckeditor_attachment_files_scope)
|
5
5
|
respond_with(@attachments)
|
6
6
|
end
|
7
7
|
|
8
8
|
def create
|
9
|
-
@attachment = Ckeditor
|
9
|
+
@attachment = Ckeditor.attachment_file_model.new
|
10
10
|
respond_with_asset(@attachment)
|
11
11
|
end
|
12
12
|
|
@@ -18,11 +18,11 @@ class Ckeditor::AttachmentFilesController < Ckeditor::ApplicationController
|
|
18
18
|
protected
|
19
19
|
|
20
20
|
def find_asset
|
21
|
-
@attachment = Ckeditor.
|
21
|
+
@attachment = Ckeditor.attachment_file_adapter.get!(params[:id])
|
22
22
|
end
|
23
23
|
|
24
24
|
def authorize_resource
|
25
|
-
model = (@attachment || Ckeditor
|
25
|
+
model = (@attachment || Ckeditor.attachment_file_model)
|
26
26
|
@authorization_adapter.try(:authorize, params[:action], model)
|
27
27
|
end
|
28
28
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
class Ckeditor::PicturesController < Ckeditor::ApplicationController
|
2
2
|
|
3
3
|
def index
|
4
|
-
@pictures = Ckeditor.
|
4
|
+
@pictures = Ckeditor.picture_adapter.find_all(ckeditor_pictures_scope)
|
5
5
|
respond_with(@pictures)
|
6
6
|
end
|
7
7
|
|
8
8
|
def create
|
9
|
-
@picture = Ckeditor
|
9
|
+
@picture = Ckeditor.picture_model.new
|
10
10
|
respond_with_asset(@picture)
|
11
11
|
end
|
12
12
|
|
@@ -18,11 +18,11 @@ class Ckeditor::PicturesController < Ckeditor::ApplicationController
|
|
18
18
|
protected
|
19
19
|
|
20
20
|
def find_asset
|
21
|
-
@picture = Ckeditor.
|
21
|
+
@picture = Ckeditor.picture_adapter.get!(params[:id])
|
22
22
|
end
|
23
23
|
|
24
24
|
def authorize_resource
|
25
|
-
model = (@picture || Ckeditor
|
25
|
+
model = (@picture || Ckeditor.picture_model)
|
26
26
|
@authorization_adapter.try(:authorize, params[:action], model)
|
27
27
|
end
|
28
28
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%= content_tag(:div, :id => dom_id(asset), :class => "gal-item", :"data-url" => image_path(asset.url_content)) do %>
|
2
|
-
<%= link_to image_tag(
|
2
|
+
<%= link_to image_tag('ckeditor/filebrowser/images/gal_del.png',
|
3
3
|
:title => I18n.t('ckeditor.buttons.delete')),
|
4
4
|
polymorphic_path(asset, :format => :json),
|
5
5
|
:remote => true,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<script id="fileupload_tmpl" type="text/x-jquery-tmpl">
|
2
2
|
<div id="asset_${id}" class="gal-item" data-url="${url_content}">
|
3
|
-
<%= link_to image_tag(
|
3
|
+
<%= link_to image_tag('ckeditor/filebrowser/images/gal_del.png',
|
4
4
|
:title => I18n.t('ckeditor.buttons.delete')),
|
5
5
|
"/ckeditor/${controller}/${id}.json",
|
6
6
|
:remote => true,
|
@@ -9,7 +9,7 @@
|
|
9
9
|
:class => "fileupload-cancel gal-del" %>
|
10
10
|
|
11
11
|
<div class="fileupload-file gal-inner-holder">
|
12
|
-
<div class="img"><img src="
|
12
|
+
<div class="img"><img src="${url_thumb}" title="${filename}"></div>
|
13
13
|
<div class="img-data">
|
14
14
|
<div class="img-name">${filename}</div>
|
15
15
|
<div class="time-size">
|
@@ -4,7 +4,6 @@
|
|
4
4
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
5
5
|
<meta name="robots" content="noindex, nofollow">
|
6
6
|
<%= csrf_meta_tag %>
|
7
|
-
<%= tag(:meta, :name => "ckeditor-path", :content => Ckeditor.relative_path) %>
|
8
7
|
<title><%= I18n.t('page_title', :scope => [:ckeditor]) %></title>
|
9
8
|
|
10
9
|
<% if assets_pipeline_enabled? -%>
|
data/lib/ckeditor.rb
CHANGED
@@ -55,7 +55,11 @@ module Ckeditor
|
|
55
55
|
# Turn on/off filename parameterize
|
56
56
|
mattr_accessor :parameterize_filenames
|
57
57
|
@@parameterize_filenames = true
|
58
|
-
|
58
|
+
|
59
|
+
# Model classes
|
60
|
+
@@picture_model = nil
|
61
|
+
@@attachment_file_model = nil
|
62
|
+
|
59
63
|
# Default way to setup Ckeditor. Run rails generate ckeditor to create
|
60
64
|
# a fresh initializer with all configuration values.
|
61
65
|
#
|
@@ -77,13 +81,51 @@ module Ckeditor
|
|
77
81
|
def self.assets
|
78
82
|
@@assets ||= Utils.select_assets("ckeditor", "vendor/assets/javascripts") << "ckeditor/init.js"
|
79
83
|
end
|
80
|
-
|
81
|
-
def self.picture_model
|
82
|
-
|
84
|
+
|
85
|
+
def self.picture_model(&block)
|
86
|
+
if block_given?
|
87
|
+
self.picture_model = block
|
88
|
+
else
|
89
|
+
@@picture_model_class ||= begin
|
90
|
+
if @@picture_model.respond_to? :call
|
91
|
+
@@picture_model.call
|
92
|
+
else
|
93
|
+
@@picture_model || Ckeditor::Picture
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
83
97
|
end
|
84
|
-
|
85
|
-
def self.
|
86
|
-
|
98
|
+
|
99
|
+
def self.picture_model=(value)
|
100
|
+
@@picture_model_class = nil
|
101
|
+
@@picture_model = value
|
102
|
+
end
|
103
|
+
|
104
|
+
def self.picture_adapter
|
105
|
+
picture_model.to_adapter
|
106
|
+
end
|
107
|
+
|
108
|
+
def self.attachment_file_model(&block)
|
109
|
+
if block_given?
|
110
|
+
self.attachment_file_model = block
|
111
|
+
else
|
112
|
+
@@attachment_file_model_class ||= begin
|
113
|
+
if @@attachment_file_model.respond_to? :call
|
114
|
+
@@attachment_file_model.call
|
115
|
+
else
|
116
|
+
@@attachment_file_model || Ckeditor::AttachmentFile
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
def self.attachment_file_model=(value)
|
123
|
+
@@attachment_file_model_class = nil
|
124
|
+
@@attachment_file_model = value
|
125
|
+
end
|
126
|
+
|
127
|
+
def self.attachment_file_adapter
|
128
|
+
attachment_file_model.to_adapter
|
87
129
|
end
|
88
130
|
|
89
131
|
# Setup authorization to be run as a before filter
|
data/lib/ckeditor/utils.rb
CHANGED
@@ -77,7 +77,7 @@ module Ckeditor
|
|
77
77
|
folder = File.join(relative_path, path, '**')
|
78
78
|
relative_folder = Ckeditor.root_path.join(relative_path)
|
79
79
|
|
80
|
-
Dir[Ckeditor.root_path.join(folder, '*.{js,css}')].inject([]) do |list, file|
|
80
|
+
Dir[Ckeditor.root_path.join(folder, '*.{js,css,png,gif,jpg}')].inject([]) do |list, file|
|
81
81
|
list << Pathname.new(file).relative_path_from(relative_folder).to_s
|
82
82
|
list
|
83
83
|
end
|
data/lib/ckeditor/version.rb
CHANGED
@@ -16,4 +16,8 @@ Ckeditor.setup do |config|
|
|
16
16
|
|
17
17
|
# Setup authorization to be run as a before filter
|
18
18
|
# config.authorize_with :cancan
|
19
|
+
|
20
|
+
# Asset model classes
|
21
|
+
# config.picture_model { Ckeditor::Picture }
|
22
|
+
# config.attachment_file_model { Ckeditor::AttachmentFile }
|
19
23
|
end
|