Refactor the RichEditor/HTMLArea so that JS and CSS scripts can be placed in the header block.
This commit is contained in:
parent
5234f66849
commit
3d79e59db2
2 changed files with 24 additions and 5 deletions
|
|
@ -572,14 +572,11 @@ sub getRichEditor {
|
|||
$config{height} = $self->getValue("editorHeight") if ($self->getValue("editorHeight") > 0);
|
||||
$config{plugins} = join(",",@plugins);
|
||||
|
||||
$self->session->style->setScript($self->session->url->extras('yui/build/yahoo/yahoo-min.js'),{type=>"text/javascript"});
|
||||
$self->session->style->setScript($self->session->url->extras('yui/build/event/event-min.js'),{type=>"text/javascript"});
|
||||
$self->session->style->setScript($self->session->url->extras('tinymce/jscripts/tiny_mce/tiny_mce_src.js'),{type=>"text/javascript"});
|
||||
$self->session->style->setScript($self->session->url->extras("tinymce-webgui/callbacks.js"),{type=>"text/javascript"});
|
||||
my $out = '';
|
||||
if ($ask) {
|
||||
$out = q|<a style="display: block;" href="javascript:toggleEditor('|.$nameId.q|')">|.$i18n->get('Toggle editor').q|</a>|;
|
||||
}
|
||||
$self->richedit_headTags;
|
||||
$out .= qq|<script type="text/javascript">\n|;
|
||||
if ($ask) {
|
||||
$out .= <<"EOHTML1";
|
||||
|
|
@ -605,6 +602,25 @@ EOHTML1
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 richedit_headTags ( )
|
||||
|
||||
Similar to the headTags method for Form plugins, this sets all Javascript and CSS links for the
|
||||
richeditor to work.
|
||||
|
||||
=cut
|
||||
|
||||
sub richedit_headTags {
|
||||
my $self = shift;
|
||||
my $style = $self->session->style;
|
||||
my $url = $self->session->url;
|
||||
$style->setScript($url->extras('yui/build/yahoo/yahoo-min.js'),{type=>"text/javascript"});
|
||||
$style->setScript($url->extras('yui/build/event/event-min.js'),{type=>"text/javascript"});
|
||||
$style->setScript($url->extras('tinymce/jscripts/tiny_mce/tiny_mce_src.js'),{type=>"text/javascript"});
|
||||
$style->setScript($url->extras("tinymce-webgui/callbacks.js"),{type=>"text/javascript"});
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 indexContent ( )
|
||||
|
|
|
|||
|
|
@ -157,6 +157,8 @@ Set the head tags for this form plugin
|
|||
sub headTags {
|
||||
my $self = shift;
|
||||
$self->session->style->setScript($self->session->url->extras('textFix.js'),{ type=>'text/javascript' });
|
||||
$self->{_richEdit} ||= WebGUI::Asset::RichEdit->new($self->session,$self->get("richEditId"));
|
||||
$self->{_richEdit}->richedit_headTags if $self->{_richEdit};
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -182,7 +184,8 @@ Renders an HTML area field.
|
|||
sub toHtml {
|
||||
my $self = shift;
|
||||
my $i18n = WebGUI::International->new($self->session);
|
||||
my $richEdit = WebGUI::Asset::RichEdit->new($self->session,$self->get("richEditId"));
|
||||
my $richEdit = $self->{_richEdit};
|
||||
$richEdit ||= WebGUI::Asset::RichEdit->new($self->session,$self->get("richEditId"));
|
||||
if (defined $richEdit) {
|
||||
$self->set("extras", $self->get('extras') . q{ onblur="fixChars(this.form['}.$self->get("name").q{'])" mce_editable="true" });
|
||||
$self->set("resizable", 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue