radiant-ck_editor_filter-extension 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.markdown +1 -1
- data/VERSION +1 -1
- data/app/views/admin/page_parts/_editor_control.html.haml +6 -0
- data/app/views/admin/pages/_editor_control.html.haml +6 -1
- data/ck_editor_filter_extension.rb +9 -1
- data/public/javascripts/extensions/ck_editor_filter/radiant.ckeditor.js +29 -1
- metadata +5 -4
data/README.markdown
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
@@ -1 +1,6 @@
|
|
1
|
-
|
1
|
+
:javascript
|
2
|
+
Event.observe(window,'load',function(){
|
3
|
+
instantiateCkEditor('#{page_part.name}')
|
4
|
+
Event.addBehavior({ 'a.insert_asset': InsertIntoCk })
|
5
|
+
})
|
6
|
+
Event.observe($('part_#{page_part.name}_filter_id'),'change',function(){ toggleEditor('#{page_part.name}') })
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# require_dependency 'application_controller'
|
3
3
|
|
4
4
|
class CkEditorFilterExtension < Radiant::Extension
|
5
|
-
version "0.2.
|
5
|
+
version "0.2.2"
|
6
6
|
description "Adds CKEditor as a filter"
|
7
7
|
url "https://github.com/jomz/radiant-ck_editor_filter-extension"
|
8
8
|
|
@@ -16,6 +16,14 @@ class CkEditorFilterExtension < Radiant::Extension
|
|
16
16
|
CkEditorFilter
|
17
17
|
Admin::PagesController.send :include, CkeditorInterface
|
18
18
|
admin.page.edit.add :part_controls, "editor_control"
|
19
|
+
|
20
|
+
# Overwrite insert link href from # to asset.url, so CK knows where to get the image.
|
21
|
+
Admin::AssetsHelper.class_eval do
|
22
|
+
def asset_insertion_link(asset)
|
23
|
+
radius_tag = asset.asset_type.default_radius_tag || 'link';
|
24
|
+
link_to t('clipped_extension.insert'), asset.asset.url, :class => 'insert_asset', :rel => "#{radius_tag}_#{Radiant.config['assets.insertion_size']}_#{asset.id}"
|
25
|
+
end
|
26
|
+
end
|
19
27
|
end
|
20
28
|
|
21
29
|
def deactivate
|
@@ -10,7 +10,7 @@ function instantiateCkEditor(partIndex){
|
|
10
10
|
['Styles','Format'],
|
11
11
|
['Bold','Italic','Strike','-','Subscript','Superscript'],
|
12
12
|
['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
|
13
|
-
['RadiantPreview', '
|
13
|
+
['RadiantPreview', 'Paste', 'RemoveFormat'],
|
14
14
|
['Find','Replace'],
|
15
15
|
['Image','Paperclipped', 'MediaEmbed', 'Table','HorizontalRule','SpecialChar'],
|
16
16
|
['Link','Unlink','Anchor'],
|
@@ -90,3 +90,31 @@ function putInEditor(partIndex){
|
|
90
90
|
var textarea = $('part_' + partIndex + '_content')
|
91
91
|
CKEDITOR.replace(textarea)
|
92
92
|
}
|
93
|
+
|
94
|
+
InsertIntoCk = Behavior.create({
|
95
|
+
onclick: function(e) {
|
96
|
+
if (e) e.stop();
|
97
|
+
var part_name = TabControlBehavior.instances[0].controller.selected.caption;
|
98
|
+
var textbox = $('part_' + part_name + '_content');
|
99
|
+
|
100
|
+
var tag_parts = this.element.getAttribute('rel').split('_');
|
101
|
+
var href = this.element.getAttribute('href')
|
102
|
+
var tag_name = tag_parts[0];
|
103
|
+
var asset_size = tag_parts[1];
|
104
|
+
var asset_id = tag_parts[2];
|
105
|
+
|
106
|
+
if($('part_' + part_name + '_filter_id').value == 'CKEditor'){
|
107
|
+
editor = CKEDITOR.instances['part_'+ part_name +'_content']
|
108
|
+
if(tag_name == 'image')
|
109
|
+
editor.insertHtml("<img src=\"" + href + "\" alt=\"\" />")
|
110
|
+
else
|
111
|
+
editor.insertHtml("<a href=\"" + href + "\">" + this.element.up(".back").down(".title").innerHTML + "</a>")
|
112
|
+
}
|
113
|
+
else{
|
114
|
+
var radius_tag = '<r:asset:' + tag_name;
|
115
|
+
if (asset_size != '') radius_tag = radius_tag + ' size="' + asset_size + '"';
|
116
|
+
radius_tag = radius_tag +' id="' + asset_id + '" />';
|
117
|
+
Asset.InsertAtCursor(textbox, radius_tag);
|
118
|
+
}
|
119
|
+
}
|
120
|
+
});
|
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:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 2
|
10
|
+
version: 0.2.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Benny Degezelle
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-06-19 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -50,6 +50,7 @@ files:
|
|
50
50
|
- VERSION
|
51
51
|
- app/models/ckeditor_interface.rb
|
52
52
|
- app/views/admin/assets/_asset.html.haml
|
53
|
+
- app/views/admin/page_parts/_editor_control.html.haml
|
53
54
|
- app/views/admin/pages/_editor_control.html.haml
|
54
55
|
- ck_editor_filter_extension.rb
|
55
56
|
- ckeditor.html
|