ckeditor 3.5.1 → 3.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. data/README.rdoc +3 -2
  2. data/app/views/ckeditor/attachments/index.html.erb +1 -1
  3. data/app/views/ckeditor/pictures/index.html.erb +1 -1
  4. data/config/locales/en.ckeditor.yml +1 -0
  5. data/config/locales/ru.ckeditor.yml +1 -0
  6. data/config/locales/uk.ckeditor.yml +1 -0
  7. data/lib/ckeditor/utils.rb +56 -16
  8. data/lib/ckeditor/version.rb +1 -1
  9. data/lib/generators/ckeditor/base/base_generator.rb +4 -10
  10. data/lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/attachment/dialogs/attachment.js +384 -0
  11. data/lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/attachment/images/attachment.png +0 -0
  12. data/lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/attachment/lang/en.js +10 -0
  13. data/lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/attachment/lang/ru.js +10 -0
  14. data/lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/attachment/lang/uk.js +10 -0
  15. data/lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/attachment/plugin.js +44 -0
  16. data/lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/embed/dialogs/embed.js +65 -0
  17. data/lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/embed/images/embed.png +0 -0
  18. data/lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/embed/lang/en.js +9 -0
  19. data/lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/embed/lang/ru.js +9 -0
  20. data/lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/embed/lang/uk.js +9 -0
  21. data/lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/embed/plugin.js +43 -0
  22. data/lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/dialogs/attachment.js +1 -0
  23. data/lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/images/attachment.png +0 -0
  24. data/lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/lang/en.js +10 -0
  25. data/lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/lang/ru.js +10 -0
  26. data/lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/lang/uk.js +10 -0
  27. data/lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/plugin.js +1 -0
  28. data/lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/dialogs/embed.js +1 -0
  29. data/lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/images/embed.png +0 -0
  30. data/lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/lang/en.js +9 -0
  31. data/lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/lang/ru.js +9 -0
  32. data/lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/lang/uk.js +9 -0
  33. data/lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/plugin.js +1 -0
  34. metadata +28 -4
@@ -24,7 +24,7 @@ http://github.com/galetahub/ckeditor-demo-app
24
24
 
25
25
  In your appication "Gemfile":
26
26
 
27
- gem 'ckeditor', '3.5.1'
27
+ gem 'ckeditor'
28
28
 
29
29
  or
30
30
  gem 'ckeditor', :git => 'git://github.com/galetahub/rails-ckeditor.git', :branch => 'rails3'
@@ -49,7 +49,7 @@ For attachment_fu:
49
49
 
50
50
  Don't forget about migration:
51
51
 
52
- rake db:migarte
52
+ rake db:migrate
53
53
 
54
54
  == Usage
55
55
 
@@ -151,6 +151,7 @@ support swf upload with AuthenticityToken.
151
151
  page_title: "CKEditor Files Manager"
152
152
  upload_files: "Upload New Files"
153
153
  buttons:
154
+ cancel: "Cancel"
154
155
  refresh:
155
156
  title: "Refresh"
156
157
  hint: "Refresh page"
@@ -32,7 +32,7 @@
32
32
  <tbody><tr>
33
33
  <td width="100%"></td>
34
34
  <td nowrap="nowrap">
35
- <button onclick="uploadButton()" class="Button"><span ckf:lang="CancelBtn">Cancel</span></button>
35
+ <button onclick="uploadButton()" class="Button"><span ckf:lang="CancelBtn"><%= I18n.t('cancel', :scope => [:ckeditor, :buttons]) %></span></button>
36
36
  </td>
37
37
  </tr>
38
38
  </tbody></table>
@@ -32,7 +32,7 @@
32
32
  <tbody><tr>
33
33
  <td width="100%"></td>
34
34
  <td nowrap="nowrap">
35
- <button onclick="uploadButton()" class="Button"><span ckf:lang="CancelBtn">Cancel</span></button>
35
+ <button onclick="uploadButton()" class="Button"><span ckf:lang="CancelBtn"><%= I18n.t('cancel', :scope => [:ckeditor, :buttons]) %></span></button>
36
36
  </td>
37
37
  </tr>
38
38
  </tbody></table>
@@ -3,6 +3,7 @@ en:
3
3
  page_title: "CKEditor Files Manager"
4
4
  upload_files: "Upload New Files"
5
5
  buttons:
6
+ cancel: "Cancel"
6
7
  refresh:
7
8
  title: "Refresh"
8
9
  hint: "Refresh page"
@@ -3,6 +3,7 @@ ru:
3
3
  page_title: "CKEditor Files Manager"
4
4
  upload_files: "Загрузка новых файлов"
5
5
  buttons:
6
+ cancel: "Отмена"
6
7
  refresh:
7
8
  title: "Обновить"
8
9
  hint: "Обновить страницу"
@@ -3,6 +3,7 @@ uk:
3
3
  page_title: "CKEditor Files Manager"
4
4
  upload_files: "Завантаження нових файлів"
5
5
  buttons:
6
+ cancel: "Відміна"
6
7
  refresh:
7
8
  title: "Оновити"
8
9
  hint: "Оновити сторінку"
@@ -1,9 +1,61 @@
1
+ # encoding: utf-8
1
2
  require 'fileutils'
2
- require 'net/http'
3
- require 'uri'
3
+ require 'open-uri'
4
+ require 'digest/sha1'
5
+ require 'mime/types'
4
6
 
