Created
February 10, 2009 18:21
-
-
Save clemens/61512 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment