@@ -12,9 +12,9 @@ public function control_panel__add_to_head()
12
12
public function control_panel__add_to_foot ()
13
13
{
14
14
if (URL ::getCurrent (false ) == '/publish ' ) {
15
- $ jsPath = Config::getSiteRoot ()."_add-ons/ckeditor/ckeditor.js " ;
15
+ $ jsPath = Config::getSiteRoot ()."_add-ons/ckeditor/ckeditor.js " ;
16
16
$ html = '<script src=" ' . $ jsPath . '"></script> ' ;
17
-
17
+
18
18
$ html .= "<script>
19
19
function initiateCKEditors() {
20
20
$('.ckeditor').each(function(){
@@ -23,11 +23,11 @@ function initiateCKEditors() {
23
23
}
24
24
25
25
// initiate CKEditor for field(s) in a newly added grid row
26
- function newRowEditor() {
26
+ function newRowEditor() {
27
27
28
28
// get the right grid field for the clicked 'add row' button
29
29
var thisGridTable = $(this).siblings('table.grid');
30
-
30
+
31
31
setTimeout(function() {
32
32
// select ckeditor cell in new row
33
33
var newRowCell = thisGridTable.find('tbody tr:last td.cell-ckeditor');
@@ -43,15 +43,38 @@ function newRowEditor() {
43
43
44
44
}
45
45
46
+ // initiate CKEditor field(s) in replicator sets
47
+ function newReplicatorEditor() {
48
+
49
+ var thisReplicatorParent = $(this).parents('.input-replicator');
50
+
51
+ setTimeout(function() {
52
+
53
+ thisReplicatorParent.find('.replicator-set').each(function(){
54
+ var thisCkeditorFieldContainer = $(this).find('.ckeditor-container');
55
+
56
+ if ( !thisCkeditorFieldContainer.find('div.cke').length ) {
57
+ thisCkeditorFieldContainer.find('textarea.ckeditor').each(function(){
58
+ CKEDITOR.replace( $(this).attr('name') );
59
+ });
60
+ }
61
+ });
62
+
63
+ }, 50);
64
+
65
+ }
66
+
46
67
$(document).ready(function() {
47
68
48
69
initiateCKEditors();
49
70
50
71
$('.grid-add-row').click(newRowEditor);
51
72
73
+ $('.replicator-buttons button').click(newReplicatorEditor);
74
+
52
75
});
53
76
</script> " ;
54
-
77
+
55
78
return $ html ;
56
79
}
57
80
}
0 commit comments