5
7
  module Ckeditor
6
8
  module Utils
9
+ # RemoteFile
10
+ #
11
+ # remote_file = RemoteFile.new("http://www.google.com/intl/en_ALL/images/logo.gif")
12
+ # remote_file.original_filename #=> logo.gif
13
+ # remote_file.content_type #= image/gif
14
+ #
15
+ class RemoteFile < ::Tempfile
16
+
17
+ def initialize(path, tmpdir = Dir::tmpdir)
18
+ @original_filename = File.basename(path)
19
+ @remote_path = path
20
+
21
+ super Digest::SHA1.hexdigest(path), tmpdir
22
+ fetch
23
+ end
24
+
25
+ def fetch
26
+ string_io = OpenURI.send(:open, @remote_path)
27
+ body = string_io.read
28
+
29
+ # Fix for ruby 1.9.2 (ASCII-8BIT and UTF-8 in hell issue)
30
+ if body && body.respond_to?(:encoding) && body.encoding.name == 'ASCII-8BIT'
31
+ body.force_encoding('UTF-8')
32
+ end
33
+
34
+ self.write body
35
+ self.rewind
36
+ self
37
+ end
38
+
39
+ def original_filename
40
+ @original_filename
41
+ end
42
+
43
+ def content_type
44
+ types = MIME::Types.type_for(self.path)
45
+ types.empty? ? extract_content_type : types.first.to_s
46
+ end
47
+
48
+ protected
49
+
50
+ def extract_content_type
51
+ mime = `file --mime -br #{self.path}`.strip
52
+ mime = mime.gsub(/^.*: */,"")
53
+ mime = mime.gsub(/;.*$/,"")
54
+ mime = mime.gsub(/,.*$/,"")
55
+ mime
56
+ end
57
+ end
58
+
7
59
  class << self
8
60
  # remove the existing install (if any)
9
61
  def destroy
@@ -24,19 +76,8 @@ module Ckeditor
24
76
  [basename.parameterize('_'), extension].join.downcase
25
77
  end
26
78
 
27
- def download(url, output)
28
- uri = URI.parse(url)
29
- file = File.open(output, 'w')
30
-
31
- Net::HTTP.start(uri.host, uri.port) do |http|
32
- begin
33
- http.request_get(uri.path) do |resp|
34
- resp.read_body { |segment| file.write(segment) }
35
- end
36
- ensure
37
- file.close
38
- end
39
- end
79
+ def download(url)
80
+ RemoteFile.new(url)
40
81
  end
41
82
 
42
83
  def extract(filepath, output)
@@ -50,6 +91,5 @@ module Ckeditor
50
91
  end
51
92
 
52
93
  end
53
-
54
94
  end
55
95
  end
@@ -2,7 +2,7 @@ module Ckeditor
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 5
5
- RELEASE = 1
5
+ RELEASE = 2
6
6
 
7
7
  def self.dup
8
8
  "#{MAJOR}.#{MINOR}.#{RELEASE}"
@@ -17,14 +17,12 @@ module Ckeditor
17
17
  # copy ckeditor files
18
18
  def install_ckeditor
19
19
  puts "Start download #{filename}"
20
- Ckeditor::Utils.download(download_url, filepath)
21
-
22
- if File.exist?(filepath)
23
- puts "Extract #{filepath}"
24
- Ckeditor::Utils.extract(filepath, Rails.root.join('public', 'javascripts'))
20
+ file = Ckeditor::Utils.download(download_url)
25
21
 
22
+ if File.exist?(file.path)
23
+ Ckeditor::Utils.extract(file.path, Rails.root.join('public', 'javascripts'))
26
24
  directory "ckeditor", "public/javascripts/ckeditor"
27
- File.delete(filepath)
25
+ file.unlink
28
26
  else
29
27
  raise Rails::Generators::Error.new("Cannot download file #{download_url}")
30
28
  end
@@ -39,9 +37,5 @@ module Ckeditor
39
37
  def filename
40
38
  "ckeditor_#{options[:version]}.tar.gz"
41
39
  end
42
-
43
- def filepath
44
- Rails.root.join('tmp', filename)
45
- end
46
40
  end
47
41
  end
@@ -0,0 +1,384 @@
1
+ /*
2
+ Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
3
+ For licensing, see LICENSE.html or http://ckeditor.com/license
4
+ */
5
+
6
+ (function()
7
+ {
8
+ CKEDITOR.dialog.add( 'attachment', function( editor )
9
+ {
10
+ var selectableTargets = /^(_(?:self|top|parent|blank))$/;
11
+
12
+ var parseLink = function( editor, element )
13
+ {
14
+ var href = element ? ( element.getAttribute( '_cke_saved_href' ) || element.getAttribute( 'href' ) ) : '',
15
+ emailMatch,
16
+ anchorMatch,
17
+ urlMatch,
18
+ retval = {};
19
+
20
+ retval.type = 'url';
21
+ retval.url = href;
22
+
23
+ // Load target and popup settings.
24
+ if ( element )
25
+ {
26
+ var target = element.getAttribute( 'target' );
27
+ retval.target = {};
28
+
29
+ // IE BUG: target attribute is an empty string instead of null in IE if it's not set.
30
+ if ( target )
31
+ {
32
+ var targetMatch = target.match( selectableTargets );
33
+ if ( targetMatch )
34
+ retval.target.type = retval.target.name = target;
35
+ else
36
+ {
37
+ retval.target.type = 'frame';
38
+ retval.target.name = target;
39
+ }
40
+ }
41
+
42
+ var me = this;
43
+
44
+ retval.title = element.getAttribute('title');
45
+ }
46
+
47
+ // Find out whether we have any anchors in the editor.
48
+ // Get all IMG elements in CK document.
49
+ var elements = editor.document.getElementsByTag( 'img' ),
50
+ realAnchors = new CKEDITOR.dom.nodeList( editor.document.$.anchors ),
51
+ anchors = retval.anchors = [];
52
+
53
+ for( var i = 0; i < elements.count() ; i++ )
54
+ {
55
+ var item = elements.getItem( i );
56
+ if ( item.getAttribute( '_cke_realelement' ) && item.getAttribute( '_cke_real_element_type' ) == 'anchor' )
57
+ {
58
+ anchors.push( editor.restoreRealElement( item ) );
59
+ }
60
+ }
61
+
62
+ for ( i = 0 ; i < realAnchors.count() ; i++ )
63
+ anchors.push( realAnchors.getItem( i ) );
64
+
65
+ for ( i = 0 ; i < anchors.length ; i++ )
66
+ {
67
+ item = anchors[ i ];
68
+ anchors[ i ] = { name : item.getAttribute( 'name' ), id : item.getAttribute( 'id' ) };
69
+ }
70
+
71
+ // Record down the selected element in the dialog.
72
+ this._.selectedElement = element;
73
+
74
+ return retval;
75
+ };
76
+ // Handles the event when the "Target" selection box is changed.
77
+ var targetChanged = function()
78
+ {
79
+ var dialog = this.getDialog(),
80
+ targetName = dialog.getContentElement( 'general', 'linkTargetName' ),
81
+ value = this.getValue();
82
+
83
+ if ( !targetName )
84
+ return;
85
+
86
+ targetName.setLabel( editor.lang.link.targetFrameName );
87
+ this.getDialog().setValueOf( 'general', 'linkTargetName', value.charAt( 0 ) == '_' ? value : '' );
88
+ };
89
+
90
+ function parseUrl(url)
91
+ {
92
+ var filename = url.split('/').pop();
93
+ var extname = filename.split('.').pop();
94
+
95
+ return { filename : filename, className : "attach_" + extname };
96
+ }
97
+
98
+ return {
99
+ title : editor.lang.attachment.title,
100
+ minWidth : 420,
101
+ minHeight : 200,
102
+
103
+ onShow : function()
104
+ {
105
+ this.fakeObj = false;
106
+
107
+ var editor = this.getParentEditor(),
108
+ selection = editor.getSelection(),
109
+ ranges = selection.getRanges(),
110
+ element = null,
111
+ me = this;
112
+ // Fill in all the relevant fields if there's already one link selected.
113
+ if ( ranges.length == 1 )
114
+ {
115
+
116
+ var rangeRoot = ranges[0].getCommonAncestor( true );
117
+ element = rangeRoot.getAscendant( 'a', true );
118
+ if ( element && element.getAttribute( 'href' ) )
119
+ {
120
+ selection.selectElement( element );
121
+ }
122
+ else if ( ( element = rangeRoot.getAscendant( 'img', true ) ) &&
123
+ element.getAttribute( '_cke_real_element_type' ) &&
124
+ element.getAttribute( '_cke_real_element_type' ) == 'anchor' )
125
+ {
126
+ this.fakeObj = element;
127
+ element = editor.restoreRealElement( this.fakeObj );
128
+ selection.selectElement( this.fakeObj );
129
+ }
130
+ else
131
+ element = null;
132
+ }
133
+
134
+ this.setupContent( parseLink.apply( this, [ editor, element ] ) );
135
+ },
136
+
137
+ onOk : function()
138
+ {
139
+ var attributes = { href : 'javascript:void(0)/*' + CKEDITOR.tools.getNextNumber() + '*/' },
140
+ removeAttributes = [],
141
+ data = { href : attributes.href },
142
+ me = this,
143
+ editor = this.getParentEditor();
144
+
145
+ this.commitContent( data );
146
+
147
+
148
+ var url = data.url || '';
149
+ attributes._cke_saved_href = ( url.indexOf( '/' ) === 0 ) ? url : "http://" + url;
150
+
151
+ var file = parseUrl(url);
152
+
153
+ var title = data.title || '';
154
+ attributes.title = (data.title.length == 0) ? file.filename : data.title;
155
+ attributes.class = file.className;
156
+
157
+ // Popups and target.
158
+ if ( data.target )
159
+ {
160
+ if ( data.target.type != 'notSet' && data.target.name )
161
+ attributes.target = data.target.name;
162
+ else
163
+ removeAttributes.push( 'target' );
164
+
165
+ removeAttributes.push( '_cke_pa_onclick', 'onclick' );
166
+ }
167
+
168
+ // Insert Link
169
+ if ( !this._.selectedElement )
170
+ {
171
+ // Create element if current selection is collapsed.
172
+ var selection = editor.getSelection(),
173
+ ranges = selection.getRanges();
174
+ if ( ranges.length == 1 && ranges[0].collapsed )
175
+ {
176
+ var text = new CKEDITOR.dom.text( attributes.title, editor.document );
177
+ ranges[0].insertNode( text );
178
+ ranges[0].selectNodeContents( text );
179
+ selection.selectRanges( ranges );
180
+ }
181
+
182
+ // Apply style.
183
+ var style = new CKEDITOR.style( { element : 'a', attributes : attributes } );
184
+ style.type = CKEDITOR.STYLE_INLINE; // need to override... dunno why.
185
+ style.apply( editor.document );
186
+ }
187
+ else
188
+ {
189
+ // We're only editing an existing link, so just overwrite the attributes.
190
+ var element = this._.selectedElement;
191
+
192
+ // IE BUG: Setting the name attribute to an existing link doesn't work.
193
+ // Must re-create the link from weired syntax to workaround.
194
+ if ( CKEDITOR.env.ie && attributes.name != element.getAttribute( 'name' ) )
195
+ {
196
+ var newElement = new CKEDITOR.dom.element( '<a name="' + CKEDITOR.tools.htmlEncode( attributes.name ) + '">',
197
+ editor.document );
198
+
199
+ selection = editor.getSelection();
200
+
201
+ element.moveChildren( newElement );
202
+ element.copyAttributes( newElement, { name : 1 } );
203
+ newElement.replace( element );
204
+ element = newElement;
205
+
206
+ selection.selectElement( element );
207
+ }
208
+
209
+ element.setAttributes( attributes );
210
+ element.removeAttributes( removeAttributes );
211
+
212
+ if (element.getAttribute('title') )
213
+ element.setHtml(element.getAttribute('title'));
214
+
215
+ // Make the element display as an anchor if a name has been set.
216
+ if ( element.getAttribute( 'name' ) )
217
+ element.addClass( 'cke_anchor' );
218
+ else
219
+ element.removeClass( 'cke_anchor' );
220
+
221
+ if ( this.fakeObj )
222
+ editor.createFakeElement( element, 'cke_anchor', 'anchor' ).replace( this.fakeObj );
223
+
224
+ delete this._.selectedElement;
225
+ }
226
+ },
227
+
228
+ contents :
229
+ [
230
+ {
231
+ label : editor.lang.common.generalTab,
232
+ id : 'general',
233
+ accessKey : 'I',
234
+ elements :
235
+ [
236
+ {
237
+ type : 'vbox',
238
+ padding : 0,
239
+ children :
240
+ [
241
+ {
242
+ type : 'html',
243
+ html : '<span>' + CKEDITOR.tools.htmlEncode( editor.lang.attachment.url ) + '</span>'
244
+ },
245
+ {
246
+ type : 'hbox',
247
+ widths : [ '280px', '110px' ],
248
+ align : 'right',
249
+ children :
250
+ [
251
+ {
252
+ id : 'src',
253
+ type : 'text',
254
+ label : '',
255
+ validate : CKEDITOR.dialog.validate.notEmpty( editor.lang.flash.validateSrc ),
256
+ setup : function( data )
257
+ {
258
+ if ( data.url )
259
+ this.setValue( data.url );
260
+
261
+ this.select();
262
+ },
263
+ commit : function( data )
264
+ {
265
+ data.url = this.getValue();
266
+ }
267
+ },
268
+ {
269
+ type : 'button',
270
+ id : 'browse',
271
+ filebrowser : 'general:src',
272
+ hidden : true,
273
+ align : 'center',
274
+ label : editor.lang.common.browseServer
275
+ }
276
+ ]
277
+ }
278
+ ]
279
+ },
280
+
281
+ {
282
+ type : 'vbox',
283
+ padding : 0,
284
+ children :
285
+ [
286
+ {
287
+ id : 'name',
288
+ type : 'text',
289
+ label : editor.lang.attachment.name,
290
+ setup : function( data )
291
+ {
292
+ if ( data.title )
293
+ this.setValue( data.title );
294
+ },
295
+ commit : function( data )
296
+ {
297
+ data.title = this.getValue();
298
+ }
299
+ }
300
+ ]
301
+ },
302
+
303
+ {
304
+ type : 'hbox',
305
+ widths : [ '50%', '50%' ],
306
+ children :
307
+ [
308
+ {
309
+ type : 'select',
310
+ id : 'linkTargetType',
311
+ label : editor.lang.link.target,
312
+ 'default' : 'notSet',
313
+ style : 'width : 100%;',
314
+ 'items' :
315
+ [
316
+ [ editor.lang.link.targetNotSet, 'notSet' ],
317
+ [ editor.lang.link.targetFrame, 'frame' ],
318
+ [ editor.lang.link.targetNew, '_blank' ],
319
+ [ editor.lang.link.targetTop, '_top' ],
320
+ [ editor.lang.link.targetSelf, '_self' ],
321
+ [ editor.lang.link.targetParent, '_parent' ]
322
+ ],
323
+ onChange : targetChanged,
324
+ setup : function( data )
325
+ {
326
+ if ( data.target )
327
+ this.setValue( data.target.type );
328
+ },
329
+ commit : function( data )
330
+ {
331
+ if ( !data.target )
332
+ data.target = {};
333
+
334
+ data.target.type = this.getValue();
335
+ }
336
+ },
337
+ {
338
+ type : 'text',
339
+ id : 'linkTargetName',
340
+ label : editor.lang.link.targetFrameName,
341
+ 'default' : '',
342
+ setup : function( data )
343
+ {
344
+ if ( data.target )
345
+ this.setValue( data.target.name );
346
+ },
347
+ commit : function( data )
348
+ {
349
+ if ( !data.target )
350
+ data.target = {};
351
+
352
+ data.target.name = this.getValue();
353
+ }
354
+ }
355
+ ]
356
+ }
357
+ ]
358
+ },
359
+ {
360
+ id : 'Upload',
361
+ hidden : true,
362
+ filebrowser : 'uploadButton',
363
+ label : editor.lang.common.upload,
364
+ elements :
365
+ [
366
+ {
367
+ type : 'file',
368
+ id : 'upload',
369
+ label : editor.lang.common.upload,
370
+ size : 38
371
+ },
372
+ {
373
+ type : 'fileButton',
374
+ id : 'uploadButton',
375
+ label : editor.lang.common.uploadSubmit,
376
+ filebrowser : 'general:src',
377
+ 'for' : [ 'Upload', 'upload' ]
378
+ }
379
+ ]
380
+ },
381
+ ]
382
+ };
383
+ });
384
+ })();
@@ -0,0 +1,10 @@
1
+ CKEDITOR.plugins.setLang('attachment', 'en',
2
+ {
3
+ attachment :
4
+ {
5
+ title : "Insert attachment",
6
+ url: "URL",
7
+ name: "Title",
8
+ button : "Insert attachment"
9
+ }
10
+ });
@@ -0,0 +1,10 @@
1
+ CKEDITOR.plugins.setLang('attachment', 'ru',
2
+ {
3
+ attachment :
4
+ {
5
+ title : "Включить вложения",
6
+ url: "URL",
7
+ name: "Название",
8
+ button : "Вставить"
9
+ }
10
+ });
@@ -0,0 +1,10 @@
1
+ CKEDITOR.plugins.setLang('attachment', 'uk',
2
+ {
3
+ attachment :
4
+ {
5
+ title : "Вставити файл",
6
+ url: "URL",
7
+ name: "Назва",
8
+ button : "Вставити"
9
+ }
10
+ });
@@ -0,0 +1,44 @@
1
+ /*
2
+ Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
3
+ For licensing, see LICENSE.html or http://ckeditor.com/license
4
+ */
5
+
6
+ /**
7
+ * @file Paste as plain text plugin
8
+ */
9
+
10
+ (function()
11
+ {
12
+ // The pastetext command definition.
13
+ var attachmentCmd =
14
+ {
15
+ exec : function( editor )
16
+ {
17
+ editor.openDialog( 'attachment' );
18
+ return;
19
+ }
20
+ };
21
+
22
+ // Register the plugin.
23
+ CKEDITOR.plugins.add( 'attachment',
24
+ {
25
+ lang : [ 'en', 'ru', 'uk' ],
26
+ requires : [ 'dialog' ],
27
+
28
+ init : function( editor )
29
+ {
30
+ var commandName = 'attachment';
31
+ editor.addCommand( commandName, attachmentCmd );
32
+
33
+ editor.ui.addButton( 'Attachment',
34
+ {
35
+ label : editor.lang.attachment.button,
36
+ command : commandName,
37
+ icon: this.path + "images/attachment.png"
38
+ });
39
+
40
+ CKEDITOR.dialog.add( commandName, CKEDITOR.getUrl( this.path + 'dialogs/attachment.js' ) );
41
+ }
42
+ });
43
+
44
+ })();
@@ -0,0 +1,65 @@
1
+ /*
2
+ Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
3
+ For licensing, see LICENSE.html or http://ckeditor.com/license
4
+ */
5
+
6
+ (function()
7
+ {
8
+ CKEDITOR.dialog.add( 'embed', function( editor )
9
+ {
10
+ return {
11
+ title : editor.lang.embed.title,
12
+
13
+ minWidth : CKEDITOR.env.ie && CKEDITOR.env.quirks ? 368 : 350,
14
+ minHeight : 240,
15
+
16
+ onShow : function()
17
+ {
18
+ // Reset the textarea value.
19
+ this.getContentElement( 'general', 'content' ).getInputElement().setValue( '' );
20
+ },
21
+
22
+ onOk : function()
23
+ {
24
+ // Get the textarea value.
25
+ var text = this.getContentElement( 'general', 'content' ).getInputElement().getValue();
26
+
27
+ // Inserts the html.
28
+ this.getParentEditor().insertHtml( text );
29
+ },
30
+
31
+ contents :
32
+ [
33
+ {
34
+ label : editor.lang.common.generalTab,
35
+ id : 'general',
36
+ elements :
37
+ [
38
+ {
39
+ type : 'html',
40
+ id : 'pasteMsg',
41
+ html : '<div style="white-space:normal;width:340px;">' + editor.lang.embed.pasteMsg + '</div>'
42
+ },
43
+ {
44
+ type : 'html',
45
+ id : 'content',
46
+ style : 'width:340px;height:170px',
47
+ html :
48
+ '<textarea style="' +
49
+ 'width:346px;' +
50
+ 'height:170px;' +
51
+ 'resize: none;' +
52
+ 'border:1px solid black;' +
53
+ 'background-color:white">' +
54
+ '</textarea>',
55
+ focus : function()
56
+ {
57
+ this.getElement().focus();
58
+ }
59
+ }
60
+ ]
61
+ }
62
+ ]
63
+ };
64
+ });
65
+ })();
@@ -0,0 +1,9 @@
1
+ CKEDITOR.plugins.setLang('embed', 'en',
2
+ {
3
+ embed :
4
+ {
5
+ title : "Paste embed",
6
+ button : "Paste embed",
7
+ pasteMsg : "Please, paste embed-code from Youtube, Myspace, Flickr and others sources into rectangle, using the keyboard (Ctrl + V), and click OK."
8
+ }
9
+ });
@@ -0,0 +1,9 @@
1
+ CKEDITOR.plugins.setLang('embed', 'ru',
2
+ {
3
+ embed :
4
+ {
5
+ title : "Вставить embed",
6
+ button : "Вставить embed",
7
+ pasteMsg : "Пожалуйста, вставьте embed-код с Youtube, Myspace, Flickr и других ресурсов в прямоугольник, используя сочетание клавиш (Ctrl+V), и нажмите OK."
8
+ }
9
+ });
@@ -0,0 +1,9 @@
1
+ CKEDITOR.plugins.setLang('embed', 'uk',
2
+ {
3
+ embed :
4
+ {
5
+ title : "Вставити embed",
6
+ button : "Вставити embed",
7
+ pasteMsg : "Будь ласка, вставте embed-код з Youtube, Myspace, Flickr та інших ресурсів в прямокутник, використовуючи (Ctrl+V), та нажміть OK."
8
+ }
9
+ });
@@ -0,0 +1,43 @@
1
+ /*
2
+ Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
3
+ For licensing, see LICENSE.html or http://ckeditor.com/license
4
+ */
5
+
6
+ /**
7
+ * @file Paste as plain text plugin
8
+ */
9
+
10
+ (function()
11
+ {
12
+ // The pastetext command definition.
13
+ var embedCmd =
14
+ {
15
+ exec : function( editor )
16
+ {
17
+ editor.openDialog( 'embed' );
18
+ return;
19
+ }
20
+ };
21
+
22
+ // Register the plugin.
23
+ CKEDITOR.plugins.add( 'embed',
24
+ {
25
+ lang : [ 'en', 'ru', 'uk' ],
26
+ requires : [ 'dialog' ],
27
+
28
+ init : function( editor )
29
+ {
30
+ var commandName = 'embed';
31
+ editor.addCommand( commandName, embedCmd );
32
+
33
+ editor.ui.addButton( 'Embed',
34
+ {
35
+ label : editor.lang.embed.button,
36
+ command : commandName,
37
+ icon: this.path + "images/embed.png"
38
+ });
39
 
40
+ CKEDITOR.dialog.add( commandName, CKEDITOR.getUrl( this.path + 'dialogs/embed.js' ) );
41
+ }
42
+ });
43
+
44
+ })();
@@ -0,0 +1 @@
1
+ (function(){CKEDITOR.dialog.add('attachment',function(editor){var selectableTargets=/^(_(?:self|top|parent|blank))$/;var parseLink=function(editor,element){var href=element?(element.getAttribute('_cke_saved_href')||element.getAttribute('href')):'',emailMatch,anchorMatch,urlMatch,retval={};retval.type='url';retval.url=href;if(element){var target=element.getAttribute('target');retval.target={};if(target){var targetMatch=target.match(selectableTargets);if(targetMatch)retval.target.type=retval.target.name=target;else{retval.target.type='frame';retval.target.name=target}}var me=this;retval.title=element.getAttribute('title')}var elements=editor.document.getElementsByTag('img'),realAnchors=new CKEDITOR.dom.nodeList(editor.document.$.anchors),anchors=retval.anchors=[];for(var i=0;i<elements.count();i++){var item=elements.getItem(i);if(item.getAttribute('_cke_realelement')&&item.getAttribute('_cke_real_element_type')=='anchor'){anchors.push(editor.restoreRealElement(item))}}for(i=0;i<realAnchors.count();i++)anchors.push(realAnchors.getItem(i));for(i=0;i<anchors.length;i++){item=anchors[i];anchors[i]={name:item.getAttribute('name'),id:item.getAttribute('id')}}this._.selectedElement=element;return retval};var targetChanged=function(){var dialog=this.getDialog(),targetName=dialog.getContentElement('general','linkTargetName'),value=this.getValue();if(!targetName)return;targetName.setLabel(editor.lang.link.targetFrameName);this.getDialog().setValueOf('general','linkTargetName',value.charAt(0)=='_'?value:'')};function parseUrl(url){var filename=url.split('/').pop();var extname=filename.split('.').pop();return{filename:filename,className:"attach_"+extname}}return{title:editor.lang.attachment.title,minWidth:420,minHeight:200,onShow:function(){this.fakeObj=false;var editor=this.getParentEditor(),selection=editor.getSelection(),ranges=selection.getRanges(),element=null,me=this;if(ranges.length==1){var rangeRoot=ranges[0].getCommonAncestor(true);element=rangeRoot.getAscendant('a',true);if(element&&element.getAttribute('href')){selection.selectElement(element)}else if((element=rangeRoot.getAscendant('img',true))&&element.getAttribute('_cke_real_element_type')&&element.getAttribute('_cke_real_element_type')=='anchor'){this.fakeObj=element;element=editor.restoreRealElement(this.fakeObj);selection.selectElement(this.fakeObj)}else element=null}this.setupContent(parseLink.apply(this,[editor,element]))},onOk:function(){var attributes={href:'javascript:void(0)/*'+CKEDITOR.tools.getNextNumber()+'*/'},removeAttributes=[],data={href:attributes.href},me=this,editor=this.getParentEditor();this.commitContent(data);var url=data.url||'';attributes._cke_saved_href=(url.indexOf('/')===0)?url:"http://"+url;var file=parseUrl(url);var title=data.title||'';attributes.title=(data.title.length==0)?file.filename:data.title;attributes.class=file.className;if(data.target){if(data.target.type!='notSet'&&data.target.name)attributes.target=data.target.name;else removeAttributes.push('target');removeAttributes.push('_cke_pa_onclick','onclick')}if(!this._.selectedElement){var selection=editor.getSelection(),ranges=selection.getRanges();if(ranges.length==1&&ranges[0].collapsed){var text=new CKEDITOR.dom.text(attributes.title,editor.document);ranges[0].insertNode(text);ranges[0].selectNodeContents(text);selection.selectRanges(ranges)}var style=new CKEDITOR.style({element:'a',attributes:attributes});style.type=CKEDITOR.STYLE_INLINE;style.apply(editor.document)}else{var element=this._.selectedElement;if(CKEDITOR.env.ie&&attributes.name!=element.getAttribute('name')){var newElement=new CKEDITOR.dom.element('<a name="'+CKEDITOR.tools.htmlEncode(attributes.name)+'">',editor.document);selection=editor.getSelection();element.moveChildren(newElement);element.copyAttributes(newElement,{name:1});newElement.replace(element);element=newElement;selection.selectElement(element)}element.setAttributes(attributes);element.removeAttributes(removeAttributes);if(element.getAttribute('title'))element.setHtml(element.getAttribute('title'));if(element.getAttribute('name'))element.addClass('cke_anchor');else element.removeClass('cke_anchor');if(this.fakeObj)editor.createFakeElement(element,'cke_anchor','anchor').replace(this.fakeObj);delete this._.selectedElement}},contents:[{label:editor.lang.common.generalTab,id:'general',accessKey:'I',elements:[{type:'vbox',padding:0,children:[{type:'html',html:'<span>'+CKEDITOR.tools.htmlEncode(editor.lang.attachment.url)+'</span>'},{type:'hbox',widths:['280px','110px'],align:'right',children:[{id:'src',type:'text',label:'',validate:CKEDITOR.dialog.validate.notEmpty(editor.lang.flash.validateSrc),setup:function(data){if(data.url)this.setValue(data.url);this.select()},commit:function(data){data.url=this.getValue()}},{type:'button',id:'browse',filebrowser:'general:src',hidden:true,align:'center',label:editor.lang.common.browseServer}]}]},{type:'vbox',padding:0,children:[{id:'name',type:'text',label:editor.lang.attachment.name,setup:function(data){if(data.title)this.setValue(data.title)},commit:function(data){data.title=this.getValue()}}]},{type:'hbox',widths:['50%','50%'],children:[{type:'select',id:'linkTargetType',label:editor.lang.link.target,'default':'notSet',style:'width : 100%;','items':[[editor.lang.link.targetNotSet,'notSet'],[editor.lang.link.targetFrame,'frame'],[editor.lang.link.targetNew,'_blank'],[editor.lang.link.targetTop,'_top'],[editor.lang.link.targetSelf,'_self'],[editor.lang.link.targetParent,'_parent']],onChange:targetChanged,setup:function(data){if(data.target)this.setValue(data.target.type)},commit:function(data){if(!data.target)data.target={};data.target.type=this.getValue()}},{type:'text',id:'linkTargetName',label:editor.lang.link.targetFrameName,'default':'',setup:function(data){if(data.target)this.setValue(data.target.name)},commit:function(data){if(!data.target)data.target={};data.target.name=this.getValue()}}]}]},{id:'Upload',hidden:true,filebrowser:'uploadButton',label:editor.lang.common.upload,elements:[{type:'file',id:'upload',label:editor.lang.common.upload,size:38},{type:'fileButton',id:'uploadButton',label:editor.lang.common.uploadSubmit,filebrowser:'general:src','for':['Upload','upload']}]},]}})})();
@@ -0,0 +1,10 @@
1
+ CKEDITOR.plugins.setLang('attachment', 'en',
2
+ {
3
+ attachment :
4
+ {
5
+ title : "Insert attachment",
6
+ url: "URL",
7
+ name: "Title",
8
+ button : "Insert attachment"
9
+ }
10
+ });
@@ -0,0 +1,10 @@
1
+ CKEDITOR.plugins.setLang('attachment', 'ru',
2
+ {
3
+ attachment :
4
+ {
5
+ title : "Включить вложения",
6
+ url: "URL",
7
+ name: "Название",
8
+ button : "Вставить"
9
+ }
10
+ });
@@ -0,0 +1,10 @@
1
+ CKEDITOR.plugins.setLang('attachment', 'uk',
2
+ {
3
+ attachment :
4
+ {
5
+ title : "Вставити файл",
6
+ url: "URL",
7
+ name: "Назва",
8
+ button : "Вставити"
9
+ }
10
+ });
@@ -0,0 +1 @@
1
+ (function(){var attachmentCmd={exec:function(editor){editor.openDialog('attachment');return}};CKEDITOR.plugins.add('attachment',{lang:['en','ru','uk'],requires:['dialog'],init:function(editor){var commandName='attachment';editor.addCommand(commandName,attachmentCmd);editor.ui.addButton('Attachment',{label:editor.lang.attachment.button,command:commandName,icon:this.path+"images/attachment.png"});CKEDITOR.dialog.add(commandName,CKEDITOR.getUrl(this.path+'dialogs/attachment.js'))}})})();
@@ -0,0 +1 @@
1
+ (function(){CKEDITOR.dialog.add('embed',function(editor){return{title:editor.lang.embed.title,minWidth:CKEDITOR.env.ie&&CKEDITOR.env.quirks?368:350,minHeight:240,onShow:function(){this.getContentElement('general','content').getInputElement().setValue('')},onOk:function(){var text=this.getContentElement('general','content').getInputElement().getValue();this.getParentEditor().insertHtml(text)},contents:[{label:editor.lang.common.generalTab,id:'general',elements:[{type:'html',id:'pasteMsg',html:'<div style="white-space:normal;width:340px;">'+editor.lang.embed.pasteMsg+'</div>'},{type:'html',id:'content',style:'width:340px;height:170px',html:'<textarea style="'+'width:346px;'+'height:170px;'+'resize: none;'+'border:1px solid black;'+'background-color:white">'+'</textarea>',focus:function(){this.getElement().focus()}}]}]}})})();
@@ -0,0 +1,9 @@
1
+ CKEDITOR.plugins.setLang('embed', 'en',
2
+ {
3
+ embed :
4
+ {
5
+ title : "Paste embed",
6
+ button : "Paste embed",
7
+ pasteMsg : "Please, paste embed-code from Youtube, Myspace, Flickr and others sources into rectangle, using the keyboard (Ctrl + V), and click OK."
8
+ }
9
+ });
@@ -0,0 +1,9 @@
1
+ CKEDITOR.plugins.setLang('embed', 'ru',
2
+ {
3
+ embed :
4
+ {
5
+ title : "Вставить embed",
6
+ button : "Вставить embed",
7
+ pasteMsg : "Пожалуйста, вставьте embed-код с Youtube, Myspace, Flickr и других ресурсов в прямоугольник, используя сочетание клавиш (Ctrl+V), и нажмите OK."
8
+ }
9
+ });
@@ -0,0 +1,9 @@
1
+ CKEDITOR.plugins.setLang('embed', 'uk',
2
+ {
3
+ embed :
4
+ {
5
+ title : "Вставити embed",
6
+ button : "Вставити embed",
7
+ pasteMsg : "Будь ласка, вставте embed-код з Youtube, Myspace, Flickr та інших ресурсів в прямокутник, використовуючи (Ctrl+V), та нажміть OK."
8
+ }
9
+ });
@@ -0,0 +1 @@
1
+ (function(){var embedCmd={exec:function(editor){editor.openDialog('embed');return}};CKEDITOR.plugins.add('embed',{lang:['en','ru','uk'],requires:['dialog'],init:function(editor){var commandName='embed';editor.addCommand(commandName,embedCmd);editor.ui.addButton('Embed',{label:editor.lang.embed.button,command:commandName,icon:this.path+"images/embed.png"});CKEDITOR.dialog.add(commandName,CKEDITOR.getUrl(this.path+'dialogs/embed.js'))}})})();
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ckeditor
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 3
8
8
  - 5
