summaryrefslogtreecommitdiff
path: root/httemplate/elements/htmlarea.html
blob: dba744e23f23fed6d023c5c256c354b2be924922 (plain)
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
39
40
41
42
43
44
45
<%doc>

Example:

  include('/elements/htmlarea.html',
            'field'      => 'fieldname',
            'curr_value' => $curr_value,
            'height'     => 800,
            'config'     => { extraPlugins => 'blockprotect' },
         );

</%doc>

% #init
<SCRIPT TYPE="text/javascript" src="<% $fsurl %>elements/ckeditor/ckeditor.js">
</SCRIPT>

% #editor
<textarea name="<% $opt{'field'} %>"><% $opt{'curr_value'} |h %></textarea>

<SCRIPT TYPE="text/javascript">

  var <% $opt{'field'} %>_editor =
    CKEDITOR.replace('<% $opt{'field'} %>',
                   <% encode_json($config) %>
  );

</SCRIPT>

<%init>

my %opt = @_;
my $config = {
  'height'              => ($opt{height} || 420),
  'startupFocus'        => Cpanel::JSON::XS::true,
  'skin'                => 'kama',
  'toolbarCanCollapse'  => JSON::true,
  'removePlugins'       => 'elementspath',
  'basePath'            => $fsurl.'elements/ckeditor/',
  'enterMode'           => 2,
  %{ $opt{config} || {} },
};
$config->{width} = $opt{width} if defined($opt{width});

</%init>