[ic] FCKeditor file browser feature
Jeff Boes
jeff at endpoint.com
Mon Sep 25 16:57:13 EDT 2006
Eric Bont wrote:
>> Bob Puff at NLE wrote:
>
>>> I would love to see either a FCKeditor or TinyMCE for IC... I
>>> noticed there was some code in
>>> previous versions, but it was ripped out of 5.4.1. If anyone has a
>>> simple little install for it,
>>> please post!
>>
>>
>
> There was a problem using FCK editor for more than one field.
> I am not sure this problem is solved.
You can try the following patch; it's been working for me.
--- fck.widget.orig 2005-11-14 18:31:56.000000000 -0700
+++ fck.widget 2006-05-02 12:26:01.000000000 -0600
@@ -82,18 +82,44 @@
if(! $::Scratch->{fck_added}) {
$Tag->tmp({ name => 'fck_added', body => 1 });
$::Scratch->{meta_header} ||= '';
- my $path = $::Variable->{FCKEDITOR_PATH} || '/fckeditor/';
+ my $path = $::Variable->{FCKEDITOR_PATH} || '/FCKeditor/';
+ my $cfg = $::Variable->{FCKCONFIG_PATH} ||
'/resources/fckconfig.js';
+
my $lang = $::Variable->{FCKEDITOR_LANG} ||
$::Scratch->{mv_locale} || '
en';
$lang = substr($lang, 0, 2);
$path =~ s:/*$:/:;
+
+ # Some explanation is in order: the original version of this
+ # widget allowed for just one copy of it per page, because it
+ # used "window.onload" to initialize each widget instance. The
+ # current version tries to use "window.addEventListener", but
+ # that is broken under IE. So instead, for IE we create a list
+ # of "editor instances", and initialize all of them when the
+ # window loads.
+
$::Scratch->{meta_header} .= <<EOF;
<script type="text/javascript" src="${path}fckeditor.js"></script>
<script type="text/javascript">
- _editor_url = "$path";
+ var _editor_url = "$path";
+ var _editor_cfg = "$cfg";
+ var _editor_instances = new Array;
+ if (!window.addEventListener) {
+ window.onload = function() {
+ for (var i = 0; i < _editor_instances.length; i++) {
+ _editor_instances[i].ReplaceTextarea();
+ }
+ }
+ }
</script>
EOF
}
+ my $toolbar = $opt->{toolbar} || 'Simple';
+ my $tb_on = defined($opt->{toolbar_on})
+ ? ($opt->{toolbar_on}
+ ? 'true'
+ : 'false')
+ : 'true';
my $val;
if($opt->{value} =~ /</) {
$val = HTML::Entities::encode($opt->{value});
@@ -101,21 +127,26 @@
else {
$val = $opt->{value};
}
- my $pre_scr = '';
+ my $pre_scr = '';
my $post_scr = '';
- my $onmouse = '';
+ my $onmouse = '';
my $edname = $pname . 'FCKeditor';
- $pre_scr = qq{
+ $post_scr = qq{
<script>
-window.onload = function()
-{
- var $edname = new FCKeditor( '$pname' ) ;
- $edname.BasePath = _editor_url ;
- $edname.ReplaceTextarea() ;
+var $edname = new FCKeditor( '$pname' );
+ $edname.BasePath = _editor_url;
+ $edname.ToolbarSet = "$toolbar";
+ $edname.Config["CustomConfigurationsPath"] = _editor_cfg;
+ $edname.Config['ToolbarStartExpanded'] = $tb_on;
+
+if (window.addEventListener) {
+ window.addEventListener("load", function()
+{ $edname.ReplaceTextarea() }, false)
+} else {
+ _editor_instances.push($edname);
}
-
</script>
};
More information about the interchange-users
mailing list