9
- - 1
10
- version: 3.5.1
9
+ - 2
10
+ version: 3.5.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Igor Galeta
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-10 00:00:00 +02:00
18
+ date: 2011-03-21 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -70,6 +70,18 @@ files:
70
70
  - lib/generators/ckeditor/base/USAGE
71
71
  - lib/generators/ckeditor/base/base_generator.rb
72
72
  - lib/generators/ckeditor/base/templates/ckeditor.rb
73
+ - lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/attachment/dialogs/attachment.js
74
+ - lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/attachment/images/attachment.png
75
+ - lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/attachment/lang/en.js
76
+ - lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/attachment/lang/ru.js
77
+ - lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/attachment/lang/uk.js
78
+ - lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/attachment/plugin.js
79
+ - lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/embed/dialogs/embed.js
80
+ - lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/embed/images/embed.png
81
+ - lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/embed/lang/en.js
82
+ - lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/embed/lang/ru.js
83
+ - lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/embed/lang/uk.js
84
+ - lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/embed/plugin.js
73
85
  - lib/generators/ckeditor/base/templates/ckeditor/config.js
74
86
  - lib/generators/ckeditor/base/templates/ckeditor/css/ckfinder.css
75
87
  - lib/generators/ckeditor/base/templates/ckeditor/css/fck_dialog.css
@@ -88,6 +100,18 @@ files:
88
100
  - lib/generators/ckeditor/base/templates/ckeditor/images/swf.gif
89
101
  - lib/generators/ckeditor/base/templates/ckeditor/images/toolbar.start.gif
90
102
  - lib/generators/ckeditor/base/templates/ckeditor/images/xls.gif
103
+ - lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/dialogs/attachment.js
104
+ - lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/images/attachment.png
105
+ - lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/lang/en.js
106
+ - lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/lang/ru.js
107
+ - lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/lang/uk.js
108
+ - lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/plugin.js
109
+ - lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/dialogs/embed.js
110
+ - lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/images/embed.png
111
+ - lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/lang/en.js
112
+ - lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/lang/ru.js
113
+ - lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/lang/uk.js
114
+ - lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/plugin.js
91
115
  - lib/generators/ckeditor/base/templates/ckeditor/swfupload/fileprogress.js
92
116
  - lib/generators/ckeditor/base/templates/ckeditor/swfupload/handlers.js
93
117
  - lib/generators/ckeditor/base/templates/ckeditor/swfupload/jquery-1.5.1.min.js