radiant-ck_editor_filter-extension 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.2.0
@@ -0,0 +1,104 @@
1
+ (function()
2
+ {
3
+ var radiantPreviewCmd =
4
+ {
5
+ modes : { wysiwyg:1, source:1 },
6
+ canUndo : false,
7
+ exec : function( editor )
8
+ {
9
+ if ($('show-preview')){
10
+ $('show-preview').click()
11
+ }
12
+ else{
13
+ var sHTML,
14
+ config = editor.config,
15
+ baseTag = config.baseHref ? '<base href="' + config.baseHref + '"/>' : '',
16
+ isCustomDomain = CKEDITOR.env.isCustomDomain();
17
+
18
+ if ( config.fullPage )
19
+ {
20
+ sHTML = editor.getData()
21
+ .replace( /<head>/, '$&' + baseTag )
22
+ .replace( /[^>]*(?=<\/title>)/, editor.lang.preview );
23
+ }
24
+ else
25
+ {
26
+ var bodyHtml = '<body ',
27
+ body = editor.document && editor.document.getBody();
28
+
29
+ if ( body )
30
+ {
31
+ if ( body.getAttribute( 'id' ) )
32
+ bodyHtml += 'id="' + body.getAttribute( 'id' ) + '" ';
33
+ if ( body.getAttribute( 'class' ) )
34
+ bodyHtml += 'class="' + body.getAttribute( 'class' ) + '" ';
35
+ }
36
+
37
+ bodyHtml += '>';
38
+
39
+ sHTML =
40
+ editor.config.docType +
41
+ '<html dir="' + editor.config.contentsLangDirection + '">' +
42
+ '<head>' +
43
+ baseTag +
44
+ '<title>' + editor.lang.preview + '</title>' +
45
+ CKEDITOR.tools.buildStyleHtml( editor.config.contentsCss ) +
46
+ '</head>' + bodyHtml +
47
+ editor.getData() +
48
+ '</body></html>';
49
+ }
50
+
51
+ var iWidth = 640, // 800 * 0.8,
52
+ iHeight = 420, // 600 * 0.7,
53
+ iLeft = 80; // (800 - 0.8 * 800) /2 = 800 * 0.1.
54
+ try
55
+ {
56
+ var screen = window.screen;
57
+ iWidth = Math.round( screen.width * 0.8 );
58
+ iHeight = Math.round( screen.height * 0.7 );
59
+ iLeft = Math.round( screen.width * 0.1 );
60
+ }
61
+ catch ( e ){}
62
+
63
+ var sOpenUrl = '';
64
+ if ( isCustomDomain )
65
+ {
66
+ window._cke_htmlToLoad = sHTML;
67
+ sOpenUrl = 'javascript:void( (function(){' +
68
+ 'document.open();' +
69
+ 'document.domain="' + document.domain + '";' +
70
+ 'document.write( window.opener._cke_htmlToLoad );' +
71
+ 'document.close();' +
72
+ 'window.opener._cke_htmlToLoad = null;' +
73
+ '})() )';
74
+ }
75
+
76
+ var oWindow = window.open( sOpenUrl, null, 'toolbar=yes,location=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=' +
77
+ iWidth + ',height=' + iHeight + ',left=' + iLeft );
78
+
79
+ if ( !isCustomDomain )
80
+ {
81
+ oWindow.document.open();
82
+ oWindow.document.write( sHTML );
83
+ oWindow.document.close();
84
+ }
85
+ }
86
+ }
87
+ };
88
+
89
+ var pluginName = 'radiantpreview';
90
+
91
+ CKEDITOR.plugins.add( pluginName,
92
+ {
93
+ init : function( editor )
94
+ {
95
+ editor.addCommand( pluginName, radiantPreviewCmd );
96
+ editor.ui.addButton( 'RadiantPreview',
97
+ {
98
+ label : editor.lang.preview,
99
+ command : pluginName,
100
+ icon: this.path+'images/radiant-preview.png'
101
+ });
102
+ }
103
+ });
104
+ })();
@@ -3,11 +3,11 @@ function instantiateCkEditor(partIndex){
3
3
  CKEDITOR.config.colorButton_enableMore = false
4
4
  CKEDITOR.config.protectedSource.push( /<r:([\S]+)*>.*<\/r:\1>/g )
5
5
  CKEDITOR.config.protectedSource.push( /<r:[^>\/]*\/>/g )
6
- CKEDITOR.config.extraPlugins = 'paperclipped,MediaEmbed'
6
+ CKEDITOR.config.extraPlugins = 'paperclipped,MediaEmbed,radiantpreview'
7
7
  CKEDITOR.config.toolbar =
8
8
  [
9
- ['Source','-','Save','Preview','-','Templates'],
10
- ['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'],
9
+ ['Source','-','Templates'],
10
+ ['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker','-','RadiantPreview'],
11
11
  ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
12
12
  // ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'],
13
13
  ['Image','Paperclipped', 'MediaEmbed', 'Table','HorizontalRule','SpecialChar','PageBreak'],
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radiant-ck_editor_filter-extension
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 1
9
- - 1
10
- version: 0.1.1
8
+ - 2
9
+ - 0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Benny Degezelle
@@ -58,6 +58,7 @@ files:
58
58
  - features/support/paths.rb
59
59
  - lib/ck_editor_filter.rb
60
60
  - lib/tasks/ck_editor_filter_extension_tasks.rake
61
+ - pkg/radiant-ck_editor_filter-extension-0.1.1.gem
61
62
  - public/images/admin/tmp_thumbnail_icon.png
62
63
  - public/javascripts/extensions/ck_editor_filter/ckeditor/.htaccess
63
64
  - public/javascripts/extensions/ck_editor_filter/ckeditor/CHANGES.html
@@ -520,6 +521,9 @@ files:
520
521
  - public/javascripts/extensions/ck_editor_filter/ckeditor/plugins/paperclipped/plugin.js
521
522
  - public/javascripts/extensions/ck_editor_filter/ckeditor/plugins/pastefromword/filter/default.js
522
523
  - public/javascripts/extensions/ck_editor_filter/ckeditor/plugins/pastetext/dialogs/pastetext.js
524
+ - public/javascripts/extensions/ck_editor_filter/ckeditor/plugins/radiantpreview/images/icon.png
525
+ - public/javascripts/extensions/ck_editor_filter/ckeditor/plugins/radiantpreview/images/radiant-preview.png
526
+ - public/javascripts/extensions/ck_editor_filter/ckeditor/plugins/radiantpreview/plugin.js
523
527
  - public/javascripts/extensions/ck_editor_filter/ckeditor/plugins/scayt/dialogs/options.js
524
528
  - public/javascripts/extensions/ck_editor_filter/ckeditor/plugins/scayt/dialogs/toolbar.css
525
529
  - public/javascripts/extensions/ck_editor_filter/ckeditor/plugins/showblocks/images/block_address.png