clemens (owner)

Revisions

gist: 61512 Download_button fork
public
Public Clone URL: git://gist.github.com/61512.git
Embed All Files: show embed
JavaScript #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
applyOrRemoveFCKeditors = function() {
  filter = $$('select.columnsFilter').first();
 
  // transform all textareas to FCKeditors, but only if filter is set to plain HTML
  if(filter && $F(filter) == '') {
    // by default, apply FCKeditor to all textareas
    $$('textarea.use-wysiwyg').each(function(t) {
      // some calculations
      height = t.getDimensions()['height'];
      if(height == 0) height = 200; // default height = 200px
 
      // initialize FCKeditor
      FCKeditor.BasePath = '/javascripts/adva_fckeditor/fckeditor/';
      var oFCKeditor = new FCKeditor(t.id, '100%', height, 'adva-cms');
      oFCKeditor.Config['CustomConfigurationsPath'] = '/javascripts/adva_fckeditor/config.js';
      oFCKeditor.ReplaceTextarea();
    });
  } else {
    // otherwise remove instances
    $$('textarea.use-wysiwyg').each(function(t) {
      f = $(t.id + '___Frame');
      c = $(t.id + '___Config');
      if(f) f.remove();
      if(c) c.remove();
      $(t).show();
    });
  }
}
 
Event.onReady(function() {
  applyOrRemoveFCKeditors();
});
 
Event.addBehavior({
  'select.columnsFilter:change':function(e) {
    applyOrRemoveFCKeditors();
  }
});